Merge pull request #1038 from jotomo/upstreaming

[Polish] Dialog/color consistency, translations and other small stuff
This commit is contained in:
Milos Kozak 2018-05-15 13:09:50 +02:00 committed by GitHub
commit 66e50f5b62
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 96 additions and 53 deletions

View file

@ -44,7 +44,7 @@ def generateGitBuild = { ->
stringBuilder.append('NoGitSystemAvailable') stringBuilder.append('NoGitSystemAvailable')
} }
stringBuilder.append('-') stringBuilder.append('-')
stringBuilder.append((new Date()).format('yyyy.MM.dd')) stringBuilder.append((new Date()).format('yyyy.MM.dd-HH:mm'))
stringBuilder.append('"') stringBuilder.append('"')
return stringBuilder.toString() return stringBuilder.toString()
} }

View file

@ -179,10 +179,10 @@ public class FillDialog extends DialogFragment implements OnClickListener {
} }
if (pumpSiteChangeCheckbox.isChecked()) if (pumpSiteChangeCheckbox.isChecked())
confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.high) + "'>" + MainApp.gs(R.string.record_pump_site_change) + "</font>"); confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.actionsConfirm) + "'>" + MainApp.gs(R.string.record_pump_site_change) + "</font>");
if (insulinCartridgeChangeCheckbox.isChecked()) if (insulinCartridgeChangeCheckbox.isChecked())
confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.high) + "'>" + MainApp.gs(R.string.record_insulin_cartridge_change) + "</font>"); confirmMessage.add("" + "<font color='" + MainApp.gc(R.color.actionsConfirm) + "'>" + MainApp.gs(R.string.record_insulin_cartridge_change) + "</font>");
final String notes = notesEdit.getText().toString(); final String notes = notesEdit.getText().toString();
if (!notes.isEmpty()) { if (!notes.isEmpty()) {

View file

@ -303,21 +303,21 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
if (currentProfile.getUnits().equals(Constants.MMOL)) { if (currentProfile.getUnits().equals(Constants.MMOL)) {
unitLabel = "mmol/l"; unitLabel = "mmol/l";
} }
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to1Decimal(activityTT) + " " + unitLabel + " (" + activityTTDuration + " min)</font>");
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to1Decimal(activityTT) + " " + unitLabel + " (" + activityTTDuration + " min)</font>");
} }
if (startEatingSoonTTCheckbox.isChecked()) { if (startEatingSoonTTCheckbox.isChecked()) {
if (currentProfile.getUnits().equals(Constants.MMOL)) { if (currentProfile.getUnits().equals(Constants.MMOL)) {
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to1Decimal(eatingSoonTT) + " mmol/l (" + eatingSoonTTDuration + " min)</font>"); actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to1Decimal(eatingSoonTT) + " mmol/l (" + eatingSoonTTDuration + " min)</font>");
} else } else {
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to0Decimal(eatingSoonTT) + " mg/dl (" + eatingSoonTTDuration + " min)</font>"); actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to0Decimal(eatingSoonTT) + " mg/dl (" + eatingSoonTTDuration + " min)</font>");
}
} }
if (startHypoTTCheckbox.isChecked()) { if (startHypoTTCheckbox.isChecked()) {
if (currentProfile.getUnits().equals(Constants.MMOL)) { if (currentProfile.getUnits().equals(Constants.MMOL)) {
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to1Decimal(hypoTT) + " mmol/l (" + hypoTTDuration + " min)</font>"); actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to1Decimal(hypoTT) + " mmol/l (" + hypoTTDuration + " min)</font>");
} else } else {
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to0Decimal(hypoTT) + " mg/dl (" + hypoTTDuration + " min)</font>"); actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to0Decimal(hypoTT) + " mg/dl (" + hypoTTDuration + " min)</font>");
}
} }
int timeOffset = editTime.getValue().intValue(); int timeOffset = editTime.getValue().intValue();

View file

@ -217,9 +217,9 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener
if (startEatingSoonTTCheckbox.isChecked()) { if (startEatingSoonTTCheckbox.isChecked()) {
if (currentProfile.getUnits().equals(Constants.MMOL)) { if (currentProfile.getUnits().equals(Constants.MMOL)) {
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to1Decimal(eatingSoonTT) + " mmol/l (" + eatingSoonTTDuration + " min)</font>"); actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to1Decimal(eatingSoonTT) + " mmol/l (" + eatingSoonTTDuration + " min)</font>");
} else } else
actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to0Decimal(eatingSoonTT) + " mg/dl (" + eatingSoonTTDuration + " min)</font>"); actions.add(MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.tempTargetConfirmation) + "'>" + DecimalFormatter.to0Decimal(eatingSoonTT) + " mg/dl (" + eatingSoonTTDuration + " min)</font>");
} }
int timeOffset = editTime.getValue().intValue(); int timeOffset = editTime.getValue().intValue();

View file

@ -7,6 +7,12 @@ package info.nightscout.utils;
public class T { public class T {
private long time; // in msec private long time; // in msec
public static T now() {
T t = new T();
t.time = System.currentTimeMillis();
return t;
}
public static T msecs(long msec) { public static T msecs(long msec) {
T t = new T(); T t = new T();
t.time = msec; t.time = msec;
@ -56,4 +62,12 @@ public class T {
public long days() { public long days() {
return time / 24 / 60 / 60 / 1000L; return time / 24 / 60 / 60 / 1000L;
} }
public T plus(T plus) {
return T.msecs(time + plus.time);
}
public T minus(T minus) {
return T.msecs(time - minus.time);
}
} }

View file

@ -11,27 +11,24 @@
android:padding="10dp"> android:padding="10dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:padding="5dp"
android:src="@drawable/icon_cp_pump_canula" /> android:src="@drawable/icon_cp_pump_canula" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="10dp" android:layout_gravity="center"
android:paddingLeft="15dp" android:layout_marginLeft="10dp"
android:paddingRight="15dp" android:layout_marginRight="10dp"
android:paddingTop="10dp"
android:text="@string/primefill" android:text="@string/primefill"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorInsulinButton" /> android:textColor="@color/colorInsulinButton" />

View file

@ -11,8 +11,8 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:padding="10dp"> android:padding="10dp">
@ -20,10 +20,16 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:padding="10dp" android:text="@string/overview_calibration"
android:text="@string/overview_calibration_bg_label" android:textColor="@color/colorCalibrationButton"
android:textAppearance="?android:attr/textAppearanceLarge" /> android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp"
android:src="@drawable/icon_calibration" />
<TextView <TextView
android:id="@+id/overview_calibration_units" android:id="@+id/overview_calibration_units"
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -20,28 +20,25 @@
android:padding="10dp"> android:padding="10dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/icon_cp_bolus_carbs" /> android:src="@drawable/icon_cp_bolus_carbs" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="10dp" android:layout_gravity="center"
android:paddingLeft="15dp" android:layout_marginLeft="10dp"
android:paddingRight="15dp" android:layout_marginRight="10dp"
android:paddingTop="10dp"
android:text="@string/carbs" android:text="@string/carbs"
android:textAlignment="center" android:textAppearance="?android:attr/textAppearanceLarge"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/colorCarbsButton" /> android:textColor="@color/colorCarbsButton" />
</LinearLayout> </LinearLayout>

View file

@ -17,26 +17,23 @@
android:padding="10dp"> android:padding="10dp">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:orientation="horizontal"> android:orientation="horizontal">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:padding="5dp"
android:layout_gravity="center" android:layout_gravity="center"
android:src="@drawable/icon_bolus" /> android:src="@drawable/icon_bolus" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingBottom="10dp" android:layout_gravity="center"
android:paddingLeft="15dp" android:layout_marginLeft="10dp"
android:paddingRight="15dp" android:layout_marginRight="10dp"
android:paddingTop="10dp"
android:textAlignment="center"
android:text="@string/overview_insulin_label" android:text="@string/overview_insulin_label"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/colorInsulinButton" /> android:textColor="@color/colorInsulinButton" />
@ -59,7 +56,7 @@
android:id="@+id/newinsulin_record_only" android:id="@+id/newinsulin_record_only"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/don_t_bolus_record_only" /> android:text="@string/do_not_bolus_record_only" />
</LinearLayout> </LinearLayout>
@ -124,6 +121,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginRight="5dp"
android:text="@string/insulin_unit_shortname" /> android:text="@string/insulin_unit_shortname" />
</LinearLayout> </LinearLayout>

View file

@ -29,7 +29,7 @@
android:id="@+id/newtreatment_record_only" android:id="@+id/newtreatment_record_only"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:text="@string/don_t_bolus_record_only" /> android:text="@string/do_not_bolus_record_only" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View file

@ -810,7 +810,7 @@
<string name="data_choices">Избор на данни</string> <string name="data_choices">Избор на данни</string>
<string name="allow_automated_crash_reporting">Позволява автоматично изпращане на данни за грешки и статистически данни до разработчиците чрез fabric.io service.</string> <string name="allow_automated_crash_reporting">Позволява автоматично изпращане на данни за грешки и статистически данни до разработчиците чрез fabric.io service.</string>
<string name="g5appnotdetected">Моля обновете G5 приложението до поддържана версия.</string> <string name="g5appnotdetected">Моля обновете G5 приложението до поддържана версия.</string>
<string name="don_t_bolus_record_only">Не доставяй болус, само запис</string> <string name="do_not_bolus_record_only">Не доставяй болус, само запис</string>
<string name="category">Категория</string> <string name="category">Категория</string>
<string name="subcategory">Подкатегория</string> <string name="subcategory">Подкатегория</string>
<string name="bolusrecordedonly">Болусът ще бъде само записан</string> <string name="bolusrecordedonly">Болусът ще бъде само записан</string>

View file

@ -810,7 +810,7 @@
<string name="start_eating_soon_tt">Spustit Dočasný cíl Blížící se jídlo</string> <string name="start_eating_soon_tt">Spustit Dočasný cíl Blížící se jídlo</string>
<string name="temptargetshort">DoCíl</string> <string name="temptargetshort">DoCíl</string>
<string name="insight_min">min</string> <string name="insight_min">min</string>
<string name="don_t_bolus_record_only">Nepouštět bolus, jen zaznamenat</string> <string name="do_not_bolus_record_only">Nepouštět bolus, jen zaznamenat</string>
<string name="subcategory">Podkategorie</string> <string name="subcategory">Podkategorie</string>
<string name="category">Kategorie</string> <string name="category">Kategorie</string>
<string name="bolusrecordedonly">Bolus bude pouze zaznamenán</string> <string name="bolusrecordedonly">Bolus bude pouze zaznamenán</string>

View file

@ -797,4 +797,6 @@
<string name="connectionsettings_title">Verbindungs-Einstellungen</string> <string name="connectionsettings_title">Verbindungs-Einstellungen</string>
<string formatted="false" name="objectivenotstarted">Zielsetzung %d nicht gestartet</string> <string formatted="false" name="objectivenotstarted">Zielsetzung %d nicht gestartet</string>
<string formatted="false" name="objectivenotfinished">Zielsetzung %d nicht abgeschlossen</string> <string formatted="false" name="objectivenotfinished">Zielsetzung %d nicht abgeschlossen</string>
<string name="do_not_bolus_record_only">Bolus nur erfassen</string>
<string name="bolusrecordedonly">Bolus wird nur erfasst</string>
</resources> </resources>

View file

@ -744,7 +744,7 @@
<string name="bolusrecordedonly">El Bolo solo será anotado</string> <string name="bolusrecordedonly">El Bolo solo será anotado</string>
<string name="category">Categoría</string> <string name="category">Categoría</string>
<string name="subcategory">Subcategoría</string> <string name="subcategory">Subcategoría</string>
<string name="don_t_bolus_record_only">No administrar Bolo, solo anotar</string> <string name="do_not_bolus_record_only">No administrar Bolo, solo anotar</string>
<string name="insight_min">min</string> <string name="insight_min">min</string>
<string name="temptargetshort">TT</string> <string name="temptargetshort">TT</string>
<string name="start_activity_tt">Inicio TT Actividad</string> <string name="start_activity_tt">Inicio TT Actividad</string>

View file

@ -835,7 +835,7 @@
<string name="start_activity_tt">Rozpocznij TT Ćwiczenia</string> <string name="start_activity_tt">Rozpocznij TT Ćwiczenia</string>
<string name="start_eating_soon_tt">Rozpocznij TT WkrótcePosiłek</string> <string name="start_eating_soon_tt">Rozpocznij TT WkrótcePosiłek</string>
<string name="temptargetshort">TT</string> <string name="temptargetshort">TT</string>
<string name="don_t_bolus_record_only">Nie podawaj bolusa, tylko zapisz rekord</string> <string name="do_not_bolus_record_only">Nie podawaj bolusa, tylko zapisz rekord</string>
<string name="category">Kategoria</string> <string name="category">Kategoria</string>
<string name="subcategory">Podkategoria</string> <string name="subcategory">Podkategoria</string>
<string name="bolusrecordedonly">Bolus zostanie tylko zapisany w rekordach</string> <string name="bolusrecordedonly">Bolus zostanie tylko zapisany w rekordach</string>

View file

@ -813,7 +813,7 @@
<string name="g5appnotdetected">Vänligen uppdatera din G5-app till en supportad version</string> <string name="g5appnotdetected">Vänligen uppdatera din G5-app till en supportad version</string>
<string name="start_activity_tt">Starta \"Träning\"</string> <string name="start_activity_tt">Starta \"Träning\"</string>
<string name="start_eating_soon_tt">Starta \"Äta snart\"</string> <string name="start_eating_soon_tt">Starta \"Äta snart\"</string>
<string name="don_t_bolus_record_only">Ge ingen bolus, logga bara</string> <string name="do_not_bolus_record_only">Ge ingen bolus, logga bara</string>
<string name="category">Kategori</string> <string name="category">Kategori</string>
<string name="subcategory">Underkategori</string> <string name="subcategory">Underkategori</string>
<string name="bolusrecordedonly">Bolusen sparas bara i loggboken</string> <string name="bolusrecordedonly">Bolusen sparas bara i loggboken</string>

View file

@ -14,6 +14,7 @@
<color name="inrange">#00FF00</color> <color name="inrange">#00FF00</color>
<color name="low">#FF0000</color> <color name="low">#FF0000</color>
<color name="high">#FFFF00</color> <color name="high">#FFFF00</color>
<color name="actionsConfirm">#FFFF00</color>
<color name="listdelimiter">#505050</color> <color name="listdelimiter">#505050</color>
<color name="tabBgColor">#f0003f59</color> <color name="tabBgColor">#f0003f59</color>
<color name="tabBgColorSelected">#FF33B5E5</color> <color name="tabBgColorSelected">#FF33B5E5</color>
@ -28,6 +29,7 @@
<color name="defaultbackground">#424242</color> <color name="defaultbackground">#424242</color>
<color name="tempTargetBackground">#77dd77</color> <color name="tempTargetBackground">#77dd77</color>
<color name="tempTargetConfirmation">#77dd77</color>
<color name="tempTargetDisabledBackground">#303F9F</color> <color name="tempTargetDisabledBackground">#303F9F</color>

View file

@ -923,7 +923,7 @@
<string name="start_activity_tt">Start Activity TT</string> <string name="start_activity_tt">Start Activity TT</string>
<string name="start_eating_soon_tt">Start Eating soon TT</string> <string name="start_eating_soon_tt">Start Eating soon TT</string>
<string name="temptargetshort">TT</string> <string name="temptargetshort">TT</string>
<string name="don_t_bolus_record_only">Don\'t bolus, record only</string> <string name="do_not_bolus_record_only">Do not bolus, record only</string>
<string name="category">Category</string> <string name="category">Category</string>
<string name="subcategory">Subcategory</string> <string name="subcategory">Subcategory</string>
<string name="bolusrecordedonly">Bolus will be recorded only</string> <string name="bolusrecordedonly">Bolus will be recorded only</string>

View file

@ -9,11 +9,11 @@ import org.powermock.modules.junit4.PowerMockRunner;
* Created by mike on 26.03.2018. * Created by mike on 26.03.2018.
*/ */
@RunWith(PowerMockRunner.class) //@RunWith(PowerMockRunner.class)
public class TTest { public class TTest {
@Test @Test
public void doTests() { public void toUnits() {
Assert.assertEquals(1, T.msecs(1000).secs()); Assert.assertEquals(1, T.msecs(1000).secs());
Assert.assertEquals(1, T.secs(60).mins()); Assert.assertEquals(1, T.secs(60).mins());
Assert.assertEquals(1, T.mins(60).hours()); Assert.assertEquals(1, T.mins(60).hours());
@ -21,4 +21,31 @@ public class TTest {
Assert.assertEquals(24, T.days(1).hours()); Assert.assertEquals(24, T.days(1).hours());
Assert.assertEquals(60000, T.mins(1).msecs()); Assert.assertEquals(60000, T.mins(1).msecs());
} }
@Test
public void now() {
Assert.assertTrue(Math.abs(T.now().msecs() - System.currentTimeMillis()) < 5000);
}
@Test
public void additions() {
long nowMsecs = System.currentTimeMillis();
T now = T.msecs(nowMsecs);
Assert.assertEquals(now.plus(T.secs(5)).msecs(), nowMsecs + 5 * 1000);
Assert.assertEquals(now.plus(T.mins(5)).msecs(), nowMsecs + 5 * 60 * 1000);
Assert.assertEquals(now.plus(T.hours(5)).msecs(), nowMsecs + 5 * 60 * 60 * 1000);
Assert.assertEquals(now.plus(T.days(5)).msecs(), nowMsecs + 5 * 24 * 60 * 60 * 1000);
}
@Test
public void subtractions() {
long nowMsecs = System.currentTimeMillis();
T now = T.msecs(nowMsecs);
Assert.assertEquals(now.minus(T.secs(5)).msecs(), nowMsecs - 5 * 1000);
Assert.assertEquals(now.minus(T.mins(5)).msecs(), nowMsecs - 5 * 60 * 1000);
Assert.assertEquals(now.minus(T.hours(5)).msecs(), nowMsecs - 5 * 60 * 60 * 1000);
Assert.assertEquals(now.minus(T.days(5)).msecs(), nowMsecs - 5 * 24 * 60 * 60 * 1000);
}
} }