aboutsummaryrefslogtreecommitdiffstats
path: root/java/src
diff options
context:
space:
mode:
authorKurt Partridge <kep@google.com>2012-07-26 15:27:57 -0700
committerKurt Partridge <kep@google.com>2012-08-30 22:52:00 -0700
commit25405eafb05d6f2096922b04e5d9ff2ac2bd1a10 (patch)
treea56e15ab7d30038ae00f3a6e00ea2c8c48af5bac /java/src
parent58eb4d9f27595202927150766d198a0bff15efad (diff)
downloadlatinime-25405eafb05d6f2096922b04e5d9ff2ac2bd1a10.tar.gz
latinime-25405eafb05d6f2096922b04e5d9ff2ac2bd1a10.tar.xz
latinime-25405eafb05d6f2096922b04e5d9ff2ac2bd1a10.zip
ResearchLogger clean up splash screen
- simpler text - AlertDialog implementation - declining users are redirected to regular IME Bug: 6188932 Change-Id: Ifb983c3511125f8919f4a8b25aeee7de66dbb0cb
Diffstat (limited to 'java/src')
-rw-r--r--java/src/com/android/inputmethod/research/ResearchLogger.java67
1 files changed, 35 insertions, 32 deletions
diff --git a/java/src/com/android/inputmethod/research/ResearchLogger.java b/java/src/com/android/inputmethod/research/ResearchLogger.java
index 9e58ec5a3..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;
}