am 434abe45: am 9b4e3db1: Legal notice

* commit '434abe450c8fd65789b6f8b04d62ad98287115dd':
  Legal notice
main
Satoshi Kataoka 2013-05-15 10:53:02 -07:00 committed by Android Git Automerger
commit 874c4fda36
7 changed files with 36 additions and 12 deletions

View File

@ -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] --> <!-- 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> <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> </resources>

View File

@ -181,6 +181,8 @@
<PreferenceScreen <PreferenceScreen
android:key="send_feedback" android:key="send_feedback"
android:title="@string/send_feedback" /> android:title="@string/send_feedback" />
<PreferenceScreen
android:key="about_keyboard" />
<PreferenceScreen <PreferenceScreen
android:key="debug_settings" android:key="debug_settings"
android:title="Debug settings" android:title="Debug settings"

View File

@ -121,18 +121,8 @@ public final class DebugSettings extends PreferenceFragment
return; return;
} }
boolean isDebugMode = mDebugMode.isChecked(); boolean isDebugMode = mDebugMode.isChecked();
String version = ""; final String version = getResources().getString(
try { R.string.version_text, Utils.getSdkVersion(getActivity()));
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.");
}
if (!isDebugMode) { if (!isDebugMode) {
mDebugMode.setTitle(version); mDebugMode.setTitle(version);
mDebugMode.setSummary(""); mDebugMode.setSummary("");

View File

@ -17,6 +17,7 @@
package com.android.inputmethod.latin; package com.android.inputmethod.latin;
import android.content.Context; import android.content.Context;
import android.content.Intent;
public class FeedbackUtils { public class FeedbackUtils {
public static boolean isFeedbackFormSupported() { public static boolean isFeedbackFormSupported() {
@ -25,4 +26,12 @@ public class FeedbackUtils {
public static void showFeedbackForm(Context context) { public static void showFeedbackForm(Context context) {
} }
public static int getAboutKeyboardTitleResId() {
return 0;
}
public static Intent getAboutKeyboardIntent(Context context) {
return null;
}
} }

View File

@ -78,6 +78,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
"pref_suppress_language_switch_key"; "pref_suppress_language_switch_key";
public static final String PREF_SEND_FEEDBACK = "send_feedback"; public static final String PREF_SEND_FEEDBACK = "send_feedback";
public static final String PREF_ABOUT_KEYBOARD = "about_keyboard";
private Resources mRes; private Resources mRes;
private SharedPreferences mPrefs; private SharedPreferences mPrefs;

View File

@ -113,6 +113,7 @@ public final class SettingsFragment extends InputMethodSettingsFragment
} }
final Preference feedbackSettings = findPreference(Settings.PREF_SEND_FEEDBACK); final Preference feedbackSettings = findPreference(Settings.PREF_SEND_FEEDBACK);
final Preference aboutSettings = findPreference(Settings.PREF_ABOUT_KEYBOARD);
if (feedbackSettings != null) { if (feedbackSettings != null) {
if (FeedbackUtils.isFeedbackFormSupported()) { if (FeedbackUtils.isFeedbackFormSupported()) {
feedbackSettings.setOnPreferenceClickListener(new OnPreferenceClickListener() { feedbackSettings.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@ -122,8 +123,11 @@ public final class SettingsFragment extends InputMethodSettingsFragment
return true; return true;
} }
}); });
aboutSettings.setTitle(FeedbackUtils.getAboutKeyboardTitleResId());
aboutSettings.setIntent(FeedbackUtils.getAboutKeyboardIntent(getActivity()));
} else { } else {
miscSettings.removePreference(feedbackSettings); miscSettings.removePreference(feedbackSettings);
miscSettings.removePreference(aboutSettings);
} }
} }

View File

@ -21,6 +21,7 @@ import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.pm.ActivityInfo; import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.PackageManager.NameNotFoundException;
import android.inputmethodservice.InputMethodService; import android.inputmethodservice.InputMethodService;
@ -473,4 +474,18 @@ public final class Utils {
} }
return 0; 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 "";
}
} }