Search in sources :

Example 11 with SettingsActivity

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);
}
Also used : Bundle(android.os.Bundle) SettingsActivity(com.android.settings.SettingsActivity)

Example 12 with SettingsActivity

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;
}
Also used : Bundle(android.os.Bundle) Intent(android.content.Intent) Cursor(android.database.Cursor) ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) SearchView(android.widget.SearchView) TextView(android.widget.TextView) ListView(android.widget.ListView) AdapterView(android.widget.AdapterView) ComponentName(android.content.ComponentName) SettingsActivity(com.android.settings.SettingsActivity)

Example 13 with SettingsActivity

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();
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Example 14 with SettingsActivity

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;
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) ArrayList(java.util.ArrayList) RecentLocationApps(com.android.settingslib.location.RecentLocationApps) DimmableIconPreference(com.android.settings.DimmableIconPreference) CheckBoxPreference(android.support.v7.preference.CheckBoxPreference) DimmableIconPreference(com.android.settings.DimmableIconPreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Preference(android.support.v7.preference.Preference) SettingsActivity(com.android.settings.SettingsActivity)

Example 15 with SettingsActivity

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();
    }
}
Also used : SettingsActivity(com.android.settings.SettingsActivity)

Aggregations

SettingsActivity (com.android.settings.SettingsActivity)28 Bundle (android.os.Bundle)10 Intent (android.content.Intent)4 TextView (android.widget.TextView)4 ContentResolver (android.content.ContentResolver)3 View (android.view.View)3 AdapterView (android.widget.AdapterView)2 ImageView (android.widget.ImageView)2 ListView (android.widget.ListView)2 SearchView (android.widget.SearchView)2 LinkifyUtils (com.android.settings.LinkifyUtils)2 FragmentTransaction (android.app.FragmentTransaction)1 ComponentName (android.content.ComponentName)1 Context (android.content.Context)1 DialogInterface (android.content.DialogInterface)1 SendIntentException (android.content.IntentSender.SendIntentException)1 SharedPreferences (android.content.SharedPreferences)1 UserInfo (android.content.pm.UserInfo)1 Resources (android.content.res.Resources)1 Cursor (android.database.Cursor)1