Update conversation-related strings am: 9e78ec75d1

Change-Id: I9fb42f08125dcfd078045c5737bae429870022d5
This commit is contained in:
Julia Reynolds
2020-05-22 11:48:26 +00:00
committed by Automerger Merge Worker
8 changed files with 58 additions and 18 deletions

View File

@@ -23,6 +23,7 @@ import android.service.notification.ConversationChannelWrapper;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import com.android.settings.R;
import com.android.settings.notification.NotificationBackend;
import java.util.Collections;
@@ -49,6 +50,14 @@ public class AllConversationsPreferenceController extends ConversationListPrefer
return true;
}
@Override
Preference getSummaryPreference() {
Preference pref = new Preference(mContext);
pref.setOrder(1);
pref.setSummary(R.string.other_conversations_summary);
return pref;
}
@Override
boolean matchesFilter(ConversationChannelWrapper conversation) {
return !conversation.getNotificationChannel().isImportantConversation();

View File

@@ -73,24 +73,33 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe
containerGroup.setVisible(false);
} else {
containerGroup.setVisible(true);
Preference summaryPref = getSummaryPreference();
if (summaryPref != null) {
containerGroup.addPreference(summaryPref);
}
}
}
abstract Preference getSummaryPreference();
abstract boolean matchesFilter(ConversationChannelWrapper conversation);
protected void populateConversations(List<ConversationChannelWrapper> conversations,
PreferenceGroup containerGroup) {
int order = 100;
for (ConversationChannelWrapper conversation : conversations) {
if (conversation.getNotificationChannel().isDemoted()
|| !matchesFilter(conversation)) {
continue;
}
containerGroup.addPreference(createConversationPref(conversation));
containerGroup.addPreference(createConversationPref(conversation, order++));
}
}
protected Preference createConversationPref(final ConversationChannelWrapper conversation) {
protected Preference createConversationPref(final ConversationChannelWrapper conversation,
int order) {
Preference pref = new Preference(mContext);
pref.setOrder(order);
pref.setTitle(getTitle(conversation));
pref.setSummary(getSummary(conversation));

View File

@@ -59,8 +59,7 @@ public class InvalidConversationPreferenceController extends NotificationPrefere
pref.setDisabledByAdmin(mAdmin);
pref.setEnabled(!pref.isDisabledByAdmin());
pref.setChecked(!mBackend.hasUserDemotedInvalidMsgApp(mAppRow.pkg, mAppRow.uid));
preference.setSummary(mContext.getString(
R.string.conversation_section_switch_summary, mAppRow.label));
preference.setSummary(mContext.getString(R.string.conversation_section_switch_summary));
}
@Override

View File

@@ -50,6 +50,11 @@ public class NoConversationsPreferenceController extends ConversationListPrefere
return true;
}
@Override
Preference getSummaryPreference() {
return null;
}
@Override
boolean matchesFilter(ConversationChannelWrapper conversation) {
return false;

View File

@@ -23,6 +23,7 @@ import android.service.notification.ConversationChannelWrapper;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import com.android.settings.R;
import com.android.settings.notification.NotificationBackend;
import java.util.Collections;
@@ -49,6 +50,14 @@ public class PriorityConversationsPreferenceController extends
return true;
}
@Override
Preference getSummaryPreference() {
Preference pref = new Preference(mContext);
pref.setOrder(1);
pref.setSummary(R.string.important_conversations_summary_bubbles);
return pref;
}
@Override
boolean matchesFilter(ConversationChannelWrapper conversation) {
return conversation.getNotificationChannel().isImportantConversation();