Expand channel settings if coming from app

Test: manual inspection
Change-Id: I2ed7f5cc2355f27e0edf36a0d8ee23e418eafd99
Fixes: 77648459
This commit is contained in:
Julia Reynolds
2018-04-18 12:17:33 -04:00
parent 270f608578
commit f3290eafce
5 changed files with 23 additions and 12 deletions

View File

@@ -18,13 +18,16 @@ package com.android.settings.notification;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.Log;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.applications.AppInfoBase;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
@@ -38,6 +41,19 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
return MetricsEvent.NOTIFICATION_TOPIC_NOTIFICATION;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final PreferenceScreen screen = getPreferenceScreen();
Bundle args = getArguments();
// If linking to this screen from an external app, expand settings
if (screen != null && args != null) {
if (!args.getBoolean(ARG_FROM_SETTINGS, false)) {
screen.setInitialExpandedChildrenCount(Integer.MAX_VALUE);
}
}
}
@Override
public void onResume() {
super.onResume();
@@ -92,7 +108,7 @@ public class ChannelNotificationSettings extends NotificationSettingsBase {
mBackend));
mControllers.add(new LightsPreferenceController(context, mBackend));
mControllers.add(new BadgePreferenceController(context, mBackend));
mControllers.add(new DndPreferenceController(context, getLifecycle(), mBackend));
mControllers.add(new DndPreferenceController(context, mBackend));
mControllers.add(new NotificationsOffPreferenceController(context));
return new ArrayList<>(mControllers);
}