Merge pull request #1 from MilosKozak/dev

Dev Sync
This commit is contained in:
Philoul 2019-12-05 18:14:27 +01:00 committed by GitHub
commit 077b39d10b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 100 additions and 75 deletions

View file

@ -7,3 +7,5 @@ files:
translation: /app/src/main/res/values-%android_code%/%original_file_name% translation: /app/src/main/res/values-%android_code%/%original_file_name%
- source: /app/src/main/res/values/objectives.xml - source: /app/src/main/res/values/objectives.xml
translation: /app/src/main/res/values-%android_code%/%original_file_name% 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

View file

@ -1,24 +1,22 @@
package info.nightscout.androidaps.data; package info.nightscout.androidaps.data;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import android.app.Notification; import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager; import android.app.NotificationManager;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import android.util.Log; 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.ConnectionResult;
import com.google.android.gms.common.api.GoogleApiClient; 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.Wearable;
import com.google.android.gms.wearable.WearableListenerService; 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.R;
import info.nightscout.androidaps.interaction.AAPSPreferences;
import info.nightscout.androidaps.interaction.actions.AcceptActivity; import info.nightscout.androidaps.interaction.actions.AcceptActivity;
import info.nightscout.androidaps.interaction.actions.CPPActivity; import info.nightscout.androidaps.interaction.actions.CPPActivity;
import info.nightscout.androidaps.interaction.utils.Persistence; 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 ACTION_RESEND_BULK = "com.dexdrip.stephenblack.nightwatch.RESEND_BULK_DATA";
private static final String AAPS_NOTIFY_CHANNEL_ID = "AndroidAPS-Openloop";
GoogleApiClient googleApiClient; GoogleApiClient googleApiClient;
private long lastRequest = 0; private long lastRequest = 0;
@ -552,13 +554,29 @@ public class ListenerService extends WearableListenerService implements GoogleAp
} }
private void notifyChangeRequest(String title, String message, String actionstring) { 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 = // Register the channel with the system; you can't change the importance
new Notification.Builder(this); //,"AndroidAPS-Openloop"); // or other notification behaviors after this
builder.setSmallIcon(R.drawable.notif_icon) 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) .setContentTitle(title)
.setContentText(message) .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 // Creates an explicit intent for an Activity in your app
Intent intent = new Intent(this, AcceptActivity.class); Intent intent = new Intent(this, AcceptActivity.class);
@ -571,8 +589,8 @@ public class ListenerService extends WearableListenerService implements GoogleAp
PendingIntent resultPendingIntent = PendingIntent resultPendingIntent =
PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); 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 mNotificationManager =
(NotificationManager) getSystemService(NOTIFICATION_SERVICE); (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

View 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>

View file

@ -4,67 +4,6 @@
<string name="app_name">AAPS</string> <string name="app_name">AAPS</string>
<string name="label_actions_activity">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">AAPS</string>
<string name="label_xdrip_large">AAPS(Large)</string> <string name="label_xdrip_large">AAPS(Large)</string>