commit
077b39d10b
4 changed files with 100 additions and 75 deletions
|
@ -7,3 +7,5 @@ files:
|
|||
translation: /app/src/main/res/values-%android_code%/%original_file_name%
|
||||
- source: /app/src/main/res/values/objectives.xml
|
||||
translation: /app/src/main/res/values-%android_code%/%original_file_name%
|
||||
- source: /wear/src/main/res/values/strings.xml
|
||||
translation: /wear/src/main/res/values-%android_code%/strings.xml
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
package info.nightscout.androidaps.data;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.preference.PreferenceManager;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
|
@ -36,8 +34,11 @@ import com.google.android.gms.wearable.NodeApi;
|
|||
import com.google.android.gms.wearable.Wearable;
|
||||
import com.google.android.gms.wearable.WearableListenerService;
|
||||
|
||||
import info.nightscout.androidaps.interaction.AAPSPreferences;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interaction.AAPSPreferences;
|
||||
import info.nightscout.androidaps.interaction.actions.AcceptActivity;
|
||||
import info.nightscout.androidaps.interaction.actions.CPPActivity;
|
||||
import info.nightscout.androidaps.interaction.utils.Persistence;
|
||||
|
@ -79,6 +80,7 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
|||
|
||||
|
||||
private static final String ACTION_RESEND_BULK = "com.dexdrip.stephenblack.nightwatch.RESEND_BULK_DATA";
|
||||
private static final String AAPS_NOTIFY_CHANNEL_ID = "AndroidAPS-Openloop";
|
||||
|
||||
GoogleApiClient googleApiClient;
|
||||
private long lastRequest = 0;
|
||||
|
@ -552,13 +554,29 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
|||
}
|
||||
|
||||
private void notifyChangeRequest(String title, String message, String actionstring) {
|
||||
// Create the NotificationChannel, but only on API 26+ because
|
||||
// the NotificationChannel class is new and not in the support library
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
CharSequence name = "AAPS Open Loop";
|
||||
String description = "Open Loop request notiffication";//getString(R.string.channel_description);
|
||||
NotificationChannel channel = new NotificationChannel(AAPS_NOTIFY_CHANNEL_ID, name, NotificationManager.IMPORTANCE_HIGH);
|
||||
channel.setDescription(description);
|
||||
channel.enableVibration(true);
|
||||
|
||||
Notification.Builder builder =
|
||||
new Notification.Builder(this); //,"AndroidAPS-Openloop");
|
||||
builder.setSmallIcon(R.drawable.notif_icon)
|
||||
// Register the channel with the system; you can't change the importance
|
||||
// or other notification behaviors after this
|
||||
NotificationManager notificationManager = getSystemService(NotificationManager.class);
|
||||
notificationManager.createNotificationChannel(channel);
|
||||
}
|
||||
|
||||
NotificationCompat.Builder builder =
|
||||
new NotificationCompat.Builder(this, AAPS_NOTIFY_CHANNEL_ID);
|
||||
|
||||
builder = builder.setSmallIcon(R.drawable.notif_icon)
|
||||
.setContentTitle(title)
|
||||
.setContentText(message)
|
||||
.setPriority(Notification.PRIORITY_HIGH);
|
||||
.setPriority(Notification.PRIORITY_HIGH)
|
||||
.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000});
|
||||
|
||||
// Creates an explicit intent for an Activity in your app
|
||||
Intent intent = new Intent(this, AcceptActivity.class);
|
||||
|
@ -571,8 +589,8 @@ public class ListenerService extends WearableListenerService implements GoogleAp
|
|||
|
||||
PendingIntent resultPendingIntent =
|
||||
PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||
builder.setContentIntent(resultPendingIntent);
|
||||
builder.setVibrate(new long[]{1000, 1000, 1000, 1000, 1000});
|
||||
|
||||
builder = builder.setContentIntent(resultPendingIntent);
|
||||
|
||||
NotificationManager mNotificationManager =
|
||||
(NotificationManager) getSystemService(NOTIFICATION_SERVICE);
|
||||
|
|
66
wear/src/main/res/values/arrays.xml
Normal file
66
wear/src/main/res/values/arrays.xml
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<string-array name="chart_timeframe">
|
||||
<item>1 hour</item>
|
||||
<item>2 hours</item>
|
||||
<item>3 hours</item>
|
||||
<item>4 hours</item>
|
||||
<item>5 hours</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="chart_timeframe_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="delta_granularity">
|
||||
<item>Low</item>
|
||||
<item>Medium</item>
|
||||
<item>High</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="delta_granularity_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="input_design">
|
||||
<item>Default</item>
|
||||
<item>Quick righty</item>
|
||||
<item>Quick lefty</item>
|
||||
<item>Modern Sparse</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="input_design_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="complication_tap_action">
|
||||
<item>Default</item>
|
||||
<item>Menu</item>
|
||||
<item>Wizard</item>
|
||||
<item>Bolus</item>
|
||||
<item>eCarb</item>
|
||||
<item>Status</item>
|
||||
<item>None</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="complication_tap_action_values">
|
||||
<item>default</item>
|
||||
<item>menu</item>
|
||||
<item>wizard</item>
|
||||
<item>bolus</item>
|
||||
<item>ecarb</item>
|
||||
<item>status</item>
|
||||
<item>none</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
|
@ -4,67 +4,6 @@
|
|||
<string name="app_name">AAPS</string>
|
||||
<string name="label_actions_activity">AAPS</string>
|
||||
|
||||
<string-array name="chart_timeframe">
|
||||
<item>1 hour</item>
|
||||
<item>2 hours</item>
|
||||
<item>3 hours</item>
|
||||
<item>4 hours</item>
|
||||
<item>5 hours</item>
|
||||
|
||||
</string-array>
|
||||
<string-array name="chart_timeframe_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
<item>5</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="delta_granularity">
|
||||
<item>Low</item>
|
||||
<item>Medium</item>
|
||||
<item>High</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="delta_granularity_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="input_design">
|
||||
<item>Default</item>
|
||||
<item>Quick righty</item>
|
||||
<item>Quick lefty</item>
|
||||
<item>Modern Sparse</item>
|
||||
|
||||
</string-array>
|
||||
<string-array name="input_design_values">
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
<item>3</item>
|
||||
<item>4</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="complication_tap_action">
|
||||
<item>Default</item>
|
||||
<item>Menu</item>
|
||||
<item>Wizard</item>
|
||||
<item>Bolus</item>
|
||||
<item>eCarb</item>
|
||||
<item>Status</item>
|
||||
<item>None</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="complication_tap_action_values">
|
||||
<item>default</item>
|
||||
<item>menu</item>
|
||||
<item>wizard</item>
|
||||
<item>bolus</item>
|
||||
<item>ecarb</item>
|
||||
<item>status</item>
|
||||
<item>none</item>
|
||||
</string-array>
|
||||
|
||||
<string name="label_xdrip">AAPS</string>
|
||||
<string name="label_xdrip_large">AAPS(Large)</string>
|
||||
|
|
Loading…
Reference in a new issue