Misc fixes for IA and pattern.

Disable NFC fragments when feature is not avaiable
Link to spell checker screen with the pref is clicked
Tint "add"/"delete" button in UserDictionary actionbar to proper color.

Change-Id: I8a8e219ce3dbbafc6c4d5a0f34f835ffd0abad4f
Fix: 34155679
Fix: 34161006
Fix: 34154795
Test: RunSettingsRoboTests
This commit is contained in:
Fan Zhang
2017-01-09 10:16:49 -08:00
parent c4372f1a48
commit ffd328b071
5 changed files with 14 additions and 7 deletions

View File

@@ -15,11 +15,13 @@
limitations under the License. limitations under the License.
--> -->
<vector xmlns:android="http://schemas.android.com/apk/res/android" <vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp" android:width="24dp"
android:height="24dp" android:height="24dp"
android:viewportWidth="24.0" android:viewportWidth="24.0"
android:viewportHeight="24.0"> android:viewportHeight="24.0"
android:tint="?android:attr/colorControlNormal">
<path <path
android:fillColor="#FFFFFFFF" android:fillColor="#FFFFFFFF"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/> android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>

View File

@@ -28,7 +28,8 @@
<Preference <Preference
android:key="spellcheckers_settings" android:key="spellcheckers_settings"
android:title="@string/spellcheckers_settings_title" android:title="@string/spellcheckers_settings_title"
android:persistent="false"/> android:persistent="false"
android:fragment="com.android.settings.inputmethod.SpellCheckersSettings"/>
<!-- User dictionary preference title and fragment will be set programmatically. --> <!-- User dictionary preference title and fragment will be set programmatically. -->
<Preference <Preference

View File

@@ -974,6 +974,11 @@ public class SettingsActivity extends SettingsDrawerActivity
pm.hasSystemFeature(PackageManager.FEATURE_NFC) pm.hasSystemFeature(PackageManager.FEATURE_NFC)
&& pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION) && pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION)
&& adapter != null && adapter.isEnabled(), isAdmin); && adapter != null && adapter.isEnabled(), isAdmin);
setTileEnabled(new ComponentName(packageName,
"com.android.settings.PaymentSettingsDashboardAlias"),
pm.hasSystemFeature(PackageManager.FEATURE_NFC)
&& pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION)
&& adapter != null && adapter.isEnabled(), isAdmin);
setTileEnabled(new ComponentName(packageName, setTileEnabled(new ComponentName(packageName,
Settings.PrintSettingsActivity.class.getName()), Settings.PrintSettingsActivity.class.getName()),

View File

@@ -86,7 +86,7 @@ public class UserDictionaryAddWordFragment extends InstrumentedPreferenceFragmen
@Override @Override
public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) {
MenuItem actionItem = menu.add(0, OPTIONS_MENU_DELETE, 0, R.string.delete) MenuItem actionItem = menu.add(0, OPTIONS_MENU_DELETE, 0, R.string.delete)
.setIcon(android.R.drawable.ic_menu_delete); .setIcon(R.drawable.ic_delete);
actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM |
MenuItem.SHOW_AS_ACTION_WITH_TEXT); MenuItem.SHOW_AS_ACTION_WITH_TEXT);
} }

View File

@@ -31,8 +31,8 @@ import org.junit.runner.RunWith;
import org.mockito.Answers; import org.mockito.Answers;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config; import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowApplication;
import static com.google.common.truth.Truth.assertThat; import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
@@ -53,7 +53,7 @@ public class SpellCheckerPreferenceControllerTest {
@Before @Before
public void setUp() { public void setUp() {
MockitoAnnotations.initMocks(this); MockitoAnnotations.initMocks(this);
mAppContext = ShadowApplication.getInstance().getApplicationContext(); mAppContext = RuntimeEnvironment.application;
when(mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE)) when(mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE))
.thenReturn(mTextServicesManager); .thenReturn(mTextServicesManager);
mPreference = new Preference(mAppContext); mPreference = new Preference(mAppContext);
@@ -76,7 +76,6 @@ public class SpellCheckerPreferenceControllerTest {
when(mTextServicesManager.isSpellCheckerEnabled()).thenReturn(false); when(mTextServicesManager.isSpellCheckerEnabled()).thenReturn(false);
mController.updateState(mPreference); mController.updateState(mPreference);
assertThat(mPreference.getSummary()) assertThat(mPreference.getSummary())
.isEqualTo(mAppContext.getString(R.string.switch_off_text)); .isEqualTo(mAppContext.getString(R.string.switch_off_text));
} }