Loading src/com/android/settings/notification/app/ImportancePreference.java +4 −16 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.preference.Preference; import androidx.preference.PreferenceViewHolder; Loading @@ -44,15 +45,11 @@ public class ImportancePreference extends Preference { private boolean mIsConfigurable = true; private int mImportance; private boolean mDisplayInStatusBar; private boolean mDisplayOnLockscreen; private View mSilenceButton; private View mAlertButton; private Context mContext; Drawable selectedBackground; Drawable unselectedBackground; private static final int BUTTON_ANIM_TIME_MS = 100; private static final boolean SHOW_BUTTON_SUMMARY = false; public ImportancePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { Loading @@ -76,10 +73,9 @@ public class ImportancePreference extends Preference { } private void init(Context context) { mContext = context; selectedBackground = mContext.getDrawable( selectedBackground = context.getDrawable( R.drawable.notification_importance_button_background_selected); unselectedBackground = mContext.getDrawable( unselectedBackground = context.getDrawable( R.drawable.notification_importance_button_background_unselected); setLayoutResource(R.layout.notif_importance_preference); } Loading @@ -92,16 +88,8 @@ public class ImportancePreference extends Preference { mIsConfigurable = configurable; } public void setDisplayInStatusBar(boolean display) { mDisplayInStatusBar = display; } public void setDisplayOnLockscreen(boolean display) { mDisplayOnLockscreen = display; } @Override public void onBindViewHolder(final PreferenceViewHolder holder) { public void onBindViewHolder(@NonNull final PreferenceViewHolder holder) { super.onBindViewHolder(holder); holder.itemView.setClickable(false); Loading src/com/android/settings/notification/app/ImportancePreferenceController.java +2 −6 Original line number Diff line number Diff line Loading @@ -22,13 +22,12 @@ import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import android.app.NotificationChannel; import android.content.Context; import android.media.RingtoneManager; import android.provider.Settings; import androidx.preference.Preference; import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.notification.NotificationBackend; import androidx.preference.Preference; public class ImportancePreferenceController extends NotificationPreferenceController implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener { Loading Loading @@ -70,9 +69,6 @@ public class ImportancePreferenceController extends NotificationPreferenceContro ImportancePreference pref = (ImportancePreference) preference; pref.setConfigurable(isChannelConfigurable(mChannel)); pref.setImportance(mChannel.getImportance()); pref.setDisplayInStatusBar(mBackend.showSilentInStatusBar(mContext.getPackageName())); pref.setDisplayOnLockscreen(Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1) == 1); } } Loading tests/robotests/src/com/android/settings/notification/app/ImportancePreferenceControllerTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; Loading Loading @@ -220,7 +219,6 @@ public class ImportancePreferenceControllerTest { verify(pref, times(1)).setConfigurable(anyBoolean()); verify(pref, times(1)).setImportance(IMPORTANCE_HIGH); verify(pref, times(1)).setDisplayInStatusBar(false); } @Test Loading tests/robotests/src/com/android/settings/notification/app/ImportancePreferenceTest.java +0 −10 Original line number Diff line number Diff line Loading @@ -154,12 +154,7 @@ public class ImportancePreferenceTest { preference.onBindViewHolder(holder); TextView tv = holder.itemView.findViewById(R.id.silence_summary); preference.setDisplayInStatusBar(true); preference.setDisplayOnLockscreen(true); preference.setImportanceSummary((ViewGroup) holder.itemView, IMPORTANCE_LOW, true); assertThat(tv.getText()).isEqualTo( mContext.getString(R.string.notification_channel_summary_low)); } Loading @@ -176,12 +171,7 @@ public class ImportancePreferenceTest { 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)); } Loading Loading
src/com/android/settings/notification/app/ImportancePreference.java +4 −16 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.preference.Preference; import androidx.preference.PreferenceViewHolder; Loading @@ -44,15 +45,11 @@ public class ImportancePreference extends Preference { private boolean mIsConfigurable = true; private int mImportance; private boolean mDisplayInStatusBar; private boolean mDisplayOnLockscreen; private View mSilenceButton; private View mAlertButton; private Context mContext; Drawable selectedBackground; Drawable unselectedBackground; private static final int BUTTON_ANIM_TIME_MS = 100; private static final boolean SHOW_BUTTON_SUMMARY = false; public ImportancePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { Loading @@ -76,10 +73,9 @@ public class ImportancePreference extends Preference { } private void init(Context context) { mContext = context; selectedBackground = mContext.getDrawable( selectedBackground = context.getDrawable( R.drawable.notification_importance_button_background_selected); unselectedBackground = mContext.getDrawable( unselectedBackground = context.getDrawable( R.drawable.notification_importance_button_background_unselected); setLayoutResource(R.layout.notif_importance_preference); } Loading @@ -92,16 +88,8 @@ public class ImportancePreference extends Preference { mIsConfigurable = configurable; } public void setDisplayInStatusBar(boolean display) { mDisplayInStatusBar = display; } public void setDisplayOnLockscreen(boolean display) { mDisplayOnLockscreen = display; } @Override public void onBindViewHolder(final PreferenceViewHolder holder) { public void onBindViewHolder(@NonNull final PreferenceViewHolder holder) { super.onBindViewHolder(holder); holder.itemView.setClickable(false); Loading
src/com/android/settings/notification/app/ImportancePreferenceController.java +2 −6 Original line number Diff line number Diff line Loading @@ -22,13 +22,12 @@ import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import android.app.NotificationChannel; import android.content.Context; import android.media.RingtoneManager; import android.provider.Settings; import androidx.preference.Preference; import com.android.settings.core.PreferenceControllerMixin; import com.android.settings.notification.NotificationBackend; import androidx.preference.Preference; public class ImportancePreferenceController extends NotificationPreferenceController implements PreferenceControllerMixin, Preference.OnPreferenceChangeListener { Loading Loading @@ -70,9 +69,6 @@ public class ImportancePreferenceController extends NotificationPreferenceContro ImportancePreference pref = (ImportancePreference) preference; pref.setConfigurable(isChannelConfigurable(mChannel)); pref.setImportance(mChannel.getImportance()); pref.setDisplayInStatusBar(mBackend.showSilentInStatusBar(mContext.getPackageName())); pref.setDisplayOnLockscreen(Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.LOCK_SCREEN_SHOW_SILENT_NOTIFICATIONS, 1) == 1); } } Loading
tests/robotests/src/com/android/settings/notification/app/ImportancePreferenceControllerTest.java +1 −3 Original line number Diff line number Diff line Loading @@ -27,7 +27,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; Loading Loading @@ -220,7 +219,6 @@ public class ImportancePreferenceControllerTest { verify(pref, times(1)).setConfigurable(anyBoolean()); verify(pref, times(1)).setImportance(IMPORTANCE_HIGH); verify(pref, times(1)).setDisplayInStatusBar(false); } @Test Loading
tests/robotests/src/com/android/settings/notification/app/ImportancePreferenceTest.java +0 −10 Original line number Diff line number Diff line Loading @@ -154,12 +154,7 @@ public class ImportancePreferenceTest { preference.onBindViewHolder(holder); TextView tv = holder.itemView.findViewById(R.id.silence_summary); preference.setDisplayInStatusBar(true); preference.setDisplayOnLockscreen(true); preference.setImportanceSummary((ViewGroup) holder.itemView, IMPORTANCE_LOW, true); assertThat(tv.getText()).isEqualTo( mContext.getString(R.string.notification_channel_summary_low)); } Loading @@ -176,12 +171,7 @@ public class ImportancePreferenceTest { 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)); } Loading