Use platform default theme for activities and dialogs
Bug: 13698528 Change-Id: Ib904c911452525e3749c0eb287434b504576db5f
This commit is contained in:
parent
f977ca6c92
commit
9b46ddc1d5
8 changed files with 110 additions and 12 deletions
|
@ -57,6 +57,7 @@
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<activity android:name=".setup.SetupActivity"
|
<activity android:name=".setup.SetupActivity"
|
||||||
|
android:theme="@style/platformActivityTheme"
|
||||||
android:label="@string/english_ime_name"
|
android:label="@string/english_ime_name"
|
||||||
android:icon="@drawable/ic_launcher_keyboard"
|
android:icon="@drawable/ic_launcher_keyboard"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
|
@ -68,6 +69,7 @@
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".setup.SetupWizardActivity"
|
<activity android:name=".setup.SetupWizardActivity"
|
||||||
|
android:theme="@style/platformActivityTheme"
|
||||||
android:label="@string/english_ime_name"
|
android:label="@string/english_ime_name"
|
||||||
android:clearTaskOnLaunch="true">
|
android:clearTaskOnLaunch="true">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -84,6 +86,7 @@
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity android:name=".settings.SettingsActivity"
|
<activity android:name=".settings.SettingsActivity"
|
||||||
|
android:theme="@style/platformActivityTheme"
|
||||||
android:label="@string/english_ime_settings"
|
android:label="@string/english_ime_settings"
|
||||||
android:uiOptions="splitActionBarWhenNarrow">
|
android:uiOptions="splitActionBarWhenNarrow">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
@ -92,6 +95,7 @@
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".spellcheck.SpellCheckerSettingsActivity"
|
<activity android:name=".spellcheck.SpellCheckerSettingsActivity"
|
||||||
|
android:theme="@style/platformActivityTheme"
|
||||||
android:label="@string/android_spell_checker_settings">
|
android:label="@string/android_spell_checker_settings">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -99,6 +103,7 @@
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name=".settings.DebugSettingsActivity"
|
<activity android:name=".settings.DebugSettingsActivity"
|
||||||
|
android:theme="@style/platformActivityTheme"
|
||||||
android:label="@string/english_ime_debug_settings">
|
android:label="@string/english_ime_debug_settings">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
@ -145,8 +150,8 @@
|
||||||
</receiver>
|
</receiver>
|
||||||
|
|
||||||
<activity android:name="com.android.inputmethod.dictionarypack.DictionarySettingsActivity"
|
<activity android:name="com.android.inputmethod.dictionarypack.DictionarySettingsActivity"
|
||||||
|
android:theme="@style/platformActivityTheme"
|
||||||
android:label="@string/dictionary_settings_title"
|
android:label="@string/dictionary_settings_title"
|
||||||
android:theme="@android:style/Theme.Holo"
|
|
||||||
android:uiOptions="splitActionBarWhenNarrow">
|
android:uiOptions="splitActionBarWhenNarrow">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
|
@ -154,8 +159,8 @@
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="com.android.inputmethod.dictionarypack.DownloadOverMeteredDialog"
|
<activity android:name="com.android.inputmethod.dictionarypack.DownloadOverMeteredDialog"
|
||||||
android:label="@string/dictionary_install_over_metered_network_prompt"
|
android:theme="@style/platformActivityTheme"
|
||||||
android:theme="@android:style/Theme.Holo">
|
android:label="@string/dictionary_install_over_metered_network_prompt">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN"/>
|
<action android:name="android.intent.action.MAIN"/>
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
|
29
java/res/values-v20/platform-theme.xml
Normal file
29
java/res/values-v20/platform-theme.xml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2014, 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- TODO: This file is temporarily placed under values-v20. -->
|
||||||
|
<!-- TODO: It might be moved under values-v21. -->
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- TODO: Use Theme.Quantum.Light once it is fixed.
|
||||||
|
<style name="platformActivityTheme" parent="@android:style/Theme.Quantum.Light" />
|
||||||
|
-->
|
||||||
|
<style name="platformActivityTheme" parent="@android:style/Theme.Quantum.Light.NoActionBar.Fullscreen" />
|
||||||
|
<style name="platformDialogTheme" parent="@android:style/Theme.Quantum.Light.Dialog" />
|
||||||
|
</resources>
|
24
java/res/values/platform-theme.xml
Normal file
24
java/res/values/platform-theme.xml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2014, 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:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<style name="platformActivityTheme" parent="@android:style/Theme.Holo" />
|
||||||
|
<style name="platformDialogTheme" parent="@android:style/Theme.Holo.Dialog" />
|
||||||
|
</resources>
|
|
@ -23,6 +23,7 @@ import android.content.DialogInterface.OnClickListener;
|
||||||
import android.content.DialogInterface.OnDismissListener;
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
import android.content.DialogInterface.OnShowListener;
|
import android.content.DialogInterface.OnShowListener;
|
||||||
|
|
||||||
|
import com.android.inputmethod.latin.utils.DialogUtils;
|
||||||
import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
|
import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,7 +41,7 @@ public final class ImportantNoticeDialog extends AlertDialog implements OnShowLi
|
||||||
|
|
||||||
public ImportantNoticeDialog(
|
public ImportantNoticeDialog(
|
||||||
final Context context, final ImportantNoticeDialogListener listener) {
|
final Context context, final ImportantNoticeDialogListener listener) {
|
||||||
super(context, THEME_HOLO_DARK);
|
super(DialogUtils.getPlatformDialogThemeContext(context));
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
mNextImportantNoticeVersion = ImportantNoticeUtils.getNextImportantNoticeVersion(context);
|
mNextImportantNoticeVersion = ImportantNoticeUtils.getNextImportantNoticeVersion(context);
|
||||||
setMessage(ImportantNoticeUtils.getNextImportantNoticeContents(context));
|
setMessage(ImportantNoticeUtils.getNextImportantNoticeContents(context));
|
||||||
|
|
|
@ -83,6 +83,7 @@ import com.android.inputmethod.latin.suggestions.SuggestionStripViewAccessor;
|
||||||
import com.android.inputmethod.latin.utils.ApplicationUtils;
|
import com.android.inputmethod.latin.utils.ApplicationUtils;
|
||||||
import com.android.inputmethod.latin.utils.CapsModeUtils;
|
import com.android.inputmethod.latin.utils.CapsModeUtils;
|
||||||
import com.android.inputmethod.latin.utils.CoordinateUtils;
|
import com.android.inputmethod.latin.utils.CoordinateUtils;
|
||||||
|
import com.android.inputmethod.latin.utils.DialogUtils;
|
||||||
import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
|
import com.android.inputmethod.latin.utils.ImportantNoticeUtils;
|
||||||
import com.android.inputmethod.latin.utils.IntentUtils;
|
import com.android.inputmethod.latin.utils.IntentUtils;
|
||||||
import com.android.inputmethod.latin.utils.JniUtils;
|
import com.android.inputmethod.latin.utils.JniUtils;
|
||||||
|
@ -1662,8 +1663,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final AlertDialog.Builder builder =
|
final AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||||
new AlertDialog.Builder(this).setItems(items, listener).setTitle(title);
|
DialogUtils.getPlatformDialogThemeContext(this));
|
||||||
|
builder.setItems(items, listener).setTitle(title);
|
||||||
showOptionDialog(builder.create());
|
showOptionDialog(builder.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.android.inputmethod.latin.BinaryDictionaryGetter;
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
import com.android.inputmethod.latin.makedict.DictionaryHeader;
|
import com.android.inputmethod.latin.makedict.DictionaryHeader;
|
||||||
import com.android.inputmethod.latin.utils.CollectionUtils;
|
import com.android.inputmethod.latin.utils.CollectionUtils;
|
||||||
|
import com.android.inputmethod.latin.utils.DialogUtils;
|
||||||
import com.android.inputmethod.latin.utils.DictionaryInfoUtils;
|
import com.android.inputmethod.latin.utils.DictionaryInfoUtils;
|
||||||
import com.android.inputmethod.latin.utils.LocaleUtils;
|
import com.android.inputmethod.latin.utils.LocaleUtils;
|
||||||
|
|
||||||
|
@ -70,7 +71,7 @@ public class ExternalDictionaryGetterForDebug {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void showNoFileDialog(final Context context) {
|
private static void showNoFileDialog(final Context context) {
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(DialogUtils.getPlatformDialogThemeContext(context))
|
||||||
.setMessage(R.string.read_external_dictionary_no_files_message)
|
.setMessage(R.string.read_external_dictionary_no_files_message)
|
||||||
.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -81,8 +82,8 @@ public class ExternalDictionaryGetterForDebug {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void showChooseFileDialog(final Context context, final String[] fileNames) {
|
private static void showChooseFileDialog(final Context context, final String[] fileNames) {
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
new AlertDialog.Builder(DialogUtils.getPlatformDialogThemeContext(context))
|
||||||
builder.setTitle(R.string.read_external_dictionary_multiple_files_title)
|
.setTitle(R.string.read_external_dictionary_multiple_files_title)
|
||||||
.setItems(fileNames, new OnClickListener() {
|
.setItems(fileNames, new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(final DialogInterface dialog, final int which) {
|
public void onClick(final DialogInterface dialog, final int which) {
|
||||||
|
@ -111,7 +112,7 @@ public class ExternalDictionaryGetterForDebug {
|
||||||
final String title = String.format(
|
final String title = String.format(
|
||||||
context.getString(R.string.read_external_dictionary_confirm_install_message),
|
context.getString(R.string.read_external_dictionary_confirm_install_message),
|
||||||
languageName);
|
languageName);
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(DialogUtils.getPlatformDialogThemeContext(context))
|
||||||
.setTitle(title)
|
.setTitle(title)
|
||||||
.setMessage(message)
|
.setMessage(message)
|
||||||
.setNegativeButton(android.R.string.cancel, new OnClickListener() {
|
.setNegativeButton(android.R.string.cancel, new OnClickListener() {
|
||||||
|
@ -167,7 +168,7 @@ public class ExternalDictionaryGetterForDebug {
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// There was an error: show a dialog
|
// There was an error: show a dialog
|
||||||
new AlertDialog.Builder(context)
|
new AlertDialog.Builder(DialogUtils.getPlatformDialogThemeContext(context))
|
||||||
.setTitle(R.string.error)
|
.setTitle(R.string.error)
|
||||||
.setMessage(e.toString())
|
.setMessage(e.toString())
|
||||||
.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
.setPositiveButton(android.R.string.ok, new OnClickListener() {
|
||||||
|
|
|
@ -48,6 +48,7 @@ import com.android.inputmethod.latin.R;
|
||||||
import com.android.inputmethod.latin.RichInputMethodManager;
|
import com.android.inputmethod.latin.RichInputMethodManager;
|
||||||
import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils;
|
import com.android.inputmethod.latin.utils.AdditionalSubtypeUtils;
|
||||||
import com.android.inputmethod.latin.utils.CollectionUtils;
|
import com.android.inputmethod.latin.utils.CollectionUtils;
|
||||||
|
import com.android.inputmethod.latin.utils.DialogUtils;
|
||||||
import com.android.inputmethod.latin.utils.IntentUtils;
|
import com.android.inputmethod.latin.utils.IntentUtils;
|
||||||
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
|
import com.android.inputmethod.latin.utils.SubtypeLocaleUtils;
|
||||||
|
|
||||||
|
@ -517,7 +518,8 @@ public final class AdditionalSubtypeSettings extends PreferenceFragment {
|
||||||
|
|
||||||
private AlertDialog createDialog(
|
private AlertDialog createDialog(
|
||||||
@SuppressWarnings("unused") final SubtypePreference subtypePref) {
|
@SuppressWarnings("unused") final SubtypePreference subtypePref) {
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
final AlertDialog.Builder builder = new AlertDialog.Builder(
|
||||||
|
DialogUtils.getPlatformDialogThemeContext(getActivity()));
|
||||||
builder.setTitle(R.string.custom_input_styles_title)
|
builder.setTitle(R.string.custom_input_styles_title)
|
||||||
.setMessage(R.string.custom_input_style_note_message)
|
.setMessage(R.string.custom_input_style_note_message)
|
||||||
.setNegativeButton(R.string.not_now, null)
|
.setNegativeButton(R.string.not_now, null)
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2014 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.android.inputmethod.latin.utils;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.ContextThemeWrapper;
|
||||||
|
|
||||||
|
import com.android.inputmethod.latin.R;
|
||||||
|
|
||||||
|
public final class DialogUtils {
|
||||||
|
private DialogUtils() {
|
||||||
|
// This utility class is not publicly instantiable.
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Context getPlatformDialogThemeContext(final Context context) {
|
||||||
|
// Because {@link AlertDialog.Builder.create()} doesn't honor the specified theme with
|
||||||
|
// createThemeContextWrapper=false, the result dialog box has unneeded paddings around it.
|
||||||
|
return new ContextThemeWrapper(context, R.style.platformDialogTheme);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue