Merge "Use add icon for add custom input style menu" into lmp-dev

main
Tadashi G. Takaoka 2014-08-06 05:25:41 +00:00 committed by Android (Google) Code Review
commit aa3ff194cd
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 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_SUBTYPE_ENABLER_NOTIFICATION_DIALOG_OPEN =
"is_subtype_enabler_notification_dialog_open";
@ -581,14 +580,13 @@ public final class CustomInputStyleSettingsFragment extends PreferenceFragment {
@Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
final MenuItem addSubtypeMenu = menu.add(0, MENU_ADD_SUBTYPE, 0, R.string.add_style);
addSubtypeMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
inflater.inflate(R.menu.add_style, menu);
}
@Override
public boolean onOptionsItemSelected(final MenuItem item) {
final int itemId = item.getItemId();
if (itemId == MENU_ADD_SUBTYPE) {
if (itemId == R.id.action_add_style) {
final SubtypePreference newSubtype =
SubtypePreference.newIncompleteSubtypePreference(getActivity(), mSubtypeProxy);
getPreferenceScreen().addPreference(newSubtype);