Search in sources :

Example 86 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.

the class SuggestionAdapterTest method onBindViewHolder_shouldInflateRemoteView.

@Test
public void onBindViewHolder_shouldInflateRemoteView() {
    List<Tile> packages = makeSuggestions("pkg1");
    RemoteViews remoteViews = mock(RemoteViews.class);
    TextView textView = new TextView(RuntimeEnvironment.application);
    doReturn(textView).when(remoteViews).apply(any(Context.class), any(ViewGroup.class));
    packages.get(0).remoteViews = remoteViews;
    setupSuggestions(mActivity, packages);
    mSuggestionAdapter.onBindViewHolder(mSuggestionHolder, 0);
    assertThat(textView.getParent()).isSameAs(mSuggestionHolder.itemView);
    mSuggestionHolder.itemView.performClick();
    verify(mActivity).startSuggestion(any(Intent.class));
}
Also used : Context(android.content.Context) RemoteViews(android.widget.RemoteViews) ViewGroup(android.view.ViewGroup) Tile(com.android.settingslib.drawer.Tile) TextView(android.widget.TextView) Intent(android.content.Intent) Test(org.junit.Test)

Example 87 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.

the class SuggestionFeatureProviderImplTest method getSuggestionIdentifier_nullComponent_shouldNotCrash.

@Test
public void getSuggestionIdentifier_nullComponent_shouldNotCrash() {
    final Tile suggestion = new Tile();
    suggestion.intent = new Intent();
    assertThat(mProvider.getSuggestionIdentifier(mContext, suggestion)).isNotEmpty();
}
Also used : Tile(com.android.settingslib.drawer.Tile) Intent(android.content.Intent) Test(org.junit.Test)

Example 88 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.

the class SuggestionFeatureProviderImplTest method getSuggestionIdentifier_nullContext_shouldNotCrash.

@Test
public void getSuggestionIdentifier_nullContext_shouldNotCrash() {
    final Tile suggestion = new Tile();
    suggestion.intent = new Intent().setClassName(RuntimeEnvironment.application.getPackageName(), "123");
    assertThat(mProvider.getSuggestionIdentifier(null, suggestion)).isNotEmpty();
}
Also used : Tile(com.android.settingslib.drawer.Tile) Intent(android.content.Intent) Test(org.junit.Test)

Example 89 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.

the class SuggestionsChecksTest method testFingerprintEnrollmentIntroductionIsCompleteWhenHardwareNotDetected.

@Test
public void testFingerprintEnrollmentIntroductionIsCompleteWhenHardwareNotDetected() {
    stubFingerprintSupported(true);
    when(mFingerprintManager.hasEnrolledFingerprints()).thenReturn(false);
    when(mFingerprintManager.isHardwareDetected()).thenReturn(false);
    Tile tile = createFingerprintTile();
    assertThat(mSuggestionsChecks.isSuggestionComplete(tile)).isTrue();
}
Also used : Tile(com.android.settingslib.drawer.Tile) Test(org.junit.Test)

Example 90 with Tile

use of com.android.settingslib.drawer.Tile in project android_packages_apps_Settings by crdroidandroid.

the class SuggestionsChecksTest method testFingerprintEnrollmentIntroductionIsCompleteWhenFingerprintDisabled.

@Test
public void testFingerprintEnrollmentIntroductionIsCompleteWhenFingerprintDisabled() {
    stubFingerprintSupported(true);
    when(mFingerprintManager.hasEnrolledFingerprints()).thenReturn(false);
    when(mFingerprintManager.isHardwareDetected()).thenReturn(true);
    when(mDevicePolicyManager.getKeyguardDisabledFeatures(any(), anyInt())).thenReturn(DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT);
    Tile tile = createFingerprintTile();
    assertThat(mSuggestionsChecks.isSuggestionComplete(tile)).isTrue();
}
Also used : Tile(com.android.settingslib.drawer.Tile) Test(org.junit.Test)

Aggregations

Tile (com.android.settingslib.drawer.Tile)506 Test (org.junit.Test)345 Intent (android.content.Intent)160 DashboardCategory (com.android.settingslib.drawer.DashboardCategory)117 Bundle (android.os.Bundle)108 Preference (android.support.v7.preference.Preference)98 ComponentName (android.content.ComponentName)93 ArrayList (java.util.ArrayList)87 Context (android.content.Context)70 ActivityTile (com.android.settingslib.drawer.ActivityTile)50 ProviderTile (com.android.settingslib.drawer.ProviderTile)45 UserHandle (android.os.UserHandle)39 Preference (androidx.preference.Preference)39 RecyclerView (android.support.v7.widget.RecyclerView)31 View (android.view.View)31 Icon (android.graphics.drawable.Icon)30 Activity (android.app.Activity)29 VisibleForTesting (android.support.annotation.VisibleForTesting)29 PackageManager (android.content.pm.PackageManager)25 ViewGroup (android.view.ViewGroup)24