1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-05 10:49:24 +02:00

MissingBookActivity in AndroidManifest, code cleanup

This commit is contained in:
Nikolay Pultsin 2014-11-16 00:32:47 +00:00
parent 9d0166d9a7
commit ee83a02cbc
7 changed files with 16 additions and 20 deletions

View file

@ -212,6 +212,7 @@
</intent-filter>
</activity>
<activity android:name="org.geometerplus.android.fbreader.preferences.EditBookInfoActivity" android:process=":library" android:theme="@style/FBReader.Activity" android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity android:name="org.geometerplus.android.fbreader.sync.MissingBookActivity" android:process=":networkLibrary" android:theme="@style/FBReader.Dialog" android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity android:name="org.geometerplus.android.fbreader.network.BookDownloader" android:process=":networkLibrary" android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>

View file

@ -212,6 +212,7 @@
</intent-filter>
</activity>
<activity android:name="org.geometerplus.android.fbreader.preferences.EditBookInfoActivity" android:process=":library" android:theme="@style/FBReader.Activity" android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity android:name="org.geometerplus.android.fbreader.sync.MissingBookActivity" android:process=":networkLibrary" android:theme="@style/FBReader.Dialog" android:configChanges="orientation|keyboardHidden|screenSize"/>
<activity android:name="org.geometerplus.android.fbreader.network.BookDownloader" android:process=":networkLibrary" android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>

View file

@ -96,7 +96,7 @@ class ProcessHyperlinkAction extends FBAndroidAction {
final boolean externalUrl;
if (BookDownloader.acceptsUri(Uri.parse(url))) {
intent.setClass(BaseActivity, BookDownloader.class);
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY, BookDownloaderService.Notifications.ALL);
intent.putExtra(BookDownloaderService.Key.SHOW_NOTIFICATIONS, BookDownloaderService.Notifications.ALL);
externalUrl = false;
} else {
externalUrl = true;

View file

@ -63,8 +63,8 @@ public class BookDownloader extends Activity {
return;
}
if (!intent.hasExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY)) {
intent.putExtra(BookDownloaderService.SHOW_NOTIFICATIONS_KEY,
if (!intent.hasExtra(BookDownloaderService.Key.SHOW_NOTIFICATIONS)) {
intent.putExtra(BookDownloaderService.Key.SHOW_NOTIFICATIONS,
BookDownloaderService.Notifications.ALREADY_DOWNLOADING);
}
if ("epub".equals(uri.getScheme())) {

View file

@ -46,15 +46,14 @@ public class BookDownloaderService extends Service {
private final ZLNetworkContext myNetworkContext = new ServiceNetworkContext(this);
public interface Key {
String BOOK_TITLE = "org.geometerplus.android.fbreader.network.Title";
String BOOK_MIME = "fbreader.book.mime";
String FROM_SYNC = "fbreader.downloader.from.sync";
String BOOK_TITLE = "fbreader.downloader.book.title";
String BOOK_KIND = "fbreader.downloader.book.kind";
String BOOK_MIME = "fbreader.downloader.book.mime";
String CLEAN_URL = "fbreader.downloader.clean.url";
String SHOW_NOTIFICATIONS = "fbreader.downloader.show.notifications";
}
public static final String REFERENCE_TYPE_KEY = "org.geometerplus.android.fbreader.network.ReferenceType";
public static final String CLEAN_URL_KEY = "org.geometerplus.android.fbreader.network.CleanURL";
public static final String SHOW_NOTIFICATIONS_KEY = "org.geometerplus.android.fbreader.network.ShowNotifications";
public interface Notifications {
int DOWNLOADING_STARTED = 0x0001;
int ALREADY_DOWNLOADING = 0x0002;
@ -112,16 +111,16 @@ public class BookDownloaderService extends Service {
}
intent.setData(null);
final int notifications = intent.getIntExtra(SHOW_NOTIFICATIONS_KEY, 0);
final int notifications = intent.getIntExtra(Key.SHOW_NOTIFICATIONS, 0);
final String url = uri.toString();
final MimeType mime = MimeType.get(intent.getStringExtra(Key.BOOK_MIME));
UrlInfo.Type referenceType = (UrlInfo.Type)intent.getSerializableExtra(REFERENCE_TYPE_KEY);
UrlInfo.Type referenceType = (UrlInfo.Type)intent.getSerializableExtra(Key.BOOK_KIND);
if (referenceType == null) {
referenceType = UrlInfo.Type.Book;
}
String cleanURL = intent.getStringExtra(CLEAN_URL_KEY);
String cleanURL = intent.getStringExtra(Key.CLEAN_URL);
if (cleanURL == null) {
cleanURL = url;
}

View file

@ -134,8 +134,8 @@ public abstract class Util implements UserRegistrationConstants {
new Intent(Intent.ACTION_VIEW, Uri.parse(ref.Url),
activity.getApplicationContext(), BookDownloaderService.class)
.putExtra(BookDownloaderService.Key.BOOK_MIME, ref.Mime.toString())
.putExtra(BookDownloaderService.REFERENCE_TYPE_KEY, resolvedType)
.putExtra(BookDownloaderService.CLEAN_URL_KEY, ref.cleanUrl())
.putExtra(BookDownloaderService.Key.BOOK_KIND, resolvedType)
.putExtra(BookDownloaderService.Key.CLEAN_URL, ref.cleanUrl())
.putExtra(BookDownloaderService.Key.BOOK_TITLE, book.Title)
);
}

View file

@ -19,7 +19,6 @@
package org.geometerplus.android.fbreader.sync;
import android.app.NotificationManager;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
@ -27,7 +26,6 @@ import android.view.View;
import org.geometerplus.zlibrary.core.resources.ZLResource;
import org.geometerplus.android.fbreader.network.BookDownloaderService;
import org.geometerplus.android.fbreader.network.NetworkNotifications;
import org.geometerplus.android.fbreader.util.SimpleDialogActivity;
public class MissingBookActivity extends SimpleDialogActivity {
@ -48,9 +46,6 @@ public class MissingBookActivity extends SimpleDialogActivity {
okButton().setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
final NotificationManager notificationManager =
(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
notificationManager.cancel(NetworkNotifications.MISSING_BOOK_ID);
startService(intent);
finish();
}