mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-06 12:00:17 +02:00
custom catalog activity (in progress)
This commit is contained in:
parent
2ebb3ad9d1
commit
8c821f34b8
6 changed files with 39 additions and 10 deletions
|
@ -134,7 +134,7 @@
|
||||||
<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:launchMode="singleTask" android:configChanges="orientation|keyboardHidden">
|
||||||
<meta-data android:name="android.app.default_searchable" android:value="org.geometerplus.android.fbreader.network.NetworkSearchActivity" />
|
<meta-data android:name="android.app.default_searchable" android:value="org.geometerplus.android.fbreader.network.NetworkSearchActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="org.geometerplus.android.fbreader.network.AddCustomCatalogActivity" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog">
|
<activity android:name="org.geometerplus.android.fbreader.network.AddCustomCatalogActivity" android:process=":networkLibrary" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
<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:launchMode="singleTask" android:configChanges="orientation|keyboardHidden">
|
||||||
<meta-data android:name="android.app.default_searchable" android:value="org.geometerplus.android.fbreader.network.NetworkSearchActivity" />
|
<meta-data android:name="android.app.default_searchable" android:value="org.geometerplus.android.fbreader.network.NetworkSearchActivity" />
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name="org.geometerplus.android.fbreader.network.AddCustomCatalogActivity" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog">
|
<activity android:name="org.geometerplus.android.fbreader.network.AddCustomCatalogActivity" android:process=":networkLibrary" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.Dialog">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 6.4 KiB |
|
@ -20,8 +20,11 @@
|
||||||
package org.geometerplus.android.fbreader.network;
|
package org.geometerplus.android.fbreader.network;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
import org.geometerplus.zlibrary.core.resources.ZLResource;
|
||||||
|
@ -43,8 +46,7 @@ public class AddCustomCatalogActivity extends Activity {
|
||||||
Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
|
Thread.setDefaultUncaughtExceptionHandler(new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
|
||||||
setContentView(R.layout.add_custom_catalog);
|
setContentView(R.layout.add_custom_catalog);
|
||||||
|
|
||||||
final ZLResource dialogResource = ZLResource.resource("dialog");
|
myResource = ZLResource.resource("dialog").getResource("CustomCatalogDialog");
|
||||||
myResource = dialogResource.getResource("CustomCatalogDialog");
|
|
||||||
|
|
||||||
setTitle(myResource.getResource("title").getValue());
|
setTitle(myResource.getResource("title").getValue());
|
||||||
|
|
||||||
|
@ -55,13 +57,31 @@ public class AddCustomCatalogActivity extends Activity {
|
||||||
setTextFromResource(R.id.add_custom_catalog_url_example, "catalogUrlExample");
|
setTextFromResource(R.id.add_custom_catalog_url_example, "catalogUrlExample");
|
||||||
setTextFromResource(R.id.add_custom_catalog_summary_example, "catalogSummaryExample");
|
setTextFromResource(R.id.add_custom_catalog_summary_example, "catalogSummaryExample");
|
||||||
|
|
||||||
final ZLResource buttonResource = dialogResource.getResource("button");
|
setupButton(
|
||||||
setText(R.id.add_custom_catalog_ok_button, buttonResource.getResource("ok").getValue());
|
R.id.add_custom_catalog_ok_button, "ok", new View.OnClickListener() {
|
||||||
setText(R.id.add_custom_catalog_cancel_button, buttonResource.getResource("cancel").getValue());
|
public void onClick(View view) {
|
||||||
|
startActivity(
|
||||||
|
new Intent(AddCustomCatalogActivity.this, NetworkLibraryActivity.class)
|
||||||
|
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
||||||
|
);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
setupButton(
|
||||||
|
R.id.add_custom_catalog_cancel_button, "cancel", new View.OnClickListener() {
|
||||||
|
public void onClick(View view) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
final Uri uri = getIntent().getData();
|
final Uri uri = getIntent().getData();
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
loadInfoByUri(uri);
|
loadInfoByUri(uri);
|
||||||
|
} else {
|
||||||
|
findViewById(R.id.add_custom_catalog_title_group).setVisibility(View.GONE);
|
||||||
|
findViewById(R.id.add_custom_catalog_summary_group).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,6 +89,14 @@ public class AddCustomCatalogActivity extends Activity {
|
||||||
((TextView)findViewById(id)).setText(text);
|
((TextView)findViewById(id)).setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupButton(int id, String resourceKey, View.OnClickListener listener) {
|
||||||
|
final Button button = (Button)findViewById(id);
|
||||||
|
button.setText(
|
||||||
|
ZLResource.resource("dialog").getResource("button").getResource(resourceKey).getValue()
|
||||||
|
);
|
||||||
|
button.setOnClickListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
private void setTextFromResource(int id, String resourceKey) {
|
private void setTextFromResource(int id, String resourceKey) {
|
||||||
setText(id, myResource.getResource(resourceKey).getValue());
|
setText(id, myResource.getResource(resourceKey).getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
package org.geometerplus.android.fbreader.network;
|
package org.geometerplus.android.fbreader.network;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
|
||||||
|
@ -70,6 +71,6 @@ class AddCustomCatalogItemActions extends NetworkTreeActions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addCustomCatalog(Activity activity) {
|
public static void addCustomCatalog(Activity activity) {
|
||||||
NetworkDialog.show(activity, NetworkDialog.DIALOG_CUSTOM_CATALOG, null, null);
|
activity.startActivity(new Intent(activity, AddCustomCatalogActivity.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ class NetworkBookActions extends NetworkTreeActions {
|
||||||
Uri.fromFile(new File(local)),
|
Uri.fromFile(new File(local)),
|
||||||
activity.getApplicationContext(),
|
activity.getApplicationContext(),
|
||||||
FBReader.class
|
FBReader.class
|
||||||
).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
|
).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue