Search in sources :

Example 86 with SpellCheckerInfo

use of android.view.textservice.SpellCheckerInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SpellCheckersSettings method onPreferenceChange.

@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    final SpellCheckerInfo sci = (SpellCheckerInfo) newValue;
    final boolean isSystemApp = (sci.getServiceInfo().applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
    if (isSystemApp) {
        changeCurrentSpellChecker(sci);
        return true;
    } else {
        showSecurityWarnDialog(sci);
        return false;
    }
}
Also used : SpellCheckerInfo(android.view.textservice.SpellCheckerInfo)

Example 87 with SpellCheckerInfo

use of android.view.textservice.SpellCheckerInfo in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class SpellCheckerPreferenceControllerTest method updateState_hasSpellerChecker_shouldSetSummaryToAppName.

@Test
public void updateState_hasSpellerChecker_shouldSetSummaryToAppName() {
    final String spellCheckerAppLabel = "test";
    final SpellCheckerInfo sci = mock(SpellCheckerInfo.class);
    when(mTextServicesManager.isSpellCheckerEnabled()).thenReturn(true);
    when(mTextServicesManager.getCurrentSpellChecker()).thenReturn(sci);
    when(sci.loadLabel(mContext.getPackageManager())).thenReturn(spellCheckerAppLabel);
    mController.updateState(mPreference);
    assertThat(mPreference.getSummary()).isEqualTo(spellCheckerAppLabel);
}
Also used : SpellCheckerInfo(android.view.textservice.SpellCheckerInfo) Test(org.junit.Test)

Aggregations

SpellCheckerInfo (android.view.textservice.SpellCheckerInfo)87 SpellCheckerSubtype (android.view.textservice.SpellCheckerSubtype)19 RemoteException (android.os.RemoteException)16 Intent (android.content.Intent)13 ServiceInfo (android.content.pm.ServiceInfo)11 Locale (java.util.Locale)10 DialogInterface (android.content.DialogInterface)7 Test (org.junit.Test)7 AlertDialog (android.app.AlertDialog)6 ComponentName (android.content.ComponentName)6 ApplicationInfo (android.content.pm.ApplicationInfo)6 PackageManager (android.content.pm.PackageManager)6 ResolveInfo (android.content.pm.ResolveInfo)6 InputMethodInfo (android.view.inputmethod.InputMethodInfo)6 InputMethodManager (android.view.inputmethod.InputMethodManager)6 InputMethodSubtype (android.view.inputmethod.InputMethodSubtype)6 ISpellCheckerSession (com.android.internal.textservice.ISpellCheckerSession)6 IOException (java.io.IOException)6 HashMap (java.util.HashMap)6 Map (java.util.Map)6