Added locale strings

This commit is contained in:
Alessandro Ferro 2022-10-28 10:48:50 +02:00
parent 11ca9fe623
commit 77337c19cf
10 changed files with 81 additions and 33 deletions

View File

@ -11,8 +11,8 @@
"type": "SINGLE", "type": "SINGLE",
"filters": [], "filters": [],
"attributes": [], "attributes": [],
"versionCode": 2, "versionCode": 3,
"versionName": "1.0", "versionName": "1.0.2",
"outputFile": "app-release.apk" "outputFile": "app-release.apk"
} }
], ],

View File

@ -69,9 +69,8 @@ public class MainActivity extends AppCompatActivity {
public void displayDrawOverlayPermissionDialog(){ public void displayDrawOverlayPermissionDialog(){
AlertDialog.Builder alert = new AlertDialog.Builder(this); AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Display over other apps"); alert.setTitle(R.string.display_over_other_apps);
alert.setMessage("Please, enable 'Display over other apps' permission. " + alert.setMessage(R.string.display_over_other_apps_request_description);
"It is required for using the option 'callme'");
alert.setPositiveButton("Settings", new DialogInterface.OnClickListener() { alert.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
@ -80,7 +79,7 @@ public class MainActivity extends AppCompatActivity {
} }
}); });
alert.setNeutralButton("Cancel", new DialogInterface.OnClickListener() { alert.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel(); dialogInterface.cancel();
@ -92,8 +91,7 @@ public class MainActivity extends AppCompatActivity {
public void requestAdminPermission(ComponentName cn){ public void requestAdminPermission(ComponentName cn){
Intent intent= new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); Intent intent= new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, cn); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, cn);
intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "The app requires this" + intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, R.string.admin_permission_request_description);
" permission to provide the 'lock' feature.");
startActivity(intent); startActivity(intent);
} }

View File

@ -59,8 +59,8 @@ public class SettingsActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
AlertDialog.Builder alert = new AlertDialog.Builder(SettingsActivity.this); AlertDialog.Builder alert = new AlertDialog.Builder(SettingsActivity.this);
alert.setTitle("Password"); alert.setTitle(R.string.password);
alert.setMessage("Enter Password"); alert.setMessage(R.string.choose_a_password);
EditText input = new EditText(SettingsActivity.this); EditText input = new EditText(SettingsActivity.this);
input.setTransformationMethod(new PasswordTransformationMethod()); input.setTransformationMethod(new PasswordTransformationMethod());
alert.setView(input); alert.setView(input);
@ -72,12 +72,12 @@ public class SettingsActivity extends AppCompatActivity {
settings.set(Settings.PASSWORD, CipherUtils.get256Sha(text)); settings.set(Settings.PASSWORD, CipherUtils.get256Sha(text));
} }
else{ else{
Toast.makeText(SettingsActivity.this, "Cannot use a blank password. Aborted!", Toast.LENGTH_LONG).show(); Toast.makeText(SettingsActivity.this, R.string.cannot_use_a_blank_password, Toast.LENGTH_LONG).show();
} }
} }
}); });
alert.setNeutralButton("Cancel", new DialogInterface.OnClickListener() { alert.setNeutralButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialogInterface, int i) { public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.cancel(); dialogInterface.cancel();
@ -114,7 +114,7 @@ public class SettingsActivity extends AppCompatActivity {
@Override @Override
public void afterTextChanged(Editable s) { public void afterTextChanged(Editable s) {
if (s.toString().isEmpty()) { if (s.toString().isEmpty()) {
Toast.makeText(SettingsActivity.this, "Empty SMS command not allowed, reverted to default (LMD)", Toast.LENGTH_LONG).show(); Toast.makeText(SettingsActivity.this, R.string.empty_sms_command_not_allowed, Toast.LENGTH_LONG).show();
settings.set(Settings.SMS_COMMAND, settings.defaultValues(Settings.SMS_COMMAND)); settings.set(Settings.SMS_COMMAND, settings.defaultValues(Settings.SMS_COMMAND));
} else { } else {
settings.set(Settings.SMS_COMMAND, s.toString()); settings.set(Settings.SMS_COMMAND, s.toString());

View File

@ -31,7 +31,7 @@ public class WhitelistContactsActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_whitelist_contacts); setContentView(R.layout.activity_whitelist_contacts);
setTitle("Whitelist"); setTitle(R.string.whitelist);
setViews(); setViews();
setListeners(); setListeners();
@ -50,7 +50,7 @@ public class WhitelistContactsActivity extends AppCompatActivity {
contactsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { contactsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override @Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
Toast.makeText(WhitelistContactsActivity.this, "Long click to delete", Toast.LENGTH_SHORT).show(); Toast.makeText(WhitelistContactsActivity.this, R.string.long_click_to_delete, Toast.LENGTH_SHORT).show();
} }
}); });
@ -106,7 +106,7 @@ public class WhitelistContactsActivity extends AppCompatActivity {
private void addNumberToWhiteList(String phoneNo){ private void addNumberToWhiteList(String phoneNo){
phoneNo = Utils.normalizePhoneNumber(phoneNo); phoneNo = Utils.normalizePhoneNumber(phoneNo);
if(contactsListView_datasource.contains(phoneNo)){ if(contactsListView_datasource.contains(phoneNo)){
Toast.makeText(this, "Contact already in the list", Toast.LENGTH_SHORT).show(); Toast.makeText(this, R.string.contact_already_in_the_list, Toast.LENGTH_SHORT).show();
return; return;
} }
whitelistDbHandler.addContact(phoneNo); whitelistDbHandler.addContact(phoneNo);

View File

@ -35,7 +35,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="10dp" android:layout_marginLeft="10dp"
android:layout_marginRight="10dp" android:layout_marginRight="10dp"
android:text="This software is open source licensed under General Public License v3.0\n\nSource code and instructions at\nhttps://www.github.com/xfarrow/locatemydevice" android:text="@string/app_open_source_description"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0" app:layout_constraintHorizontal_bias="0.0"

View File

@ -10,7 +10,7 @@
android:id="@+id/textView" android:id="@+id/textView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Locate my device is running" android:text="@string/locate_my_device_is_running"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497" app:layout_constraintHorizontal_bias="0.497"
@ -22,13 +22,13 @@
android:id="@+id/imageView" android:id="@+id/imageView"
android:layout_width="181dp" android:layout_width="181dp"
android:layout_height="171dp" android:layout_height="171dp"
android:contentDescription="logo"
android:src="@drawable/logo" android:src="@drawable/logo"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5" app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.5" /> app:layout_constraintVertical_bias="0.5"
android:contentDescription="logo" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -21,13 +21,13 @@
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:textSize="17sp" android:textSize="17sp"
android:text="SMS command" /> android:text="@string/sms_command" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:text="Choose a command to initialize the conversation with the smartphone" /> android:text="@string/sms_command_description" />
<EditText <EditText
android:id="@+id/editTextLmdCommand" android:id="@+id/editTextLmdCommand"
@ -50,13 +50,13 @@
android:textSize="17sp" android:textSize="17sp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:text="Password" /> android:text="@string/password" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:text="Choose a Password" /> android:text="@string/choose_a_password" />
<Button <Button
android:id="@+id/buttonEnterPassword" android:id="@+id/buttonEnterPassword"
@ -64,7 +64,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:text="Enter Password"/> android:text="@string/enter_password"/>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@ -78,13 +78,13 @@
android:textSize="17sp" android:textSize="17sp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:text="Whitelist" /> android:text="@string/whitelist" />
<Switch <Switch
android:id="@+id/SwitchWhitelist" android:id="@+id/SwitchWhitelist"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Enabled" android:text="@string/enabled"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
tools:ignore="UseSwitchCompatOrMaterialXml" /> tools:ignore="UseSwitchCompatOrMaterialXml" />
@ -92,7 +92,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:text="Only contacts in the whitelist are allowed to communicate with this smartphone"/> android:text="@string/whitelist_description"/>
<Button <Button
android:id="@+id/buttonAddContacts" android:id="@+id/buttonAddContacts"
@ -100,7 +100,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:text="Whitelist contacts"/> android:text="@string/whitelist_contacts"/>
<View <View
android:layout_width="match_parent" android:layout_width="match_parent"
@ -121,18 +121,20 @@
android:textSize="17sp" android:textSize="17sp"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:text="Info" /> android:text="@string/info" />
<TextView <TextView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="10dp" android:layout_marginStart="10dp"
android:text="Click here for more info"/> android:text="@string/click_here_for_more_info"/>
</LinearLayout> </LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider" />
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="sms_command">Comando SMS</string>
<string name="sms_command_description">Scegli un comando con cui inizializzare la conversazione con lo smartphone</string>
<string name="choose_a_password">Scegli una password</string>
<string name="enter_password">Inserisci password</string>
<string name="whitelist">Lista bianca</string>
<string name="enabled">Abilitata</string>
<string name="whitelist_description">Solo i contatti nella lista bianca sono autorizzati a comunicare con questo smartphone</string>
<string name="whitelist_contacts">Contatti in lista bianca</string>
<string name="info">Info</string>
<string name="click_here_for_more_info">Clicca qui per più info</string>
<string name="password">Password</string>
<string name="app_version">Versione app:</string>
<string name="app_open_source_description">Questo software è open source ed è sotto licenza GPLv3\n\nCodice sorgente ed istruzioni a\nhttps://www.github.com/xfarrow/locatemydevice</string>
<string name="app_name">Trova il mio dispositivo</string>
<string name="locate_my_device_is_running">Trova il mio dispositivo è in esecuzione</string>
<string name="display_over_other_apps">Mostra sulle altre app</string>
<string name="display_over_other_apps_request_description">Per favore, abilita l\'opzione \'mostra sulle altre app\'. Ciò è richiesto per le opzioni \'callme\' e \'show\'</string>
<string name="cancel">Annulla</string>
<string name="admin_permission_request_description">L\'app richiede questo permesso per utilizzare l\'opzione \'lock\'</string>
<string name="cannot_use_a_blank_password">Non è possibile usare una password vuota. Operazione annullata.</string>
<string name="empty_sms_command_not_allowed">Non è consentito usare un comando SMS vuoto. Ripristinato il valore di default (LMD)</string>
<string name="long_click_to_delete">Click prolungato per cancellare</string>
<string name="contact_already_in_the_list">Contatto già presente nella lista</string>
</resources>

View File

@ -1,3 +1,25 @@
<resources> <resources>
<string name="app_name">Locate my device</string> <string name="app_name">Locate my device</string>
<string name="sms_command">SMS command</string>
<string name="sms_command_description">Choose a command to initialize the conversation with the smartphone</string>
<string name="password">Password</string>
<string name="choose_a_password">Choose a password</string>
<string name="enter_password">Enter password</string>
<string name="whitelist">Whitelist</string>
<string name="enabled">Enabled</string>
<string name="whitelist_description">Only contacts in the whitelist are allowed to communicate with this smartphone</string>
<string name="whitelist_contacts">Whitelist contacts</string>
<string name="info">Info</string>
<string name="click_here_for_more_info">Click here for more info</string>
<string name="app_version">App version:</string>
<string name="app_open_source_description">This software is open source and licensed under GPLv3\n\nSource code and instructions at\nhttps://www.github.com/xfarrow/locatemydevice</string>
<string name="locate_my_device_is_running">Locate my device is running</string>
<string name="display_over_other_apps">Display over other apps</string>
<string name="display_over_other_apps_request_description">Please, enable \'Display over other apps\' permission. It is required for using the options \'callme\' and \'show\'</string>
<string name="cancel">Cancel</string>
<string name="admin_permission_request_description">The app requires this permission to provide the \'lock\' feature.</string>
<string name="cannot_use_a_blank_password">Cannot use a blank password. Aborted.</string>
<string name="empty_sms_command_not_allowed">Empty SMS command not allowed, reverted to default (LMD)</string>
<string name="long_click_to_delete">Long click to delete</string>
<string name="contact_already_in_the_list">Contact already in the list</string>
</resources> </resources>