Merge pull request #88 from MilosKozak/dev

Dev
This commit is contained in:
Roumen Georgiev 2019-12-05 15:06:15 +02:00 committed by GitHub
commit 6c8a5aee47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
79 changed files with 955 additions and 473 deletions

View file

@ -225,8 +225,8 @@ dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-wearable:17.0.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation("com.crashlytics.sdk.android:crashlytics:2.9.9@aar") {
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
transitive = true;
}
@ -234,11 +234,11 @@ dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation "com.wdullaer:materialdatetimepicker:2.3.0"
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
@ -247,11 +247,11 @@ dependencies {
implementation("com.github.tony19:logback-android-classic:1.1.1-6") {
exclude group: "com.google.android", module: "android"
}
implementation "org.apache.commons:commons-lang3:3.7"
implementation "org.slf4j:slf4j-api:1.7.21"
implementation "org.apache.commons:commons-lang3:3.9"
implementation "org.slf4j:slf4j-api:1.7.29"
// Graphview cannot be upgraded
implementation "com.jjoe64:graphview:4.0.1"
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.2.2"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
implementation 'com.madgag.spongycastle:core:1.58.0.0'
@ -263,24 +263,23 @@ dependencies {
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"
}
implementation "com.google.code.gson:gson:2.8.5"
implementation "com.google.code.gson:gson:2.8.6"
implementation "com.google.guava:guava:24.1-jre"
implementation "net.danlew:android.joda:2.9.9.1"
implementation "uk.com.robust-it:cloning:1.9.9"
implementation "net.danlew:android.joda:2.10.3"
implementation 'org.mozilla:rhino:1.7.7.2'
implementation 'org.mozilla:rhino:1.7.11'
implementation 'com.github.DavidProdinger:weekdays-selector:1.1.0'
testImplementation "junit:junit:4.12"
testImplementation "org.json:json:20140107"
testImplementation "org.json:json:20190722"
testImplementation "org.mockito:mockito-core:2.8.47"
testImplementation "org.powermock:powermock-api-mockito2:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule-agent:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4-rule:${powermockVersion}"
testImplementation "org.powermock:powermock-module-junit4:${powermockVersion}"
testImplementation "joda-time:joda-time:2.9.9"
testImplementation "joda-time:joda-time:2.10.5"
testImplementation("com.google.truth:truth:0.39") {
exclude group: "com.google.guava", module: "guava"
}
@ -300,11 +299,11 @@ dependencies {
// new for tidepool
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation "com.squareup.retrofit2:retrofit:2.4.0"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.4.0"
implementation "com.squareup.retrofit2:converter-gson:2.4.0"
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.2'
implementation "com.squareup.retrofit2:retrofit:2.6.2"
implementation "com.squareup.retrofit2:adapter-rxjava2:2.6.2"
implementation "com.squareup.retrofit2:converter-gson:2.6.2"
}

View file

@ -37,12 +37,10 @@ import com.joanzapata.iconify.fonts.FontAwesomeModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.activities.AgreementActivity;
import info.nightscout.androidaps.activities.HistoryBrowseActivity;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.activities.PreferencesActivity;
import info.nightscout.androidaps.activities.SingleFragmentActivity;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventPreferenceChange;
import info.nightscout.androidaps.events.EventRebuildTabs;
@ -51,7 +49,6 @@ import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.aps.loop.LoopPlugin;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.constraints.versionChecker.VersionCheckerUtilsKt;
import info.nightscout.androidaps.plugins.general.nsclient.data.NSSettingsStatus;
import info.nightscout.androidaps.setupwizard.SetupWizardActivity;
@ -59,7 +56,6 @@ import info.nightscout.androidaps.tabs.TabPageAdapter;
import info.nightscout.androidaps.utils.AndroidPermission;
import info.nightscout.androidaps.utils.FabricPrivacy;
import info.nightscout.androidaps.utils.LocaleHelper;
import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.PasswordProtection;
import info.nightscout.androidaps.utils.SP;
import io.reactivex.android.schedulers.AndroidSchedulers;
@ -141,11 +137,9 @@ public class MainActivity extends NoSplashAppCompatActivity {
.subscribe(this::processPreferenceChange, FabricPrivacy::logException)
);
if (!SP.getBoolean(R.string.key_setupwizard_processed, false)) {
if (!SP.getBoolean(R.string.key_setupwizard_processed, false) || !SP.contains(R.string.key_units)) {
Intent intent = new Intent(this, SetupWizardActivity.class);
startActivity(intent);
} else {
checkEula();
}
AndroidPermission.notifyForStoragePermission(this);
@ -237,16 +231,6 @@ public class MainActivity extends NoSplashAppCompatActivity {
}
}
private void checkEula() {
//SP.removeBoolean(R.string.key_i_understand);
boolean IUnderstand = SP.getBoolean(R.string.key_i_understand, false);
if (!IUnderstand) {
Intent intent = new Intent(getApplicationContext(), AgreementActivity.class);
startActivity(intent);
finish();
}
}
private void doMigrations() {
// guarantee that the unreachable threshold is at least 30 and of type String
@ -255,11 +239,6 @@ public class MainActivity extends NoSplashAppCompatActivity {
SP.remove(R.string.key_pump_unreachable_threshold);
if (unreachable_threshold < 30) unreachable_threshold = 30;
SP.putString(R.string.key_pump_unreachable_threshold, Integer.toString(unreachable_threshold));
if (!SP.contains(R.string.key_units)) {
Intent intent = new Intent(this, SetupWizardActivity.class);
startActivity(intent);
}
}

View file

@ -1,44 +0,0 @@
package info.nightscout.androidaps.activities;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import info.nightscout.androidaps.MainActivity;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.utils.SP;
public class AgreementActivity extends NoSplashActivity {
boolean IUnderstand;
CheckBox agreeCheckBox;
Button saveButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_agreement);
IUnderstand = SP.getBoolean(R.string.key_i_understand, false);
setContentView(R.layout.activity_agreement);
agreeCheckBox = (CheckBox)findViewById(R.id.agreementCheckBox);
agreeCheckBox.setChecked(IUnderstand);
saveButton = (Button)findViewById(R.id.agreementSaveButton);
addListenerOnButton();
}
public void addListenerOnButton() {
saveButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
SP.putBoolean(R.string.key_i_understand, agreeCheckBox.isChecked());
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
startActivity(intent);
finish();
}
});
}
}

View file

@ -45,7 +45,7 @@ import info.nightscout.androidaps.utils.T;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
public class HistoryBrowseActivity extends NoSplashActivity {
public class HistoryBrowseActivity extends NoSplashAppCompatActivity {
private static Logger log = LoggerFactory.getLogger(HistoryBrowseActivity.class);
private CompositeDisposable disposable = new CompositeDisposable();
@ -150,7 +150,7 @@ public class HistoryBrowseActivity extends NoSplashActivity {
);
dpd.setThemeDark(true);
dpd.dismissOnPause(true);
dpd.show(getFragmentManager(), "Datepickerdialog");
dpd.show(getSupportFragmentManager(), "Datepickerdialog");
});
bgGraph.getGridLabelRenderer().setGridColor(MainApp.gc(R.color.graphgrid));

View file

@ -1,13 +0,0 @@
package info.nightscout.androidaps.activities
import android.app.Activity
import android.os.Bundle
import info.nightscout.androidaps.R
open class NoSplashActivity : Activity() {
public override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme_NoActionBar)
super.onCreate(savedInstanceState)
}
}

View file

@ -1,12 +1,18 @@
package info.nightscout.androidaps.activities
import android.content.Context
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import info.nightscout.androidaps.R
import info.nightscout.androidaps.utils.LocaleHelper
open class NoSplashAppCompatActivity : AppCompatActivity() {
public override fun onCreate(savedInstanceState: Bundle?) {
setTheme(R.style.AppTheme_NoActionBar)
super.onCreate(savedInstanceState)
}
public override fun attachBaseContext(newBase: Context) {
super.attachBaseContext(LocaleHelper.wrap(newBase))
}
}

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.activities;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.preference.EditTextPreference;
@ -47,6 +48,7 @@ import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref0Plugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityOref1Plugin;
import info.nightscout.androidaps.plugins.sensitivity.SensitivityWeightedAveragePlugin;
import info.nightscout.androidaps.plugins.source.SourceDexcomPlugin;
import info.nightscout.androidaps.utils.LocaleHelper;
import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.SafeParse;
@ -66,6 +68,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
PreferenceManager.getDefaultSharedPreferences(this).registerOnSharedPreferenceChangeListener(this);
}
@Override
public void attachBaseContext(Context newBase) {
super.attachBaseContext(LocaleHelper.INSTANCE.wrap(newBase));
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
RxBus.INSTANCE.send(new EventPreferenceChange(key));
@ -122,6 +129,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
}
}
}
if (pref != null)
adjustUnitDependentPrefs(pref);
}

View file

@ -54,7 +54,7 @@ import info.nightscout.androidaps.utils.SafeParse;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
public class TDDStatsActivity extends NoSplashActivity {
public class TDDStatsActivity extends NoSplashAppCompatActivity {
private static Logger log = LoggerFactory.getLogger(TDDStatsActivity.class);
private CompositeDisposable disposable = new CompositeDisposable();

View file

@ -1,7 +1,5 @@
package info.nightscout.androidaps.data;
import com.rits.cloning.Cloner;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -37,8 +35,19 @@ public class IobTotal implements DataPointWithLabelInterface {
public IobTotal copy() {
Cloner cloner = new Cloner();
return cloner.deepClone(this);
IobTotal i = new IobTotal(time);
i.iob = iob;
i.activity = activity;
i.bolussnooze = bolussnooze;
i.basaliob = basaliob;
i.netbasalinsulin = netbasalinsulin;
i.hightempinsulin = hightempinsulin;
i.lastBolusTime = lastBolusTime;
if (iobWithZeroTemp != null) i.iobWithZeroTemp = iobWithZeroTemp.copy();
i.netInsulin = netInsulin;
i.netRatio = netRatio;
i.extendedBolusInsulin = extendedBolusInsulin;
return i;
}
public IobTotal(long time) {
@ -137,7 +146,7 @@ public class IobTotal implements DataPointWithLabelInterface {
// DataPoint interface
int color;
private int color;
@Override
public double getX() {

View file

@ -7,6 +7,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import info.nightscout.androidaps.Constants;
@ -19,10 +20,11 @@ import info.nightscout.androidaps.plugins.general.overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.DataPointWithLabelInterface;
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.PointsWithLabelGraphSeries;
import info.nightscout.androidaps.utils.DecimalFormatter;
import info.nightscout.androidaps.utils.T;
@DatabaseTable(tableName = DatabaseHelper.DATABASE_BGREADINGS)
public class BgReading implements DataPointWithLabelInterface {
private static Logger log = LoggerFactory.getLogger(L.DATABASE);
private static Logger log = LoggerFactory.getLogger(L.GLUCOSE);
@DatabaseField(id = true)
public long date;
@ -73,9 +75,10 @@ public class BgReading implements DataPointWithLabelInterface {
public String directionToSymbol() {
String symbol = "";
if (direction == null) {
symbol = "??";
} else if (direction.compareTo("DoubleDown") == 0) {
if (direction == null)
direction = calculateDirection();
if (direction.compareTo("DoubleDown") == 0) {
symbol = "\u21ca";
} else if (direction.compareTo("SingleDown") == 0) {
symbol = "\u2193";
@ -95,18 +98,13 @@ public class BgReading implements DataPointWithLabelInterface {
return symbol;
}
public static boolean isSlopeNameInvalid(String direction) {
if (direction.compareTo("NOT_COMPUTABLE") == 0 ||
private static boolean isSlopeNameInvalid(String direction) {
return direction.compareTo("NOT_COMPUTABLE") == 0 ||
direction.compareTo("NOT COMPUTABLE") == 0 ||
direction.compareTo("OUT_OF_RANGE") == 0 ||
direction.compareTo("OUT OF RANGE") == 0 ||
direction.compareTo("NONE") == 0 ||
direction.compareTo("NotComputable") == 0
) {
return true;
} else {
return false;
}
direction.compareTo("NotComputable") == 0;
}
@ -123,6 +121,7 @@ public class BgReading implements DataPointWithLabelInterface {
public boolean isDataChanging(BgReading other) {
if (date != other.date) {
if (L.isEnabled(L.GLUCOSE))
log.error("Comparing different");
return false;
}
@ -133,6 +132,7 @@ public class BgReading implements DataPointWithLabelInterface {
public boolean isEqual(BgReading other) {
if (date != other.date) {
if (L.isEnabled(L.GLUCOSE))
log.error("Comparing different");
return false;
}
@ -149,6 +149,7 @@ public class BgReading implements DataPointWithLabelInterface {
public void copyFrom(BgReading other) {
if (date != other.date) {
if (L.isEnabled(L.GLUCOSE))
log.error("Copying different");
return;
}
@ -245,4 +246,53 @@ public class BgReading implements DataPointWithLabelInterface {
return isaCOBPrediction || isCOBPrediction || isIOBPrediction || isUAMPrediction || isZTPrediction;
}
// Copied from xDrip+
String calculateDirection() {
// Rework to get bgreaings from internal DB and calculate on that base
List<BgReading> bgReadingsList = MainApp.getDbHelper().getAllBgreadingsDataFromTime(this.date - T.mins(10).msecs(), false);
if (bgReadingsList == null || bgReadingsList.size() < 2)
return "NONE";
BgReading current = bgReadingsList.get(1);
BgReading previous = bgReadingsList.get(0);
if (bgReadingsList.get(1).date < bgReadingsList.get(0).date) {
current = bgReadingsList.get(0);
previous = bgReadingsList.get(1);
}
double slope;
// Avoid division by 0
if (current.date == previous.date)
slope = 0;
else
slope = (previous.value - current.value) / (previous.date - current.date);
if (L.isEnabled(L.GLUCOSE))
log.debug("Slope is :" + slope + " delta " + (previous.value - current.value) + " date difference " + (current.date - previous.date));
double slope_by_minute = slope * 60000;
String arrow = "NONE";
if (slope_by_minute <= (-3.5)) {
arrow = "DoubleDown";
} else if (slope_by_minute <= (-2)) {
arrow = "SingleDown";
} else if (slope_by_minute <= (-1)) {
arrow = "FortyFiveDown";
} else if (slope_by_minute <= (1)) {
arrow = "Flat";
} else if (slope_by_minute <= (2)) {
arrow = "FortyFiveUp";
} else if (slope_by_minute <= (3.5)) {
arrow = "SingleUp";
} else if (slope_by_minute <= (40)) {
arrow = "DoubleUp";
}
if (L.isEnabled(L.GLUCOSE))
log.debug("Direction set to: " + arrow);
return arrow;
}
}

View file

@ -5,10 +5,14 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog
import info.nightscout.androidaps.plugins.general.automation.dragHelpers.OnStartDragListener
import info.nightscout.androidaps.plugins.general.automation.dragHelpers.SimpleItemTouchHelperCallback
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
import info.nightscout.androidaps.utils.FabricPrivacy
@ -17,11 +21,14 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.CompositeDisposable
import kotlinx.android.synthetic.main.automation_fragment.*
class AutomationFragment : Fragment() {
class AutomationFragment : Fragment(), OnStartDragListener {
private var disposable: CompositeDisposable = CompositeDisposable()
private var eventListAdapter: EventListAdapter? = null
private var itemTouchHelper: ItemTouchHelper? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.automation_fragment, container, false)
}
@ -29,7 +36,7 @@ class AutomationFragment : Fragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
eventListAdapter = EventListAdapter(AutomationPlugin.automationEvents, fragmentManager, activity)
eventListAdapter = EventListAdapter(AutomationPlugin.automationEvents, fragmentManager, activity, this)
automation_eventListView.layoutManager = LinearLayoutManager(context)
automation_eventListView.adapter = eventListAdapter
@ -42,6 +49,10 @@ class AutomationFragment : Fragment() {
fragmentManager?.let { dialog.show(it, "EditEventDialog") }
}
val callback: ItemTouchHelper.Callback = SimpleItemTouchHelperCallback(eventListAdapter!!)
itemTouchHelper = ItemTouchHelper(callback)
itemTouchHelper?.attachToRecyclerView(automation_eventListView)
}
@Synchronized
@ -81,4 +92,8 @@ class AutomationFragment : Fragment() {
automation_logView?.text = sb.toString()
}
override fun onStartDrag(viewHolder: RecyclerView.ViewHolder) {
itemTouchHelper?.startDrag(viewHolder);
}
}

View file

@ -161,7 +161,7 @@ object AutomationPlugin : PluginBase(PluginDescription()
private fun processActions() {
if (!isEnabled(PluginType.GENERAL))
return
if (LoopPlugin.getPlugin().isSuspended) {
if (LoopPlugin.getPlugin().isSuspended || !LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)) {
if (L.isEnabled(L.AUTOMATION))
log.debug("Loop deactivated")
return

View file

@ -1,9 +1,12 @@
package info.nightscout.androidaps.plugins.general.automation;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
@ -17,6 +20,7 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
@ -25,19 +29,26 @@ import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.plugins.general.automation.actions.Action;
import info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDialog;
import info.nightscout.androidaps.plugins.general.automation.dragHelpers.ItemTouchHelperAdapter;
import info.nightscout.androidaps.plugins.general.automation.dragHelpers.ItemTouchHelperViewHolder;
import info.nightscout.androidaps.plugins.general.automation.dragHelpers.OnStartDragListener;
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged;
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui;
import info.nightscout.androidaps.plugins.general.automation.triggers.TriggerConnector;
import info.nightscout.androidaps.utils.OKDialog;
class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder> {
class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder> implements ItemTouchHelperAdapter {
private final List<AutomationEvent> eventList;
private final FragmentManager fragmentManager;
private final Activity activity;
EventListAdapter(List<AutomationEvent> events, FragmentManager fragmentManager, Activity activity) {
private final OnStartDragListener mDragStartListener;
EventListAdapter(List<AutomationEvent> events, FragmentManager fragmentManager, Activity activity, OnStartDragListener dragStartListener) {
this.eventList = events;
this.fragmentManager = fragmentManager;
this.activity = activity;
mDragStartListener = dragStartListener;
}
@NonNull
@ -54,6 +65,7 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
layout.addView(iv);
}
@SuppressLint("ClickableViewAccessibility")
@Override
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
final AutomationEvent event = eventList.get(position);
@ -91,16 +103,10 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
RxBus.INSTANCE.send(new EventAutomationDataChanged());
});
// remove event
holder.iconTrash.setOnClickListener(v ->
OKDialog.showConfirmation(activity, MainApp.gs(R.string.removerecord) + " " + event.getTitle(), () -> {
eventList.remove(event);
RxBus.INSTANCE.send(new EventAutomationDataChanged());
})
);
// edit event
holder.rootLayout.setOnClickListener(v -> {
holder.rootLayout.setOnClickListener(v ->
{
//EditEventDialog dialog = EditEventDialog.Companion.newInstance(event, false);
EditEventDialog dialog = new EditEventDialog();
Bundle args = new Bundle();
@ -110,6 +116,17 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
if (fragmentManager != null)
dialog.show(fragmentManager, "EditEventDialog");
});
// Start a drag whenever the handle view it touched
holder.iconSort.setOnTouchListener((v, motionEvent) ->
{
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
mDragStartListener.onStartDrag(holder);
return true;
}
return v.onTouchEvent(motionEvent);
});
}
@Override
@ -117,12 +134,33 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
return eventList.size();
}
static class ViewHolder extends RecyclerView.ViewHolder {
@Override
public boolean onItemMove(int fromPosition, int toPosition) {
Collections.swap(eventList, fromPosition, toPosition);
notifyItemMoved(fromPosition, toPosition);
RxBus.INSTANCE.send(new EventAutomationDataChanged());
return true;
}
@Override
public void onItemDismiss(int position) {
OKDialog.showConfirmation(activity, MainApp.gs(R.string.removerecord) + " " + eventList.get(position).getTitle(),
() -> {
eventList.remove(position);
notifyItemRemoved(position);
RxBus.INSTANCE.send(new EventAutomationDataChanged());
RxBus.INSTANCE.send(new EventAutomationUpdateGui());
}, () -> {
RxBus.INSTANCE.send(new EventAutomationUpdateGui());
});
}
static class ViewHolder extends RecyclerView.ViewHolder implements ItemTouchHelperViewHolder {
final RelativeLayout rootLayout;
final LinearLayout iconLayout;
final TextView eventTitle;
final Context context;
final ImageView iconTrash;
final ImageView iconSort;
final CheckBox enabled;
ViewHolder(View view, Context context) {
@ -131,8 +169,18 @@ class EventListAdapter extends RecyclerView.Adapter<EventListAdapter.ViewHolder>
eventTitle = view.findViewById(R.id.viewEventTitle);
rootLayout = view.findViewById(R.id.rootLayout);
iconLayout = view.findViewById(R.id.iconLayout);
iconTrash = view.findViewById(R.id.iconTrash);
iconSort = view.findViewById(R.id.iconSort);
enabled = view.findViewById(R.id.automation_enabled);
}
@Override
public void onItemSelected() {
itemView.setBackgroundColor(Color.LTGRAY);
}
@Override
public void onItemClear() {
itemView.setBackgroundColor(MainApp.gc(R.color.ribbonDefault));
}
}
}

View file

@ -0,0 +1,33 @@
package info.nightscout.androidaps.plugins.general.automation.dragHelpers
interface ItemTouchHelperAdapter {
/**
* Called when an item has been dragged far enough to trigger a move. This is called every time
* an item is shifted, and **not** at the end of a "drop" event.<br></br>
* <br></br>
* Implementations should call [RecyclerView.Adapter.notifyItemMoved] after
* adjusting the underlying data to reflect this move.
*
* @param fromPosition The start position of the moved item.
* @param toPosition Then resolved position of the moved item.
* @return True if the item was moved to the new adapter position.
*
* @see RecyclerView.getAdapterPositionFor
* @see RecyclerView.ViewHolder.getAdapterPosition
*/
fun onItemMove(fromPosition: Int, toPosition: Int): Boolean
/**
* Called when an item has been dismissed by a swipe.<br></br>
* <br></br>
* Implementations should call [RecyclerView.Adapter.notifyItemRemoved] after
* adjusting the underlying data to reflect this removal.
*
* @param position The position of the item dismissed.
*
* @see RecyclerView.getAdapterPositionFor
* @see RecyclerView.ViewHolder.getAdapterPosition
*/
fun onItemDismiss(position: Int)
}

View file

@ -0,0 +1,20 @@
package info.nightscout.androidaps.plugins.general.automation.dragHelpers
/**
* Interface to notify an item ViewHolder of relevant callbacks from [ ].
*
* @author Paul Burke (ipaulpro)
*/
interface ItemTouchHelperViewHolder {
/**
* Called when the [ItemTouchHelper] first registers an item as being moved or swiped.
* Implementations should update the item view to indicate it's active state.
*/
fun onItemSelected()
/**
* Called when the [ItemTouchHelper] has completed the move or swipe, and the active item
* state should be cleared.
*/
fun onItemClear()
}

View file

@ -0,0 +1,12 @@
package info.nightscout.androidaps.plugins.general.automation.dragHelpers
import androidx.recyclerview.widget.RecyclerView
interface OnStartDragListener {
/**
* Called when a view is requesting a start of a drag.
*
* @param viewHolder The holder of the view to drag.
*/
fun onStartDrag(viewHolder: RecyclerView.ViewHolder)
}

View file

@ -0,0 +1,85 @@
package info.nightscout.androidaps.plugins.general.automation.dragHelpers
import android.graphics.Canvas
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView
import kotlin.math.abs
/**
* An implementation of [ItemTouchHelper.Callback] that enables basic drag & drop and
* swipe-to-dismiss. Drag events are automatically started by an item long-press.<br></br>
*
* Expects the `RecyclerView.Adapter` to listen for [ ] callbacks and the `RecyclerView.ViewHolder` to implement
* [ItemTouchHelperViewHolder].
*
*/
class SimpleItemTouchHelperCallback(private val mAdapter: ItemTouchHelperAdapter) : ItemTouchHelper.Callback() {
override fun isLongPressDragEnabled(): Boolean {
return true
}
override fun isItemViewSwipeEnabled(): Boolean {
return true
}
override fun getMovementFlags(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder): Int { // Set movement flags based on the layout manager
return if (recyclerView.layoutManager is GridLayoutManager) {
val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN or ItemTouchHelper.LEFT or ItemTouchHelper.RIGHT
val swipeFlags = 0
makeMovementFlags(dragFlags, swipeFlags)
} else {
val dragFlags = ItemTouchHelper.UP or ItemTouchHelper.DOWN
val swipeFlags = ItemTouchHelper.START or ItemTouchHelper.END
makeMovementFlags(dragFlags, swipeFlags)
}
}
override fun onMove(recyclerView: RecyclerView, source: RecyclerView.ViewHolder, target: RecyclerView.ViewHolder): Boolean {
if (source.itemViewType != target.itemViewType) {
return false
}
// Notify the adapter of the move
mAdapter.onItemMove(source.adapterPosition, target.adapterPosition)
return true
}
override fun onSwiped(viewHolder: RecyclerView.ViewHolder, i: Int) { // Notify the adapter of the dismissal
mAdapter.onItemDismiss(viewHolder.adapterPosition)
}
override fun onChildDraw(c: Canvas, recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder, dX: Float, dY: Float, actionState: Int, isCurrentlyActive: Boolean) {
if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { // Fade out the view as it is swiped out of the parent's bounds
val alpha = ALPHA_FULL - abs(dX) / viewHolder.itemView.width.toFloat()
viewHolder.itemView.alpha = alpha
viewHolder.itemView.translationX = dX
} else {
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive)
}
}
override fun onSelectedChanged(viewHolder: RecyclerView.ViewHolder?, actionState: Int) { // We only want the active item to change
if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) {
if (viewHolder is ItemTouchHelperViewHolder) { // Let the view holder know that this item is being moved or dragged
val itemViewHolder: ItemTouchHelperViewHolder = viewHolder
itemViewHolder.onItemSelected()
}
}
super.onSelectedChanged(viewHolder, actionState)
}
override fun clearView(recyclerView: RecyclerView, viewHolder: RecyclerView.ViewHolder) {
super.clearView(recyclerView, viewHolder)
viewHolder.itemView.alpha = ALPHA_FULL
if (viewHolder is ItemTouchHelperViewHolder) { // Tell the view holder it's time to restore the idle state
val itemViewHolder: ItemTouchHelperViewHolder = viewHolder
itemViewHolder.onItemClear()
}
}
companion object {
const val ALPHA_FULL = 1.0f
}
}

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.general.automation.triggers;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import com.google.common.base.Optional;
@ -84,11 +84,11 @@ public abstract class Trigger {
}
@Nullable
Activity scanForActivity(Context cont) {
AppCompatActivity scanForActivity(Context cont) {
if (cont == null)
return null;
else if (cont instanceof Activity)
return (Activity) cont;
else if (cont instanceof AppCompatActivity)
return (AppCompatActivity) cont;
else if (cont instanceof ContextWrapper)
return scanForActivity(((ContextWrapper) cont).getBaseContext());

View file

@ -1,6 +1,5 @@
package info.nightscout.androidaps.plugins.general.automation.triggers;
import android.app.Activity;
import android.graphics.Typeface;
import android.text.format.DateFormat;
import android.view.ViewGroup;
@ -9,6 +8,7 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import com.dpro.widgets.WeekdaysPicker;
@ -269,6 +269,8 @@ public class TriggerRecurringTime extends Trigger {
weekdaysPicker.setSelectedDays(getSelectedDays());
weekdaysPicker.setOnWeekdaysChangeListener((view, i, list) -> set(DayOfWeek.fromCalendarInt(i), list.contains(i)));
weekdaysPicker.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
weekdaysPicker.setSundayFirstDay(Calendar.getInstance().getFirstDayOfWeek() == Calendar.SUNDAY);
weekdaysPicker.redrawDays();
root.addView(weekdaysPicker);
@ -294,9 +296,9 @@ public class TriggerRecurringTime extends Trigger {
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
Activity a = scanForActivity(root.getContext());
AppCompatActivity a = scanForActivity(root.getContext());
if (a != null)
tpd.show(a.getFragmentManager(), "TimePickerDialog");
tpd.show(a.getSupportFragmentManager(), "TimePickerDialog");
});
int px = MainApp.dpToPx(10);

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.general.automation.triggers;
import android.app.Activity;
import android.graphics.Typeface;
import android.text.format.DateFormat;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import com.google.common.base.Optional;
@ -142,9 +142,9 @@ public class TriggerTime extends Trigger {
);
dpd.setThemeDark(true);
dpd.dismissOnPause(true);
Activity a = scanForActivity(root.getContext());
AppCompatActivity a = scanForActivity(root.getContext());
if (a != null)
dpd.show(a.getFragmentManager(), "DatePickerDialog");
dpd.show(a.getSupportFragmentManager(), "DatePickerDialog");
});
timeButton.setOnClickListener(view -> {
GregorianCalendar calendar = new GregorianCalendar();
@ -162,9 +162,9 @@ public class TriggerTime extends Trigger {
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
Activity a = scanForActivity(root.getContext());
AppCompatActivity a = scanForActivity(root.getContext());
if (a != null)
tpd.show(a.getFragmentManager(), "TimePickerDialog");
tpd.show(a.getSupportFragmentManager(), "TimePickerDialog");
});
int px = MainApp.dpToPx(10);

View file

@ -1,12 +1,12 @@
package info.nightscout.androidaps.plugins.general.automation.triggers;
import android.app.Activity;
import android.graphics.Typeface;
import android.text.format.DateFormat;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import com.google.common.base.Optional;
@ -18,7 +18,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import info.nightscout.androidaps.MainApp;
@ -60,11 +59,11 @@ public class TriggerTimeRange extends Trigger {
return false;
boolean doRun = false;
if ( start < end && start < currentMinSinceMidnight && currentMinSinceMidnight < end)
if (start < end && start < currentMinSinceMidnight && currentMinSinceMidnight < end)
doRun = true;
// handle cases like 10PM to 6AM
else if ( start > end && (start < currentMinSinceMidnight || currentMinSinceMidnight < end))
else if (start > end && (start < currentMinSinceMidnight || currentMinSinceMidnight < end))
doRun = true;
if (doRun) {
@ -129,8 +128,8 @@ public class TriggerTimeRange extends Trigger {
}
TriggerTimeRange period(int start, int end) {
this.start = getMinSinceMidnight(start*60000);
this.end = getMinSinceMidnight(end*60000);
this.start = getMinSinceMidnight(start * 60000);
this.end = getMinSinceMidnight(end * 60000);
return this;
}
@ -145,7 +144,7 @@ public class TriggerTimeRange extends Trigger {
}
long toMilis(long minutesSinceMidnight) {
return minutesSinceMidnight*60*1000;
return minutesSinceMidnight * 60 * 1000;
}
public int getMinSinceMidnight(long time) {
@ -157,11 +156,11 @@ public class TriggerTimeRange extends Trigger {
return (calendar.get(Calendar.HOUR_OF_DAY) * 60) + calendar.get(Calendar.MINUTE);
}
int getStart(){
int getStart() {
return start;
}
int getEnd(){
int getEnd() {
return end;
}
@ -170,8 +169,8 @@ public class TriggerTimeRange extends Trigger {
TextView label = new TextView(root.getContext());
TextView startButton = new TextView(root.getContext());
TextView endButton = new TextView(root.getContext());
log.debug("Start is: " + start );
log.debug("End is: " + end );
log.debug("Start is: " + start);
log.debug("End is: " + end);
startButton.setText(DateUtil.timeString(toMilis(start) - timeZoneOffset));
endButton.setText(MainApp.gs(R.string.and) + " " + DateUtil.timeString(toMilis(end) - timeZoneOffset));
@ -193,9 +192,9 @@ public class TriggerTimeRange extends Trigger {
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
Activity a = scanForActivity(root.getContext());
AppCompatActivity a = scanForActivity(root.getContext());
if (a != null)
tpd.show(a.getFragmentManager(), "TimePickerDialog");
tpd.show(a.getSupportFragmentManager(), "TimePickerDialog");
});
endButton.setOnClickListener(view -> {
GregorianCalendar calendar = new GregorianCalendar();
@ -213,9 +212,9 @@ public class TriggerTimeRange extends Trigger {
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
Activity a = scanForActivity(root.getContext());
AppCompatActivity a = scanForActivity(root.getContext());
if (a != null)
tpd.show(a.getFragmentManager(), "TimePickerDialog");
tpd.show(a.getSupportFragmentManager(), "TimePickerDialog");
});
int px = MainApp.dpToPx(10);

View file

@ -1,10 +1,8 @@
package info.nightscout.androidaps.plugins.general.careportal.Dialogs;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import androidx.fragment.app.DialogFragment;
import androidx.appcompat.app.AlertDialog;
import android.text.Editable;
import android.text.TextWatcher;
import android.text.format.DateFormat;
@ -20,9 +18,12 @@ import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatDialogFragment;
import androidx.fragment.app.DialogFragment;
import com.google.common.collect.Lists;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
import org.json.JSONException;
@ -39,7 +40,6 @@ import java.util.List;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.db.BgReading;
@ -51,6 +51,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.DefaultValueHelper;
@ -61,11 +62,9 @@ import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.SafeParse;
import info.nightscout.androidaps.utils.Translator;
public class NewNSTreatmentDialog extends DialogFragment implements View.OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
public class NewNSTreatmentDialog extends AppCompatDialogFragment implements View.OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
private static Logger log = LoggerFactory.getLogger(NewNSTreatmentDialog.class);
private Activity context;
private static OptionsToShow options;
private static String event;
@ -119,18 +118,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
}
}
@Override
public void onAttach(Activity activity) {
context = activity;
super.onAttach(activity);
}
@Override
public void onDetach() {
super.onDetach();
this.context = null;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -421,18 +408,18 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
);
dpd.setThemeDark(true);
dpd.dismissOnPause(true);
dpd.show(context.getFragmentManager(), "Datepickerdialog");
dpd.show(getActivity().getSupportFragmentManager(), "Datepickerdialog");
break;
case R.id.careportal_newnstreatment_eventtime:
TimePickerDialog tpd = TimePickerDialog.newInstance(
this,
calendar.get(Calendar.HOUR_OF_DAY),
calendar.get(Calendar.MINUTE),
DateFormat.is24HourFormat(context)
DateFormat.is24HourFormat(getContext())
);
tpd.setThemeDark(true);
tpd.dismissOnPause(true);
tpd.show(context.getFragmentManager(), "Timepickerdialog");
tpd.show(getActivity().getSupportFragmentManager(), "Timepickerdialog");
break;
case R.id.ok:
confirmNSTreatmentCreation();
@ -469,7 +456,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
}
@Override
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {
public void onTimeSet(TimePickerDialog view, int hourOfDay, int minute, int second) {
eventTime.setHours(hourOfDay);
eventTime.setMinutes(minute);
eventTime.setSeconds(this.seconds++); // randomize seconds to prevent creating record of the same time, if user choose time manually
@ -477,7 +464,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
updateBGforDateTime();
}
JSONObject gatherData() {
String enteredBy = SP.getString("careportal_enteredby", "");
JSONObject data = new JSONObject();
@ -702,6 +688,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
}
void confirmNSTreatmentCreation() {
Context context = getContext();
if (context != null) {
final JSONObject data = gatherData();
final String confirmText = buildConfirmText(data);
@ -715,7 +702,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
}
public void createNSTreatment(JSONObject data) {
void createNSTreatment(JSONObject data) {
if (options.executeProfileSwitch) {
if (data.has("profile")) {
ProfileFunctions.doProfileSwitch(profileStore, JsonHelper.safeGetString(data, "profile"), JsonHelper.safeGetInt(data, "duration"), JsonHelper.safeGetInt(data, "percentage"), JsonHelper.safeGetInt(data, "timeshift"));

View file

@ -30,6 +30,7 @@ import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.bus.RxBus;
import info.nightscout.androidaps.utils.OKDialog;
import info.nightscout.androidaps.utils.SP;
import info.nightscout.androidaps.utils.ToastUtils;
/**
@ -113,27 +114,24 @@ public class ImportExportPrefs {
.setMessage(MainApp.gs(R.string.import_from) + " " + file + " ?")
.setPositiveButton(android.R.string.yes, (dialog, which) -> {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
SharedPreferences.Editor editor = prefs.edit();
String line;
String[] lineParts;
try {
editor.clear();
editor.commit();
SP.clear();
BufferedReader reader = new BufferedReader(new FileReader(file));
while ((line = reader.readLine()) != null) {
lineParts = line.split("::");
if (lineParts.length == 2) {
if (lineParts[1].equals("true") || lineParts[1].equals("false")) {
editor.putBoolean(lineParts[0], Boolean.parseBoolean(lineParts[1]));
SP.putBoolean(lineParts[0], Boolean.parseBoolean(lineParts[1]));
} else {
editor.putString(lineParts[0], lineParts[1]);
SP.putString(lineParts[0], lineParts[1]);
}
}
}
reader.close();
editor.commit();
SP.putBoolean(R.string.key_setupwizard_processed, true);
OKDialog.show(context, MainApp.gs(R.string.setting_imported), MainApp.gs(R.string.restartingapp), () -> {
log.debug("Exiting");
MainApp.instance().stopKeepAliveService();

View file

@ -6,11 +6,11 @@ import android.widget.CheckBox
import android.widget.LinearLayout
import android.widget.TextView
import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.NoSplashActivity
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.logging.L
import kotlinx.android.synthetic.main.activity_logsetting.*
class LogSettingActivity : NoSplashActivity() {
class LogSettingActivity : NoSplashAppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View file

@ -19,7 +19,7 @@ class InfoInterceptor(tag: String) : Interceptor {
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()
request?.body()?.let {
request.body?.let {
if (L.isEnabled(L.TIDEPOOL)) {
log.debug("Interceptor Body size: " + it.contentLength())
val requestBuffer = Buffer()

View file

@ -14,9 +14,9 @@ import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.OKDialog
import info.nightscout.androidaps.utils.SP
import info.nightscout.androidaps.utils.T
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.OkHttpClient
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import okhttp3.logging.HttpLoggingInterceptor
import org.slf4j.LoggerFactory
import retrofit2.Retrofit
@ -43,7 +43,7 @@ object TidepoolUploader {
val PUMPTYPE = "Tandem"
var connectionStatus: ConnectionStatus = TidepoolUploader.ConnectionStatus.DISCONNECTED
var connectionStatus: ConnectionStatus = ConnectionStatus.DISCONNECTED
fun getRetrofitInstance(): Retrofit? {
if (retrofit == null) {
@ -75,7 +75,7 @@ object TidepoolUploader {
retrofit = null
if (L.isEnabled(L.TIDEPOOL))
log.debug("Instance reset")
connectionStatus = TidepoolUploader.ConnectionStatus.DISCONNECTED
connectionStatus = ConnectionStatus.DISCONNECTED
}
@Synchronized
@ -197,7 +197,7 @@ object TidepoolUploader {
}
else -> {
val body = RequestBody.create(MediaType.parse("application/json"), chunk)
val body = chunk.toRequestBody("application/json".toMediaTypeOrNull())
RxBus.send(EventTidepoolStatus(("Uploading")))
if (session.service != null && session.token != null && session.datasetReply != null) {
@ -231,11 +231,11 @@ object TidepoolUploader {
extendWakeLock(60000)
val call = session!!.service?.deleteDataSet(session!!.token!!, session!!.datasetReply!!.id!!)
call?.enqueue(TidepoolCallback(session!!, "Delete Dataset", {
connectionStatus = TidepoolUploader.ConnectionStatus.DISCONNECTED
connectionStatus = ConnectionStatus.DISCONNECTED
RxBus.send(EventTidepoolStatus(("Dataset removed OK")))
releaseWakeLock()
}, {
connectionStatus = TidepoolUploader.ConnectionStatus.DISCONNECTED
connectionStatus = ConnectionStatus.DISCONNECTED
RxBus.send(EventTidepoolStatus(("Dataset remove FAILED")))
releaseWakeLock()
}))
@ -255,11 +255,11 @@ object TidepoolUploader {
extendWakeLock(60000)
val call = session.service?.deleteAllData(token, userid)
call?.enqueue(TidepoolCallback(session, "Delete all data", {
connectionStatus = TidepoolUploader.ConnectionStatus.DISCONNECTED
connectionStatus = ConnectionStatus.DISCONNECTED
RxBus.send(EventTidepoolStatus(("All data removed OK")))
releaseWakeLock()
}, {
connectionStatus = TidepoolUploader.ConnectionStatus.DISCONNECTED
connectionStatus = ConnectionStatus.DISCONNECTED
RxBus.send(EventTidepoolStatus(("All data remove FAILED")))
releaseWakeLock()
}))

View file

@ -3,9 +3,9 @@ package info.nightscout.androidaps.plugins.general.tidepool.events
import info.nightscout.androidaps.events.Event
import info.nightscout.androidaps.logging.L
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.LocaleHelper
import org.slf4j.LoggerFactory
import java.text.SimpleDateFormat
import java.util.*
class EventTidepoolStatus(val status: String) : Event() {
private val log = LoggerFactory.getLogger(L.TIDEPOOL)
@ -17,7 +17,7 @@ class EventTidepoolStatus(val status: String) : Event() {
log.debug("New status: $status")
}
private var timeFormat = SimpleDateFormat("HH:mm:ss", LocaleHelper.currentLocale())
private var timeFormat = SimpleDateFormat("HH:mm:ss", Locale.getDefault())
fun toPreparedHtml(): StringBuilder {
val stringBuilder = StringBuilder()

View file

@ -1,8 +1,9 @@
package info.nightscout.androidaps.plugins.general.tidepool.messages
import info.nightscout.androidaps.plugins.general.tidepool.utils.GsonInstance
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
open class BaseMessage {
private fun toS(): String {
@ -10,7 +11,7 @@ open class BaseMessage {
}
fun getBody(): RequestBody {
return RequestBody.create(MediaType.parse("application/json"), this.toS())
return this.toS().toRequestBody("application/json".toMediaTypeOrNull())
}
}

View file

@ -24,7 +24,7 @@ import java.util.List;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.NoSplashActivity;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.DanaRHistoryRecord;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
@ -44,7 +44,7 @@ import info.nightscout.androidaps.utils.FabricPrivacy;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.CompositeDisposable;
public class DanaRHistoryActivity extends NoSplashActivity {
public class DanaRHistoryActivity extends NoSplashAppCompatActivity {
private static Logger log = LoggerFactory.getLogger(L.PUMP);
private CompositeDisposable disposable = new CompositeDisposable();

View file

@ -12,9 +12,8 @@ import org.slf4j.LoggerFactory;
import java.text.DecimalFormat;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.NoSplashActivity;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.logging.L;
@ -33,7 +32,7 @@ import io.reactivex.disposables.CompositeDisposable;
* Created by Rumen Georgiev on 5/31/2018.
*/
public class DanaRUserOptionsActivity extends NoSplashActivity {
public class DanaRUserOptionsActivity extends NoSplashAppCompatActivity {
private static Logger log = LoggerFactory.getLogger(L.PUMP);
private CompositeDisposable disposable = new CompositeDisposable();

View file

@ -20,13 +20,13 @@ import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.activities.NoSplashActivity;
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntry;
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump.PumpHistoryEntryGroup;
public class MedtronicHistoryActivity extends NoSplashActivity {
public class MedtronicHistoryActivity extends NoSplashAppCompatActivity {
private static Logger LOG = LoggerFactory.getLogger(L.PUMP);

View file

@ -48,7 +48,7 @@ class TreatmentsProfileSwitchFragment : Fragment() {
val builder = AlertDialog.Builder(this.context!!)
builder.setTitle(MainApp.gs(R.string.confirmation))
builder.setMessage(MainApp.gs(R.string.refresheventsfromnightscout) + "?")
builder.setPositiveButton(MainApp.gs(R.string.ok)) { dialog: DialogInterface?, id: Int ->
builder.setPositiveButton(MainApp.gs(R.string.ok)) { _ , _->
MainApp.getDbHelper().resetProfileSwitch()
RxBus.send(EventNSClientRestart())
}

View file

@ -72,18 +72,6 @@ public class SetupWizardActivity extends NoSplashAppCompatActivity {
}
}
@Override
public void onBackPressed() {
if (currentWizardPage == 0)
OKDialog.showConfirmation(this, MainApp.gs(R.string.exitwizard), this::finish);
else showPreviousPage(null);
}
public void exitPressed(View view) {
SP.putBoolean(R.string.key_setupwizard_processed, true);
OKDialog.showConfirmation(this, MainApp.gs(R.string.exitwizard), this::finish);
}
@Override
public void onPause() {
super.onPause();
@ -157,6 +145,18 @@ public class SetupWizardActivity extends NoSplashAppCompatActivity {
});
}
@Override
public void onBackPressed() {
if (currentWizardPage == 0)
OKDialog.showConfirmation(this, MainApp.gs(R.string.exitwizard), this::finish);
else showPreviousPage(null);
}
public void exitPressed(View view) {
SP.putBoolean(R.string.key_setupwizard_processed, true);
OKDialog.showConfirmation(this, MainApp.gs(R.string.exitwizard), this::finish);
}
public void showNextPage(View view) {
this.finish();
Intent intent = new Intent(this, SetupWizardActivity.class);

View file

@ -3,6 +3,8 @@ package info.nightscout.androidaps.setupwizard.elements;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.StringRes;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -67,12 +69,12 @@ public class SWItem {
return type;
}
public SWItem label(int label) {
public SWItem label(@StringRes int label) {
this.label = label;
return this;
}
public SWItem comment(int comment) {
public SWItem comment(@StringRes int comment) {
this.comment = comment;
return this;
}

View file

@ -1,21 +1,19 @@
package info.nightscout.androidaps.utils
import android.content.Context
import android.content.ContextWrapper
import android.os.Build
import android.os.LocaleList
import info.nightscout.androidaps.R
import java.util.*
object LocaleHelper {
fun update(context: Context) =
updateResources(context, currentLanguage())
object LocaleHelper {
fun currentLanguage(): String =
SP.getString(R.string.key_language, Locale.getDefault().language)
fun currentLocale(): Locale =
Locale(SP.getString(R.string.key_language, Locale.getDefault().language))
@Suppress("DEPRECATION")
private fun updateResources(context: Context, language: String) {
private fun currentLocale(): Locale {
val language = currentLanguage()
var locale = Locale(language)
if (language.contains("_")) {
// language with country like pt_BR defined in arrays.xml
@ -23,10 +21,35 @@ object LocaleHelper {
val country = language.substring(3, 5)
locale = Locale(lang, country)
}
return locale
}
@Suppress("DEPRECATION")
fun update(context: Context) {
val locale = currentLocale()
Locale.setDefault(locale)
val resources = context.resources
resources.configuration.setLocale(locale)
resources.updateConfiguration(resources.configuration, resources.displayMetrics)
val configuration = resources.configuration
context.createConfigurationContext(configuration)
configuration.setLocale(locale)
configuration.locale = locale
resources.updateConfiguration(configuration, resources.displayMetrics)
}
fun wrap(ctx: Context): ContextWrapper {
val res = ctx.resources
val configuration = res.configuration
val newLocale = currentLocale()
val context = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
configuration.setLocale(newLocale)
val localeList = LocaleList(newLocale)
LocaleList.setDefault(localeList)
configuration.locales = localeList
ctx.createConfigurationContext(configuration)
} else {
configuration.setLocale(newLocale)
ctx.createConfigurationContext(configuration)
}
return ContextWrapper(context)
}
}

View file

@ -10,7 +10,11 @@ import info.nightscout.androidaps.MainApp;
*/
public class SP {
static SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
private static SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
static public void clear() {
sharedPreferences.edit().clear().apply();
}
static public boolean contains(String key) {
return sharedPreferences.contains(key);
@ -85,75 +89,51 @@ public class SP {
}
static public void putBoolean(String key, boolean value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(key, value);
editor.apply();
sharedPreferences.edit().putBoolean(key, value).apply();
}
static public void putBoolean(int resourceID, boolean value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean(MainApp.gs(resourceID), value);
editor.apply();
sharedPreferences.edit().putBoolean(MainApp.gs(resourceID), value).apply();
}
static public void putDouble(String key, double value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(key, Double.toString(value));
editor.apply();
sharedPreferences.edit().putString(key, Double.toString(value)).apply();
}
static public void putLong(String key, long value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putLong(key, value);
editor.apply();
sharedPreferences.edit().putLong(key, value).apply();
}
static public void putLong(int resourceID, long value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putLong(MainApp.gs(resourceID), value);
editor.apply();
sharedPreferences.edit().putLong(MainApp.gs(resourceID), value).apply();
}
static public void putInt(String key, int value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(key, value);
editor.apply();
sharedPreferences.edit().putInt(key, value).apply();
}
static public void putInt(int resourceID, int value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putInt(MainApp.gs(resourceID), value);
editor.apply();
sharedPreferences.edit().putInt(MainApp.gs(resourceID), value).apply();
}
static public void incInt(int resourceID) {
SharedPreferences.Editor editor = sharedPreferences.edit();
int value = SP.getInt(resourceID, 0) + 1;
editor.putInt(MainApp.gs(resourceID), value);
editor.apply();
sharedPreferences.edit().putInt(MainApp.gs(resourceID), value).apply();
}
static public void putString(int resourceID, String value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(MainApp.gs(resourceID), value);
editor.apply();
sharedPreferences.edit().putString(MainApp.gs(resourceID), value).apply();
}
static public void putString(String key, String value) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString(key, value);
editor.apply();
sharedPreferences.edit().putString(key, value).apply();
}
static public void remove(int resourceID) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove(MainApp.gs(resourceID));
editor.apply();
sharedPreferences.edit().remove(MainApp.gs(resourceID)).apply();
}
static public void remove(String key) {
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.remove(key);
editor.apply();
sharedPreferences.edit().remove(key).apply();
}
}

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#C0C0C0"
android:viewportHeight="24.0" android:viewportWidth="24.0"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#FF000000" android:pathData="M3,15h18v-2L3,13v2zM3,19h18v-2L3,17v2zM3,11h18L21,9L3,9v2zM3,5v2h18L21,5L3,5z"/>
</vector>

View file

@ -142,7 +142,7 @@
</LinearLayout>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -1,65 +0,0 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="info.nightscout.androidaps.activities.AgreementActivity">
<ScrollView
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:text="@string/end_user_license_agreement"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:text="@string/app_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="11sp" />
<TextView
android:text="@string/end_user_license_agreement_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="11sp" />
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/end_user_license_agreement_i_understand"
android:id="@+id/agreementCheckBox"
android:checked="false" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/save"
android:id="@+id/agreementSaveButton"
android:layout_marginTop="20dp" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</RelativeLayout>

View file

@ -29,6 +29,7 @@
android:layout_marginStart="10dp"
android:layout_weight="1"
android:text="@string/exit"
android:onClick="exitPressed"
android:textAppearance="@android:style/TextAppearance.Material.Medium"
android:textStyle="bold" />
</LinearLayout>

View file

@ -8,6 +8,8 @@
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="8dp"
android:clickable="true"
android:focusable="true"
android:background="@color/ribbonDefault"
android:padding="8dp">
@ -26,21 +28,21 @@
android:layout_alignBottom="@+id/automation_enabled"
android:layout_centerVertical="true"
android:layout_marginTop="6dp"
android:layout_toStartOf="@+id/iconTrash"
android:layout_toStartOf="@+id/iconSort"
android:layout_toEndOf="@id/automation_enabled"
android:text="Title"
android:textAlignment="viewStart"
android:textStyle="bold" />
<ImageView
android:id="@+id/iconTrash"
android:id="@+id/iconSort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:contentDescription="@string/remove_label"
android:contentDescription="@string/reorder_label"
android:orientation="horizontal"
android:src="@drawable/ic_trash_outline" />
android:src="@drawable/ic_reorder_gray_24dp" />
<LinearLayout
android:id="@+id/iconLayout"

View file

@ -567,7 +567,7 @@
</LinearLayout>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -47,7 +47,7 @@
android:layout_marginRight="30dp" />
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -150,7 +150,7 @@
android:layout_height="wrap_content"
android:entries="@array/quickWizardYesNo"/>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -214,7 +214,7 @@
</LinearLayout>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -82,6 +82,6 @@
</LinearLayout>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -179,7 +179,7 @@
</LinearLayout>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -139,7 +139,7 @@
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp" />
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -65,7 +65,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginBottom="15dp" />
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/okcancel" />
</LinearLayout>

View file

@ -10,8 +10,7 @@
android:layout_height="match_parent"
android:orientation="vertical">
<com.google.android.flexbox.FlexboxLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<com.google.android.flexbox.FlexboxLayout xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/defaultbackground"
@ -19,7 +18,7 @@
app:alignItems="stretch"
app:flexDirection="row"
app:flexWrap="wrap"
app:justifyContent="space_between">
app:justifyContent="center">
<TextView
android:id="@+id/treatments_treatments"

View file

@ -358,10 +358,8 @@
<string name="button1">Knoppie 1</string>
<string name="button2">Knoppie 2</string>
<string name="button3">Knoppie 3</string>
<string name="units">Eenhede:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">Doelwit reeks:</string>
<string name="prefs_range_title">Reeks vir visualisering</string>
<string name="prefs_range_summary">Hoë en lae merke vir die diagramme in Overview en Smartwatch</string>

View file

@ -376,10 +376,11 @@
<string name="button1">Бутон 1</string>
<string name="button2">Бутон 2</string>
<string name="button3">Бутон 3</string>
<string name="units">Единици:</string>
<string name="units_colon">Единици:</string>
<string name="units">Единици</string>
<string name="mgdl">мг/дл</string>
<string name="mmol">ммол/л</string>
<string name="dia">DIA:</string>
<string name="dia">DIA</string>
<string name="target_range">Целева КЗ:</string>
<string name="prefs_range_title">Диапазон за визуализация</string>
<string name="prefs_range_summary">Стойност на линиите за ниска и висока КЗ (mmol/l) за телефона и часовника</string>
@ -1391,7 +1392,29 @@
<string name="format_percent">%1$d %%</string>
<string name="boluswizard">Болус калкулатор</string>
<string name="unit_minute_short">мин</string>
<string name="profile_name">Име на профила:</string>
<string name="selected_profile">Избрано:</string>
<string name="unitsnosemicolon">Единици</string>
<string name="doyouwantswitchprofile">Искате да смените профила и премахнете на промените, направени в текущия профил?</string>
<string name="format_carbs">%1$dг</string>
<string name="common_on">Вкл</string>
<string name="common_off">Изкл</string>
<string name="objectives_button_unfinish">Изчисти приключение</string>
<string name="objectives_button_unstart">Изчисти стартираните</string>
<string name="timedetection">Засичане на времето</string>
<string name="doyouwantresetstart">Искате ли да нулирате прогреса си?</string>
<string name="nopumpselected">Не е избрана помпа</string>
<string name="setupwizard_units_prompt">Изберете единиците, в които искате да работите</string>
<string name="ns_ploadlocalprofile">Качване на локални промени в НС профила</string>
<string name="dia_short">DIA</string>
<string name="ic_short">IC (Инсулин/въглехидр.):</string>
<string name="isf_short">ISF (Инс.чувствителност)</string>
<string name="target_short">Цел</string>
<string name="clone_label">Клонирай</string>
<string name="saveorresetchangesfirst">Първо запазете или се откажете от промените</string>
<string name="deletecurrentprofile">Изтриване на текущия профил?</string>
<string name="copytolocalprofile">Създаване на нов локален профил от това превключване?</string>
<string name="profilenamecontainsdot">Името на профила съдържа точка.\nТова не се поддържа от НС.\nПрофилът не е качен в НС.</string>
<string name="low_mark_comment">Ниската граница на диапазона (графика)</string>
<string name="high_mark_comment">Високата граница на диапазона (графика)</string>
</resources>

View file

@ -376,10 +376,11 @@
<string name="button1">Tlačítko 1</string>
<string name="button2">Tlačítko 2</string>
<string name="button3">Tlačítko 3</string>
<string name="units">Jednotky:</string>
<string name="units_colon">Jednotky:</string>
<string name="units">Jednotky</string>
<string name="mgdl">mg/dL</string>
<string name="mmol">mmol/L</string>
<string name="dia">DIA:</string>
<string name="dia">DIA</string>
<string name="target_range">Cílový rozsah:</string>
<string name="prefs_range_title">Rozsah pro zobrazení</string>
<string name="prefs_range_summary">Značka vysoké a nízké hodnoty v přehledu a na hodinkách Wear</string>
@ -1391,6 +1392,10 @@
<string name="format_percent">%1$d%%</string>
<string name="boluswizard">Bolusová kalkulačka</string>
<string name="unit_minute_short">min</string>
<string name="profile_name">Jméno profilu:</string>
<string name="selected_profile">Vybráno:</string>
<string name="unitsnosemicolon">Jednotky</string>
<string name="doyouwantswitchprofile">Chcete přepnout profil a zahodit změny provedené v aktuálním profilu?</string>
<string name="format_carbs">%1$dg</string>
<string name="common_on">ZAP</string>
<string name="common_off">VYP</string>
@ -1398,4 +1403,18 @@
<string name="objectives_button_unstart">Vymazat start</string>
<string name="timedetection">Detekce času</string>
<string name="doyouwantresetstart">Chcete resetovat začátek cíle? Můžete přijít o svůj pokrok.</string>
<string name="nopumpselected">Nevybrána žádná pumpa</string>
<string name="setupwizard_units_prompt">Vyberte jednotky, ve kterých chcete zobrazit hodnoty</string>
<string name="ns_ploadlocalprofile">Odeslat změny lokálního profilu do NS</string>
<string name="dia_short">DIA</string>
<string name="ic_short">I:C</string>
<string name="isf_short">ISF</string>
<string name="target_short">CÍL</string>
<string name="clone_label">Klonovat</string>
<string name="saveorresetchangesfirst">Nejprve uložte nebo resetujte aktuální změny</string>
<string name="deletecurrentprofile">Odstranit aktuální profil?</string>
<string name="copytolocalprofile">Chcete vytvořit nový lokální profil z tohoto přepnutí profilu?</string>
<string name="profilenamecontainsdot">Název profilu obsahuje tečky.\nToto není v NS podporováno.\nProfil není přenesen do NS.</string>
<string name="low_mark_comment">Spodní hodnota oblasti v rozsahu (pouze zobrazování)</string>
<string name="high_mark_comment">Horní hodnota oblasti v rozsahu (pouze zobrazování)</string>
</resources>

View file

@ -376,10 +376,11 @@
<string name="button1">Schaltfläche 1</string>
<string name="button2">Schaltfläche 2</string>
<string name="button3">Schaltfläche 3</string>
<string name="units">Einheiten:</string>
<string name="units_colon">Einheiten:</string>
<string name="units">Einheiten</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="dia">DIA</string>
<string name="target_range">Zielbereich:</string>
<string name="prefs_range_title">Zielbereich für die Grafikanzeige</string>
<string name="prefs_range_summary">Hoch- und Niedrig-Werte für die Übersicht- und die Smartwatch-Anzeige</string>
@ -1392,6 +1393,10 @@ Unerwartetes Verhalten.</string>
<string name="format_percent">%1$d%%</string>
<string name="boluswizard">Bolus-Rechner</string>
<string name="unit_minute_short">Min.</string>
<string name="profile_name">Profilname:</string>
<string name="selected_profile">Ausgewählt:</string>
<string name="unitsnosemicolon">Einheiten</string>
<string name="doyouwantswitchprofile">Willst Du das Profil wechseln und die Änderungen am aktuellen Profil verwerfen?</string>
<string name="format_carbs">%1$dg</string>
<string name="common_on">Ein</string>
<string name="common_off">Aus</string>
@ -1399,4 +1404,18 @@ Unerwartetes Verhalten.</string>
<string name="objectives_button_unstart">Löschen gestartet</string>
<string name="timedetection">Zeiterkennung</string>
<string name="doyouwantresetstart">Möchtest Du den Start der Ziele zurücksetzen? Du verlierst Deine Fortschritte.</string>
<string name="nopumpselected">Keine Pumpe ausgewählt</string>
<string name="setupwizard_units_prompt">Wähle die Einheit, in der die Werte angezeigt werden sollen.</string>
<string name="ns_ploadlocalprofile">Lade die Änderungen des lokalen Profils zu NS hoch.</string>
<string name="dia_short">DIA</string>
<string name="ic_short">IC</string>
<string name="isf_short">ISF</string>
<string name="target_short">ZIEL</string>
<string name="clone_label">Duplizieren</string>
<string name="saveorresetchangesfirst">Speichere oder verwerfe die aktuellen Änderungen zuerst</string>
<string name="deletecurrentprofile">Aktuelles Profil löschen?</string>
<string name="copytolocalprofile">Neues lokales Profil auf Basis dieses Profilwechsels erstellen?</string>
<string name="profilenamecontainsdot">Profilname enthält Punkte.\nDies wird von NS nicht unterstützt.\nProfil wird nicht zu NS hochgeladen.</string>
<string name="low_mark_comment">Unterer Wert des Zielbereichs (nur Anzeige)</string>
<string name="high_mark_comment">Oberer Wert des Zielbereichs (nur Anzeige)</string>
</resources>

View file

@ -361,10 +361,8 @@
<string name="button1">Πλήκτρο 1</string>
<string name="button2">Πλήκτρο 2</string>
<string name="button3">Πλήκτρο 3</string>
<string name="units">Μονάδες:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">Εύρος στόχου:</string>
<string name="prefs_range_title">Εύρος εμφάνισης</string>
<string name="prefs_range_summary">Υψηλό και Χαμηλό σημείο για την γραφική στην Επισκόπηση και Smartwatch</string>

View file

@ -36,6 +36,7 @@
<string name="objectives_useloop">Mostrar contenido del plugin Loop</string>
<string name="objectives_usescale">Usar función de escala mediante un gráfico BG pulsado largo</string>
<string name="objectives_button_enter">Intro</string>
<string name="enter_code_obtained_from_developers_to_bypass_the_rest_of_objectives">Si fuiste usuario de OpenAPS y tu NS tiene al menos 3 meses de datos de lazo cerrado, puedes enviar un correo electrónico a objectives@androidaps.org con tu dirección web de NS y solicitar código para saltarse el resto de objetivos. Ingresa posteriormente el código obtenido de los desarrolladores</string>
<string name="codeaccepted">Código aceptado</string>
<string name="codeinvalid">Código no válido</string>
<string name="objectives_exam_objective">Compruebe su conocimiento</string>

View file

@ -260,11 +260,23 @@
<string name="smscommunicator_allowednumbers">Números de teléfono permitidos</string>
<string name="smscommunicator_allowednumbers_summary">XXXXXXXXXX +; + YYYYYYYYYY</string>
<string name="smscommunicator_bolusreplywithcode">Para entregar bolo %1$.2fU responder con código %2$s</string>
<string name="smscommunicator_mealbolusreplywithcode">Para entregar bolo %1$.2fU responder con código %2$s</string>
<string name="smscommunicator_temptargetwithcode">Para establecer un basal temporal %1$s responder con el código %2$s</string>
<string name="smscommunicator_temptargetcancel">Para cancelar la basal temporal, responder con el código %1$s</string>
<string name="smscommunicator_stopsmswithcode">Para inhabilitar la respuesta de servicio remoto de SMS, responder con el código %1$s.\n\nTenga en cuenta que solamente será capaz de reactivarlo directamente desde el móvil con la AAPS maestro.</string>
<string name="smscommunicator_stoppedsms">Servicio remoto de SMS detenido. Para reactivarlo, utilice AAPS en el movil maestro.</string>
<string name="smscommunicator_calibrationreplywithcode">Para enviar calibración %1$.2f responder con código %2$s</string>
<string name="smscommunicator_bolusfailed">Bolo falló</string>
<string name="smscommunicator_remotebolusmindistance_summary">Número mínimo de minutos que deben transcursar entre un bolus remoto y el siguiente</string>
<string name="smscommunicator_remotebolusmindistance">Cuántos minutos deben transcurrir, al menos, entre un bolo y el siguiente</string>
<string name="smscommunicator_remotebolusmindistance_caveat">Por su seguridad, para editar esta preferencia es necesario añadir al menos 2 números de teléfono.</string>
<string name="bolusdelivered">El bolo %1$.2fU se ha infundido correctamente</string>
<string name="bolusrequested">Se van a infundir %1$.2fU</string>
<string name="smscommunicator_bolusdelivered">El bolo %1$.2fU se ha infundido correctamente</string>
<string name="smscommunicator_mealbolusdelivered">Bolo %1$.2fU entregado correctamente</string>
<string name="smscommunicator_mealbolusdelivered_tt">Objetivo %1$s para %2$d minutos</string>
<string name="smscommunicator_tt_set">Objetivo %1$s para %2$d minutos establecido correctamente</string>
<string name="smscommunicator_tt_canceled">Objetivo temporal cancelado con éxito</string>
<string name="bolusdelivering">Infundiendo %1$.2fU</string>
<string name="smscommunicator_remotecommandsallowed">Permitir comandos remotos vía SMS</string>
<string name="glucosetype_finger">Dedo</string>
@ -324,10 +336,13 @@
<string name="smscommunicator_basalreplywithcode">Para iniciar una basal de %1$.2f% durante %2$d min, responder con el código %3$s</string>
<string name="smscommunicator_profilereplywithcode">Para cambiar el perfil a %1$s %2$d%% responder con el código %3$s</string>
<string name="smscommunicator_extendedreplywithcode">Para iniciar un bolo extendido de %1$.2fU durante %2$d minutos, responder con el código %3$s</string>
<string name="smscommunicator_carbsreplywithcode">Para introducir %1$dg en %2$s responder con código %3$s</string>
<string name="smscommunicator_basalpctreplywithcode">Para iniciar una basal de %1$d%% durante %2$d min, responder con el código %3$s</string>
<string name="smscommunicator_suspendreplywithcode">Para cancelar lazo por %1$d minutos responde con código %2$s</string>
<string name="smscommunicator_tempbasalset">Basal temporal %1$.2fU/h para %2$d min iniciada correctamente</string>
<string name="smscommunicator_extendedset">Bolo ampliado de %1$.2fU durante %2$d min se inició correctamente</string>
<string name="smscommunicator_carbsset">Los carbohidratos %1$dg introducidos con éxito</string>
<string name="smscommunicator_carbsfailed">Error al introducir %1$dg de carbohidratos</string>
<string name="smscommunicator_tempbasalset_percent">Basal temporal de %1$d%% durante %2$d min iniciada correctamente</string>
<string name="smscommunicator_tempbasalfailed">Fallo inicio basal temporal</string>
<string name="smscommunicator_extendedfailed">Error al iniciar el bolo extendido</string>
@ -361,10 +376,8 @@
<string name="button1">Botón 1</string>
<string name="button2">Botón 2</string>
<string name="button3">Botón 3</string>
<string name="units">Unidades:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA (Duración Insulina Activa):</string>
<string name="target_range">Rango Objetivo:</string>
<string name="prefs_range_title">Rango de visualización</string>
<string name="prefs_range_summary">Marcas Alta y Baja para gráficos en pantalla Inicio y Smartwatch</string>
@ -680,6 +693,7 @@
<string name="shortgramm">g</string>
<string name="shortminute">m</string>
<string name="shorthour">h</string>
<string name="shortday">d</string>
<string name="none"><![CDATA[<ninguno>]]></string>
<string name="shortkilojoul">kJ</string>
<string name="shortenergy">En</string>
@ -708,6 +722,7 @@
<string name="bgsource_upload">Ajuste de subida de datos de glucosa</string>
<string name="wear_detailed_delta_title">Mostrar detalles delta</string>
<string name="wear_detailed_delta_summary">Mostrar delta con un decimal mas</string>
<string name="smbmaxminutes">Minutos máximos SMB</string>
<string name="smbmaxminutes_summary">Minutos máximos de basal para limitar SMB</string>
<string name="unsupportedfirmware">Firmware de la bomba no soportado</string>
<string name="dexcomg5_xdripupload_title">Mandar datos BG a xDrip+</string>
@ -1377,4 +1392,8 @@
<string name="format_carbs">%1$dg</string>
<string name="common_on">Activado</string>
<string name="common_off">Desactivado</string>
<string name="objectives_button_unfinish">Limpieza finalizada</string>
<string name="objectives_button_unstart">Limpieza iniciada</string>
<string name="timedetection">Detección de tiempo</string>
<string name="doyouwantresetstart">¿Desea reiniciar el objetivo? Puedes perder tu progreso.</string>
</resources>

View file

@ -205,7 +205,7 @@
<string name="careportal_newnstreatment_carbtime_label">Heure glucides</string>
<string name="careportal_newnstreatment_split_label">Diviser</string>
<string name="careportal_newnstreatment_duration_label">Durée</string>
<string name="careportal_newnstreatment_percent_label">Pour cent</string>
<string name="careportal_newnstreatment_percent_label">Pourcentage</string>
<string name="careportal_newnstreatment_absolute_label">Absolu</string>
<string name="careportal_newnstreatment_notes_label">Notes</string>
<string name="careportal_newnstreatment_eventtime_label">Heure de l\'événement</string>
@ -253,7 +253,7 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
<string name="enacted">Activé</string>
<string name="comment">Commentaire</string>
<string name="success">Succès</string>
<string name="percent">Pour cent</string>
<string name="percent">Pourcentage</string>
<string name="absolute">Absolu</string>
<string name="canceltemp">Annuler le basal temporaire</string>
<string name="smscommunicator">Communicateur SMS</string>
@ -377,10 +377,8 @@ L\'ENSEMBLE DES RISQUES LIÉS À LA QUALITÉ ET À LA PERFORMANCE DU PROGRAMME S
<string name="button1">Bouton 1</string>
<string name="button2">Bouton 2</string>
<string name="button3">Bouton 3</string>
<string name="units">Unités :</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DAI :</string>
<string name="target_range">Fourchette cible :</string>
<string name="prefs_range_title">Fourchette de visualisation</string>
<string name="prefs_range_summary">Les repères hauts et bas sur les graphiques pour l\'aperçu et la montre</string>

View file

@ -376,10 +376,11 @@
<string name="button1">Tasto 1</string>
<string name="button2">Tasto 2</string>
<string name="button3">Tasto 3</string>
<string name="units">Unità:</string>
<string name="units_colon">Unità:</string>
<string name="units">Unità</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="dia">DIA</string>
<string name="target_range">Intervallo target:</string>
<string name="prefs_range_title">Intervallo di visualizzazione</string>
<string name="prefs_range_summary">Limite alto e basso per i grafici nella sezione Panoramica e sullo Smartwatch</string>
@ -852,7 +853,7 @@
<string name="combo_activity_checking_pump_state">Aggiornamento stato micro</string>
<string name="combo_warning_pump_basal_rate_changed">La velocità basale nel micro è cambiata e verrà aggiornata a breve</string>
<string name="combo_error_failure_reading_changed_basal_rate">Velocità basale cambiata sul micro, ma la sua lettura è fallita</string>
<string name="combo_activity_checking_for_history_changes">Controllo delle modifiche allo storico</string>
<string name="combo_activity_checking_for_history_changes">Controllo modifiche allo storico</string>
<string name="combo_error_multiple_boluses_with_identical_timestamp">Sono appena stati importati più boli con la stessa quantità nello stesso minuto. Solo un record può essere aggiunto ai trattamenti. Controlla il micro e aggiungi manualmente un record di bolo utilizzando la sezione Portale. Assicurati di creare un bolo con un orario non utilizzato da nessun altro bolo.</string>
<string name="about_link_urls">\n\nhttp://www.androidaps.org\nhttp://www.androidaps.de (de)\n\nfacebook:\nhttp://facebook.androidaps.org\nhttp://facebook.androidaps.de (de)</string>
<string name="combo_check_date">L\'ultimo bolo è più vecchio di 24 ore o ha una data nel futuro. Controlla che la data sul micro sia impostata correttamente.</string>
@ -1391,6 +1392,10 @@
<string name="format_percent">%1$d%%</string>
<string name="boluswizard">Calcolatore</string>
<string name="unit_minute_short">min</string>
<string name="profile_name">Nome profilo:</string>
<string name="selected_profile">Selezionato:</string>
<string name="unitsnosemicolon">Unità</string>
<string name="doyouwantswitchprofile">Vuoi cambiare profilo e scartare le modifiche apportate al profilo corrente?</string>
<string name="format_carbs">%1$dg</string>
<string name="common_on">On</string>
<string name="common_off">Off</string>
@ -1398,4 +1403,18 @@
<string name="objectives_button_unstart">Cancella avviato</string>
<string name="timedetection">Rilevazione tempo</string>
<string name="doyouwantresetstart">Vuoi resettare l\'avvio dell\'obiettivo? Potresti perdere i tuoi progressi.</string>
<string name="nopumpselected">Nessun micro selezionato</string>
<string name="setupwizard_units_prompt">Seleziona le unità in cui vuoi visualizzare i valori</string>
<string name="ns_ploadlocalprofile">Carica modifiche al profilo locale in NS</string>
<string name="dia_short">DIA</string>
<string name="ic_short">IC</string>
<string name="isf_short">ISF</string>
<string name="target_short">TARG</string>
<string name="clone_label">Clona</string>
<string name="saveorresetchangesfirst">Salva o reimposta prima le modifiche correnti</string>
<string name="deletecurrentprofile">Rimuovere il profilo corrente?</string>
<string name="copytolocalprofile">Creare nuovo profilo locale da questo cambio profilo?</string>
<string name="profilenamecontainsdot">Il nome profilo contiene dei punti.\nQuesto non è supportato da NS.\nIl profilo non viene caricato in NS.</string>
<string name="low_mark_comment">Valore più basso per l\'intervallo di visualizzazione dell\'area \"in range\"</string>
<string name="high_mark_comment">Valore più alto per l\'intervallo di visualizzazione dell\'area \"in range\"</string>
</resources>

View file

@ -359,10 +359,8 @@
<string name="button1">버튼1</string>
<string name="button2">버튼2</string>
<string name="button3">버튼3</string>
<string name="units">유닛:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">목표 범위:</string>
<string name="prefs_range_title">차트 표시 범위</string>
<string name="prefs_range_summary">스마트워치 차트 고/저혈당 선</string>

View file

@ -361,10 +361,8 @@
<string name="button1">Mygtukas 1</string>
<string name="button2">Mygtukas 2</string>
<string name="button3">Mygtukas 3</string>
<string name="units">Vienetai:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">IVT:</string>
<string name="target_range">Tikslinis diapazonas:</string>
<string name="prefs_range_title">Vizualizacijos diapazonas</string>
<string name="prefs_range_summary">Aukštoji ir žemoji riba Apžvalgos grafikuose bei išmaniuosiuose laikrodžiuose</string>

View file

@ -376,10 +376,8 @@
<string name="button1">Knop 1</string>
<string name="button2">Knop 2</string>
<string name="button3">Knop 3</string>
<string name="units">Eenheden:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">Streefdoel:</string>
<string name="prefs_range_title">Bereik voor visualisatie</string>
<string name="prefs_range_summary">Hoge en lage grens voor grafieken op het Overzicht en op Wear</string>
@ -591,7 +589,7 @@
<string name="hours">uren</string>
<string name="overview_newtempbasal_basaltype_label">Basaal type</string>
<string name="invalidprofile">Ongeldig profiel !!!</string>
<string name="profileswitch">Wisselen van profiel</string>
<string name="profileswitch">Profiel Wissel</string>
<string name="careportal_pbage_label">Ouderdom batterij</string>
<string name="careportal_pumpbatterychange">Pomp bat. wissel</string>
<string name="ns_alarmoptions">Alarm opties</string>

View file

@ -361,10 +361,8 @@
<string name="button1">Przycisk 1</string>
<string name="button2">Przycisk 2</string>
<string name="button3">Przycisk 3</string>
<string name="units">Jednostki:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">Zakres docelowy:</string>
<string name="prefs_range_title">Zakres do wizualizacji (na wykresie)</string>
<string name="prefs_range_summary">Oznaczenia wysokiego i niskiego cukru na wykresie w oknie przegląd i na smartwatch\'u</string>
@ -1378,4 +1376,8 @@
<string name="format_carbs">%1$dg</string>
<string name="common_on">Włącz</string>
<string name="common_off">Wyłącz</string>
<string name="objectives_button_unfinish">Wyczyść skończone</string>
<string name="objectives_button_unstart">Wyczyść rozpoczęte</string>
<string name="timedetection">Wykrywanie czasu</string>
<string name="doyouwantresetstart">Czy chcesz zresetować czas rozpoczęcia zadania? Możesz utracić postępy.</string>
</resources>

View file

@ -361,10 +361,8 @@
<string name="button1">Botão 1</string>
<string name="button2">Botão 2</string>
<string name="button3">Botão 3</string>
<string name="units">Unidades:</string>
<string name="mgdl">mg/dL</string>
<string name="mmol">mmol/L</string>
<string name="dia">DIA:</string>
<string name="target_range">Intervalo Alvo:</string>
<string name="prefs_range_title">Intervalo para visualização</string>
<string name="prefs_range_summary">Marca alta e baixa para as cartas em Visão geral e Smartwatch</string>

View file

@ -210,7 +210,7 @@
<string name="careportal_newnstreatment_notes_label">Notas</string>
<string name="careportal_newnstreatment_eventtime_label">Tempo do evento</string>
<string name="careportal_newnstreatment_profile_label">Perfil</string>
<string name="careportal_newnstreatment_enteredby_title">Introduzido por</string>
<string name="careportal_newnstreatment_enteredby_title">Inserido por</string>
<string name="careportal_newnstreatment_glucosetype">Tipo de glicose</string>
<string name="noprofile">Sem perfil carregado do NS</string>
<string name="overview_tempbasal_button">BasalTemp</string>
@ -265,6 +265,9 @@
<string name="bolusdelivered">Bólus %1$.2fU enviado com êxito</string>
<string name="bolusrequested">Vai ser enviado %1$.2fU</string>
<string name="smscommunicator_bolusdelivered">Bólus %1$.2fU enviado com êxito</string>
<string name="smscommunicator_mealbolusdelivered_tt">Alvo %1$s para %2$d minutos</string>
<string name="smscommunicator_tt_set">Alvo %1$s para %2$d minutos definido com sucesso</string>
<string name="smscommunicator_tt_canceled">Alvo Temp cancelado com êxito</string>
<string name="bolusdelivering">A enviar %1$.2fU</string>
<string name="smscommunicator_remotecommandsallowed">Permitir comandos remotos via SMS</string>
<string name="glucosetype_finger">Dedo</string>
@ -324,10 +327,13 @@
<string name="smscommunicator_basalreplywithcode">Para começar a basal %1$.2fU/h durante%2$d min responda com o código %3$s</string>
<string name="smscommunicator_profilereplywithcode">Para mudar o perfil para %1$s %2$d%% responda com o código %3$s</string>
<string name="smscommunicator_extendedreplywithcode">Para começar o bólus estendido %1$.2fU/h para %2$d min responda com o código %3$s</string>
<string name="smscommunicator_carbsreplywithcode">Para inserir %1$dg em %2$s responda com código %3$s</string>
<string name="smscommunicator_basalpctreplywithcode">Para começar a basal %1$d% U/h durante %2$d min responda com o código %3$s</string>
<string name="smscommunicator_suspendreplywithcode">Para suspender o loop por %1$d minutos resposta com código %2$s</string>
<string name="smscommunicator_tempbasalset">Basal temporária %1$.2fU/h para %2$d min iniciada com êxito</string>
<string name="smscommunicator_extendedset">Bólus estendido %1$.2fU/h para %2$d min iniciado com êxito</string>
<string name="smscommunicator_carbsset">Hidratos %1$dg inseridos com sucesso</string>
<string name="smscommunicator_carbsfailed">Introdução de %1$dg de hidratos falhou</string>
<string name="smscommunicator_tempbasalset_percent">Basal temporária %1$d% U/h durante%2$d min iniciada com êxito</string>
<string name="smscommunicator_tempbasalfailed">Início basal temp falhou </string>
<string name="smscommunicator_extendedfailed">Falha ao iniciar o bólus estendido</string>
@ -361,10 +367,11 @@
<string name="button1">Botão 1</string>
<string name="button2">Botão 2</string>
<string name="button3">Botão 3</string>
<string name="units">Unidades:</string>
<string name="units_colon">Unidades:</string>
<string name="units">Unidades</string>
<string name="mgdl">mg/dL</string>
<string name="mmol">mmol/L</string>
<string name="dia">DIA:</string>
<string name="dia">DIA</string>
<string name="target_range">Intervalo Alvo:</string>
<string name="prefs_range_title">Intervalo para visualização</string>
<string name="prefs_range_summary">Marca Alto e Baixo para os gráficos em Sumário e Smartwatch</string>
@ -1376,7 +1383,25 @@
<string name="format_percent">%1$d%%</string>
<string name="boluswizard">Assistente de Bólus</string>
<string name="unit_minute_short">min</string>
<string name="profile_name">Nome do Perfil:</string>
<string name="selected_profile">Seleccionado:</string>
<string name="unitsnosemicolon">Unidades</string>
<string name="doyouwantswitchprofile">Deseja mudar de perfil e descartar as alterações feitas no perfil actual?</string>
<string name="format_carbs">%1$dg</string>
<string name="common_on">Ligado</string>
<string name="common_off">Desligado</string>
<string name="objectives_button_unfinish">Limpar terminado</string>
<string name="objectives_button_unstart">Limpar iniciado</string>
<string name="timedetection">Detecção de tempo</string>
<string name="nopumpselected">Nenhuma bomba seleccionada</string>
<string name="setupwizard_units_prompt">Seleccione as unidades em que deseja exibir os valores</string>
<string name="ns_ploadlocalprofile">Carregar as alterações do perfil local para NS</string>
<string name="dia_short">DIA</string>
<string name="ic_short">IC</string>
<string name="isf_short">FSI</string>
<string name="target_short">ALV</string>
<string name="clone_label">Clone</string>
<string name="deletecurrentprofile">Eliminar perfil actual?</string>
<string name="copytolocalprofile">Criar novo perfil local a partir desta troca de perfil?</string>
<string name="profilenamecontainsdot">Nome do perfil contém pontos.\nIsso não é suportado pelo NS.\nPerfil não é enviado para o NS.</string>
</resources>

View file

@ -360,10 +360,8 @@
<string name="button1">Buton 1</string>
<string name="button2">Buton 2</string>
<string name="button3">Buton 3</string>
<string name="units">Unități:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">Intervalul țintă:</string>
<string name="prefs_range_title">Intervalul pentru vizualizare</string>
<string name="prefs_range_summary">Valoarea maximă și minimă pentru graficele din vizualizare și pentru smartwatch</string>

View file

@ -376,10 +376,8 @@
<string name="button1">кнопка 1</string>
<string name="button2">кнопка 2</string>
<string name="button3">кнопка 3</string>
<string name="units">единицы измерения:</string>
<string name="mgdl">мг/дл</string>
<string name="mmol">ммоль/л</string>
<string name="dia">Время действия инсулина DIA:</string>
<string name="target_range">целевой диапазон</string>
<string name="prefs_range_title">диапазон для визуализации</string>
<string name="prefs_range_summary">Нижняя и верхняя граница диаграммы в отчетах и Smartwatch</string>
@ -1396,4 +1394,8 @@ Context | Edit Context</string>
<string name="format_carbs">%1$d гр</string>
<string name="common_on">Вкл.</string>
<string name="common_off">Выкл.</string>
<string name="objectives_button_unfinish">Очистить завершенные</string>
<string name="objectives_button_unstart">Очистить начатые</string>
<string name="timedetection">Определение времени</string>
<string name="doyouwantresetstart">Хотите сбросить начатую цель? Можете потерять уже достигнутое.</string>
</resources>

View file

@ -376,10 +376,11 @@
<string name="button1">Tlačidlo 1</string>
<string name="button2">Tlačidlo 2</string>
<string name="button3">Tlačidlo 3</string>
<string name="units">Jednotky:</string>
<string name="units_colon">Jednotky:</string>
<string name="units">Jednotky</string>
<string name="mgdl">mg/dL</string>
<string name="mmol">mmol/L</string>
<string name="dia">DIA:</string>
<string name="dia">DIA</string>
<string name="target_range">Cieľový rozsah:</string>
<string name="prefs_range_title">Rozsah pre zobrazenie</string>
<string name="prefs_range_summary">Značka vysokej a nízkej hodnoty v prehľade a na hodinkách Wear</string>
@ -521,7 +522,7 @@
<string name="child">Dieťa</string>
<string name="teenage">Dospievajúci</string>
<string name="adult">Dospelý</string>
<string name="resistantadult">Dospelý z nízkou citlivosťou</string>
<string name="resistantadult">Dospelý s nízkou citlivosťou</string>
<string name="patientage_summary">Vyberte vek pacienta pre nastavenie bezpečnostných limitov</string>
<string name="Glimp">Glimp</string>
<string name="needwhitelisting">%1$s potrebuje vypnúť optimalizáciu batérie pre optimálny výkon</string>
@ -977,7 +978,7 @@
<string name="option_off">VYP</string>
<string name="open_navigation">Otvoriť Menu</string>
<string name="close_navigation">Zavrieť Menu</string>
<string name="nav_plugin_preferences">Nastavenie modulov</string>
<string name="nav_plugin_preferences">Nastavenie modulu</string>
<string name="completed_well_done">Hotovo, gratulujeme!</string>
<string name="not_completed_yet">Nedokončené</string>
<string name="time_elapsed">Uplynutý čas</string>
@ -1391,7 +1392,29 @@
<string name="format_percent">%1$d%%</string>
<string name="boluswizard">Bolusová kalkulačka</string>
<string name="unit_minute_short">min</string>
<string name="profile_name">Názov profilu:</string>
<string name="selected_profile">Vybrané:</string>
<string name="unitsnosemicolon">Jednotky</string>
<string name="doyouwantswitchprofile">Chcete prepnúť profil a zahodiť zmeny vykonané v aktuálnom profile?</string>
<string name="format_carbs">%1$dg</string>
<string name="common_on">ZAP</string>
<string name="common_off">VYP</string>
<string name="objectives_button_unfinish">Vymazanie dokončené</string>
<string name="objectives_button_unstart">Vymazanie začaté</string>
<string name="timedetection">Detekcia času</string>
<string name="doyouwantresetstart">Chcete resetovať začiatok cieľa? Môžete prísť o svoj pokrok.</string>
<string name="nopumpselected">Nie je vybraná žiadna pumpa</string>
<string name="setupwizard_units_prompt">Vyberte jednotky, v ktorých chcete zobraziť hodnoty</string>
<string name="ns_ploadlocalprofile">Odoslať zmeny lokálneho profilu do NS</string>
<string name="dia_short">Doba pôsobenia inzulínu</string>
<string name="ic_short">I:C</string>
<string name="isf_short">ISF</string>
<string name="target_short">CIEĽ</string>
<string name="clone_label">Klonovať</string>
<string name="saveorresetchangesfirst">Najskôr uložte, alebo resetujte aktuálne zmeny</string>
<string name="deletecurrentprofile">Zmazať aktuálny profil?</string>
<string name="copytolocalprofile">Chcete vytvoriť nový lokálny profil z tohto prepnutia profilu?</string>
<string name="profilenamecontainsdot">Názov profilu obsahuje bodky.\nToto nie je podporované v NS.\nProfil nebude prenesený do NS.</string>
<string name="low_mark_comment">Spodná hodnota v oblasti cieľového rozsahu (iba zobrazovanie)</string>
<string name="high_mark_comment">Horná hodnota v oblasti cieľového rozsahu (iba zobrazovanie)</string>
</resources>

View file

@ -377,10 +377,8 @@ Eversense-appen.</string>
<string name="button1">Knapp 1</string>
<string name="button2">Knapp 2</string>
<string name="button3">Knapp 3</string>
<string name="units">Enheter:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">Målområde:</string>
<string name="prefs_range_title">Gränsvärden för visualisering</string>
<string name="prefs_range_summary">Högt och lågt värde för grafen i Översikt och i klockan</string>

View file

@ -333,10 +333,8 @@
<string name="button1">Düğme 1</string>
<string name="button2">Düğme 2</string>
<string name="button3">Düğme 3</string>
<string name="units">Birim:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">Hedef aralığı:</string>
<string name="prefs_range_title">Görselleştirme Aralığı</string>
<string name="prefs_range_summary">Genel bakış ve akıllı saat göstergesi için yüksek ve düşük değerler</string>

View file

@ -357,10 +357,8 @@
<string name="button1">按钮1</string>
<string name="button2">按钮2</string>
<string name="button3">按钮3</string>
<string name="units">单位:</string>
<string name="mgdl">mg/dl</string>
<string name="mmol">mmol/l</string>
<string name="dia">DIA:</string>
<string name="target_range">目标范围:</string>
<string name="prefs_range_title">可视化范围</string>
<string name="prefs_range_summary">在智能手表上的图表上的高值和低值标记</string>

View file

@ -1663,5 +1663,6 @@
<string name="profilenamecontainsdot">Profile name contains dots.\nThis is not supported by NS.\nProfile is not uploaded to NS.</string>
<string name="low_mark_comment">Lower value of in range area (display only)</string>
<string name="high_mark_comment">Higher value of in range area (display only)</string>
<string name="reorder_label">Reorder</string>
</resources>

View file

@ -0,0 +1,155 @@
package info.nightscout.androidaps.db;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.logging.Logger;
import info.AAPSMocker;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.logging.L;
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
import info.nightscout.androidaps.utils.SP;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.Mockito.when;
@RunWith(PowerMockRunner.class)
@PrepareForTest({MainApp.class, Logger.class, L.class, SP.class, GlucoseStatus.class})
public class BgReadingTest {
private BgReading bgReading = new BgReading();
@Test
public void valueToUnits() {
bgReading.value = 18;
assertEquals(18, bgReading.valueToUnits(Constants.MGDL) * 1, 0.01d);
assertEquals(1, bgReading.valueToUnits(Constants.MMOL) * 1, 0.01d);
}
@Test
public void directionToSymbol() {
bgReading = new BgReading();
bgReading.direction = "DoubleDown";
assertEquals("\u21ca", bgReading.directionToSymbol());
bgReading.direction = "SingleDown";
assertEquals("\u2193", bgReading.directionToSymbol());
bgReading.direction = "FortyFiveDown";
assertEquals("\u2198", bgReading.directionToSymbol());
bgReading.direction = "Flat";
assertEquals("\u2192", bgReading.directionToSymbol());
bgReading.direction = "FortyFiveUp";
assertEquals("\u2197", bgReading.directionToSymbol());
bgReading.direction = "SingleUp";
assertEquals("\u2191", bgReading.directionToSymbol());
bgReading.direction = "DoubleUp";
assertEquals("\u21c8", bgReading.directionToSymbol());
bgReading.direction = "OUT OF RANGE";
assertEquals("??", bgReading.directionToSymbol());
}
@Test
public void dateTest() {
bgReading = new BgReading();
long now = System.currentTimeMillis();
bgReading.date = now;
Date nowDate = new Date(now);
assertEquals(now, bgReading.date(now).date);
assertEquals(now, bgReading.date(nowDate).date);
}
@Test
public void valueTest() {
bgReading = new BgReading();
double valueToSet = 81; // 4.5 mmol
assertEquals(81d, bgReading.value(valueToSet).value, 0.01d);
}
@Test
public void copyFromTest() {
bgReading = new BgReading();
BgReading copy = new BgReading();
bgReading.value = 81;
long now = System.currentTimeMillis();
bgReading.date = now;
copy.date = now;
copy.copyFrom(bgReading);
assertEquals(81, copy.value, 0.1d);
assertEquals(now, copy.date);
assertEquals(bgReading.directionToSymbol(), copy.directionToSymbol());
}
@Test
public void isEqualTest() {
bgReading = new BgReading();
BgReading copy = new BgReading();
bgReading.value = 81;
long now = System.currentTimeMillis();
bgReading.date = now;
copy.date = now;
copy.copyFrom(bgReading);
assertTrue(copy.isEqual(bgReading));
assertFalse(copy.isEqual(new BgReading()));
}
@Test
public void calculateDirection() {
List<BgReading> bgReadingsList = null;
AAPSMocker.mockDatabaseHelper();
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadingsList);
assertEquals("NONE", bgReading.calculateDirection());
setReadings(72,0);
assertEquals("DoubleUp", bgReading.calculateDirection());
setReadings(76,60);
assertEquals("SingleUp", bgReading.calculateDirection());
setReadings(74,65);
assertEquals("FortyFiveUp", bgReading.calculateDirection());
setReadings(72,72);
assertEquals("Flat", bgReading.calculateDirection());
setReadings(0,72);
assertEquals("DoubleDown", bgReading.calculateDirection());
setReadings(60,76);
assertEquals("SingleDown", bgReading.calculateDirection());
setReadings(65,74);
assertEquals("FortyFiveDown", bgReading.calculateDirection());
}
@Before
public void prepareMock() {
AAPSMocker.mockMainApp();
AAPSMocker.mockApplicationContext();
AAPSMocker.mockSP();
AAPSMocker.mockL();
AAPSMocker.mockDatabaseHelper();
}
public void setReadings(int current_value, int previous_value){
BgReading now = new BgReading();
now.value = current_value;
now.date = System.currentTimeMillis();
BgReading previous = new BgReading();
previous.value = previous_value;
previous.date = System.currentTimeMillis() - ( 6 * 60 * 1000L);
List<BgReading> bgReadings = new ArrayList() {{
add(now);
add(previous);
}};
when(MainApp.getDbHelper().getAllBgreadingsDataFromTime(anyLong(),anyBoolean())).thenReturn(bgReadings);
}
}

View file

@ -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);

View file

@ -65,6 +65,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
public boolean lowResMode = false;
public boolean layoutSet = false;
public boolean bIsRound = false;
public boolean dividerMatchesBg = false;
public int pointSize = 2;
public BgGraphBuilder bgGraphBuilder;
public LineChartView chart;
@ -480,6 +481,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
}
public void setColor() {
dividerMatchesBg = sharedPrefs.getBoolean("match_divider", false);
if(lowResMode){
setColorLowRes();
} else if (sharedPrefs.getBoolean("dark", true)) {

View file

@ -65,7 +65,8 @@ public class Home extends BaseWatchFace {
protected void setColorDark() {
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_statusView));
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.dark_background : R.color.dark_statusView));
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTime));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
if (rawData.sgvLevel == 1) {
@ -83,18 +84,21 @@ public class Home extends BaseWatchFace {
}
if (ageLevel == 1) {
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTimestamp1_home));
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.dark_midColor : R.color.dark_mTimestamp1_home));
} else {
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_TimestampOld));
}
if (rawData.batteryLevel == 1) {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBattery));
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.dark_midColor : R.color.dark_uploaderBattery));
} else {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBatteryEmpty));
}
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mStatus_home));
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.dark_midColor : R.color.dark_mStatus_home));
if (chart != null) {
highColor = ContextCompat.getColor(getApplicationContext(), R.color.dark_highColor);
@ -131,7 +135,8 @@ public class Home extends BaseWatchFace {
protected void setColorBright() {
if (getCurrentWatchMode() == WatchMode.INTERACTIVE) {
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_stripe_background));
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.light_background : R.color.light_stripe_background));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_background));
if (rawData.sgvLevel == 1) {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_highColor));
@ -148,17 +153,17 @@ public class Home extends BaseWatchFace {
}
if (ageLevel == 1) {
mTimestamp.setTextColor(Color.WHITE);
mTimestamp.setTextColor(dividerMatchesBg ? Color.BLACK : Color.WHITE);
} else {
mTimestamp.setTextColor(Color.RED);
}
if (rawData.batteryLevel == 1) {
mUploaderBattery.setTextColor(Color.WHITE);
mUploaderBattery.setTextColor(dividerMatchesBg ? Color.BLACK : Color.WHITE);
} else {
mUploaderBattery.setTextColor(Color.RED);
}
mStatus.setTextColor(Color.WHITE);
mStatus.setTextColor(dividerMatchesBg ? Color.BLACK : Color.WHITE);
mTime.setTextColor(Color.BLACK);
if (chart != null) {

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.watchfaces;
import android.content.Intent;
import android.graphics.Color;
import androidx.annotation.ColorInt;
import androidx.core.content.ContextCompat;
import android.support.wearable.watchface.WatchFaceStyle;
import android.view.LayoutInflater;
@ -64,7 +65,14 @@ public class Home2 extends BaseWatchFace {
}
protected void setColorDark() {
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_statusView));
@ColorInt final int dividerTxtColor = dividerMatchesBg ?
ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor) : Color.BLACK;
@ColorInt final int dividerBatteryOkColor = ContextCompat.getColor(getApplicationContext(),
dividerMatchesBg ? R.color.dark_midColor : R.color.dark_uploaderBattery);
@ColorInt final int dividerBgColor = ContextCompat.getColor(getApplicationContext(),
dividerMatchesBg ? R.color.dark_background : R.color.dark_statusView);
mLinearLayout.setBackgroundColor(dividerBgColor);
mLinearLayout2.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
@ -96,15 +104,15 @@ public class Home2 extends BaseWatchFace {
}
if (rawData.batteryLevel == 1) {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBattery));
mUploaderBattery.setTextColor(dividerBatteryOkColor);
} else {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBatteryEmpty));
}
mRigBattery.setTextColor(Color.BLACK);
mDelta.setTextColor(Color.BLACK);
mAvgDelta.setTextColor(Color.BLACK);
mBasalRate.setTextColor(Color.BLACK);
mBgi.setTextColor(Color.BLACK);
mRigBattery.setTextColor(dividerTxtColor);
mDelta.setTextColor(dividerTxtColor);
mAvgDelta.setTextColor(dividerTxtColor);
mBasalRate.setTextColor(dividerTxtColor);
mBgi.setTextColor(dividerTxtColor);
if (loopLevel == 1) {
mLoop.setBackgroundResource(R.drawable.loop_green_25);
@ -125,7 +133,12 @@ public class Home2 extends BaseWatchFace {
}
protected void setColorLowRes() {
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_statusView));
@ColorInt final int dividerTxtColor = dividerMatchesBg ?
ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor) : Color.BLACK;
@ColorInt final int dividerBgColor = ContextCompat.getColor(getApplicationContext(),
dividerMatchesBg ? R.color.dark_background : R.color.dark_statusView);
mLinearLayout.setBackgroundColor(dividerBgColor);
mLinearLayout2.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
mLoop.setBackgroundResource(R.drawable.loop_grey_25);
@ -133,12 +146,12 @@ public class Home2 extends BaseWatchFace {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_Timestamp));
mDelta.setTextColor(Color.BLACK);
mAvgDelta.setTextColor(Color.BLACK);
mRigBattery.setTextColor(Color.BLACK);
mUploaderBattery.setTextColor(Color.BLACK);
mBasalRate.setTextColor(Color.BLACK);
mBgi.setTextColor(Color.BLACK);
mDelta.setTextColor(dividerTxtColor);
mAvgDelta.setTextColor(dividerTxtColor);
mRigBattery.setTextColor(dividerTxtColor);
mUploaderBattery.setTextColor(dividerTxtColor);
mBasalRate.setTextColor(dividerTxtColor);
mBgi.setTextColor(dividerTxtColor);
mIOB1.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mIOB2.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mCOB1.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
@ -162,7 +175,13 @@ public class Home2 extends BaseWatchFace {
protected void setColorBright() {
if (getCurrentWatchMode() == WatchMode.INTERACTIVE) {
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_stripe_background));
@ColorInt final int dividerTxtColor = dividerMatchesBg ? Color.BLACK :
ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor);
@ColorInt final int dividerBgColor = ContextCompat.getColor(getApplicationContext(),
dividerMatchesBg ? R.color.light_background : R.color.light_stripe_background);
mLinearLayout.setBackgroundColor(dividerBgColor);
mLinearLayout2.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_background));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_background));
mTime.setTextColor(Color.BLACK);
@ -194,15 +213,15 @@ public class Home2 extends BaseWatchFace {
}
if (rawData.batteryLevel == 1) {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mUploaderBattery.setTextColor(dividerTxtColor);
} else {
mUploaderBattery.setTextColor(Color.RED);
}
mRigBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mAvgDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mBasalRate.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mBgi.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mRigBattery.setTextColor(dividerTxtColor);
mDelta.setTextColor(dividerTxtColor);
mAvgDelta.setTextColor(dividerTxtColor);
mBasalRate.setTextColor(dividerTxtColor);
mBgi.setTextColor(dividerTxtColor);
if (loopLevel == 1) {
mLoop.setBackgroundResource(R.drawable.loop_green_25);

View file

@ -49,7 +49,8 @@ public class LargeHome extends BaseWatchFace {
@Override
protected void setColorDark(){
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mLinearLayout));
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.dark_background : R.color.dark_mLinearLayout));
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTime));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
if (rawData.sgvLevel == 1) {
@ -67,24 +68,27 @@ public class LargeHome extends BaseWatchFace {
}
if (ageLevel == 1) {
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTimestamp1_home));
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.dark_midColor : R.color.dark_mTimestamp1_home));
} else {
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_TimestampOld));
}
if (rawData.batteryLevel == 1) {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBattery));
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.dark_midColor : R.color.dark_uploaderBattery));
} else {
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBatteryEmpty));
}
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mStatus_home));
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ? R.color.dark_midColor : R.color.dark_mStatus_home));
}
@Override
protected void setColorBright() {
if (getCurrentWatchMode() == WatchMode.INTERACTIVE) {
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_stripe_background));
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ?
R.color.light_background : R.color.light_stripe_background));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.light_background));
if (rawData.sgvLevel == 1) {
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.light_highColor));
@ -101,21 +105,21 @@ public class LargeHome extends BaseWatchFace {
}
if (ageLevel == 1) {
mTimestamp.setTextColor(Color.WHITE);
mTimestamp.setTextColor(dividerMatchesBg ? Color.BLACK : Color.WHITE);
} else {
mTimestamp.setTextColor(Color.RED);
}
if (rawData.batteryLevel == 1) {
mUploaderBattery.setTextColor(Color.WHITE);
mUploaderBattery.setTextColor(dividerMatchesBg ? Color.BLACK : Color.WHITE);
} else {
mUploaderBattery.setTextColor(Color.RED);
}
mStatus.setTextColor(Color.WHITE);
mStatus.setTextColor(dividerMatchesBg ? Color.BLACK : Color.WHITE);
mTime.setTextColor(Color.BLACK);
} else {
mRelativeLayout.setBackgroundColor(Color.BLACK);
mLinearLayout.setBackgroundColor(Color.LTGRAY);
mLinearLayout.setBackgroundColor(dividerMatchesBg ? Color.BLACK : Color.LTGRAY);
if (rawData.sgvLevel == 1) {
mSgv.setTextColor(Color.YELLOW);
mDirection.setTextColor(Color.YELLOW);
@ -130,23 +134,23 @@ public class LargeHome extends BaseWatchFace {
mDelta.setTextColor(Color.RED);
}
mUploaderBattery.setTextColor(Color.BLACK);
mTimestamp.setTextColor(Color.BLACK);
mStatus.setTextColor(Color.BLACK);
mUploaderBattery.setTextColor(dividerMatchesBg ? Color.WHITE : Color.BLACK);
mTimestamp.setTextColor(dividerMatchesBg ? Color.WHITE : Color.BLACK);
mStatus.setTextColor(dividerMatchesBg ? Color.WHITE : Color.BLACK);
mTime.setTextColor(Color.WHITE);
}
}
@Override
protected void setColorLowRes() {
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mLinearLayout));
mLinearLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ? R.color.dark_background : R.color.dark_mLinearLayout));
mTime.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTime));
mRelativeLayout.setBackgroundColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_background));
mSgv.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mDelta.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mDirection.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_midColor));
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mTimestamp1_home));
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_uploaderBattery));
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), R.color.dark_mStatus_home));
mTimestamp.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ? R.color.dark_midColor : R.color.dark_mTimestamp1_home));
mUploaderBattery.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ? R.color.dark_midColor : R.color.dark_uploaderBattery));
mStatus.setTextColor(ContextCompat.getColor(getApplicationContext(), dividerMatchesBg ? R.color.dark_midColor : R.color.dark_mStatus_home));
}
}

View file

@ -125,6 +125,14 @@
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="match_divider"
android:summary="Status bar divider background matches watchface background"
android:title="Matching divider"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<ListPreference
android:defaultValue="3"
android:entries="@array/chart_timeframe"