diff --git a/app/src/main/java/com/jens/automation2/ActivityMainPoi.java b/app/src/main/java/com/jens/automation2/ActivityMainPoi.java
index 27d11989..2d8a1f73 100644
--- a/app/src/main/java/com/jens/automation2/ActivityMainPoi.java
+++ b/app/src/main/java/com/jens/automation2/ActivityMainPoi.java
@@ -44,6 +44,7 @@ public class ActivityMainPoi extends ActivityGeneric
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
+ Miscellaneous.setDisplayLanguage(ActivityMainPoi.this);
setContentView(R.layout.main_poi_layout);
instance = this;
diff --git a/app/src/main/java/com/jens/automation2/ActivityMainProfiles.java b/app/src/main/java/com/jens/automation2/ActivityMainProfiles.java
index 17a20d6f..cca51273 100644
--- a/app/src/main/java/com/jens/automation2/ActivityMainProfiles.java
+++ b/app/src/main/java/com/jens/automation2/ActivityMainProfiles.java
@@ -40,6 +40,7 @@ public class ActivityMainProfiles extends ActivityGeneric
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
+ Miscellaneous.setDisplayLanguage(ActivityMainProfiles.this);
setContentView(R.layout.main_profile_layout);
instance = this;
diff --git a/app/src/main/java/com/jens/automation2/ActivityMainRules.java b/app/src/main/java/com/jens/automation2/ActivityMainRules.java
index ed5bb741..d49648b3 100644
--- a/app/src/main/java/com/jens/automation2/ActivityMainRules.java
+++ b/app/src/main/java/com/jens/automation2/ActivityMainRules.java
@@ -47,7 +47,8 @@ public class ActivityMainRules extends ActivityGeneric
@Override
protected void onCreate(Bundle savedInstanceState)
{
- super.onCreate(savedInstanceState);
+ super.onCreate(savedInstanceState);
+ Miscellaneous.setDisplayLanguage(ActivityMainRules.this);
setContentView(R.layout.main_rule_layout);
instance = this;
diff --git a/app/src/main/java/com/jens/automation2/ActivityMainScreen.java b/app/src/main/java/com/jens/automation2/ActivityMainScreen.java
index ea9df837..4b3cef9c 100644
--- a/app/src/main/java/com/jens/automation2/ActivityMainScreen.java
+++ b/app/src/main/java/com/jens/automation2/ActivityMainScreen.java
@@ -6,9 +6,12 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.res.Configuration;
+import android.content.res.Resources;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
@@ -31,6 +34,7 @@ import com.jens.automation2.location.LocationProvider;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Locale;
@SuppressLint("NewApi")
public class ActivityMainScreen extends ActivityGeneric
@@ -51,6 +55,7 @@ public class ActivityMainScreen extends ActivityGeneric
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
+ Miscellaneous.setDisplayLanguage(ActivityMainScreen.this);
setContentView(R.layout.main_overview_layout);
activityMainScreenInstance = this;
diff --git a/app/src/main/java/com/jens/automation2/ActivityMainTabLayout.java b/app/src/main/java/com/jens/automation2/ActivityMainTabLayout.java
index 11ab97f5..bbdf5df1 100644
--- a/app/src/main/java/com/jens/automation2/ActivityMainTabLayout.java
+++ b/app/src/main/java/com/jens/automation2/ActivityMainTabLayout.java
@@ -3,12 +3,17 @@ package com.jens.automation2;
import android.annotation.SuppressLint;
import android.app.TabActivity;
import android.content.Intent;
+import android.content.res.Configuration;
+import android.content.res.Resources;
import android.os.Bundle;
+import android.util.DisplayMetrics;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;
import com.jens.automation2.receivers.NfcReceiver;
+import java.util.Locale;
+
@SuppressLint("NewApi")
public class ActivityMainTabLayout extends TabActivity
@@ -17,8 +22,8 @@ public class ActivityMainTabLayout extends TabActivity
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
-
Settings.readFromPersistentStorage(ActivityMainTabLayout.this);
+ Miscellaneous.setDisplayLanguage(ActivityMainTabLayout.this);
if(Settings.tabsPlacement == 1)
setContentView(R.layout.main_tab_layout_tabs_at_bottom);
diff --git a/app/src/main/java/com/jens/automation2/AutomationService.java b/app/src/main/java/com/jens/automation2/AutomationService.java
index 0119b5f7..9fb03a4e 100644
--- a/app/src/main/java/com/jens/automation2/AutomationService.java
+++ b/app/src/main/java/com/jens/automation2/AutomationService.java
@@ -12,6 +12,8 @@ import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
+import android.content.res.Configuration;
+import android.content.res.Resources;
import android.media.AudioManager;
import android.os.Binder;
import android.os.Build;
@@ -20,6 +22,7 @@ import android.os.Environment;
import android.os.IBinder;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.widget.Toast;
@@ -127,6 +130,8 @@ public class AutomationService extends Service implements OnInitListener
// Store a reference to myself. Other classes often need a context or something, this can provide that.
centralInstance = this;
+
+ Miscellaneous.setDisplayLanguage(AutomationService.this);
}
public boolean checkStartupRequirements(Context context, boolean startAtBoot)
diff --git a/app/src/main/java/com/jens/automation2/Miscellaneous.java b/app/src/main/java/com/jens/automation2/Miscellaneous.java
index 7006c41c..ef838767 100644
--- a/app/src/main/java/com/jens/automation2/Miscellaneous.java
+++ b/app/src/main/java/com/jens/automation2/Miscellaneous.java
@@ -15,6 +15,7 @@ import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
+import android.content.res.Resources;
import android.database.Cursor;
import android.media.AudioAttributes;
import android.media.RingtoneManager;
@@ -31,6 +32,7 @@ import android.provider.Settings.Secure;
import android.telephony.PhoneNumberUtils;
import android.telephony.TelephonyManager;
import android.util.Base64;
+import android.util.DisplayMetrics;
import android.util.Log;
import android.widget.Toast;
@@ -1985,4 +1987,20 @@ public class Miscellaneous extends Service
{
return context.getApplicationContext().getApplicationInfo().targetSdkVersion;
}
+
+ public static void setDisplayLanguage(Context context)
+ {
+ if(!Settings.displayLanguage.equals(Settings.default_displayLanguage))
+ {
+ Locale myLocale = new Locale(Settings.displayLanguage);
+ Resources res = context.getResources();
+ DisplayMetrics dm = res.getDisplayMetrics();
+ Configuration conf = res.getConfiguration();
+ conf.locale = myLocale;
+ res.updateConfiguration(conf, dm);
+ //Intent refresh = new Intent(this, AndroidLocalize.class);
+ //finish();
+ //startActivity(refresh);
+ }
+ }
}
\ No newline at end of file
diff --git a/app/src/main/java/com/jens/automation2/Settings.java b/app/src/main/java/com/jens/automation2/Settings.java
index 895a81b9..8717d389 100644
--- a/app/src/main/java/com/jens/automation2/Settings.java
+++ b/app/src/main/java/com/jens/automation2/Settings.java
@@ -68,6 +68,7 @@ public class Settings implements SharedPreferences
public static boolean showToasts;
public static boolean automaticUpdateCheck;
public static long musicCheckFrequency;
+ public static String displayLanguage;
public static boolean lockSoundChanges;
public static boolean noticeAndroid9MicrophoneShown;
@@ -138,6 +139,7 @@ public class Settings implements SharedPreferences
public static final long default_lastNewsPolltime = -1;
public static final long default_lastUpdateCheck = -1;
public static final long default_musicCheckFrequency = 2500;
+ public static final String default_displayLanguage = "systemDefaultLanguage";
@Override
public boolean contains(String arg0)
@@ -273,6 +275,7 @@ public class Settings implements SharedPreferences
tabsPlacement = Integer.parseInt(prefs.getString("tabsPlacement", String.valueOf(default_tabsPlacement)));
musicCheckFrequency = Long.parseLong(prefs.getString("musicCheckFrequency", String.valueOf(default_musicCheckFrequency)));
+ displayLanguage = prefs.getString("displayLanguage", default_displayLanguage);
if(Settings.musicCheckFrequency == 0)
Settings.musicCheckFrequency = Settings.default_musicCheckFrequency;
@@ -482,6 +485,9 @@ public class Settings implements SharedPreferences
if(!prefs.contains("musicCheckFrequency") || force)
editor.putLong("musicCheckFrequency", default_musicCheckFrequency);
+ if(!prefs.contains("displayLanguage") || force)
+ editor.putString("displayLanguage", default_displayLanguage);
+
if(!prefs.contains("lockSoundChanges") || force)
editor.putBoolean("lockSoundChanges", default_lockSoundChanges);
@@ -568,6 +574,8 @@ public class Settings implements SharedPreferences
Settings.musicCheckFrequency = Settings.default_musicCheckFrequency;
editor.putString("musicCheckFrequency", String.valueOf(musicCheckFrequency));
+ editor.putString("displayLanguage", displayLanguage);
+
editor.putBoolean("lockSoundChanges", lockSoundChanges);
editor.putBoolean("noticeAndroid9MicrophoneShown", noticeAndroid9MicrophoneShown);
editor.putBoolean("noticeAndroid10WifiShown", noticeAndroid10WifiShown);
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index 5eec7a1b..8ce9375b 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -59,6 +59,13 @@
android:entries="@array/tabsPlacementOptions"
android:entryValues="@array/tabsPlacementOptionsValues" />
+
+
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 8e12ecb3..2aa457c8 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -1,5 +1,13 @@
+ System Standard
+ Englisch
+ Deutsch
+ Italienisch
+ Spanisch
+ Niederländisch
+ Russisch
+ Französisch
Aktiviere Regel %1$s
Aktiviere Profil %1$s
Aktiviere Regel %1$s im Umkehrmodus
@@ -780,4 +788,7 @@
Toasts anzeigen
Popups anzeigen, wenn Ereignisse wie Regelausführungen auftreten
Nachdem Sie auf OK geklickt haben, wählen Sie Automatisierung, dann \"Benachrichtigungszugriff zulassen\" und dann \"Zulassen\".
+ Anzeigesprache
+ Bestimmte Anzeigesprache wählen
+ B
\ No newline at end of file
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index 4caccedd..c2859098 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -1,5 +1,13 @@
+ Predeterminado
+ Inglés
+ Alemán
+ Italiano
+ Español
+ Holandés
+ Ruso
+ Francés
Estoy activando regla %1$s
Estoy activando perfil %1$s
Estoy activando regla %1$s en el modo de invertir
@@ -779,4 +787,6 @@
Mostrar toasts
Mostrar notificaciones del sistema cuando se producen eventos como ejecuciones de reglas
Después de hacer clcliquear en OK, seleccione Automation, luego seleccione \"Permitir acceso a notificaciones\", luego \"Permitir\".
+ Idioma de visualización
+ Establecer un idioma personalizado para la aplicación
\ No newline at end of file
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index a2ca330e..3d96a930 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -1,5 +1,13 @@
+ Valeur par défaut du système
+ Anglais
+ Allemand
+ Italien
+ Espagnol
+ Néerlandais
+ Russe
+ Français
Activation de la règle %1$s
Activation du profil %1$s
Activation de la règle %1$s en mode alternatif
@@ -779,4 +787,6 @@
Afficher les toasts
Afficher les toasts lorsque des événements tels que des exécutions de règles se produisent
Après avoir cliqué sur OK, sélectionnez Automatisation, puis sélectionnez « Autoriser l\'accès aux notifications », puis « Autoriser ».
+ Langue d\'affichage
+ Définir une langue personnalisée pour l\'application
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 0cb7d36c..b1747eb1 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -396,6 +396,14 @@
Roaming
È necessario avere i permessi di root per utilizzare questa funzione. Una volta abilitato l\'accesso root, dovrai \"eseguire la regola manualmente\" per attivare la richiesta di autorizzazione come superuser. Nella finestra di popup di superuser, bisognerà consentire sempre l\'esecuzione dell\'applicazione con questi permessi. In caso contrario, la regola non potrà funzionare quando il telefono è inattivo.
Regola
+ Impostazione predefinita del sistema
+ Inglese
+ Tedesco
+ Italiano
+ Spagnolo
+ Olandese
+ Russo
+ Francese
Attivando la regola %1$s
Attivando la regola %1$s in modalità reversibile
Regola attiva
@@ -780,4 +788,6 @@
Mostra toast
Mostrare gli avvisi popup quando si verificano eventi come le esecuzioni di regole
Dopo aver fatto clic su OK, selezionare Automazione, quindi selezionare \"Consenti accesso alle notifiche\", quindi \"Consenti\".
+ Lingua di visualizzazione
+ Set a custom language for the application
diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index e8fac35d..ed213a2c 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -1,4 +1,12 @@
+ Systeemstandaard
+ Engels
+ Duits
+ Italiaans
+ Spaans
+ Nederlands
+ Russisch
+ Frans
Activering regel %1$s
Activeren profiel %1$s
Activeren regel %1$s in Togglemode
@@ -778,5 +786,7 @@
Toon toasts
Pop-ups weergeven wanneer gebeurtenissen zoals regeluitvoeringen plaatsvinden
Nadat u op OK hebt geklikt, selecteert u Automatisering, selecteert u vervolgens \"Toegang tot meldingen toestaan\" en vervolgens \"toestaan\".
+ Taal weergeven
+ Een aangepaste taal instellen voor de toepassing
diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml
index 13084154..4fe55d72 100644
--- a/app/src/main/res/values-ru/strings.xml
+++ b/app/src/main/res/values-ru/strings.xml
@@ -1,5 +1,13 @@
+ Системное значение по умолчанию
+ Английский
+ Немецкий
+ Итальянский
+ Испанский
+ Нидерландский
+ русский
+ Французский
Активация правила %1$s
Активация профиля %1$s
Активация правила %1$s в режиме переключения
@@ -837,4 +845,6 @@
Показать тосты
Отображение всплывающих уведомлений при таких событиях, как выполнение правил
После нажатия кнопки «ОК» выберите «Автоматизация», затем выберите «Разрешить доступ к уведомлениям», затем «Разрешить».
+ Язык интерфейса
+ Язык интерфейса
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 2fdce81c..19212da5 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -22,6 +22,28 @@
- 3
+
+ - @string/languageSystemDefault
+ - @string/languageEnglish
+ - @string/languageGerman
+ - @string/languageItalian
+ - @string/languageSpanish
+ - @string/languageDutch
+ - @string/languageRussian
+ - @string/languageFrench
+
+
+
+ - systemDefaultLanguage
+ - en
+ - de
+ - it
+ - es
+ - nl
+ - ru
+ - fr
+
+
- @string/top
- @string/bottom
@@ -33,4 +55,12 @@
- 3
+ System default
+ English
+ German
+ Italian
+ Spanish
+ Dutch
+ Russian
+ French
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ab0e9db4..39964fc2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -877,4 +877,6 @@
Show toasts
Show toasts when events like rule executions occur
After clicking ok, select Automation, then select \"Allow notification access\", then \"allow\".
+ Display language
+ Set a custom language for the application
\ No newline at end of file
diff --git a/fastlane/metadata/android/en-US/changelogs/127.txt b/fastlane/metadata/android/en-US/changelogs/127.txt
index ae24b570..1b90ec02 100644
--- a/fastlane/metadata/android/en-US/changelogs/127.txt
+++ b/fastlane/metadata/android/en-US/changelogs/127.txt
@@ -1 +1,2 @@
-* Fixed: Editing variable action was not possible
\ No newline at end of file
+* Fixed: Editing variable action was not possible
+* Added: Possibility to pick a custom language in settings
\ No newline at end of file