mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-04 05:25:15 +02:00
Use constants for "rtl" and "contextualArabic" preferences
This commit is contained in:
parent
bd162f6319
commit
4f7e5b256a
@ -32,6 +32,8 @@ public class GBPrefs {
|
|||||||
private static final boolean AUTO_START_DEFAULT = true;
|
private static final boolean AUTO_START_DEFAULT = true;
|
||||||
private static final String BG_JS_ENABLED = "pebble_enable_background_javascript";
|
private static final String BG_JS_ENABLED = "pebble_enable_background_javascript";
|
||||||
private static final boolean BG_JS_ENABLED_DEFAULT = false;
|
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 boolean AUTO_RECONNECT_DEFAULT = true;
|
||||||
|
|
||||||
public static final String USER_NAME = "mi_user_alias";
|
public static final String USER_NAME = "mi_user_alias";
|
||||||
|
@ -18,7 +18,7 @@ public class RtlUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean rtlSupport()
|
public static boolean rtlSupport()
|
||||||
{
|
{
|
||||||
return GBApplication.getPrefs().getBoolean("rtl", false);
|
return GBApplication.getPrefs().getBoolean(GBPrefs.RTL_SUPPORT, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum characterType{
|
public enum characterType{
|
||||||
@ -65,7 +65,7 @@ public class RtlUtils {
|
|||||||
*/
|
*/
|
||||||
public static boolean contextualSupport()
|
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
|
//map with brackets chars to change there direction
|
||||||
|
@ -119,7 +119,7 @@ public class DeviceCommunicationServiceTestCase extends TestBase {
|
|||||||
public void testRtlSupport() {
|
public void testRtlSupport() {
|
||||||
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putBoolean("rtl", true);
|
editor.putBoolean(GBPrefs.RTL_SUPPORT, true);
|
||||||
editor.commit();
|
editor.commit();
|
||||||
|
|
||||||
Intent intent = mDeviceService.createIntent().putExtra(EXTRA_NOTIFICATION_BODY, "English and עברית");
|
Intent intent = mDeviceService.createIntent().putExtra(EXTRA_NOTIFICATION_BODY, "English and עברית");
|
||||||
|
@ -5,6 +5,7 @@ import android.content.SharedPreferences;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.util.GBPrefs;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.util.RtlUtils;
|
import nodomain.freeyourgadget.gadgetbridge.util.RtlUtils;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
@ -332,14 +333,14 @@ public class RtlUtilsTest extends TestBase {
|
|||||||
private void setDefaultRtl() {
|
private void setDefaultRtl() {
|
||||||
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.remove("rtl");
|
editor.remove(GBPrefs.RTL_SUPPORT);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableRtl(boolean enable) {
|
private void enableRtl(boolean enable) {
|
||||||
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putBoolean("rtl", enable);
|
editor.putBoolean(GBPrefs.RTL_SUPPORT, enable);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,14 +356,14 @@ public class RtlUtilsTest extends TestBase {
|
|||||||
private void setDefaultContextual() {
|
private void setDefaultContextual() {
|
||||||
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.remove("contextualArabic");
|
editor.remove(GBPrefs.RTL_CONTEXTUAL_ARABIC);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableContextual(boolean enable) {
|
private void enableContextual(boolean enable) {
|
||||||
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
SharedPreferences settings = GBApplication.getPrefs().getPreferences();
|
||||||
SharedPreferences.Editor editor = settings.edit();
|
SharedPreferences.Editor editor = settings.edit();
|
||||||
editor.putBoolean("contextualArabic", enable);
|
editor.putBoolean(GBPrefs.RTL_CONTEXTUAL_ARABIC, enable);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user