use of com.cosmic.settings.preferences.PackageListAdapter in project platform_packages_apps_Galaxy by Cosmic-OS.
the class GamingMode method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get launch-able applications
addPreferencesFromResource(R.xml.gaming_mode_settings);
final PreferenceScreen prefScreen = getPreferenceScreen();
mHardwareKeysDisable = (SwitchPreference) findPreference(GAMING_MODE_HW_KEYS);
mGamingModeEnabled = (SwitchPreference) findPreference(GAMING_MODE_ENABLED);
if (!haveHWkeys()) {
prefScreen.removePreference(mHardwareKeysDisable);
}
mPackageManager = getPackageManager();
mPackageAdapter = new PackageListAdapter(getActivity());
mGamingPrefList = (PreferenceGroup) findPreference("gamingmode_applications");
mGamingPrefList.setOrderingAsAdded(false);
mGamingPackages = new HashMap<String, Package>();
mAddGamingPref = findPreference("add_gamingmode_packages");
mAddGamingPref.setOnPreferenceClickListener(this);
mContext = getActivity().getApplicationContext();
SettingsObserver observer = new SettingsObserver(new Handler(Looper.getMainLooper()));
observer.observe();
}
use of com.cosmic.settings.preferences.PackageListAdapter in project platform_packages_apps_Galaxy by Cosmic-OS.
the class HeadsUpSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get launch-able applications
addPreferencesFromResource(R.xml.heads_up_settings);
mPackageManager = getPackageManager();
mPackageAdapter = new PackageListAdapter(getActivity());
mStoplistPrefList = (PreferenceGroup) findPreference("stoplist_applications");
mStoplistPrefList.setOrderingAsAdded(false);
mBlacklistPrefList = (PreferenceGroup) findPreference("blacklist_applications");
mBlacklistPrefList.setOrderingAsAdded(false);
mStoplistPackages = new HashMap<String, Package>();
mBlacklistPackages = new HashMap<String, Package>();
mAddStoplistPref = findPreference("add_stoplist_packages");
mAddBlacklistPref = findPreference("add_blacklist_packages");
mAddStoplistPref.setOnPreferenceClickListener(this);
mAddBlacklistPref.setOnPreferenceClickListener(this);
Resources systemUiResources;
try {
systemUiResources = getPackageManager().getResourcesForApplication("com.android.systemui");
} catch (Exception e) {
return;
}
int defaultTimeOut = systemUiResources.getInteger(systemUiResources.getIdentifier("com.android.systemui:integer/heads_up_notification_decay", null, null));
mHeadsUpTimeOut = (ListPreference) findPreference(PREF_HEADS_UP_TIME_OUT);
mHeadsUpTimeOut.setOnPreferenceChangeListener(this);
int headsUpTimeOut = Settings.System.getInt(getContentResolver(), Settings.System.HEADS_UP_TIMEOUT, defaultTimeOut);
mHeadsUpTimeOut.setValue(String.valueOf(headsUpTimeOut));
updateHeadsUpTimeOutSummary(headsUpTimeOut);
int defaultSnooze = systemUiResources.getInteger(systemUiResources.getIdentifier("com.android.systemui:integer/heads_up_default_snooze_length_ms", null, null));
mHeadsUpSnoozeTime = (ListPreference) findPreference(PREF_HEADS_UP_SNOOZE_TIME);
mHeadsUpSnoozeTime.setOnPreferenceChangeListener(this);
int headsUpSnooze = Settings.System.getInt(getContentResolver(), Settings.System.HEADS_UP_NOTIFICATION_SNOOZE, defaultSnooze);
mHeadsUpSnoozeTime.setValue(String.valueOf(headsUpSnooze));
updateHeadsUpSnoozeTimeSummary(headsUpSnooze);
}
use of com.cosmic.settings.preferences.PackageListAdapter in project platform_packages_apps_Galaxy by Cosmic-OS.
the class NotificationSettings method onCreate.
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.cosmic_settings_notifications);
PreferenceScreen prefSet = getPreferenceScreen();
ContentResolver resolver = getActivity().getContentResolver();
mAnnoyingNotification = (ListPreference) findPreference("less_notification_sounds");
mAnnoyingNotification.setOnPreferenceChangeListener(this);
int threshold = Settings.System.getIntForUser(getContentResolver(), Settings.System.MUTE_ANNOYING_NOTIFICATIONS_THRESHOLD, 30000, UserHandle.USER_CURRENT);
mAnnoyingNotification.setValue(String.valueOf(threshold));
mPackageManager = getPackageManager();
mPackageAdapter = new PackageListAdapter(getActivity());
mStoplistPrefList = (PreferenceGroup) findPreference("stoplist_applications");
mStoplistPrefList.setOrderingAsAdded(false);
mBlacklistPrefList = (PreferenceGroup) findPreference("blacklist_applications");
mBlacklistPrefList.setOrderingAsAdded(false);
mStoplistPackages = new HashMap<String, Package>();
mBlacklistPackages = new HashMap<String, Package>();
mAddStoplistPref = findPreference("add_stoplist_packages");
mAddBlacklistPref = findPreference("add_blacklist_packages");
mAddStoplistPref.setOnPreferenceClickListener(this);
mAddBlacklistPref.setOnPreferenceClickListener(this);
Resources systemUiResources;
try {
systemUiResources = getPackageManager().getResourcesForApplication("com.android.systemui");
} catch (Exception e) {
return;
}
int defaultTimeOut = systemUiResources.getInteger(systemUiResources.getIdentifier("com.android.systemui:integer/heads_up_notification_decay", null, null));
mHeadsUpTimeOut = (ListPreference) findPreference(PREF_HEADS_UP_TIME_OUT);
mHeadsUpTimeOut.setOnPreferenceChangeListener(this);
int headsUpTimeOut = Settings.System.getInt(getContentResolver(), Settings.System.HEADS_UP_TIMEOUT, defaultTimeOut);
mHeadsUpTimeOut.setValue(String.valueOf(headsUpTimeOut));
updateHeadsUpTimeOutSummary(headsUpTimeOut);
int defaultSnooze = systemUiResources.getInteger(systemUiResources.getIdentifier("com.android.systemui:integer/heads_up_default_snooze_length_ms", null, null));
mHeadsUpSnoozeTime = (ListPreference) findPreference(PREF_HEADS_UP_SNOOZE_TIME);
mHeadsUpSnoozeTime.setOnPreferenceChangeListener(this);
int headsUpSnooze = Settings.System.getInt(getContentResolver(), Settings.System.HEADS_UP_NOTIFICATION_SNOOZE, defaultSnooze);
mHeadsUpSnoozeTime.setValue(String.valueOf(headsUpSnooze));
updateHeadsUpSnoozeTimeSummary(headsUpSnooze);
mForceExpanded = (SwitchPreference) findPreference(FORCE_EXPANDED_NOTIFICATIONS);
mForceExpanded.setChecked((Settings.System.getInt(getContentResolver(), Settings.System.FORCE_EXPANDED_NOTIFICATIONS, 0) == 1));
}
Aggregations