Merge "Add indexing for Limited Interruptions (notifications) preferences"
This commit is contained in:
committed by
Android (Google) Code Review
commit
a95864d025
@@ -20,6 +20,7 @@ import android.app.ActionBar;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.database.ContentObserver;
|
import android.database.ContentObserver;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
@@ -27,6 +28,7 @@ import android.os.AsyncTask;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
|
import android.provider.SearchIndexableResource;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -43,8 +45,13 @@ import android.widget.RelativeLayout;
|
|||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
import android.widget.Switch;
|
import android.widget.Switch;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import com.android.settings.search.Indexable;
|
||||||
|
import com.android.settings.search.SearchIndexableRaw;
|
||||||
|
|
||||||
public class ZenModeSettings extends SettingsPreferenceFragment {
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ZenModeSettings extends SettingsPreferenceFragment implements Indexable {
|
||||||
private static final String TAG = "ZenModeSettings";
|
private static final String TAG = "ZenModeSettings";
|
||||||
private static final boolean DEBUG = false;
|
private static final boolean DEBUG = false;
|
||||||
|
|
||||||
@@ -282,4 +289,74 @@ public class ZenModeSettings extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable indexing of searchable data
|
||||||
|
public static final Indexable.SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||||
|
new Indexable.SearchIndexProvider() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SearchIndexableResource> getXmlResourcesToIndex(
|
||||||
|
Context context, boolean enabled) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SearchIndexableRaw> getRawDataToIndex(Context context, boolean enabled) {
|
||||||
|
final List<SearchIndexableRaw> result = new ArrayList<SearchIndexableRaw>();
|
||||||
|
final Resources res = context.getResources();
|
||||||
|
|
||||||
|
SearchIndexableRaw data = new SearchIndexableRaw(context);
|
||||||
|
data.title = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "When on";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "Calls";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "Text & SMS Messages";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "Alarms & Timers";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "Other Interruptions";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "Automatically turn on";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "While driving";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "While in meetings";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
data = new SearchIndexableRaw(context);
|
||||||
|
data.title = "During a set time period";
|
||||||
|
data.screenTitle = res.getString(R.string.zen_mode_settings_title);
|
||||||
|
result.add(data);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ import com.android.settings.SecuritySettings;
|
|||||||
import com.android.settings.SoundSettings;
|
import com.android.settings.SoundSettings;
|
||||||
import com.android.settings.WallpaperTypeSettings;
|
import com.android.settings.WallpaperTypeSettings;
|
||||||
import com.android.settings.WirelessSettings;
|
import com.android.settings.WirelessSettings;
|
||||||
|
import com.android.settings.ZenModeSettings;
|
||||||
import com.android.settings.accessibility.AccessibilitySettings;
|
import com.android.settings.accessibility.AccessibilitySettings;
|
||||||
import com.android.settings.bluetooth.BluetoothSettings;
|
import com.android.settings.bluetooth.BluetoothSettings;
|
||||||
import com.android.settings.deviceinfo.Memory;
|
import com.android.settings.deviceinfo.Memory;
|
||||||
@@ -89,97 +90,122 @@ public final class SearchIndexableResources {
|
|||||||
R.drawable.ic_settings_bluetooth2));
|
R.drawable.ic_settings_bluetooth2));
|
||||||
|
|
||||||
sResMap.put(DataUsageMeteredSettings.class.getName(),
|
sResMap.put(DataUsageMeteredSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_DATA_USAGE, R.xml.data_usage_metered_prefs,
|
new SearchIndexableResource(RANK_DATA_USAGE,
|
||||||
|
R.xml.data_usage_metered_prefs,
|
||||||
DataUsageMeteredSettings.class.getName(),
|
DataUsageMeteredSettings.class.getName(),
|
||||||
R.drawable.ic_settings_data_usage));
|
R.drawable.ic_settings_data_usage));
|
||||||
|
|
||||||
sResMap.put(WirelessSettings.class.getName(),
|
sResMap.put(WirelessSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_WIRELESS, R.xml.wireless_settings,
|
new SearchIndexableResource(RANK_WIRELESS,
|
||||||
|
R.xml.wireless_settings,
|
||||||
WirelessSettings.class.getName(),
|
WirelessSettings.class.getName(),
|
||||||
R.drawable.empty_icon));
|
R.drawable.empty_icon));
|
||||||
|
|
||||||
sResMap.put(HomeSettings.class.getName(),
|
sResMap.put(HomeSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_HOME, R.xml.home_selection,
|
new SearchIndexableResource(RANK_HOME,
|
||||||
|
R.xml.home_selection,
|
||||||
HomeSettings.class.getName(),
|
HomeSettings.class.getName(),
|
||||||
R.drawable.ic_settings_home));
|
R.drawable.ic_settings_home));
|
||||||
|
|
||||||
sResMap.put(SoundSettings.class.getName(),
|
sResMap.put(SoundSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_SOUND, R.xml.sound_settings,
|
new SearchIndexableResource(RANK_SOUND,
|
||||||
|
R.xml.sound_settings,
|
||||||
SoundSettings.class.getName(),
|
SoundSettings.class.getName(),
|
||||||
R.drawable.ic_settings_sound));
|
R.drawable.ic_settings_sound));
|
||||||
|
|
||||||
sResMap.put(DisplaySettings.class.getName(),
|
sResMap.put(DisplaySettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_DISPLAY, R.xml.display_settings,
|
new SearchIndexableResource(RANK_DISPLAY,
|
||||||
|
R.xml.display_settings,
|
||||||
DisplaySettings.class.getName(),
|
DisplaySettings.class.getName(),
|
||||||
R.drawable.ic_settings_display));
|
R.drawable.ic_settings_display));
|
||||||
|
|
||||||
sResMap.put(WallpaperTypeSettings.class.getName(),
|
sResMap.put(WallpaperTypeSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_WALLPAPER, NO_DATA_RES_ID,
|
new SearchIndexableResource(RANK_WALLPAPER,
|
||||||
|
NO_DATA_RES_ID,
|
||||||
WallpaperTypeSettings.class.getName(),
|
WallpaperTypeSettings.class.getName(),
|
||||||
R.drawable.ic_settings_display));
|
R.drawable.ic_settings_display));
|
||||||
|
|
||||||
sResMap.put(NotificationSettings.class.getName(),
|
sResMap.put(NotificationSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_NOTIFICATIONS, R.xml.notification_settings,
|
new SearchIndexableResource(RANK_NOTIFICATIONS,
|
||||||
|
R.xml.notification_settings,
|
||||||
NotificationSettings.class.getName(),
|
NotificationSettings.class.getName(),
|
||||||
R.drawable.ic_settings_notifications));
|
R.drawable.ic_settings_notifications));
|
||||||
|
|
||||||
|
sResMap.put(ZenModeSettings.class.getName(),
|
||||||
|
new SearchIndexableResource(RANK_NOTIFICATIONS,
|
||||||
|
NO_DATA_RES_ID,
|
||||||
|
ZenModeSettings.class.getName(),
|
||||||
|
R.drawable.ic_settings_notifications));
|
||||||
|
|
||||||
sResMap.put(Memory.class.getName(),
|
sResMap.put(Memory.class.getName(),
|
||||||
new SearchIndexableResource(RANK_MEMORY, R.xml.device_info_memory,
|
new SearchIndexableResource(RANK_MEMORY,
|
||||||
|
R.xml.device_info_memory,
|
||||||
Memory.class.getName(),
|
Memory.class.getName(),
|
||||||
R.drawable.ic_settings_storage));
|
R.drawable.ic_settings_storage));
|
||||||
|
|
||||||
sResMap.put(PowerUsageSummary.class.getName(),
|
sResMap.put(PowerUsageSummary.class.getName(),
|
||||||
new SearchIndexableResource(RANK_POWER_USAGE, R.xml.power_usage_summary,
|
new SearchIndexableResource(RANK_POWER_USAGE,
|
||||||
|
R.xml.power_usage_summary,
|
||||||
PowerUsageSummary.class.getName(),
|
PowerUsageSummary.class.getName(),
|
||||||
R.drawable.ic_settings_battery));
|
R.drawable.ic_settings_battery));
|
||||||
|
|
||||||
sResMap.put(UserSettings.class.getName(),
|
sResMap.put(UserSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_USERS, R.xml.user_settings,
|
new SearchIndexableResource(RANK_USERS,
|
||||||
|
R.xml.user_settings,
|
||||||
UserSettings.class.getName(),
|
UserSettings.class.getName(),
|
||||||
R.drawable.ic_settings_multiuser));
|
R.drawable.ic_settings_multiuser));
|
||||||
|
|
||||||
sResMap.put(LocationSettings.class.getName(),
|
sResMap.put(LocationSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_LOCATION, R.xml.location_settings,
|
new SearchIndexableResource(RANK_LOCATION,
|
||||||
|
R.xml.location_settings,
|
||||||
LocationSettings.class.getName(),
|
LocationSettings.class.getName(),
|
||||||
R.drawable.ic_settings_location));
|
R.drawable.ic_settings_location));
|
||||||
|
|
||||||
sResMap.put(SecuritySettings.class.getName(),
|
sResMap.put(SecuritySettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_SECURITY, R.xml.security_settings,
|
new SearchIndexableResource(RANK_SECURITY,
|
||||||
|
R.xml.security_settings,
|
||||||
SecuritySettings.class.getName(),
|
SecuritySettings.class.getName(),
|
||||||
R.drawable.ic_settings_security));
|
R.drawable.ic_settings_security));
|
||||||
|
|
||||||
sResMap.put(InputMethodAndLanguageSettings.class.getName(),
|
sResMap.put(InputMethodAndLanguageSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_IME, R.xml.language_settings,
|
new SearchIndexableResource(RANK_IME,
|
||||||
|
R.xml.language_settings,
|
||||||
InputMethodAndLanguageSettings.class.getName(),
|
InputMethodAndLanguageSettings.class.getName(),
|
||||||
R.drawable.ic_settings_language));
|
R.drawable.ic_settings_language));
|
||||||
|
|
||||||
sResMap.put(PrivacySettings.class.getName(),
|
sResMap.put(PrivacySettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_PRIVACY, R.xml.privacy_settings,
|
new SearchIndexableResource(RANK_PRIVACY,
|
||||||
|
R.xml.privacy_settings,
|
||||||
PrivacySettings.class.getName(),
|
PrivacySettings.class.getName(),
|
||||||
R.drawable.ic_settings_backup));
|
R.drawable.ic_settings_backup));
|
||||||
|
|
||||||
sResMap.put(DateTimeSettings.class.getName(),
|
sResMap.put(DateTimeSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_DATE_TIME, R.xml.date_time_prefs,
|
new SearchIndexableResource(RANK_DATE_TIME,
|
||||||
|
R.xml.date_time_prefs,
|
||||||
DateTimeSettings.class.getName(),
|
DateTimeSettings.class.getName(),
|
||||||
R.drawable.ic_settings_date_time));
|
R.drawable.ic_settings_date_time));
|
||||||
|
|
||||||
sResMap.put(AccessibilitySettings.class.getName(),
|
sResMap.put(AccessibilitySettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_ACCESSIBILITY, R.xml.accessibility_settings,
|
new SearchIndexableResource(RANK_ACCESSIBILITY,
|
||||||
|
R.xml.accessibility_settings,
|
||||||
AccessibilitySettings.class.getName(),
|
AccessibilitySettings.class.getName(),
|
||||||
R.drawable.ic_settings_accessibility));
|
R.drawable.ic_settings_accessibility));
|
||||||
|
|
||||||
sResMap.put(PrintSettingsFragment.class.getName(),
|
sResMap.put(PrintSettingsFragment.class.getName(),
|
||||||
new SearchIndexableResource(RANK_PRINTING, R.xml.print_settings,
|
new SearchIndexableResource(RANK_PRINTING,
|
||||||
|
R.xml.print_settings,
|
||||||
PrintSettingsFragment.class.getName(),
|
PrintSettingsFragment.class.getName(),
|
||||||
com.android.internal.R.drawable.ic_print));
|
com.android.internal.R.drawable.ic_print));
|
||||||
|
|
||||||
sResMap.put(DevelopmentSettings.class.getName(),
|
sResMap.put(DevelopmentSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_DEVELOPEMENT, R.xml.development_prefs,
|
new SearchIndexableResource(RANK_DEVELOPEMENT,
|
||||||
|
R.xml.development_prefs,
|
||||||
DevelopmentSettings.class.getName(),
|
DevelopmentSettings.class.getName(),
|
||||||
R.drawable.ic_settings_development));
|
R.drawable.ic_settings_development));
|
||||||
|
|
||||||
sResMap.put(DeviceInfoSettings.class.getName(),
|
sResMap.put(DeviceInfoSettings.class.getName(),
|
||||||
new SearchIndexableResource(RANK_DEVICE_INFO, R.xml.device_info_settings,
|
new SearchIndexableResource(RANK_DEVICE_INFO,
|
||||||
|
R.xml.device_info_settings,
|
||||||
DeviceInfoSettings.class.getName(),
|
DeviceInfoSettings.class.getName(),
|
||||||
R.drawable.ic_settings_about));
|
R.drawable.ic_settings_about));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user