Add a few pages to search index.
- Data saver - A few special permission access pages - Picture-in-picture - Premium sms - do not disturb access - And a unrelated cleanup: move EmptyTextFragment from notification/ to widget/ Bug: 70720645 Test: robotests Change-Id: I6a87f712bf81f9fd32fa9a3826fba851ca748409
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* 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.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(android.R.id.list_container)).addView(mEmpty,
|
||||
new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
|
||||
setEmptyView(mEmpty);
|
||||
}
|
||||
|
||||
protected void setEmptyText(int text) {
|
||||
mEmpty.setText(text);
|
||||
}
|
||||
}
|
@@ -36,6 +36,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.RemoteException;
|
||||
import android.provider.SearchIndexableResource;
|
||||
import android.provider.Settings.Secure;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArraySet;
|
||||
@@ -47,7 +48,11 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.instrumentation.InstrumentedDialogFragment;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settings.search.BaseSearchIndexProvider;
|
||||
import com.android.settings.search.Indexable;
|
||||
import com.android.settings.widget.AppSwitchPreference;
|
||||
import com.android.settings.widget.EmptyTextSettings;
|
||||
import com.android.settingslib.search.SearchIndexable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -58,6 +63,7 @@ import androidx.preference.Preference.OnPreferenceChangeListener;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
import androidx.preference.SwitchPreference;
|
||||
|
||||
@SearchIndexable
|
||||
public class ZenAccessSettings extends EmptyTextSettings {
|
||||
private final String TAG = "ZenAccessSettings";
|
||||
|
||||
@@ -336,4 +342,18 @@ public class ZenAccessSettings extends EmptyTextSettings {
|
||||
.create();
|
||||
}
|
||||
}
|
||||
|
||||
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
new BaseSearchIndexProvider() {
|
||||
@Override
|
||||
public List<SearchIndexableResource> getXmlResourcesToIndex(Context context,
|
||||
boolean enabled) {
|
||||
final ArrayList<SearchIndexableResource> result = new ArrayList<>();
|
||||
|
||||
final SearchIndexableResource sir = new SearchIndexableResource(context);
|
||||
sir.xmlResId = R.xml.zen_access_settings;
|
||||
result.add(sir);
|
||||
return result;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user