mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Merge pull request #1614 from deltachat/fix-generic-fgservice
close generic foreground-service when hitting 'cancel' button
This commit is contained in:
@@ -132,6 +132,7 @@ public class WelcomeActivity extends BaseActionBarActivity implements DcEventCen
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getResources().getString(android.R.string.cancel), (dialog, which) -> {
|
||||
dcContext.stopOngoingProcess();
|
||||
notificationController.close();
|
||||
});
|
||||
progressDialog.show();
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ public class NotificationCenter {
|
||||
|
||||
public static final int ID_PERMANTENT = 1;
|
||||
public static final int ID_MSG_SUMMARY = 2;
|
||||
public static final int ID_GENERIC = 3;
|
||||
public static final int ID_MSG_OFFSET = 0; // msgId is added - as msgId start at 10, there are no conflicts with lower numbers
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,10 @@ public abstract class ListSummaryPreferenceFragment extends CorrectedPreferenceF
|
||||
progressDialog.setMessage(getActivity().getString(R.string.one_moment));
|
||||
progressDialog.setCanceledOnTouchOutside(false);
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(android.R.string.cancel), (dialog, which) -> dcContext.stopOngoingProcess());
|
||||
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, getActivity().getString(android.R.string.cancel), (dialog, which) -> {
|
||||
dcContext.stopOngoingProcess();
|
||||
notificationController.close();
|
||||
});
|
||||
progressDialog.show();
|
||||
|
||||
imexDir = dcContext.getImexDir().getAbsolutePath();
|
||||
|
||||
@@ -32,7 +32,6 @@ public final class GenericForegroundService extends Service {
|
||||
|
||||
private final IBinder binder = new LocalBinder();
|
||||
|
||||
private static final int NOTIFICATION_ID = 849319618;
|
||||
private static final String EXTRA_TITLE = "extra_title";
|
||||
private static final String EXTRA_CONTENT_TEXT = "extra_content_text";
|
||||
private static final String EXTRA_CHANNEL_ID = "extra_channel_id";
|
||||
@@ -109,7 +108,7 @@ public final class GenericForegroundService extends Service {
|
||||
|
||||
private void postObligatoryForegroundNotification(@NonNull Entry active) {
|
||||
lastPosted = active;
|
||||
startForeground(NOTIFICATION_ID, new Builder(this, active.channelId)
|
||||
startForeground(NotificationCenter.ID_GENERIC, new Builder(this, active.channelId)
|
||||
.setSmallIcon(active.iconRes)
|
||||
.setContentTitle(active.title)
|
||||
.setTicker(active.contentText)
|
||||
|
||||
Reference in New Issue
Block a user