1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Use constants for "rtl" and "contextualArabic" preferences

This commit is contained in:
cpfeiffer 2018-09-05 21:32:06 +02:00
parent bd162f6319
commit 4f7e5b256a
4 changed files with 10 additions and 7 deletions

View File

@ -32,6 +32,8 @@ public class GBPrefs {
private static final boolean AUTO_START_DEFAULT = true;
private static final String BG_JS_ENABLED = "pebble_enable_background_javascript";
private static final boolean BG_JS_ENABLED_DEFAULT = false;
public static final String RTL_SUPPORT = "rtl";
public static final String RTL_CONTEXTUAL_ARABIC = "contextualArabic";
public static boolean AUTO_RECONNECT_DEFAULT = true;
public static final String USER_NAME = "mi_user_alias";

View File

@ -18,7 +18,7 @@ public class RtlUtils {
*/
public static boolean rtlSupport()
{
return GBApplication.getPrefs().getBoolean("rtl", false);
return GBApplication.getPrefs().getBoolean(GBPrefs.RTL_SUPPORT, false);
}
public enum characterType{
@ -65,7 +65,7 @@ public class RtlUtils {
*/
public static boolean contextualSupport()
{
return GBApplication.getPrefs().getBoolean("contextualArabic", false);
return GBApplication.getPrefs().getBoolean(GBPrefs.RTL_CONTEXTUAL_ARABIC, false);
}
//map with brackets chars to change there direction

View File

@ -119,7 +119,7 @@ public class DeviceCommunicationServiceTestCase extends TestBase {
public void testRtlSupport() {
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("rtl", true);
editor.putBoolean(GBPrefs.RTL_SUPPORT, true);
editor.commit();
Intent intent = mDeviceService.createIntent().putExtra(EXTRA_NOTIFICATION_BODY, "English and עברית");

View File

@ -5,6 +5,7 @@ import android.content.SharedPreferences;
import org.junit.Test;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
import nodomain.freeyourgadget.gadgetbridge.util.RtlUtils;
import static org.junit.Assert.assertEquals;
@ -332,14 +333,14 @@ public class RtlUtilsTest extends TestBase {
private void setDefaultRtl() {
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
SharedPreferences.Editor editor = settings.edit();
editor.remove("rtl");
editor.remove(GBPrefs.RTL_SUPPORT);
editor.apply();
}
private void enableRtl(boolean enable) {
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("rtl", enable);
editor.putBoolean(GBPrefs.RTL_SUPPORT, enable);
editor.apply();
}
@ -355,14 +356,14 @@ public class RtlUtilsTest extends TestBase {
private void setDefaultContextual() {
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
SharedPreferences.Editor editor = settings.edit();
editor.remove("contextualArabic");
editor.remove(GBPrefs.RTL_CONTEXTUAL_ARABIC);
editor.apply();
}
private void enableContextual(boolean enable) {
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("contextualArabic", enable);
editor.putBoolean(GBPrefs.RTL_CONTEXTUAL_ARABIC, enable);
editor.apply();
}
}