Merge "Update preference screen title."
This commit is contained in:
committed by
Android (Google) Code Review
commit
2bb74379e5
@@ -31,6 +31,17 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
|
||||
|
||||
private TextView mEmpty;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
super.onCreatePreferences(savedInstanceState, rootKey);
|
||||
if (usePreferenceScreenTitle()) {
|
||||
final int resId = getPreferenceScreenResId();
|
||||
if (resId > 0) {
|
||||
addPreferencesFromResource(resId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
@@ -47,4 +58,9 @@ public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
|
||||
protected void setEmptyText(int text) {
|
||||
mEmpty.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the res id for static preference xml for this fragment.
|
||||
*/
|
||||
protected abstract int getPreferenceScreenResId();
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.android.settings.notification;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.Fragment;
|
||||
@@ -38,11 +37,6 @@ public class NotificationAccessSettings extends ManagedServiceSettings {
|
||||
private static final String TAG = NotificationAccessSettings.class.getSimpleName();
|
||||
private static final Config CONFIG = getNotificationListenerConfig();
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
}
|
||||
|
||||
private static Config getNotificationListenerConfig() {
|
||||
final Config c = new Config();
|
||||
c.tag = TAG;
|
||||
@@ -100,6 +94,11 @@ public class NotificationAccessSettings extends ManagedServiceSettings {
|
||||
mNm.setNotificationListenerAccessGranted(service, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.notification_access_settings;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
void logSpecialPermissionChange(boolean enable, String packageName) {
|
||||
int logCategory = enable ? MetricsEvent.APP_SPECIAL_PERMISSION_NOTIVIEW_ALLOW
|
||||
|
@@ -21,9 +21,7 @@ import android.app.ActivityManager;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AppGlobals;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@@ -38,7 +36,6 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.Settings;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.support.v14.preference.SwitchPreference;
|
||||
import android.support.v7.preference.Preference;
|
||||
@@ -48,7 +45,6 @@ import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
@@ -80,7 +76,9 @@ public class ZenAccessSettings extends EmptyTextSettings {
|
||||
mContext = getActivity();
|
||||
mPkgMan = mContext.getPackageManager();
|
||||
mNoMan = mContext.getSystemService(NotificationManager.class);
|
||||
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));
|
||||
if (!usePreferenceScreenTitle()) {
|
||||
setPreferenceScreen(getPreferenceManager().createPreferenceScreen(mContext));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,6 +87,11 @@ public class ZenAccessSettings extends EmptyTextSettings {
|
||||
setEmptyText(R.string.zen_access_empty_text);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getPreferenceScreenResId() {
|
||||
return R.xml.zen_access_settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
Reference in New Issue
Block a user