abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2/Config.java
diff options
context:
space:
mode:
authorJules Aguillon2021-12-19 19:44:27 +0100
committerJules Aguillon2021-12-19 19:44:27 +0100
commit1cfecbdf48edb65cc0be8b017c8f389f91212a32 (patch)
treec15f27b20e63aaf959cbf7d91701b3cfff01b098 /srcs/juloo.keyboard2/Config.java
parent988d8db7e8a6f539a8e6f40c66df7b87571a88e9 (diff)
downloadunexpected-keyboard-1cfecbdf48edb65cc0be8b017c8f389f91212a32.tar.gz
unexpected-keyboard-1cfecbdf48edb65cc0be8b017c8f389f91212a32.zip
Auto-format Java and XML files
Use xmllint. Re-indent Java files using spaces.
Diffstat (limited to 'srcs/juloo.keyboard2/Config.java')
-rw-r--r--srcs/juloo.keyboard2/Config.java118
1 files changed, 59 insertions, 59 deletions
diff --git a/srcs/juloo.keyboard2/Config.java b/srcs/juloo.keyboard2/Config.java
index 8c6a46a..7f1b395 100644
--- a/srcs/juloo.keyboard2/Config.java
+++ b/srcs/juloo.keyboard2/Config.java
@@ -7,25 +7,25 @@ import android.util.TypedValue;
class Config
{
- private Keyboard2 _context;
+ private Keyboard2 _context;
// From resources
- public final float marginTop;
- public final float keyPadding;
- public final float keyVerticalInterval;
- public final float keyHorizontalInterval;
- public final float keyRound;
+ public final float marginTop;
+ public final float keyPadding;
+ public final float keyVerticalInterval;
+ public final float keyHorizontalInterval;
+ public final float keyRound;
// From preferences
public int layout; // Or '-1' for the system defaults
- public float subValueDist;
- public boolean vibrateEnabled;
- public long vibrateDuration;
- public long longPressTimeout;
- public long longPressInterval;
- public float marginBottom;
- public float keyHeight;
- public float horizontalMargin;
+ public float subValueDist;
+ public boolean vibrateEnabled;
+ public long vibrateDuration;
+ public long longPressTimeout;
+ public long longPressInterval;
+ public float marginBottom;
+ public float keyHeight;
+ public float horizontalMargin;
public boolean preciseRepeat;
public float characterSize; // Ratio
public int accents; // Values are R.values.pref_accents_v_*
@@ -34,67 +34,67 @@ class Config
public boolean shouldOfferSwitchingToNextInputMethod;
public int accent_flags_to_remove;
- public Config(Keyboard2 context)
- {
- Resources res = context.getResources();
+ public Config(Keyboard2 context)
+ {
+ Resources res = context.getResources();
- _context = context;
- // static values
- marginTop = res.getDimension(R.dimen.margin_top);
- keyPadding = res.getDimension(R.dimen.key_padding);
- keyVerticalInterval = res.getDimension(R.dimen.key_vertical_interval);
- keyHorizontalInterval = res.getDimension(R.dimen.key_horizontal_interval);
- keyRound = res.getDimension(R.dimen.key_round);
- // default values
+ _context = context;
+ // static values
+ marginTop = res.getDimension(R.dimen.margin_top);
+ keyPadding = res.getDimension(R.dimen.key_padding);
+ keyVerticalInterval = res.getDimension(R.dimen.key_vertical_interval);
+ keyHorizontalInterval = res.getDimension(R.dimen.key_horizontal_interval);
+ keyRound = res.getDimension(R.dimen.key_round);
+ // default values
layout = -1;
- subValueDist = 10f;
- vibrateEnabled = true;
- vibrateDuration = 20;
- longPressTimeout = 600;
- longPressInterval = 65;
- marginBottom = res.getDimension(R.dimen.margin_bottom);
- keyHeight = res.getDimension(R.dimen.key_height);
- horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
+ subValueDist = 10f;
+ vibrateEnabled = true;
+ vibrateDuration = 20;
+ longPressTimeout = 600;
+ longPressInterval = 65;
+ marginBottom = res.getDimension(R.dimen.margin_bottom);
+ keyHeight = res.getDimension(R.dimen.key_height);
+ horizontalMargin = res.getDimension(R.dimen.horizontal_margin);
preciseRepeat = true;
characterSize = 1.f;
accents = 1;
- // from prefs
- refresh();
+ // from prefs
+ refresh();
// initialized later
shouldOfferSwitchingToNextInputMethod = false;
accent_flags_to_remove = 0;
- }
+ }
- /*
- ** Reload prefs
- */
- public void refresh()
- {
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_context);
+ /*
+ ** Reload prefs
+ */
+ public void refresh()
+ {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_context);
layout = layoutId_of_string(prefs.getString("layout", "system"));
- subValueDist = prefs.getFloat("sub_value_dist", subValueDist);
- vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled);
- vibrateDuration = prefs.getInt("vibrate_duration", (int)vibrateDuration);
- longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout);
- longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval);
- marginBottom = getDipPref(prefs, "margin_bottom", marginBottom);
- keyHeight = getDipPref(prefs, "key_height", keyHeight);
- horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
+ subValueDist = prefs.getFloat("sub_value_dist", subValueDist);
+ vibrateEnabled = prefs.getBoolean("vibrate_enabled", vibrateEnabled);
+ vibrateDuration = prefs.getInt("vibrate_duration", (int)vibrateDuration);
+ longPressTimeout = prefs.getInt("longpress_timeout", (int)longPressTimeout);
+ longPressInterval = prefs.getInt("longpress_interval", (int)longPressInterval);
+ marginBottom = getDipPref(prefs, "margin_bottom", marginBottom);
+ keyHeight = getDipPref(prefs, "key_height", keyHeight);
+ horizontalMargin = getDipPref(prefs, "horizontal_margin", horizontalMargin);
preciseRepeat = prefs.getBoolean("precise_repeat", preciseRepeat);
characterSize = prefs.getFloat("character_size", characterSize);
accents = Integer.valueOf(prefs.getString("accents", "1"));
- }
+ }
- private float getDipPref(SharedPreferences prefs, String pref_name, float def)
- {
- int value = prefs.getInt(pref_name, -1);
+ private float getDipPref(SharedPreferences prefs, String pref_name, float def)
+ {
+ int value = prefs.getInt(pref_name, -1);
- if (value < 0)
- return (def);
- return (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value,
- _context.getResources().getDisplayMetrics()));
- }
+ if (value < 0)
+ return (def);
+ return (TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, value,
+ _context.getResources().getDisplayMetrics()));
+ }
public static int layoutId_of_string(String name)
{