1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-29 03:55:49 +01:00

Improved toast messages for sleep widget

This commit is contained in:
cpfeiffer 2019-01-11 00:03:17 +01:00
parent 51632d16a2
commit 3c0871f474
21 changed files with 28 additions and 29 deletions

View File

@ -32,12 +32,10 @@ import java.util.Calendar;
import java.util.GregorianCalendar;
import nodomain.freeyourgadget.gadgetbridge.activities.ConfigureAlarms;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityUser;
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
import nodomain.freeyourgadget.gadgetbridge.util.AlarmUtils;
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
/**
@ -112,9 +110,17 @@ public class SleepAlarmWidget extends AppWidgetProvider {
GB.toast(context,
context.getString(R.string.appwidget_not_connected),
Toast.LENGTH_LONG, GB.WARN);
return;
}
}
int hours = calendar.get(Calendar.HOUR_OF_DAY);
int minutes = calendar.get(Calendar.MINUTE);
GB.toast(context,
context.getString(R.string.appwidget_setting_alarm, hours, minutes),
Toast.LENGTH_SHORT, GB.INFO);
Alarm alarm = AlarmUtils.createSingleShot(0,true, calendar);
ArrayList<Alarm> alarms = new ArrayList<>(1);
alarms.add(alarm);
@ -123,13 +129,6 @@ public class SleepAlarmWidget extends AppWidgetProvider {
// if (GBApplication.isRunningLollipopOrLater()) {
// setAlarmViaAlarmManager(context, calendar.getTimeInMillis());
// }
// int hours = calendar.get(Calendar.HOUR_OF_DAY);
// int minutes = calendar.get(Calendar.MINUTE);
//
// GB.toast(context,
// String.format(context.getString(R.string.appwidget_alarms_set), hours, minutes),
// Toast.LENGTH_SHORT, GB.INFO);
}
}

View File

@ -425,7 +425,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Afegeix un giny</string>
<string name="activity_prefs_sleep_duration">Duració preferida del son en hores</string>
<string name="appwidget_alarms_set">S\'ha creat una alarma a les %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">S\'ha creat una alarma a les %1$02d:%2$02d</string>
<string name="device_hw">Revisió del maquinari: %1$s</string>
<string name="device_fw">Versió del microprogramari: %1$s</string>
<string name="error_creating_directory_for_logfiles">S\'ha produït un error al crear un directori per als fitxers de registre: %1$s</string>

View File

@ -313,7 +313,7 @@
<string name="appwidget_text">Spí...</string>
<string name="add_widget">Přidat widget</string>
<string name="activity_prefs_sleep_duration">Preferovaná doba spánku v hodinách</string>
<string name="appwidget_alarms_set">Budík nastaven na %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Budík nastaven na %1$02d:%2$02d</string>
<string name="device_hw">Revize HW: %1$s</string>
<string name="device_fw">Verze FW: %1$s</string>
<string name="error_creating_directory_for_logfiles">Chyba při vytváření adresáře pro logy: %1$s</string>

View File

@ -335,7 +335,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Widget hinzufügen</string>
<string name="activity_prefs_sleep_duration">Gewünschte Schlafdauer in Stunden</string>
<string name="appwidget_alarms_set">Ein Wecker wurde auf %1$02d:%2$02d gestellt</string>
<string name="appwidget_setting_alarm">Ein Wecker wurde auf %1$02d:%2$02d gestellt</string>
<string name="device_hw">Hardwarerevision: %1$s</string>
<string name="device_fw">Firmware-Version: %1$s</string>
<string name="error_creating_directory_for_logfiles">Fehler beim Erstellen des Verzeichnisses für Logdateien: %1$s</string>

View File

@ -437,7 +437,7 @@
<string name="appwidget_text">Ζzz</string>
<string name="add_widget">Πρόσθεση widget</string>
<string name="activity_prefs_sleep_duration">Προτιμώμενος χρόνος ύπνου (σε ώρες)</string>
<string name="appwidget_alarms_set">Ένα ξυπνητήρι έχει οριστεί για τις %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Ένα ξυπνητήρι έχει οριστεί για τις %1$02d:%2$02d</string>
<string name="device_hw">Έκδοση υλικού: %1$s</string>
<string name="device_fw">Έκδοση λογισμικού: %1$s</string>
<string name="error_creating_directory_for_logfiles">Σφάλμα κατά τη δημιουργία φακέλου για τα αρχεία καταγραφής: %1$s</string>

View File

@ -336,7 +336,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Añadir widget</string>
<string name="activity_prefs_sleep_duration">Horas de sueño deseadas</string>
<string name="appwidget_alarms_set">Una alarma ha sido fijada para %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Una alarma ha sido fijada para %1$02d:%2$02d</string>
<string name="device_hw">Revisión de hardware: %1$s</string>
<string name="device_fw">Versión de firmware: %1$s</string>
<string name="error_creating_directory_for_logfiles">Error creando un directorio para los archivos de registro: %1$s</string>

View File

@ -337,7 +337,7 @@
<string name="add_widget">Ajouter un widget</string>
<string name="activity_prefs_sleep_duration">
Temps de sommeil préféré en heures</string>
<string name="appwidget_alarms_set">Une alarme a été enregistré pour %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Une alarme a été enregistré pour %1$02d:%2$02d</string>
<string name="device_hw">Révision matérielle : %1$s</string>
<string name="device_fw">Version du micrologiciel : %1$s</string>
<string name="error_creating_directory_for_logfiles">Erreur à la création de votre fichier log : %1$s</string>

View File

@ -391,7 +391,7 @@
<string name="appwidget_text">ZzZ</string>
<string name="add_widget">Engadir widget</string>
<string name="activity_prefs_sleep_duration">Duración de sono preferida en horas</string>
<string name="appwidget_alarms_set">Unha alarma foi definida para %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Unha alarma foi definida para %1$02d:%2$02d</string>
<string name="device_hw">Revisión de hardware: %1$s</string>
<string name="device_fw">Versión de firmware: %1$s</string>
<string name="error_creating_directory_for_logfiles">Erro creando un cartafol para os arquivos de rexistro: %1$s</string>

View File

@ -299,7 +299,7 @@
<string name="appwidget_text">חררר</string>
<string name="add_widget">הוספת וידג׳ט</string>
<string name="activity_prefs_sleep_duration">משך השינה המועדף בשעות</string>
<string name="appwidget_alarms_set">הוגדרה התראה לשעה %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">הוגדרה התראה לשעה %1$02d:%2$02d</string>
<string name="device_hw">מהדורת חומרה: %1$s</string>
<string name="device_fw">מהדורת קושחה: %1$s</string>
<string name="error_creating_directory_for_logfiles">אירעה שגיאה ביצירת תיקייה לקובצי הרישום: %1$s</string>

View File

@ -330,7 +330,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Widget hozzáadása</string>
<string name="activity_prefs_sleep_duration">Preferált alvási idő órában</string>
<string name="appwidget_alarms_set">Ébresztő beállítva: %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Ébresztő beállítva: %1$02d:%2$02d</string>
<string name="device_hw">HW: %1$s</string>
<string name="device_fw">FW: %1$s</string>
<string name="error_creating_directory_for_logfiles">Hiba a könyvtár létrehozásakor a naplófájlok számára: %1$s</string>

View File

@ -335,7 +335,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Aggiungi widget</string>
<string name="activity_prefs_sleep_duration">Ore di sonno preferite</string>
<string name="appwidget_alarms_set">Impostata sveglia per %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Impostata sveglia per %1$02d:%2$02d</string>
<string name="device_hw">Versione Hardware: %1$s</string>
<string name="device_fw">Versione Firmware: %1$s</string>
<string name="error_creating_directory_for_logfiles">Errore durante la creazione della directory per i file di log: %1$s</string>

View File

@ -336,7 +336,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">ウィジェットを追加</string>
<string name="activity_prefs_sleep_duration">好ましい睡眠時間(時間)</string>
<string name="appwidget_alarms_set">%1$02d:%2$02d のアラームを設定しました</string>
<string name="appwidget_setting_alarm">%1$02d:%2$02d のアラームを設定しました</string>
<string name="device_hw">HW: %1$s</string>
<string name="device_fw">FW: %1$s</string>
<string name="error_creating_directory_for_logfiles">ログファイルのディレクトリを作成中にエラー: %1$s</string>

View File

@ -211,7 +211,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">위젯 추가</string>
<string name="activity_prefs_sleep_duration">선호하는 수면 시간</string>
<string name="appwidget_alarms_set">%1$02d:%2$02d 알람이 설정되었습니다</string>
<string name="appwidget_setting_alarm">%1$02d:%2$02d 알람이 설정되었습니다</string>
<string name="device_hw">하드웨어: %1$s</string>
<string name="device_fw">펌웨어: %1$s</string>
<string name="error_creating_directory_for_logfiles">기록 파일을 저장할 디렉토리 생성 오류: %1$s</string>

View File

@ -407,7 +407,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Legg til miniprogram</string>
<string name="activity_prefs_sleep_duration">Foretrukket søvn i timer</string>
<string name="appwidget_alarms_set">En alarm ble satt for %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">En alarm ble satt for %1$02d:%2$02d</string>
<string name="device_hw">Maskinvarerevisjon: %1$s</string>
<string name="device_fw">Fastvareversjon: %1$s</string>
<string name="error_creating_directory_for_logfiles">Feil under opprettelse av mappe for loggfiler: %1$s</string>

View File

@ -441,7 +441,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Widget toevoegen</string>
<string name="activity_prefs_sleep_duration">Gewenste slaapduur in uren</string>
<string name="appwidget_alarms_set">Een alarm is ingesteld voor %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Een alarm is ingesteld voor %1$02d:%2$02d</string>
<string name="device_hw">Hardware revisie: %1$s</string>
<string name="device_fw">Firmware versie: %1$s</string>
<string name="error_creating_directory_for_logfiles">Fout tijdens het aanmaken van map voor logbestanden: %1$s</string>

View File

@ -299,7 +299,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Adicionar widget</string>
<string name="activity_prefs_sleep_duration">Preferir duração de sono em horas</string>
<string name="appwidget_alarms_set">Um alarme foi definido para %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Um alarme foi definido para %1$02d:%2$02d</string>
<string name="device_hw">HW: %1$s</string>
<string name="device_fw">FW: %1$s</string>
<string name="error_creating_directory_for_logfiles">Erro ao criar o diretório para arquivos de log: %1$s</string>

View File

@ -326,7 +326,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Adicionar widget</string>
<string name="activity_prefs_sleep_duration">Preferir duração de sono em horas</string>
<string name="appwidget_alarms_set">Alarme definido para as %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Alarme definido para as %1$02d:%2$02d</string>
<string name="device_hw">HW: %1$s</string>
<string name="device_fw">Versão FW: %1$s</string>
<string name="error_creating_directory_for_logfiles">Erro ao criar o diretório para os ficheiros de registo: %1$s</string>

View File

@ -318,7 +318,7 @@
<string name="appwidget_text">Хрр</string>
<string name="add_widget">Добавить виджет</string>
<string name="activity_prefs_sleep_duration">Желаемая продолжительность сна</string>
<string name="appwidget_alarms_set">Будильник был установлен на %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Будильник был установлен на %1$02d:%2$02d</string>
<string name="device_hw">Версия устройства: %1$s</string>
<string name="device_fw">Версия прошивки: %1$s</string>
<string name="error_creating_directory_for_logfiles">Ошибка создания каталога для лог-файлов: %1$s</string>

View File

@ -436,7 +436,7 @@
<string name="appwidget_text">Spí...</string>
<string name="add_widget">Pridať miniaplikáciu</string>
<string name="activity_prefs_sleep_duration">Preferovaná doba spánku v hodinách</string>
<string name="appwidget_alarms_set">Budík nastavený na %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Budík nastavený na %1$02d:%2$02d</string>
<string name="device_hw">Revízia HW: %1$s</string>
<string name="device_fw">Verzia FW: %1$s</string>
<string name="error_creating_directory_for_logfiles">Chyba pri vytváraní adresára pre logy: %1$s</string>

View File

@ -411,7 +411,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">添加小部件</string>
<string name="activity_prefs_sleep_duration">睡眠时间目标</string>
<string name="appwidget_alarms_set">已设置一个闹钟为 %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">已设置一个闹钟为 %1$02d:%2$02d</string>
<string name="device_hw">硬件版本:%1$s</string>
<string name="device_fw">固件版本:%1$s</string>
<string name="error_creating_directory_for_logfiles">为日志文件创建目录时出错:%1$s</string>

View File

@ -494,7 +494,7 @@
<string name="appwidget_text">Zzz</string>
<string name="add_widget">Add widget</string>
<string name="activity_prefs_sleep_duration">Preferred sleep duration in hours</string>
<string name="appwidget_alarms_set">An alarm was set for %1$02d:%2$02d</string>
<string name="appwidget_setting_alarm">Setting alarm for %1$02d:%2$02d</string>
<string name="device_hw">Hardware revision: %1$s</string>
<string name="device_fw">Firmware version: %1$s</string>
<string name="error_creating_directory_for_logfiles">Error creating directory for log files: %1$s</string>