ResearchLogger no longer offers option to disable logging

Bug: 6188932
Change-Id: I0b9474216080f3820438c09f89b0b6c6c102c69d
main
Kurt Partridge 2012-07-26 15:39:55 -07:00
parent 49d8af8a4e
commit 58eb4d9f27
2 changed files with 39 additions and 24 deletions

View File

@ -1309,7 +1309,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
break; break;
case Keyboard.CODE_RESEARCH: case Keyboard.CODE_RESEARCH:
if (ProductionFlag.IS_EXPERIMENTAL) { if (ProductionFlag.IS_EXPERIMENTAL) {
ResearchLogger.getInstance().presentResearchDialog(this); ResearchLogger.getInstance().onResearchKeySelected(this);
} }
break; break;
default: default:

View File

@ -450,12 +450,18 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
prefsChanged(prefs); prefsChanged(prefs);
} }
public void presentResearchDialog(final LatinIME latinIME) { public void onResearchKeySelected(final LatinIME latinIME) {
if (mInFeedbackDialog) { if (mInFeedbackDialog) {
Toast.makeText(latinIME, R.string.research_please_exit_feedback_form, Toast.makeText(latinIME, R.string.research_please_exit_feedback_form,
Toast.LENGTH_LONG).show(); Toast.LENGTH_LONG).show();
return; 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 CharSequence title = latinIME.getString(R.string.english_ime_research_log);
final boolean showEnable = mIsLoggingSuspended || !sIsLogging; final boolean showEnable = mIsLoggingSuspended || !sIsLogging;
final CharSequence[] items = new CharSequence[] { final CharSequence[] items = new CharSequence[] {
@ -472,28 +478,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
presentFeedbackDialog(latinIME); presentFeedbackDialog(latinIME);
break; break;
case 1: case 1:
if (showEnable) { enableOrDisable(showEnable, latinIME);
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();
}
break; break;
} }
} }
@ -504,6 +489,7 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
.setTitle(title); .setTitle(title);
latinIME.showOptionDialog(builder.create()); latinIME.showOptionDialog(builder.create());
} }
*/
private boolean mInFeedbackDialog = false; private boolean mInFeedbackDialog = false;
public void presentFeedbackDialog(LatinIME latinIME) { public void presentFeedbackDialog(LatinIME latinIME) {
@ -511,6 +497,35 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
latinIME.launchKeyboardedDialogActivity(FeedbackActivity.class); 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 = { private static final String[] EVENTKEYS_FEEDBACK = {
"UserTimestamp", "contents" "UserTimestamp", "contents"
}; };