Merge "Read the subtext of notif importance field on selection" into qt-dev

am: 3f95fda1cf

Change-Id: Icc507ca10f4c657593ed1c6b6cb9d93c0b01f8fe
This commit is contained in:
Julia Reynolds
2019-06-05 14:49:45 -07:00
committed by android-build-merger
2 changed files with 16 additions and 12 deletions

View File

@@ -99,7 +99,7 @@
<TextView <TextView
android:id="@+id/silence_summary" android:id="@+id/silence_summary"
android:paddingTop="@dimen/notification_importance_button_padding" android:paddingTop="@dimen/notification_importance_button_padding"
android:text="@string/notification_channel_summary_default" android:text="@string/notification_channel_summary_low"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clickable="false" android:clickable="false"

View File

@@ -27,6 +27,7 @@ import android.content.Context;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.transition.AutoTransition; import android.transition.AutoTransition;
import android.transition.Transition;
import android.transition.TransitionManager; import android.transition.TransitionManager;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
@@ -112,6 +113,7 @@ public class ImportancePreference extends Preference {
mAlertButton.setEnabled(false); mAlertButton.setEnabled(false);
} }
setImportanceSummary((ViewGroup) holder.itemView, mImportance, false);
switch (mImportance) { switch (mImportance) {
case IMPORTANCE_MIN: case IMPORTANCE_MIN:
case IMPORTANCE_LOW: case IMPORTANCE_LOW:
@@ -126,23 +128,29 @@ public class ImportancePreference extends Preference {
mAlertButton.setSelected(true); mAlertButton.setSelected(true);
break; break;
} }
setImportanceSummary((ViewGroup) holder.itemView, mImportance, false);
mSilenceButton.setOnClickListener(v -> { mSilenceButton.setOnClickListener(v -> {
callChangeListener(IMPORTANCE_LOW); callChangeListener(IMPORTANCE_LOW);
mAlertButton.setBackground(unselectedBackground); mAlertButton.setBackground(unselectedBackground);
mAlertButton.setSelected(false);
mSilenceButton.setBackground(selectedBackground); mSilenceButton.setBackground(selectedBackground);
mSilenceButton.setSelected(true);
setImportanceSummary((ViewGroup) holder.itemView, IMPORTANCE_LOW, true); setImportanceSummary((ViewGroup) holder.itemView, IMPORTANCE_LOW, true);
// a11y service won't always read the newly appearing text in the right order if the
// selection happens too soon (readback happens on a different thread as layout). post
// the selection to make that conflict less likely
holder.itemView.post(() -> {
mAlertButton.setSelected(false);
mSilenceButton.setSelected(true);
});
}); });
mAlertButton.setOnClickListener(v -> { mAlertButton.setOnClickListener(v -> {
callChangeListener(IMPORTANCE_DEFAULT); callChangeListener(IMPORTANCE_DEFAULT);
mSilenceButton.setBackground(unselectedBackground); mSilenceButton.setBackground(unselectedBackground);
mSilenceButton.setSelected(false);
mAlertButton.setBackground(selectedBackground); mAlertButton.setBackground(selectedBackground);
mAlertButton.setSelected(true);
setImportanceSummary((ViewGroup) holder.itemView, IMPORTANCE_DEFAULT, true); setImportanceSummary((ViewGroup) holder.itemView, IMPORTANCE_DEFAULT, true);
holder.itemView.post(() -> {
mSilenceButton.setSelected(false);
mAlertButton.setSelected(true);
});
}); });
} }
@@ -172,9 +180,7 @@ public class ImportancePreference extends Preference {
((ImageView) parent.findViewById(R.id.alert_icon)).setImageTintList(colorAccent); ((ImageView) parent.findViewById(R.id.alert_icon)).setImageTintList(colorAccent);
((TextView) parent.findViewById(R.id.alert_label)).setTextColor(colorAccent); ((TextView) parent.findViewById(R.id.alert_label)).setTextColor(colorAccent);
TextView view = parent.findViewById(R.id.alert_summary); parent.findViewById(R.id.alert_summary).setVisibility(VISIBLE);
view.setText(R.string.notification_channel_summary_default);
view.setVisibility(VISIBLE);
} else { } else {
parent.findViewById(R.id.alert_summary).setVisibility(GONE); parent.findViewById(R.id.alert_summary).setVisibility(GONE);
((ImageView) parent.findViewById(R.id.alert_icon)).setImageTintList(colorNormal); ((ImageView) parent.findViewById(R.id.alert_icon)).setImageTintList(colorNormal);
@@ -182,9 +188,7 @@ public class ImportancePreference extends Preference {
((ImageView) parent.findViewById(R.id.silence_icon)).setImageTintList(colorAccent); ((ImageView) parent.findViewById(R.id.silence_icon)).setImageTintList(colorAccent);
((TextView) parent.findViewById(R.id.silence_label)).setTextColor(colorAccent); ((TextView) parent.findViewById(R.id.silence_label)).setTextColor(colorAccent);
TextView view = parent.findViewById(R.id.silence_summary); parent.findViewById(R.id.silence_summary).setVisibility(VISIBLE);
view.setVisibility(VISIBLE);
view.setText(R.string.notification_channel_summary_low);
} }
} }
} }