parent
1a9bf159a4
commit
9b4e3db1af
|
@ -554,4 +554,7 @@ Tip: You can download and remove dictionaries by going to <b>Language & i
|
|||
|
||||
<!-- The text of the toast warning a download is starting automatically to enable suggestions for the selected language [CHAR LIMIT=100] -->
|
||||
<string name="toast_downloading_suggestions">Downloading: suggestions for <xliff:g id="language" example="English">%1$s</xliff:g> will be ready soon.</string>
|
||||
|
||||
<!-- Version text [CHAR LIMIT=30]-->
|
||||
<string name="version_text">Version <xliff:g id="version_number" example="1.0.1864.643521">%1$s</xliff:g></string>
|
||||
</resources>
|
||||
|
|
|
@ -181,6 +181,8 @@
|
|||
<PreferenceScreen
|
||||
android:key="send_feedback"
|
||||
android:title="@string/send_feedback" />
|
||||
<PreferenceScreen
|
||||
android:key="about_keyboard" />
|
||||
<PreferenceScreen
|
||||
android:key="debug_settings"
|
||||
android:title="Debug settings"
|
||||
|
|
|
@ -121,18 +121,8 @@ public final class DebugSettings extends PreferenceFragment
|
|||
return;
|
||||
}
|
||||
boolean isDebugMode = mDebugMode.isChecked();
|
||||
String version = "";
|
||||
try {
|
||||
final Context context = getActivity();
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
final String packageName = context.getPackageName();
|
||||
PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
|
||||
version = "Version " + info.versionName;
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.e(TAG, "Could not find version info.");
|
||||
}
|
||||
final String version = getResources().getString(
|
||||
R.string.version_text, Utils.getSdkVersion(getActivity()));
|
||||
if (!isDebugMode) {
|
||||
mDebugMode.setTitle(version);
|
||||
mDebugMode.setSummary("");
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package com.android.inputmethod.latin;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
public class FeedbackUtils {
|
||||
public static boolean isFeedbackFormSupported() {
|
||||
|
@ -25,4 +26,12 @@ public class FeedbackUtils {
|
|||
|
||||
public static void showFeedbackForm(Context context) {
|
||||
}
|
||||
|
||||
public static int getAboutKeyboardTitleResId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static Intent getAboutKeyboardIntent(Context context) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
|
|||
"pref_suppress_language_switch_key";
|
||||
|
||||
public static final String PREF_SEND_FEEDBACK = "send_feedback";
|
||||
public static final String PREF_ABOUT_KEYBOARD = "about_keyboard";
|
||||
|
||||
private Resources mRes;
|
||||
private SharedPreferences mPrefs;
|
||||
|
|
|
@ -113,6 +113,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
|||
}
|
||||
|
||||
final Preference feedbackSettings = findPreference(Settings.PREF_SEND_FEEDBACK);
|
||||
final Preference aboutSettings = findPreference(Settings.PREF_ABOUT_KEYBOARD);
|
||||
if (feedbackSettings != null) {
|
||||
if (FeedbackUtils.isFeedbackFormSupported()) {
|
||||
feedbackSettings.setOnPreferenceClickListener(new OnPreferenceClickListener() {
|
||||
|
@ -122,8 +123,11 @@ public final class SettingsFragment extends InputMethodSettingsFragment
|
|||
return true;
|
||||
}
|
||||
});
|
||||
aboutSettings.setTitle(FeedbackUtils.getAboutKeyboardTitleResId());
|
||||
aboutSettings.setIntent(FeedbackUtils.getAboutKeyboardIntent(getActivity()));
|
||||
} else {
|
||||
miscSettings.removePreference(feedbackSettings);
|
||||
miscSettings.removePreference(aboutSettings);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ import android.content.ComponentName;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.PackageManager.NameNotFoundException;
|
||||
import android.inputmethodservice.InputMethodService;
|
||||
|
@ -473,4 +474,18 @@ public final class Utils {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static String getSdkVersion(Context context) {
|
||||
try {
|
||||
if (context == null) {
|
||||
return "";
|
||||
}
|
||||
final String packageName = context.getPackageName();
|
||||
PackageInfo info = context.getPackageManager().getPackageInfo(packageName, 0);
|
||||
return info.versionName;
|
||||
} catch (NameNotFoundException e) {
|
||||
Log.e(TAG, "Could not find version info.", e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue