Merge changes Ifb983c35,I0b947421 into jb-mr1-dev
* changes: ResearchLogger clean up splash screen ResearchLogger no longer offers option to disable loggingmain
commit
9bbc7ec052
|
@ -1,88 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2012 The Android Open Source Project
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:id="@+id/research_splash_screen_layout">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<com.android.internal.widget.DialogTitle
|
|
||||||
style="?android:attr/windowTitleStyle"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="64dip"
|
|
||||||
android:layout_marginLeft="16dip"
|
|
||||||
android:layout_marginRight="16dip"
|
|
||||||
android:gravity="center_vertical|left"
|
|
||||||
android:text="@string/research_splash_title" />
|
|
||||||
<View android:layout_width="match_parent"
|
|
||||||
android:layout_height="2dip"
|
|
||||||
android:background="@android:color/holo_blue_light" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:text="@string/research_splash_content"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_gravity="fill_horizontal|center_vertical"
|
|
||||||
android:layout_marginLeft="16dip"
|
|
||||||
android:layout_marginRight="16dip"
|
|
||||||
android:layout_marginBottom="16dip"
|
|
||||||
android:layout_marginTop="16dip"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:divider="?android:attr/dividerHorizontal"
|
|
||||||
android:showDividers="beginning"
|
|
||||||
android:dividerPadding="0dip">
|
|
||||||
<LinearLayout
|
|
||||||
style="?android:attr/buttonBarStyle"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:measureWithLargestChild="true">
|
|
||||||
<Button
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_gravity="left"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:maxLines="2"
|
|
||||||
stype="?android:attr/buttonBarButtonStyle"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:text="@string/research_dont_send_usage_info"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/research_do_not_log_button" />
|
|
||||||
<Button
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_gravity="right"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:maxLines="2"
|
|
||||||
style="?android:attr/buttonBarButtonStyle"
|
|
||||||
android:textSize="14sp"
|
|
||||||
android:text="@string/research_send_usage_info"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:id="@+id/research_do_log_button" />
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
||||||
</LinearLayout>
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2012, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
||||||
|
<!-- Contents of note explaining what data is collected and how. -->
|
||||||
|
<!-- TODO: remove translatable=false attribute once text is stable -->
|
||||||
|
<string name="research_splash_content" translatable="false"></string>
|
||||||
|
</resources>
|
|
@ -278,16 +278,11 @@
|
||||||
|
|
||||||
<!-- Title of dialog shown at start informing users about contributing research usage data-->
|
<!-- Title of dialog shown at start informing users about contributing research usage data-->
|
||||||
<!-- TODO: remove translatable=false attribute once text is stable -->
|
<!-- TODO: remove translatable=false attribute once text is stable -->
|
||||||
<string name="research_splash_title" translatable="false">Usage Participation</string>
|
<string name="research_splash_title" translatable="false">Warning</string>
|
||||||
<!-- Contents of note explaining what data is collected and how. -->
|
|
||||||
|
<!-- Toast message informing users that logging has been disabled -->
|
||||||
<!-- TODO: remove translatable=false attribute once text is stable -->
|
<!-- TODO: remove translatable=false attribute once text is stable -->
|
||||||
<string name="research_splash_content" translatable="false">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</string>
|
<string name="research_logging_disabled" translatable="false">Logging Disabled</string>
|
||||||
<!-- Button label text for opting out of research usage data collection [CHAR LIMIT=50] -->
|
|
||||||
<!-- TODO: remove translatable=false attribute once text is stable -->
|
|
||||||
<string name="research_dont_send_usage_info" translatable="false">Do not send\nusage info</string>
|
|
||||||
<!-- Button label text for opting into research usage data collection [CHAR LIMIT=50] -->
|
|
||||||
<!-- TODO: remove translatable=false attribute once text is stable -->
|
|
||||||
<string name="research_send_usage_info" translatable="false">Send usage info</string>
|
|
||||||
|
|
||||||
<!-- Name for the research uploading service to be displayed to users. [CHAR LIMIT=50] -->
|
<!-- Name for the research uploading service to be displayed to users. [CHAR LIMIT=50] -->
|
||||||
<!-- TODO: remove translatable=false attribute once text is stable -->
|
<!-- TODO: remove translatable=false attribute once text is stable -->
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -35,6 +35,7 @@ import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
@ -43,15 +44,12 @@ import android.text.format.DateUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.inputmethod.CompletionInfo;
|
import android.view.inputmethod.CompletionInfo;
|
||||||
import android.view.inputmethod.CorrectionInfo;
|
import android.view.inputmethod.CorrectionInfo;
|
||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputConnection;
|
import android.view.inputmethod.InputConnection;
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.android.inputmethod.keyboard.Key;
|
import com.android.inputmethod.keyboard.Key;
|
||||||
|
@ -251,44 +249,49 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
if (windowToken == null) {
|
if (windowToken == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mSplashDialog = new Dialog(mInputMethodService, android.R.style.Theme_Holo_Dialog);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(mInputMethodService)
|
||||||
mSplashDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
|
.setTitle(R.string.research_splash_title)
|
||||||
mSplashDialog.setContentView(R.layout.research_splash);
|
.setMessage(R.string.research_splash_content)
|
||||||
mSplashDialog.setCancelable(true);
|
.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 Window w = mSplashDialog.getWindow();
|
||||||
final WindowManager.LayoutParams lp = w.getAttributes();
|
final WindowManager.LayoutParams lp = w.getAttributes();
|
||||||
lp.token = windowToken;
|
lp.token = windowToken;
|
||||||
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
|
||||||
w.setAttributes(lp);
|
w.setAttributes(lp);
|
||||||
w.addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
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();
|
mSplashDialog.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onUserLoggingElection(final boolean enableLogging) {
|
public void onUserLoggingConsent() {
|
||||||
setLoggingAllowed(enableLogging);
|
setLoggingAllowed(true);
|
||||||
if (mPrefs == null) {
|
if (mPrefs == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -450,12 +453,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,6 +481,29 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
presentFeedbackDialog(latinIME);
|
presentFeedbackDialog(latinIME);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
enableOrDisable(showEnable, latinIME);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
final AlertDialog.Builder builder = new AlertDialog.Builder(latinIME)
|
||||||
|
.setItems(items, listener)
|
||||||
|
.setTitle(title);
|
||||||
|
latinIME.showOptionDialog(builder.create());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
private boolean mInFeedbackDialog = false;
|
||||||
|
public void presentFeedbackDialog(LatinIME latinIME) {
|
||||||
|
mInFeedbackDialog = true;
|
||||||
|
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 (showEnable) {
|
||||||
if (!sIsLogging) {
|
if (!sIsLogging) {
|
||||||
setLoggingAllowed(true);
|
setLoggingAllowed(true);
|
||||||
|
@ -494,22 +526,8 @@ public class ResearchLogger implements SharedPreferences.OnSharedPreferenceChang
|
||||||
Toast.makeText(latinIME, R.string.research_notify_logging_suspended,
|
Toast.makeText(latinIME, R.string.research_notify_logging_suspended,
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(latinIME)
|
|
||||||
.setItems(items, listener)
|
|
||||||
.setTitle(title);
|
|
||||||
latinIME.showOptionDialog(builder.create());
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean mInFeedbackDialog = false;
|
|
||||||
public void presentFeedbackDialog(LatinIME latinIME) {
|
|
||||||
mInFeedbackDialog = true;
|
|
||||||
latinIME.launchKeyboardedDialogActivity(FeedbackActivity.class);
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private static final String[] EVENTKEYS_FEEDBACK = {
|
private static final String[] EVENTKEYS_FEEDBACK = {
|
||||||
"UserTimestamp", "contents"
|
"UserTimestamp", "contents"
|
||||||
|
|
Loading…
Reference in New Issue