通知添加全部停止
This commit is contained in:
1 parent
103cfe1749
commit
9df26b94c7
7 files changed
+15
-2
No files matched your search
Binary file not shown.
|
After Width: | Height: | Size: 829 B |
Binary file not shown.
|
After Width: | Height: | Size: 487 B |
Binary file not shown.
|
After Width: | Height: | Size: 974 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -333,6 +333,7 @@
|
||||
<string name="attention">注意</string>
|
||||
<string name="start">开始</string>
|
||||
<string name="stop">停止</string>
|
||||
<string name="stop_all">全部停止</string>
|
||||
<string name="invalid_input">无效的输入</string>
|
||||
<string name="never_show">不再显示</string>
|
||||
<string name="retry">重试</string>
|
||||
|
||||
@@ -355,6 +355,7 @@
|
||||
<string name="attention">Attention</string>
|
||||
<string name="start">Start</string>
|
||||
<string name="stop">Stop</string>
|
||||
<string name="stop_all">Stop all</string>
|
||||
<string name="invalid_input">Invalid Input</string>
|
||||
<string name="never_show">Never show me this dialog</string>
|
||||
<string name="retry">Retry</string>
|
||||
|
||||
@@ -43,6 +43,7 @@ public class DownloadService extends Service
|
||||
|
||||
public static final String ACTION_UPDATE = "com.hippo.ehviewer.service.DownloadService.UPDATE";
|
||||
public static final String ACTION_STOP = "com.hippo.ehviewer.service.DownloadService.STOP";
|
||||
public static final String ACTION_STOP_ALL = "com.hippo.ehviewer.service.DownloadService.STOP_ALL";
|
||||
|
||||
private Context mContext;
|
||||
private Data mData;
|
||||
@@ -70,8 +71,13 @@ public class DownloadService extends Service
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
|
||||
if (ACTION_STOP.equals(intent.getAction()))
|
||||
if (ACTION_STOP.equals(intent.getAction())) {
|
||||
stopCurrentTask();
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
} else if (ACTION_STOP_ALL.equals(intent.getAction())) {
|
||||
stopAll();
|
||||
mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID);
|
||||
}
|
||||
|
||||
return START_NOT_STICKY;
|
||||
}
|
||||
@@ -235,7 +241,12 @@ public class DownloadService extends Service
|
||||
Intent stopIntent = new Intent(this, DownloadService.class);
|
||||
stopIntent.setAction(ACTION_STOP);
|
||||
PendingIntent piStop = PendingIntent.getService(this, 0, stopIntent, 0);
|
||||
mBuilder.addAction(R.drawable.ic_clear, getString(R.string.stop), piStop);
|
||||
mBuilder.addAction(R.drawable.ic_clear2, getString(R.string.stop), piStop);
|
||||
|
||||
Intent stopAllIntent = new Intent(this, DownloadService.class);
|
||||
stopAllIntent.setAction(ACTION_STOP_ALL);
|
||||
PendingIntent piStopAll = PendingIntent.getService(this, 0, stopAllIntent, 0);
|
||||
mBuilder.addAction(R.drawable.ic_clear, getString(R.string.stop_all), piStopAll);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user