am 0bfcb89a: am e8668c2e: am aa3ff194: Merge "Use add icon for add custom input style menu" into lmp-dev

* commit '0bfcb89ac4202fb7d53f5c82ec27f8f87fa0cea1':
  Use add icon for add custom input style menu
Tadashi G. Takaoka 2014-08-06 17:47:44 +00:00 committed by Android Git Automerger
commit 2809183cb6
6 changed files with 28 additions and 4 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

View File

@ -0,0 +1,26 @@
<?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.
*/
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/action_add_style"
android:icon="@drawable/ic_add_circle_wht_24dp"
android:title="@string/add_style"
android:showAsAction="always" />
</menu>

View File

@ -63,7 +63,6 @@ public final class CustomInputStyleSettingsFragment extends PreferenceFragment {
private AlertDialog mSubtypeEnablerNotificationDialog; private AlertDialog mSubtypeEnablerNotificationDialog;
private String mSubtypePreferenceKeyForSubtypeEnabler; private String mSubtypePreferenceKeyForSubtypeEnabler;
private static final int MENU_ADD_SUBTYPE = Menu.FIRST;
private static final String KEY_IS_ADDING_NEW_SUBTYPE = "is_adding_new_subtype"; private static final String KEY_IS_ADDING_NEW_SUBTYPE = "is_adding_new_subtype";
private static final String KEY_IS_SUBTYPE_ENABLER_NOTIFICATION_DIALOG_OPEN = private static final String KEY_IS_SUBTYPE_ENABLER_NOTIFICATION_DIALOG_OPEN =
"is_subtype_enabler_notification_dialog_open"; "is_subtype_enabler_notification_dialog_open";
@ -581,14 +580,13 @@ public final class CustomInputStyleSettingsFragment extends PreferenceFragment {
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
final MenuItem addSubtypeMenu = menu.add(0, MENU_ADD_SUBTYPE, 0, R.string.add_style); inflater.inflate(R.menu.add_style, menu);
addSubtypeMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
} }
@Override @Override
public boolean onOptionsItemSelected(final MenuItem item) { public boolean onOptionsItemSelected(final MenuItem item) {
final int itemId = item.getItemId(); final int itemId = item.getItemId();
if (itemId == MENU_ADD_SUBTYPE) { if (itemId == R.id.action_add_style) {
final SubtypePreference newSubtype = final SubtypePreference newSubtype =
SubtypePreference.newIncompleteSubtypePreference(getActivity(), mSubtypeProxy); SubtypePreference.newIncompleteSubtypePreference(getActivity(), mSubtypeProxy);
getPreferenceScreen().addPreference(newSubtype); getPreferenceScreen().addPreference(newSubtype);