Search in sources :

Example 6 with ImportancePreference

use of com.android.settings.notification.app.ImportancePreference in project android_packages_apps_Settings by omnirom.

the class ImportancePreferenceTest method setImportanceSummary_default.

@Test
public void setImportanceSummary_default() {
    final ImportancePreference preference = spy(new ImportancePreference(mContext));
    final LayoutInflater inflater = LayoutInflater.from(mContext);
    final PreferenceViewHolder holder = PreferenceViewHolder.createInstanceForTests(inflater.inflate(R.layout.notif_importance_preference, null));
    preference.setConfigurable(true);
    preference.setImportance(IMPORTANCE_DEFAULT);
    preference.onBindViewHolder(holder);
    TextView tv = holder.itemView.findViewById(R.id.alert_summary);
    preference.setDisplayInStatusBar(true);
    preference.setDisplayOnLockscreen(true);
    preference.setImportanceSummary((ViewGroup) holder.itemView, IMPORTANCE_DEFAULT, true);
    assertThat(tv.getText()).isEqualTo(mContext.getString(R.string.notification_channel_summary_default));
}
Also used : ImportancePreference(com.android.settings.notification.app.ImportancePreference) LayoutInflater(android.view.LayoutInflater) TextView(android.widget.TextView) PreferenceViewHolder(androidx.preference.PreferenceViewHolder) Test(org.junit.Test)

Aggregations

ImportancePreference (com.android.settings.notification.app.ImportancePreference)6 Test (org.junit.Test)6 LayoutInflater (android.view.LayoutInflater)5 PreferenceViewHolder (androidx.preference.PreferenceViewHolder)5 TextView (android.widget.TextView)4 Drawable (android.graphics.drawable.Drawable)3 View (android.view.View)1