mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 10:49:24 +02:00
openTree mechanism has been changed: intents are used (for correct restoring after force closing)
This commit is contained in:
parent
592aa59c33
commit
6c38d394f5
6 changed files with 64 additions and 29 deletions
|
@ -239,20 +239,18 @@ abstract class Util implements UserRegistrationConstants {
|
|||
}
|
||||
}
|
||||
|
||||
static final String TREE_KEY_KEY = "org.geometerplus.android.fbreader.network.TreeKey";
|
||||
|
||||
static void openTree(Context context, NetworkTree tree) {
|
||||
final Class<?> clz = tree instanceof NetworkBookTree
|
||||
? NetworkBookInfoActivity.class : NetworkBaseActivity.class;
|
||||
context.startActivity(
|
||||
new Intent(context.getApplicationContext(), clz)
|
||||
.putExtra(TREE_KEY_KEY, tree.getUniqueKey())
|
||||
.putExtra(NetworkBaseActivity.TREE_KEY_KEY, tree.getUniqueKey())
|
||||
);
|
||||
}
|
||||
|
||||
public static NetworkTree getTreeFromIntent(Intent intent) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
final NetworkTree.Key key = (NetworkTree.Key)intent.getSerializableExtra(TREE_KEY_KEY);
|
||||
final NetworkTree.Key key = (NetworkTree.Key)intent.getSerializableExtra(NetworkBaseActivity.TREE_KEY_KEY);
|
||||
return library.getTreeByKey(key);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue