abouttreesummaryrefslogcommitdiff
path: root/srcs/juloo.keyboard2
diff options
context:
space:
mode:
Diffstat (limited to 'srcs/juloo.keyboard2')
-rw-r--r--srcs/juloo.keyboard2/CustomExtraKeysPreference.java5
-rw-r--r--srcs/juloo.keyboard2/Keyboard2.java19
-rw-r--r--srcs/juloo.keyboard2/Logs.java34
3 files changed, 40 insertions, 18 deletions
diff --git a/srcs/juloo.keyboard2/CustomExtraKeysPreference.java b/srcs/juloo.keyboard2/CustomExtraKeysPreference.java
index 228eae8..668e6f1 100644
--- a/srcs/juloo.keyboard2/CustomExtraKeysPreference.java
+++ b/srcs/juloo.keyboard2/CustomExtraKeysPreference.java
@@ -109,7 +109,10 @@ public class CustomExtraKeysPreference extends PreferenceCategory
for (int i = 0; i < arr.length(); i++)
keys.add(arr.getString(i));
}
- catch (JSONException e) {}
+ catch (JSONException e)
+ {
+ Logs.err_load_custom_extra_keys(e);
+ }
return keys;
}
diff --git a/srcs/juloo.keyboard2/Keyboard2.java b/srcs/juloo.keyboard2/Keyboard2.java
index 4b82c33..48e60db 100644
--- a/srcs/juloo.keyboard2/Keyboard2.java
+++ b/srcs/juloo.keyboard2/Keyboard2.java
@@ -26,8 +26,6 @@ import java.util.Set;
public class Keyboard2 extends InputMethodService
implements SharedPreferences.OnSharedPreferenceChangeListener
{
- static private final String TAG = "Keyboard2";
-
private Keyboard2View _keyboardView;
private KeyEventHandler _keyeventhandler;
// If not 'null', the layout to use instead of [_currentTextLayout].
@@ -40,8 +38,6 @@ public class Keyboard2 extends InputMethodService
private Config _config;
- private boolean _debug_logs = false;
-
/** Layout currently visible. */
KeyboardData current_layout()
{
@@ -87,7 +83,7 @@ public class Keyboard2 extends InputMethodService
_config = Config.globalConfig();
_keyboardView = (Keyboard2View)inflate_view(R.layout.keyboard);
_keyboardView.reset();
- _debug_logs = getResources().getBoolean(R.bool.debug_logs);
+ Logs.set_debug_logs(getResources().getBoolean(R.bool.debug_logs));
}
private List<InputMethodSubtype> getEnabledSubtypes(InputMethodManager imm)
@@ -239,16 +235,6 @@ public class Keyboard2 extends InputMethodService
return null;
}
- private void log_editor_info(EditorInfo info)
- {
- LogPrinter p = new LogPrinter(Log.DEBUG, TAG);
- info.dump(p, "");
- if (info.extras != null)
- Log.d(TAG, "extras: "+info.extras.toString());
- Log.d(TAG, "swapEnterActionKey: "+_config.swapEnterActionKey);
- Log.d(TAG, "actionLabel: "+_config.actionLabel);
- }
-
private void refresh_special_layout(EditorInfo info)
{
switch (info.inputType & InputType.TYPE_MASK_CLASS)
@@ -274,8 +260,7 @@ public class Keyboard2 extends InputMethodService
_keyboardView.setKeyboard(current_layout());
_keyeventhandler.started(info);
setInputView(_keyboardView);
- if (_debug_logs)
- log_editor_info(info);
+ Logs.debug_startup_input_view(info, _config);
}
@Override
diff --git a/srcs/juloo.keyboard2/Logs.java b/srcs/juloo.keyboard2/Logs.java
new file mode 100644
index 0000000..ee44e21
--- /dev/null
+++ b/srcs/juloo.keyboard2/Logs.java
@@ -0,0 +1,34 @@
+package juloo.keyboard2;
+
+import android.util.Log;
+import android.util.LogPrinter;
+import android.view.inputmethod.EditorInfo;
+import org.json.JSONException;
+
+public final class Logs
+{
+ static final String TAG = "juloo.keyboard2";
+
+ static LogPrinter _debug_logs = null;
+
+ public static void set_debug_logs(boolean d)
+ {
+ _debug_logs = d ? new LogPrinter(Log.DEBUG, TAG) : null;
+ }
+
+ public static void debug_startup_input_view(EditorInfo info, Config conf)
+ {
+ if (_debug_logs == null)
+ return;
+ info.dump(_debug_logs, "");
+ if (info.extras != null)
+ _debug_logs.println("extras: "+info.extras.toString());
+ _debug_logs.println("swapEnterActionKey: "+conf.swapEnterActionKey);
+ _debug_logs.println("actionLabel: "+conf.actionLabel);
+ }
+
+ public static void err_load_custom_extra_keys(JSONException e)
+ {
+ Log.e(TAG, "Failed to read custom extra keys from preferences", e);
+ }
+}