added dedicated button to disable foreground service in perma notification

This commit is contained in:
iNPUTmice 2015-01-15 16:17:55 +01:00
parent 351e5d7065
commit 994c9495ba
6 changed files with 11 additions and 3 deletions

View File

@ -409,13 +409,20 @@ public class NotificationService {
final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService); final NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService);
mBuilder.setSmallIcon(R.drawable.ic_stat_communication_import_export); mBuilder.setSmallIcon(R.drawable.ic_stat_communication_import_export);
mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.conversations_foreground_service)); mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.conversations_foreground_service));
mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_disable)); mBuilder.setContentText(mXmppConnectionService.getString(R.string.touch_to_open_conversations));
mBuilder.setContentIntent(createDisableForeground()); mBuilder.addAction(R.drawable.ic_action_cancel,
mXmppConnectionService.getString(R.string.disable_foreground_service),
createDisableForeground());
mBuilder.setContentIntent(createOpenConversationsIntent());
mBuilder.setWhen(0); mBuilder.setWhen(0);
mBuilder.setPriority(NotificationCompat.PRIORITY_MIN); mBuilder.setPriority(NotificationCompat.PRIORITY_MIN);
return mBuilder.build(); return mBuilder.build();
} }
private PendingIntent createOpenConversationsIntent() {
return PendingIntent.getActivity(mXmppConnectionService, 0, new Intent(mXmppConnectionService,ConversationActivity.class),0);
}
public void updateErrorNotification() { public void updateErrorNotification() {
final NotificationManager mNotificationManager = (NotificationManager) mXmppConnectionService.getSystemService(Context.NOTIFICATION_SERVICE); final NotificationManager mNotificationManager = (NotificationManager) mXmppConnectionService.getSystemService(Context.NOTIFICATION_SERVICE);
final List<Account> errors = new ArrayList<>(); final List<Account> errors = new ArrayList<>();

Binary file not shown.

After

Width:  |  Height:  |  Size: 353 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 B

View File

@ -357,7 +357,6 @@
<string name="smp_requested">Contact requested SMP verification</string> <string name="smp_requested">Contact requested SMP verification</string>
<string name="no_otr_session_found">No valid OTR session has been found!</string> <string name="no_otr_session_found">No valid OTR session has been found!</string>
<string name="conversations_foreground_service">Conversations</string> <string name="conversations_foreground_service">Conversations</string>
<string name="touch_to_disable">Touch to disable foreground service</string>
<string name="pref_keep_foreground_service">Keep service in foreground</string> <string name="pref_keep_foreground_service">Keep service in foreground</string>
<string name="pref_keep_foreground_service_summary">Prevents the operating system from killing your connection</string> <string name="pref_keep_foreground_service_summary">Prevents the operating system from killing your connection</string>
<string name="choose_file">Choose file</string> <string name="choose_file">Choose file</string>
@ -441,4 +440,6 @@
<string name="video">video file</string> <string name="video">video file</string>
<string name="pdf_document">PDF document</string> <string name="pdf_document">PDF document</string>
<string name="received_x_file">Received %s</string> <string name="received_x_file">Received %s</string>
<string name="disable_foreground_service">Disable foreground service</string>
<string name="touch_to_open_conversations">Touch to open Conversations</string>
</resources> </resources>