aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMenny Even Danan <menny@evendanan.net>2016-02-22 16:07:51 +0000
committerMenny Even Danan <menny@evendanan.net>2016-02-22 16:07:51 +0000
commit2db8061475ed2193440195316355bb70839b3238 (patch)
treed673b2cb0a61bfc80ad1369bc7b1cc4d29317933 /src
parentab19b66e253f13d480ec2793731baeeb31c01fa7 (diff)
downloadAnySoftKeyboard-2db8061475ed2193440195316355bb70839b3238.tar.gz
AnySoftKeyboard-2db8061475ed2193440195316355bb70839b3238.tar.bz2
adding TESTING_BUILD flag1.7-beta1
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/anysoftkeyboard/AnySoftKeyboard.java2
-rw-r--r--src/main/java/com/anysoftkeyboard/AskPrefsImpl.java8
-rw-r--r--src/main/java/com/anysoftkeyboard/dictionaries/BTreeDictionary.java4
-rw-r--r--src/main/java/com/anysoftkeyboard/dictionaries/TextEntryState.java7
-rw-r--r--src/main/java/com/anysoftkeyboard/keyboards/KeyboardFactory.java6
-rw-r--r--src/main/java/com/anysoftkeyboard/receivers/PackagesChangedReceiver.java4
-rw-r--r--src/main/java/com/anysoftkeyboard/ui/settings/MainFragment.java2
-rw-r--r--src/main/java/com/anysoftkeyboard/ui/tutorials/TutorialsProvider.java2
-rw-r--r--src/main/java/com/anysoftkeyboard/utils/IMEUtil.java4
-rw-r--r--src/main/java/com/anysoftkeyboard/utils/Log.java30
-rw-r--r--src/main/java/com/menny/android/anysoftkeyboard/ChewbaccaUncaughtExceptionHandler.java4
-rw-r--r--src/main/java/com/menny/android/anysoftkeyboard/FeaturesSet.java1
12 files changed, 35 insertions, 39 deletions
diff --git a/src/main/java/com/anysoftkeyboard/AnySoftKeyboard.java b/src/main/java/com/anysoftkeyboard/AnySoftKeyboard.java
index cc815de20..71e496f56 100644
--- a/src/main/java/com/anysoftkeyboard/AnySoftKeyboard.java
+++ b/src/main/java/com/anysoftkeyboard/AnySoftKeyboard.java
@@ -792,7 +792,7 @@ public abstract class AnySoftKeyboard extends InputMethodService implements
@Override
public void onDisplayCompletions(CompletionInfo[] completions) {
- if (FeaturesSet.DEBUG_LOG) {
+ if (BuildConfig.DEBUG) {
Log.d(TAG, "Received completions:");
for (int i = 0; i < (completions != null ? completions.length : 0); i++) {
Log.d(TAG, " #" + i + ": " + completions[i]);
diff --git a/src/main/java/com/anysoftkeyboard/AskPrefsImpl.java b/src/main/java/com/anysoftkeyboard/AskPrefsImpl.java
index f0d3aea85..6808bb0db 100644
--- a/src/main/java/com/anysoftkeyboard/AskPrefsImpl.java
+++ b/src/main/java/com/anysoftkeyboard/AskPrefsImpl.java
@@ -106,11 +106,11 @@ public class AskPrefsImpl implements AskPrefs, OnSharedPreferenceChangeListener
public AskPrefsImpl(Context context) {
mContext = context;
- int currentAppVersion = BuildConfig.VERSION_CODE;
Log.i(TAG, "** Version: " + BuildConfig.VERSION_NAME);
- Log.i(TAG, "** Release code: " + currentAppVersion);
- Log.i(TAG, "** Debug: " + BuildConfig.DEBUG);
- Log.i(TAG, "** DEBUG_LOG: " + FeaturesSet.DEBUG_LOG);
+ Log.i(TAG, "** Release code: " + BuildConfig.VERSION_CODE);
+ Log.i(TAG, "** BUILD_TYPE: " + BuildConfig.BUILD_TYPE);
+ Log.i(TAG, "** DEBUG: " + BuildConfig.DEBUG);
+ Log.i(TAG, "** TESTING_BUILD: " + BuildConfig.TESTING_BUILD);
Log.i(TAG, "** CUTTING_EDGE: " + FeaturesSet.CUTTING_EDGE);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
//setting some statistics
diff --git a/src/main/java/com/anysoftkeyboard/dictionaries/BTreeDictionary.java b/src/main/java/com/anysoftkeyboard/dictionaries/BTreeDictionary.java
index a7425f001..856963500 100644
--- a/src/main/java/com/anysoftkeyboard/dictionaries/BTreeDictionary.java
+++ b/src/main/java/com/anysoftkeyboard/dictionaries/BTreeDictionary.java
@@ -28,7 +28,7 @@ import com.anysoftkeyboard.base.dictionaries.WordComposer;
import com.anysoftkeyboard.base.dictionaries.WordsCursor;
import com.anysoftkeyboard.utils.Log;
import com.menny.android.anysoftkeyboard.AnyApplication;
-import com.menny.android.anysoftkeyboard.FeaturesSet;
+import com.menny.android.anysoftkeyboard.BuildConfig;
public abstract class BTreeDictionary extends EditableDictionary {
@@ -84,7 +84,7 @@ public abstract class BTreeDictionary extends EditableDictionary {
addWordFromStorage(word, frequency);
}
cursor.moveToNext();
- if (FeaturesSet.DEBUG_LOG) {
+ if (BuildConfig.DEBUG) {
if (cursor.getPosition() % 25 == 0) {
Log.d(TAG, "Read %d out of %d words.", cursor.getPosition(), cursor.getCount());
}
diff --git a/src/main/java/com/anysoftkeyboard/dictionaries/TextEntryState.java b/src/main/java/com/anysoftkeyboard/dictionaries/TextEntryState.java
index 57bf101f3..2422acb74 100644
--- a/src/main/java/com/anysoftkeyboard/dictionaries/TextEntryState.java
+++ b/src/main/java/com/anysoftkeyboard/dictionaries/TextEntryState.java
@@ -22,7 +22,6 @@ import android.text.format.DateFormat;
import com.anysoftkeyboard.keyboards.Keyboard.Key;
import com.anysoftkeyboard.utils.Log;
import com.menny.android.anysoftkeyboard.BuildConfig;
-import com.menny.android.anysoftkeyboard.FeaturesSet;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -34,8 +33,6 @@ public class TextEntryState {
private static final String TAG = "TextEntryState";
- private static boolean LOGGING = FeaturesSet.DEBUG_LOG;
-
private static int sBackspaceCount = 0;
private static int sAutoSuggestCount = 0;
@@ -83,7 +80,7 @@ public class TextEntryState {
sActualChars = 0;
sState = State.START;
- if (LOGGING) {
+ if (DBG) {
try {
endSession();//closing any still(?) open session
sKeyLocationFile = context.openFileOutput("key.txt", Context.MODE_APPEND);
@@ -257,7 +254,7 @@ public class TextEntryState {
}
public static void keyPressedAt(Key key, int x, int y) {
- if (LOGGING && sKeyLocationFile != null && key.getCodeAtIndex(0, false) >= 32) {
+ if (DBG && sKeyLocationFile != null && key.getCodeAtIndex(0, false) >= 32) {
String out =
"KEY: " + (char) key.getCodeAtIndex(0, false)
+ " X: " + x
diff --git a/src/main/java/com/anysoftkeyboard/keyboards/KeyboardFactory.java b/src/main/java/com/anysoftkeyboard/keyboards/KeyboardFactory.java
index 482c1d6e1..f1e1c69df 100644
--- a/src/main/java/com/anysoftkeyboard/keyboards/KeyboardFactory.java
+++ b/src/main/java/com/anysoftkeyboard/keyboards/KeyboardFactory.java
@@ -23,7 +23,7 @@ import android.util.AttributeSet;
import com.anysoftkeyboard.addons.AddOn;
import com.anysoftkeyboard.addons.AddOnsFactory;
import com.anysoftkeyboard.utils.Log;
-import com.menny.android.anysoftkeyboard.FeaturesSet;
+import com.menny.android.anysoftkeyboard.BuildConfig;
import com.menny.android.anysoftkeyboard.R;
import java.util.ArrayList;
@@ -82,7 +82,7 @@ public class KeyboardFactory extends AddOnsFactory<KeyboardAddOnAndBuilder> {
enabledAddOns.add(addOn);
}
- if (FeaturesSet.DEBUG_LOG) {
+ if (BuildConfig.TESTING_BUILD) {
for (final KeyboardAddOnAndBuilder addOn : enabledAddOns) {
Log.d(TAG, "Factory provided addon: %s", addOn.getId());
}
@@ -128,7 +128,7 @@ public class KeyboardFactory extends AddOnsFactory<KeyboardAddOnAndBuilder> {
Log.e(TAG, "External Keyboard does not include all mandatory details! Will not create keyboard.");
return null;
} else {
- if (FeaturesSet.DEBUG_LOG) {
+ if (BuildConfig.DEBUG) {
Log.d(TAG,
"External keyboard details: prefId:" + prefId + " nameId:"
+ nameId + " resId:" + layoutResId
diff --git a/src/main/java/com/anysoftkeyboard/receivers/PackagesChangedReceiver.java b/src/main/java/com/anysoftkeyboard/receivers/PackagesChangedReceiver.java
index 8c8c982f1..70ef54439 100644
--- a/src/main/java/com/anysoftkeyboard/receivers/PackagesChangedReceiver.java
+++ b/src/main/java/com/anysoftkeyboard/receivers/PackagesChangedReceiver.java
@@ -24,7 +24,7 @@ import android.content.IntentFilter;
import com.anysoftkeyboard.AnySoftKeyboard;
import com.anysoftkeyboard.addons.AddOnsFactory;
import com.anysoftkeyboard.utils.Log;
-import com.menny.android.anysoftkeyboard.FeaturesSet;
+import com.menny.android.anysoftkeyboard.BuildConfig;
public class PackagesChangedReceiver extends BroadcastReceiver {
@@ -42,7 +42,7 @@ public class PackagesChangedReceiver extends BroadcastReceiver {
if (intent == null || intent.getData() == null || context == null)
return;
- if (FeaturesSet.DEBUG_LOG) {
+ if (BuildConfig.TESTING_BUILD) {
mSB.setLength(0);
String text = mSB.append("Package '").append(intent.getData()).append("' have been changed.").toString();
Log.d(TAG, text);
diff --git a/src/main/java/com/anysoftkeyboard/ui/settings/MainFragment.java b/src/main/java/com/anysoftkeyboard/ui/settings/MainFragment.java
index 5de05f119..7c2261b4b 100644
--- a/src/main/java/com/anysoftkeyboard/ui/settings/MainFragment.java
+++ b/src/main/java/com/anysoftkeyboard/ui/settings/MainFragment.java
@@ -62,7 +62,7 @@ public class MainFragment extends Fragment {
.commit();
}
View testingView = view.findViewById(R.id.testing_build_message);
- testingView.setVisibility(BuildConfig.BUILD_TYPE.equals("release")? View.GONE : View.VISIBLE);
+ testingView.setVisibility(BuildConfig.TESTING_BUILD? View.VISIBLE : View.GONE);
}
@Override
diff --git a/src/main/java/com/anysoftkeyboard/ui/tutorials/TutorialsProvider.java b/src/main/java/com/anysoftkeyboard/ui/tutorials/TutorialsProvider.java
index 53b7fe907..95a1dca0a 100644
--- a/src/main/java/com/anysoftkeyboard/ui/tutorials/TutorialsProvider.java
+++ b/src/main/java/com/anysoftkeyboard/ui/tutorials/TutorialsProvider.java
@@ -35,7 +35,7 @@ public class TutorialsProvider {
private static final String TAG = "ASK Tutorial";
public static void showDragonsIfNeeded(Context context) {
- if (BuildConfig.DEBUG && firstTestersTimeVersionLoaded(context)) {
+ if (BuildConfig.TESTING_BUILD && firstTestersTimeVersionLoaded(context)) {
Log.i(TAG, "TESTERS VERSION added");
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, new Intent(context, TestersNoticeActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0);
diff --git a/src/main/java/com/anysoftkeyboard/utils/IMEUtil.java b/src/main/java/com/anysoftkeyboard/utils/IMEUtil.java
index ad27cc9d1..6e457ff16 100644
--- a/src/main/java/com/anysoftkeyboard/utils/IMEUtil.java
+++ b/src/main/java/com/anysoftkeyboard/utils/IMEUtil.java
@@ -23,7 +23,7 @@ import android.view.inputmethod.InputMethodManager;
import com.anysoftkeyboard.AnySoftKeyboard;
import com.anysoftkeyboard.api.KeyCodes;
-import com.menny.android.anysoftkeyboard.FeaturesSet;
+import com.menny.android.anysoftkeyboard.BuildConfig;
import java.util.ArrayList;
@@ -128,7 +128,7 @@ public class IMEUtil {
}
}
}
- if (FeaturesSet.DEBUG_LOG) {
+ if (BuildConfig.DEBUG) {
Log.d(TAG, "editDistance:" + s + "," + t);
for (int i = 0; i < dp.length; ++i) {
StringBuffer sb = new StringBuffer();
diff --git a/src/main/java/com/anysoftkeyboard/utils/Log.java b/src/main/java/com/anysoftkeyboard/utils/Log.java
index f89886b3c..eefab5f49 100644
--- a/src/main/java/com/anysoftkeyboard/utils/Log.java
+++ b/src/main/java/com/anysoftkeyboard/utils/Log.java
@@ -20,9 +20,9 @@ import android.annotation.TargetApi;
import android.os.Build;
import android.support.annotation.NonNull;
-import java.util.ArrayList;
+import com.menny.android.anysoftkeyboard.BuildConfig;
-import static com.menny.android.anysoftkeyboard.BuildConfig.DEBUG;
+import java.util.ArrayList;
public class Log {
public static final String NEW_LINE = System.getProperty("line.separator");
@@ -30,18 +30,18 @@ public class Log {
private static final StringBuilder msFormatBuilder = new StringBuilder(1024);
private static final java.util.Formatter msFormatter = new java.util.Formatter(msFormatBuilder);
- private static final String[] msLogs = new String[DEBUG ? 225 : 0];
+ private static final String[] msLogs = new String[BuildConfig.TESTING_BUILD ? 225 : 0];
private static int msLogIndex = 0;
private synchronized static void addLog(String level, String tag, String message) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
msLogs[msLogIndex] = System.currentTimeMillis() + "-" + level + "-[" + tag + "] " + message;
msLogIndex = (msLogIndex + 1) % msLogs.length;
}
}
private synchronized static void addLog(String level, String tag, String message, Throwable t) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
addLog(level, tag, message);
addLog(level, tag, getStackTrace(t));
}
@@ -67,7 +67,7 @@ public class Log {
@NonNull
public synchronized static String getAllLogLines() {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
ArrayList<String> lines = getAllLogLinesList();
//now to build the string
StringBuilder sb = new StringBuilder("Log contains " + lines.size() + " lines:");
@@ -89,7 +89,7 @@ public class Log {
private static final String LVL_V = "V";
public static void v(String TAG, String text, Object... args) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
String msg = args == null ? text : msFormatter.format(text, args).toString();
msFormatBuilder.setLength(0);
android.util.Log.v(TAG, msg);
@@ -98,7 +98,7 @@ public class Log {
}
public static void v(String TAG, String text, Throwable t) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
android.util.Log.v(TAG, text, t);
addLog(LVL_V, TAG, text, t);
}
@@ -107,14 +107,14 @@ public class Log {
private static final String LVL_D = "D";
public static void d(String TAG, String text) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
android.util.Log.d(TAG, text);
addLog(LVL_D, TAG, text);
}
}
public static void d(String TAG, String text, Object... args) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
String msg = args == null ? text : msFormatter.format(text, args).toString();
msFormatBuilder.setLength(0);
android.util.Log.d(TAG, msg);
@@ -123,7 +123,7 @@ public class Log {
}
public static void d(String TAG, String text, Throwable t) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
android.util.Log.d(TAG, text, t);
addLog(LVL_D, TAG, text, t);
}
@@ -132,14 +132,14 @@ public class Log {
private static final String LVL_YELL = "YELL";
public static void yell(String TAG, String text) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
android.util.Log.w("YELL! "+TAG, text);
addLog(LVL_YELL, TAG, text);
}
}
public static void yell(String TAG, String text, Object... args) {
- if (DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
String msg = args == null ? text : msFormatter.format(text, args).toString();
msFormatBuilder.setLength(0);
android.util.Log.w("YELL! "+TAG, msg);
@@ -206,7 +206,7 @@ public class Log {
addLog(LVL_WTF, TAG, msg);
if (Build.VERSION.SDK_INT >= 8)
android.util.Log.wtf(TAG, msg);
- else if (DEBUG)
+ else if (BuildConfig.TESTING_BUILD)
throw new RuntimeException(msg);
else
android.util.Log.e(TAG, msg);
@@ -217,7 +217,7 @@ public class Log {
addLog(LVL_WTF, TAG, text, t);
if (Build.VERSION.SDK_INT >= 8)
android.util.Log.wtf(TAG, text, t);
- else if (DEBUG)
+ else if (BuildConfig.TESTING_BUILD)
throw new RuntimeException(text, t);
else
android.util.Log.e(TAG, text, t);
diff --git a/src/main/java/com/menny/android/anysoftkeyboard/ChewbaccaUncaughtExceptionHandler.java b/src/main/java/com/menny/android/anysoftkeyboard/ChewbaccaUncaughtExceptionHandler.java
index d2c291b51..d86927609 100644
--- a/src/main/java/com/menny/android/anysoftkeyboard/ChewbaccaUncaughtExceptionHandler.java
+++ b/src/main/java/com/menny/android/anysoftkeyboard/ChewbaccaUncaughtExceptionHandler.java
@@ -114,7 +114,7 @@ class ChewbaccaUncaughtExceptionHandler implements UncaughtExceptionHandler {
setTicker(mApp.getText(R.string.ime_crashed_ticker)).
setContentTitle(mApp.getText(R.string.ime_name)).
setContentText(mApp.getText(R.string.ime_crashed_sub_text)).
- setSubText(BuildConfig.DEBUG ? crashType : null/*not showing the type of crash in RELEASE mode*/).
+ setSubText(BuildConfig.TESTING_BUILD ? crashType : null/*not showing the type of crash in RELEASE mode*/).
setWhen(System.currentTimeMillis()).
setContentIntent(contentIntent).
setAutoCancel(true).
@@ -143,7 +143,7 @@ class ChewbaccaUncaughtExceptionHandler implements UncaughtExceptionHandler {
+ "Free: " + Runtime.getRuntime().freeMemory() + "\n" + "Max: "
+ Runtime.getRuntime().maxMemory() + "\n";
- if (BuildConfig.DEBUG) {
+ if (BuildConfig.TESTING_BUILD) {
try {
File target = DeveloperUtils.createMemoryDump();
mem += "Created hprof file at " + target.getAbsolutePath()
diff --git a/src/main/java/com/menny/android/anysoftkeyboard/FeaturesSet.java b/src/main/java/com/menny/android/anysoftkeyboard/FeaturesSet.java
index ffad8b5e0..3ecde7fde 100644
--- a/src/main/java/com/menny/android/anysoftkeyboard/FeaturesSet.java
+++ b/src/main/java/com/menny/android/anysoftkeyboard/FeaturesSet.java
@@ -19,7 +19,6 @@ package com.menny.android.anysoftkeyboard;
public class FeaturesSet {
- public static final boolean DEBUG_LOG = BuildConfig.DEBUG;
public static final boolean CUTTING_EDGE = BuildConfig.DEBUG;
}