mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-05 02:39:23 +02:00
single NetworkLibraryActivity instance is now used
This commit is contained in:
parent
364e191be1
commit
469525664d
9 changed files with 50 additions and 36 deletions
|
@ -133,7 +133,7 @@
|
|||
</intent-filter>
|
||||
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
|
||||
</activity>
|
||||
<activity android:name="org.geometerplus.android.fbreader.network.NetworkLibraryActivity" android:process=":networkLibrary" android:launchMode="singleTask" android:configChanges="orientation|keyboardHidden">
|
||||
<activity android:name="org.geometerplus.android.fbreader.network.NetworkLibraryActivity" android:process=":networkLibrary" android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.default_searchable" android:value="org.geometerplus.android.fbreader.network.NetworkSearchActivity" />
|
||||
</activity>
|
||||
<activity android:name="org.geometerplus.android.fbreader.network.AuthenticationActivity" android:process=":networkLibrary" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog"/>
|
||||
|
|
|
@ -133,7 +133,7 @@
|
|||
</intent-filter>
|
||||
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
|
||||
</activity>
|
||||
<activity android:name="org.geometerplus.android.fbreader.network.NetworkTopLevelActivity" android:process=":networkLibrary" android:launchMode="singleTask" android:configChanges="orientation|keyboardHidden">
|
||||
<activity android:name="org.geometerplus.android.fbreader.network.NetworkLibraryActivity" android:process=":networkLibrary" android:configChanges="orientation|keyboardHidden">
|
||||
<meta-data android:name="android.app.default_searchable" android:value="org.geometerplus.android.fbreader.network.NetworkSearchActivity" />
|
||||
</activity>
|
||||
<activity android:name="org.geometerplus.android.fbreader.network.AuthenticationActivity" android:process=":networkLibrary" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog"/>
|
||||
|
|
|
@ -25,6 +25,7 @@ import android.app.Activity;
|
|||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.net.Uri;
|
||||
import android.view.Menu;
|
||||
import android.view.ContextMenu;
|
||||
|
@ -376,7 +377,7 @@ class NetworkCatalogActions extends NetworkTreeActions {
|
|||
NetworkView.Instance().tryResumeLoading(activity, tree, new Runnable() {
|
||||
public void run() {
|
||||
if (tree instanceof NetworkCatalogRootTree) {
|
||||
/*
|
||||
try {
|
||||
activity.startActivityForResult(
|
||||
new Intent(
|
||||
Util.TOPUP_ACTION,
|
||||
|
@ -384,7 +385,9 @@ class NetworkCatalogActions extends NetworkTreeActions {
|
|||
),
|
||||
NetworkLibraryActivity.LIST_TOPUP_METHODS_CODE
|
||||
);
|
||||
*/
|
||||
} catch (ActivityNotFoundException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
|
||||
boolean resumeNotLoad = false;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.geometerplus.android.fbreader.network;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
|
|
@ -72,8 +72,7 @@ public class NetworkLibraryActivity extends BaseActivity implements NetworkView.
|
|||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
OLD_STYLE_FLAG = true;
|
||||
System.err.println("NetworkLibraryActivity.onCreate");
|
||||
|
||||
SQLiteCookieDatabase.init(this);
|
||||
|
||||
|
@ -189,6 +188,11 @@ public class NetworkLibraryActivity extends BaseActivity implements NetworkView.
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isTreeInvisible(FBTree tree) {
|
||||
return tree instanceof RootTree && ((RootTree)tree).IsFake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
|
||||
|
@ -286,7 +290,7 @@ public class NetworkLibraryActivity extends BaseActivity implements NetworkView.
|
|||
Util.processSignup(((NetworkCatalogTree)getCurrentTree()).Item.Link, resultCode, data);
|
||||
break;
|
||||
case LIST_TOPUP_METHODS_CODE:
|
||||
{
|
||||
if (data != null) {
|
||||
final Bundle bundle = data.getExtras();
|
||||
final ArrayList<PluginApi.ActionInfo> infos =
|
||||
bundle != null
|
||||
|
|
|
@ -242,11 +242,15 @@ abstract class Util implements UserRegistrationConstants {
|
|||
static void openTree(Context context, NetworkTree tree) {
|
||||
final Class<?> clz = tree instanceof NetworkBookTree
|
||||
? NetworkBookInfoActivity.class : NetworkLibraryActivity.class;
|
||||
if (context instanceof NetworkLibraryActivity && clz == NetworkLibraryActivity.class) {
|
||||
((NetworkLibraryActivity)context).openTree(tree);
|
||||
} else {
|
||||
context.startActivity(
|
||||
new Intent(context.getApplicationContext(), clz)
|
||||
.putExtra(NetworkLibraryActivity.TREE_KEY_KEY, tree.getUniqueKey())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public static NetworkTree getTreeFromIntent(Intent intent) {
|
||||
final NetworkLibrary library = NetworkLibrary.Instance();
|
||||
|
|
|
@ -71,14 +71,12 @@ public abstract class BaseActivity extends ListActivity {
|
|||
protected abstract FBTree getTreeByKey(FBTree.Key key);
|
||||
public abstract boolean isTreeSelected(FBTree tree);
|
||||
|
||||
protected boolean OLD_STYLE_FLAG = false;
|
||||
protected boolean isTreeInvisible(FBTree tree) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (OLD_STYLE_FLAG) {
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
FBTree parent = null;
|
||||
while (parent == null && !myHistory.isEmpty()) {
|
||||
|
@ -87,7 +85,7 @@ public abstract class BaseActivity extends ListActivity {
|
|||
if (parent == null) {
|
||||
parent = myCurrentTree.Parent;
|
||||
}
|
||||
if (parent != null) {
|
||||
if (parent != null && !isTreeInvisible(parent)) {
|
||||
openTree(parent, myCurrentTree, false);
|
||||
return true;
|
||||
}
|
||||
|
@ -96,7 +94,8 @@ public abstract class BaseActivity extends ListActivity {
|
|||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
protected void openTree(final FBTree tree) {
|
||||
// TODO: change to protected
|
||||
public void openTree(final FBTree tree) {
|
||||
openTree(tree, null, true);
|
||||
}
|
||||
|
||||
|
@ -157,7 +156,7 @@ public abstract class BaseActivity extends ListActivity {
|
|||
if (storeInHistory && !myCurrentKey.equals(tree.getUniqueKey())) {
|
||||
myHistory.add(myCurrentKey);
|
||||
}
|
||||
startActivity(new Intent(this, getClass())
|
||||
onNewIntent(new Intent(this, getClass())
|
||||
.setAction(OPEN_TREE_ACTION)
|
||||
.putExtra(TREE_KEY_KEY, tree.getUniqueKey())
|
||||
.putExtra(
|
||||
|
|
|
@ -124,8 +124,8 @@ public class NetworkLibrary {
|
|||
return filteredList;
|
||||
}
|
||||
|
||||
private final RootTree myRootTree = new RootTree("@Root");
|
||||
private final RootTree myFakeRootTree = new RootTree("@FakeRoot");
|
||||
private final RootTree myRootTree = new RootTree("@Root", false);
|
||||
private final RootTree myFakeRootTree = new RootTree("@FakeRoot", true);
|
||||
private SearchItemTree mySearchItemTree;
|
||||
|
||||
private boolean myChildrenAreInvalid = true;
|
||||
|
|
|
@ -22,9 +22,12 @@ package org.geometerplus.fbreader.network.tree;
|
|||
import org.geometerplus.fbreader.network.*;
|
||||
|
||||
public final class RootTree extends NetworkTree {
|
||||
public final boolean IsFake;
|
||||
|
||||
private final String myId;
|
||||
|
||||
public RootTree(String id) {
|
||||
public RootTree(String id, boolean isFake) {
|
||||
IsFake = isFake;
|
||||
myId = id;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue