mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-08-30 19:15:54 +02:00
Remove quit button from the service notification, put a quit item in the context menu instead. Closes #12
This commit is contained in:
parent
79c7085264
commit
ecb7a9f3b5
@ -1,8 +1,9 @@
|
|||||||
###Changelog
|
###Changelog
|
||||||
|
|
||||||
####Version 0.1.3
|
####Version 0.1.3
|
||||||
* List all suported devices and connect on tap
|
* Remove the connect button, list all suported devices and connect on tap instead
|
||||||
* Remove the connect button
|
* Display firmware version of connected devices
|
||||||
|
* Remove quit button from the service notification, put a quit item in the context menu instead
|
||||||
|
|
||||||
####Version 0.1.2
|
####Version 0.1.2
|
||||||
* Added option to start Gadgetbridge and connect automatically when bluetooth is turned on
|
* Added option to start Gadgetbridge and connect automatically when bluetooth is turned on
|
||||||
|
@ -96,18 +96,13 @@ public class BluetoothCommunicationService extends Service {
|
|||||||
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
|
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
|
||||||
notificationIntent, 0);
|
notificationIntent, 0);
|
||||||
|
|
||||||
Intent stopIntent = new Intent(this, StopServiceReceiver.class);
|
|
||||||
PendingIntent pendingIntentStop = PendingIntent.getBroadcast(this, 0, stopIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
|
||||||
|
|
||||||
return new NotificationCompat.Builder(this)
|
return new NotificationCompat.Builder(this)
|
||||||
.setContentTitle("Gadgetbridge")
|
.setContentTitle("Gadgetbridge")
|
||||||
.setTicker(text)
|
.setTicker(text)
|
||||||
.setContentText(text)
|
.setContentText(text)
|
||||||
.setSmallIcon(R.drawable.ic_notification)
|
.setSmallIcon(R.drawable.ic_notification)
|
||||||
.addAction(android.R.drawable.ic_menu_close_clear_cancel, "Quit", pendingIntentStop)
|
|
||||||
.setContentIntent(pendingIntent)
|
.setContentIntent(pendingIntent)
|
||||||
.setOngoing(true).build();
|
.setOngoing(true).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNotification(String text) {
|
private void updateNotification(String text) {
|
||||||
|
@ -125,11 +125,18 @@ public class ControlCenter extends Activity {
|
|||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (id == R.id.action_debug) {
|
else if (id == R.id.action_debug) {
|
||||||
Intent intent = new Intent(this, DebugActivity.class);
|
Intent intent = new Intent(this, DebugActivity.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (id == R.id.action_quit) {
|
||||||
|
Intent stopIntent = new Intent(this, BluetoothCommunicationService.class);
|
||||||
|
stopService(stopIntent);
|
||||||
|
|
||||||
|
Intent quitIntent = new Intent(ControlCenter.ACTION_QUIT);
|
||||||
|
sendBroadcast(quitIntent);
|
||||||
|
}
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
package nodomain.freeyourgadget.gadgetbridge;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
|
|
||||||
public class StopServiceReceiver extends BroadcastReceiver {
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
Intent stopIntent = new Intent(context, BluetoothCommunicationService.class);
|
|
||||||
context.stopService(stopIntent);
|
|
||||||
|
|
||||||
Intent quitIntent = new Intent(ControlCenter.ACTION_QUIT);
|
|
||||||
context.sendBroadcast(quitIntent);
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,4 +6,6 @@
|
|||||||
android:orderInCategory="100" app:showAsAction="never" />
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
<item android:id="@+id/action_debug" android:title="@string/action_debug"
|
<item android:id="@+id/action_debug" android:title="@string/action_debug"
|
||||||
android:orderInCategory="100" app:showAsAction="never" />
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
|
<item android:id="@+id/action_quit" android:title="@string/action_quit"
|
||||||
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<string name="app_name">Gadgetbridge</string>
|
<string name="app_name">Gadgetbridge</string>
|
||||||
<string name="title_activity_main">Gadgetbridge Control Center</string>
|
<string name="title_activity_main">Gadgetbridge Control Center</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="action_debug">Debug</string>
|
<string name="action_debug">Debug</string>
|
||||||
|
<string name="action_quit">Quit</string>
|
||||||
<string name="title_activity_debug">Debug</string>
|
<string name="title_activity_debug">Debug</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user