Search in sources :

Example 21 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BluetoothSwitchPreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application.getApplicationContext());
    mFooterPreference = new FooterPreference(mContext);
    FakeFeatureFactory.setupForTest();
    mController = new BluetoothSwitchPreferenceController(mContext, mRestrictionUtils, mSwitchController, mFooterPreference);
}
Also used : FooterPreference(com.android.settingslib.widget.FooterPreference) Before(org.junit.Before)

Example 22 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChooseLockGenericTest method updatePreferencesOrFinish_footerPreferenceAddedNoneComplexityText.

@Test
public void updatePreferencesOrFinish_footerPreferenceAddedNoneComplexityText() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    Intent intent = new Intent().putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name").putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_NONE);
    initActivity(intent);
    CharSequence expectedTitle = mActivity.getString(R.string.unlock_footer_none_complexity_requested, "app name");
    mFragment.updatePreferencesOrFinish(/* isRecreatingActivity= */
    false);
    FooterPreference footer = mFragment.findPreference(FooterPreference.KEY_FOOTER);
    assertThat(footer.getTitle()).isEqualTo(expectedTitle);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference) Test(org.junit.Test)

Example 23 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChooseLockGenericTest method updatePreferencesOrFinish_footerPreferenceAddedHighComplexityText.

@Test
public void updatePreferencesOrFinish_footerPreferenceAddedHighComplexityText() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    Intent intent = new Intent().putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name").putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_HIGH);
    initActivity(intent);
    CharSequence expectedTitle = mActivity.getString(R.string.unlock_footer_high_complexity_requested, "app name");
    mFragment.updatePreferencesOrFinish(false);
    FooterPreference footer = mFragment.findPreference(FooterPreference.KEY_FOOTER);
    assertThat(footer.getTitle()).isEqualTo(expectedTitle);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference) Test(org.junit.Test)

Example 24 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChooseLockGenericTest method updatePreferencesOrFinish_footerPreferenceAddedLowComplexityText.

@Test
public void updatePreferencesOrFinish_footerPreferenceAddedLowComplexityText() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    Intent intent = new Intent().putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name").putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_LOW);
    initActivity(intent);
    CharSequence expectedTitle = mActivity.getString(R.string.unlock_footer_low_complexity_requested, "app name");
    mFragment.updatePreferencesOrFinish(false);
    FooterPreference footer = mFragment.findPreference(FooterPreference.KEY_FOOTER);
    assertThat(footer.getTitle()).isEqualTo(expectedTitle);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference) Test(org.junit.Test)

Example 25 with FooterPreference

use of com.android.settingslib.widget.FooterPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChooseLockGenericTest method updatePreferencesOrFinish_footerPreferenceAddedMediumComplexityText.

@Test
public void updatePreferencesOrFinish_footerPreferenceAddedMediumComplexityText() {
    ShadowStorageManager.setIsFileEncryptedNativeOrEmulated(false);
    Intent intent = new Intent().putExtra(EXTRA_KEY_CALLER_APP_NAME, "app name").putExtra(EXTRA_KEY_REQUESTED_MIN_COMPLEXITY, PASSWORD_COMPLEXITY_MEDIUM);
    initActivity(intent);
    CharSequence expectedTitle = mActivity.getString(R.string.unlock_footer_medium_complexity_requested, "app name");
    mFragment.updatePreferencesOrFinish(false);
    FooterPreference footer = mFragment.findPreference(FooterPreference.KEY_FOOTER);
    assertThat(footer.getTitle()).isEqualTo(expectedTitle);
}
Also used : Intent(android.content.Intent) FooterPreference(com.android.settingslib.widget.FooterPreference) Test(org.junit.Test)

Aggregations

FooterPreference (com.android.settingslib.widget.FooterPreference)56 Before (org.junit.Before)14 Test (org.junit.Test)12 NotificationChannel (android.app.NotificationChannel)6 NotificationChannelGroup (android.app.NotificationChannelGroup)6 Preference (android.support.v7.preference.Preference)6 PreferenceCategory (android.support.v7.preference.PreferenceCategory)6 View (android.view.View)6 TextView (android.widget.TextView)6 LayoutPreference (com.android.settings.applications.LayoutPreference)6 MasterSwitchPreference (com.android.settings.widget.MasterSwitchPreference)6 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)6 Intent (android.content.Intent)5 Preference (androidx.preference.Preference)5 PreferenceScreen (androidx.preference.PreferenceScreen)3 Context (android.content.Context)1 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1 Handler (android.os.Handler)1 PowerManager (android.os.PowerManager)1 SwitchPreference (android.support.v14.preference.SwitchPreference)1