Migrate more places to subsetting launcher

Bug: 73250851
Test: robotests
Change-Id: Iaf29df45ddb42fd58f181cb01e10998a97cb7c34
This commit is contained in:
Fan Zhang
2018-02-19 13:54:09 -08:00
parent be45f9c865
commit 47854c2945
20 changed files with 99 additions and 249 deletions

View File

@@ -23,17 +23,14 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.core.InstrumentedFragment;
import com.android.settings.R;
import com.android.settings.SettingsActivity;
import com.android.settings.core.InstrumentedFragment;
import com.android.settings.inputmethod.UserDictionaryAddWordContents.LocaleRenderer;
import java.util.ArrayList;
import java.util.Locale;
/**
* Fragment to add a word/shortcut to the user dictionary.
@@ -41,9 +38,7 @@ import java.util.Locale;
* As opposed to the UserDictionaryActivity, this is only invoked within Settings
* from the UserDictionarySettings.
*/
public class UserDictionaryAddWordFragment extends InstrumentedFragment
implements AdapterView.OnItemSelectedListener,
com.android.internal.app.LocalePicker.LocaleSelectionListener {
public class UserDictionaryAddWordFragment extends InstrumentedFragment {
private static final int OPTIONS_MENU_DELETE = Menu.FIRST;
@@ -136,30 +131,4 @@ public class UserDictionaryAddWordFragment extends InstrumentedFragment
mContents.apply(getActivity(), null);
}
}
@Override
public void onItemSelected(final AdapterView<?> parent, final View view, final int pos,
final long id) {
final LocaleRenderer locale = (LocaleRenderer)parent.getItemAtPosition(pos);
if (locale.isMoreLanguages()) {
SettingsActivity sa = (SettingsActivity)getActivity();
sa.startPreferenceFragment(new UserDictionaryLocalePicker(this), true);
} else {
mContents.updateLocale(locale.getLocaleString());
}
}
@Override
public void onNothingSelected(final AdapterView<?> parent) {
// I'm not sure we can come here, but if we do, that's the right thing to do.
final Bundle args = getArguments();
mContents.updateLocale(args.getString(UserDictionaryAddWordContents.EXTRA_LOCALE));
}
// Called by the locale picker
@Override
public void onLocaleSelected(final Locale locale) {
mContents.updateLocale(locale.toString());
getActivity().onBackPressed();
}
}

View File

@@ -1,24 +0,0 @@
/*
* Copyright (C) 2012 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.settings.inputmethod;
public class UserDictionaryLocalePicker extends com.android.internal.app.LocalePicker {
public UserDictionaryLocalePicker(final UserDictionaryAddWordFragment parent) {
super();
setLocaleSelectionListener(parent);
}
}