diff --git a/java/res/layout/research_splash.xml b/java/res/layout/research_splash.xml
deleted file mode 100644
index 56fd7024f..000000000
--- a/java/res/layout/research_splash.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/java/res/values/research_strings.xml b/java/res/values/research_strings.xml
new file mode 100644
index 000000000..2cad15eb0
--- /dev/null
+++ b/java/res/values/research_strings.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml
index 35cbcf3c4..bd60844a3 100644
--- a/java/res/values/strings.xml
+++ b/java/res/values/strings.xml
@@ -278,16 +278,11 @@
- Usage Participation
-
+ Warning
+
+
- Thank you for dogfooding this keyboard.\n\nIf you like it, please help us make it better by sending us usage information. When enabled, the keyboard uploads general statistics, such as how fast you type, and also occasional samples of how you type words.\n\nNo passwords or non-dictionary words are ever automatically uploaded, and words are sampled infrequently enough so that reconstructing the meaning of what you typed is highly unlikely.\n\nYou can disable and reenable logging through the RLog menu by long-pressing on the microphone or settings key.\n
-
-
- Do not send\nusage info
-
-
- Send usage info
+ Logging Disabled
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 76f495729..39c3a808f 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -1309,7 +1309,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
break;
case Keyboard.CODE_RESEARCH:
if (ProductionFlag.IS_EXPERIMENTAL) {
- ResearchLogger.getInstance().presentResearchDialog(this);
+ ResearchLogger.getInstance().onResearchKeySelected(this);
}
break;
default:
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 9bb81a034..5c2487195 100644
--- a/java/src/com/android/inputmethod/research/ResearchLogger.java
+++ b/java/src/com/android/inputmethod/research/ResearchLogger.java
@@ -35,6 +35,7 @@ import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.inputmethodservice.InputMethodService;
+import android.net.Uri;
import android.os.Build;
import android.os.IBinder;
import android.os.SystemClock;
@@ -43,15 +44,12 @@ import android.text.format.DateUtils;
import android.util.Log;
import android.view.KeyEvent;
import android.view.MotionEvent;
-import android.view.View;
-import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.CompletionInfo;
import android.view.inputmethod.CorrectionInfo;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
-import android.widget.Button;
import android.widget.Toast;
import com.android.inputmethod.keyboard.Key;
@@ -251,44 +249,49 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
if (windowToken == null) {
return;
}
- mSplashDialog = new Dialog(mInputMethodService, android.R.style.Theme_Holo_Dialog);
- mSplashDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
- mSplashDialog.setContentView(R.layout.research_splash);
- mSplashDialog.setCancelable(true);
+ final AlertDialog.Builder builder = new AlertDialog.Builder(mInputMethodService)
+ .setTitle(R.string.research_splash_title)
+ .setMessage(R.string.research_splash_content)
+ .setPositiveButton(android.R.string.yes,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ onUserLoggingConsent();
+ mSplashDialog.dismiss();
+ }
+ })
+ .setNegativeButton(android.R.string.no,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ final String packageName = mInputMethodService.getPackageName();
+ final Uri packageUri = Uri.parse("package:" + packageName);
+ final Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE,
+ packageUri);
+ intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ mInputMethodService.startActivity(intent);
+ }
+ })
+ .setCancelable(true)
+ .setOnCancelListener(
+ new OnCancelListener() {
+ @Override
+ public void onCancel(DialogInterface dialog) {
+ mInputMethodService.requestHideSelf(0);
+ }
+ });
+ mSplashDialog = builder.create();
final Window w = mSplashDialog.getWindow();
final WindowManager.LayoutParams lp = w.getAttributes();
lp.token = windowToken;
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
w.setAttributes(lp);
w.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
- mSplashDialog.setOnCancelListener(new OnCancelListener() {
- @Override
- public void onCancel(DialogInterface dialog) {
- mInputMethodService.requestHideSelf(0);
- }
- });
- final Button doNotLogButton = (Button) mSplashDialog.findViewById(
- R.id.research_do_not_log_button);
- doNotLogButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- onUserLoggingElection(false);
- mSplashDialog.dismiss();
- }
- });
- final Button doLogButton = (Button) mSplashDialog.findViewById(R.id.research_do_log_button);
- doLogButton.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View v) {
- onUserLoggingElection(true);
- mSplashDialog.dismiss();
- }
- });
mSplashDialog.show();
}
- public void onUserLoggingElection(final boolean enableLogging) {
- setLoggingAllowed(enableLogging);
+ public void onUserLoggingConsent() {
+ setLoggingAllowed(true);
if (mPrefs == null) {
return;
}
@@ -450,12 +453,18 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
prefsChanged(prefs);
}
- public void presentResearchDialog(final LatinIME latinIME) {
+ public void onResearchKeySelected(final LatinIME latinIME) {
if (mInFeedbackDialog) {
Toast.makeText(latinIME, R.string.research_please_exit_feedback_form,
Toast.LENGTH_LONG).show();
return;
}
+ presentFeedbackDialog(latinIME);
+ }
+
+ // TODO: currently unreachable. Remove after being sure no menu is needed.
+ /*
+ public void presentResearchDialog(final LatinIME latinIME) {
final CharSequence title = latinIME.getString(R.string.english_ime_research_log);
final boolean showEnable = mIsLoggingSuspended || !sIsLogging;
final CharSequence[] items = new CharSequence[] {
@@ -472,28 +481,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
presentFeedbackDialog(latinIME);
break;
case 1:
- if (showEnable) {
- if (!sIsLogging) {
- setLoggingAllowed(true);
- }
- resumeLogging();
- Toast.makeText(latinIME,
- R.string.research_notify_session_logging_enabled,
- Toast.LENGTH_LONG).show();
- } else {
- Toast toast = Toast.makeText(latinIME,
- R.string.research_notify_session_log_deleting,
- Toast.LENGTH_LONG);
- toast.show();
- boolean isLogDeleted = abort();
- final long currentTime = System.currentTimeMillis();
- final long resumeTime = currentTime + 1000 * 60 *
- SUSPEND_DURATION_IN_MINUTES;
- suspendLoggingUntil(resumeTime);
- toast.cancel();
- Toast.makeText(latinIME, R.string.research_notify_logging_suspended,
- Toast.LENGTH_LONG).show();
- }
+ enableOrDisable(showEnable, latinIME);
break;
}
}
@@ -504,6 +492,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
.setTitle(title);
latinIME.showOptionDialog(builder.create());
}
+ */
private boolean mInFeedbackDialog = false;
public void presentFeedbackDialog(LatinIME latinIME) {
@@ -511,6 +500,35 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
latinIME.launchKeyboardedDialogActivity(FeedbackActivity.class);
}
+ // TODO: currently unreachable. Remove after being sure enable/disable is
+ // not needed.
+ /*
+ public void enableOrDisable(final boolean showEnable, final LatinIME latinIME) {
+ if (showEnable) {
+ if (!sIsLogging) {
+ setLoggingAllowed(true);
+ }
+ resumeLogging();
+ Toast.makeText(latinIME,
+ R.string.research_notify_session_logging_enabled,
+ Toast.LENGTH_LONG).show();
+ } else {
+ Toast toast = Toast.makeText(latinIME,
+ R.string.research_notify_session_log_deleting,
+ Toast.LENGTH_LONG);
+ toast.show();
+ boolean isLogDeleted = abort();
+ final long currentTime = System.currentTimeMillis();
+ final long resumeTime = currentTime + 1000 * 60 *
+ SUSPEND_DURATION_IN_MINUTES;
+ suspendLoggingUntil(resumeTime);
+ toast.cancel();
+ Toast.makeText(latinIME, R.string.research_notify_logging_suspended,
+ Toast.LENGTH_LONG).show();
+ }
+ }
+ */
+
private static final String[] EVENTKEYS_FEEDBACK = {
"UserTimestamp", "contents"
};