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

separate icon fo 'downloading' status

This commit is contained in:
Nikolay Pultsin 2013-02-18 00:44:34 +04:00
parent 0084c1f78d
commit 31f4c630f2
7 changed files with 27 additions and 16 deletions

View file

@ -28,7 +28,7 @@
<data android:scheme="ExceptionInInitializerError"/>
</intent-filter>
</activity>
<service android:name="org.geometerplus.android.fbreader.api.ApiService">
<service android:name="org.geometerplus.android.fbreader.api.ApiService" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.fbreader.action.API"/>
<category android:name="android.intent.category.DEFAULT"/>
@ -170,7 +170,7 @@
<data android:host="*" android:scheme="epub"/>
</intent-filter>
</activity>
<service android:name="org.geometerplus.android.fbreader.network.BookDownloaderService" android:process=":networkLibrary"/>
<service android:name="org.geometerplus.android.fbreader.network.BookDownloaderService" android:launchMode="singleTask" android:process=":networkLibrary"/>
<activity android:name="org.geometerplus.android.fbreader.network.NetworkSearchActivity" android:process=":networkLibrary" android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.SEARCH"/>

View file

@ -28,7 +28,7 @@
<data android:scheme="ExceptionInInitializerError"/>
</intent-filter>
</activity>
<service android:name="org.geometerplus.android.fbreader.api.ApiService">
<service android:name="org.geometerplus.android.fbreader.api.ApiService" android:launchMode="singleTask">
<intent-filter>
<action android:name="android.fbreader.action.API"/>
<category android:name="android.intent.category.DEFAULT"/>
@ -170,7 +170,7 @@
<data android:host="*" android:scheme="epub"/>
</intent-filter>
</activity>
<service android:name="org.geometerplus.android.fbreader.network.BookDownloaderService" android:process=":networkLibrary"/>
<service android:name="org.geometerplus.android.fbreader.network.BookDownloaderService" android:launchMode="singleTask" android:process=":networkLibrary"/>
<activity android:name="org.geometerplus.android.fbreader.network.NetworkSearchActivity" android:process=":networkLibrary" android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.SEARCH"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

View file

@ -24,11 +24,13 @@ import android.os.IBinder;
public class BookDownloaderServiceConnection implements ServiceConnection {
private volatile Runnable myAction;
private BookDownloaderInterface myInterface;
private volatile BookDownloaderInterface myInterface;
synchronized void bindToService(Context context, Runnable action) {
if (myInterface != null) {
action.run();
if (action != null) {
action.run();
}
} else {
myAction = action;
context.bindService(
@ -41,7 +43,10 @@ public class BookDownloaderServiceConnection implements ServiceConnection {
synchronized void unbind(Context context) {
myAction = null;
context.unbindService(this);
if (myInterface != null) {
context.unbindService(this);
myInterface = null;
}
}
public synchronized void onServiceConnected(ComponentName className, IBinder service) {

View file

@ -95,11 +95,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
protected void onStart() {
super.onStart();
bindService(
new Intent(getApplicationContext(), BookDownloaderService.class),
Connection,
BIND_AUTO_CREATE
);
Connection.bindToService(this, null);
NetworkLibrary.Instance().addChangeListener(this);
}
@ -115,7 +111,7 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
protected void onStop() {
NetworkLibrary.Instance().removeChangeListener(this);
unbindService(Connection);
Connection.unbind(this);
super.onStop();
}
@ -147,6 +143,15 @@ public abstract class NetworkLibraryActivity extends TreeActivity<NetworkTree> i
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Connection.bindToService(this, new Runnable() {
public void run() {
getListView().invalidateViews();
}
});
}
@Override
public boolean onSearchRequested() {
final NetworkTree tree = getCurrentTree();

View file

@ -91,7 +91,7 @@ public abstract class NetworkBookActions {
final BookUrlInfo reference = book.reference(UrlInfo.Type.Book);
if (reference != null
&& connection != null && connection.isBeingDownloaded(reference.Url)) {
return R.drawable.ic_list_download;
return R.drawable.ic_list_downloading;
} else if (book.localCopyFileName() != null) {
return R.drawable.ic_list_flag;
} else if (reference != null) {

View file

@ -61,10 +61,11 @@ public class ShowBookInfoAction extends BookAction {
}
private void showBookInfo(NetworkTree tree) {
OrientationUtil.startActivity(
OrientationUtil.startActivityForResult(
myActivity,
new Intent(myActivity, NetworkBookInfoActivity.class)
.putExtra(NetworkLibraryActivity.TREE_KEY_KEY, tree.getUniqueKey())
.putExtra(NetworkLibraryActivity.TREE_KEY_KEY, tree.getUniqueKey()),
1
);
}
}