+++ /dev/null
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2013 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:orientation="vertical">
-
- <FrameLayout
- android:layout_width="match_parent"
- android:layout_height="0px"
- android:layout_weight="1">
-
- <ListView android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:paddingStart="@dimen/settings_side_margin"
- android:paddingEnd="@dimen/settings_side_margin"
- android:drawSelectorOnTop="false"
- android:fastScrollEnabled="true"
- android:scrollbarStyle="outsideInset" />
-
- <TextView android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center"
- android:textAppearance="?android:attr/textAppearanceMedium" />
-
- </FrameLayout>
-
-</LinearLayout>
--- /dev/null
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.notification;
+
+import android.annotation.Nullable;
+import android.os.Bundle;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
+import android.widget.TextView;
+import com.android.settings.R;
+import com.android.settings.SettingsPreferenceFragment;
+
+public abstract class EmptyTextSettings extends SettingsPreferenceFragment {
+
+ private TextView mEmpty;
+
+ @Override
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ mEmpty = new TextView(getContext());
+ mEmpty.setGravity(Gravity.CENTER);
+ TypedValue value = new TypedValue();
+ getContext().getTheme().resolveAttribute(android.R.attr.textAppearanceMedium, value, true);
+ mEmpty.setTextAppearance(value.resourceId);
+ ((ViewGroup) view.findViewById(R.id.list_container)).addView(mEmpty,
+ new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
+ setEmptyView(mEmpty);
+ }
+
+ protected void setEmptyText(int text) {
+ mEmpty.setText(text);
+ }
+}
package com.android.settings.notification;
+import android.annotation.Nullable;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.support.v7.preference.PreferenceScreen;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ListView;
import android.widget.TextView;
-
import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
import java.util.Collections;
import java.util.List;
-public abstract class ManagedServiceSettings extends SettingsPreferenceFragment {
+public abstract class ManagedServiceSettings extends EmptyTextSettings {
private final Config mConfig;
private Context mContext;
}
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- final View v = inflater.inflate(R.layout.managed_service_settings, container, false);
- mEmpty = (TextView) v.findViewById(android.R.id.empty);
- mEmpty.setText(mConfig.emptyText);
- ((ListView) v.findViewById(android.R.id.list)).setEmptyView(mEmpty);
- return v;
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ setEmptyText(mConfig.emptyText);
}
@Override
package com.android.settings.notification;
+import android.annotation.Nullable;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.support.v7.preference.PreferenceScreen;
import android.text.TextUtils;
import android.util.ArraySet;
-import android.view.LayoutInflater;
import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
-import com.android.settings.SettingsPreferenceFragment;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-public class ZenAccessSettings extends SettingsPreferenceFragment {
+public class ZenAccessSettings extends EmptyTextSettings {
private final SettingObserver mObserver = new SettingObserver();
private Context mContext;
private PackageManager mPkgMan;
private NotificationManager mNoMan;
- private TextView mEmpty;
@Override
protected int getMetricsCategory() {
}
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- final View v = inflater.inflate(R.layout.managed_service_settings, container, false);
- mEmpty = (TextView) v.findViewById(android.R.id.empty);
- mEmpty.setText(R.string.zen_access_empty_text);
- return v;
+ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ setEmptyText(R.string.zen_access_empty_text);
}
@Override
});
screen.addPreference(pref);
}
- mEmpty.setVisibility(apps.isEmpty() ? View.VISIBLE : View.GONE);
}
private boolean hasAccess(String pkg) {