use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ManageAccountsSettings method startAccountSettings.
private void startAccountSettings(AccountPreference acctPref) {
Bundle args = new Bundle();
args.putParcelable(AccountSyncSettings.ACCOUNT_KEY, acctPref.getAccount());
args.putParcelable(EXTRA_USER, mUserHandle);
((SettingsActivity) getActivity()).startPreferencePanel(AccountSyncSettings.class.getCanonicalName(), args, R.string.account_sync_settings_title, acctPref.getAccount().name, this, REQUEST_SHOW_SYNC_SETTINGS);
}
use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SearchResultsSummary method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View view = inflater.inflate(R.layout.search_panel, container, false);
mLayoutSuggestions = (ViewGroup) view.findViewById(R.id.layout_suggestions);
mLayoutResults = (ViewGroup) view.findViewById(R.id.layout_results);
mResultsListView = (ListView) view.findViewById(R.id.list_results);
mResultsListView.setAdapter(mResultsAdapter);
mResultsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// We have a header, so we need to decrement the position by one
position--;
// List Header and thus the position passed was "0" and then by decrement was "-1"
if (position < 0) {
return;
}
final Cursor cursor = mResultsAdapter.mCursor;
cursor.moveToPosition(position);
final String className = cursor.getString(Index.COLUMN_INDEX_CLASS_NAME);
final String screenTitle = cursor.getString(Index.COLUMN_INDEX_SCREEN_TITLE);
final String action = cursor.getString(Index.COLUMN_INDEX_INTENT_ACTION);
final String key = cursor.getString(Index.COLUMN_INDEX_KEY);
final SettingsActivity sa = (SettingsActivity) getActivity();
sa.needToRevertToInitialFragment();
if (TextUtils.isEmpty(action)) {
Bundle args = new Bundle();
args.putString(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key);
Utils.startWithFragment(sa, className, args, null, 0, -1, screenTitle);
} else {
final Intent intent = new Intent(action);
final String targetPackage = cursor.getString(Index.COLUMN_INDEX_INTENT_ACTION_TARGET_PACKAGE);
final String targetClass = cursor.getString(Index.COLUMN_INDEX_INTENT_ACTION_TARGET_CLASS);
if (!TextUtils.isEmpty(targetPackage) && !TextUtils.isEmpty(targetClass)) {
final ComponentName component = new ComponentName(targetPackage, targetClass);
intent.setComponent(component);
}
intent.putExtra(SettingsActivity.EXTRA_FRAGMENT_ARG_KEY, key);
sa.startActivity(intent);
}
saveQueryToDatabase();
}
});
mResultsListView.addHeaderView(LayoutInflater.from(getActivity()).inflate(R.layout.search_panel_results_header, mResultsListView, false), null, false);
mSuggestionsListView = (ListView) view.findViewById(R.id.list_suggestions);
mSuggestionsListView.setAdapter(mSuggestionsAdapter);
mSuggestionsListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// We have a header, so we need to decrement the position by one
position--;
// List Header and thus the position passed was "0" and then by decrement was "-1"
if (position < 0) {
return;
}
final Cursor cursor = mSuggestionsAdapter.mCursor;
cursor.moveToPosition(position);
mShowResults = true;
mQuery = cursor.getString(0);
mSearchView.setQuery(mQuery, false);
}
});
mSuggestionsListView.addHeaderView(LayoutInflater.from(getActivity()).inflate(R.layout.search_panel_suggestions_header, mSuggestionsListView, false), null, false);
return view;
}
use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LocationSettings method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final SettingsActivity activity = (SettingsActivity) getActivity();
mUm = (UserManager) activity.getSystemService(Context.USER_SERVICE);
setHasOptionsMenu(true);
mSwitchBar = activity.getSwitchBar();
mSwitch = mSwitchBar.getSwitch();
mSwitchBar.show();
}
use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class LocationSettings method createPreferenceHierarchy.
private PreferenceScreen createPreferenceHierarchy() {
final SettingsActivity activity = (SettingsActivity) getActivity();
PreferenceScreen root = getPreferenceScreen();
if (root != null) {
root.removeAll();
}
addPreferencesFromResource(R.xml.location_settings);
root = getPreferenceScreen();
setupManagedProfileCategory(root);
mLocationMode = root.findPreference(KEY_LOCATION_MODE);
mLocationMode.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
activity.startPreferencePanel(LocationMode.class.getName(), null, R.string.location_mode_screen_title, null, LocationSettings.this, 0);
return true;
}
});
mAgpsEnabled = getActivity().getResources().getBoolean(R.bool.config_agps_enabled);
mAssistedGps = (CheckBoxPreference) root.findPreference(KEY_ASSISTED_GPS);
if (!mAgpsEnabled) {
root.removePreference(mAssistedGps);
}
if (mAssistedGps != null) {
mAssistedGps.setChecked(Settings.Global.getInt(getContentResolver(), Settings.Global.ASSISTED_GPS_ENABLED, 0) == 1);
}
mCategoryRecentLocationRequests = (PreferenceCategory) root.findPreference(KEY_RECENT_LOCATION_REQUESTS);
RecentLocationApps recentApps = new RecentLocationApps(activity);
List<RecentLocationApps.Request> recentLocationRequests = recentApps.getAppList();
List<Preference> recentLocationPrefs = new ArrayList<>(recentLocationRequests.size());
for (final RecentLocationApps.Request request : recentLocationRequests) {
DimmableIconPreference pref = new DimmableIconPreference(getPrefContext(), request.contentDescription);
pref.setIcon(request.icon);
pref.setTitle(request.label);
if (request.isHighBattery) {
pref.setSummary(R.string.location_high_battery_use);
} else {
pref.setSummary(R.string.location_low_battery_use);
}
pref.setOnPreferenceClickListener(new PackageEntryClickedListener(request.packageName, request.userHandle));
recentLocationPrefs.add(pref);
}
if (recentLocationRequests.size() > 0) {
addPreferencesSorted(recentLocationPrefs, mCategoryRecentLocationRequests);
} else {
// If there's no item to display, add a "No recent apps" item.
Preference banner = new Preference(getPrefContext());
banner.setLayoutResource(R.layout.location_list_no_item);
banner.setTitle(R.string.location_no_recent_apps);
banner.setSelectable(false);
mCategoryRecentLocationRequests.addPreference(banner);
}
boolean lockdownOnLocationAccess = false;
// injected location services must not be shown.
if (mManagedProfile != null && mUm.hasUserRestriction(UserManager.DISALLOW_SHARE_LOCATION, mManagedProfile)) {
lockdownOnLocationAccess = true;
}
addLocationServices(activity, root, lockdownOnLocationAccess);
refreshLocationMode();
return root;
}
use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AndroidBeam method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
SettingsActivity activity = (SettingsActivity) getActivity();
mOldActivityTitle = activity.getActionBar().getTitle();
mSwitchBar = activity.getSwitchBar();
if (mBeamDisallowedByOnlyAdmin) {
mSwitchBar.hide();
} else {
mSwitchBar.setChecked(!mBeamDisallowedByBase && mNfcAdapter.isNdefPushEnabled());
mSwitchBar.addOnSwitchChangeListener(this);
mSwitchBar.setEnabled(!mBeamDisallowedByBase);
mSwitchBar.show();
}
}
Aggregations