Search in sources :

Example 6 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class BluetoothSettings method setOffMessage.

private void setOffMessage() {
    final TextView emptyView = getEmptyTextView();
    if (emptyView == null) {
        return;
    }
    final CharSequence briefText = getText(R.string.bluetooth_empty_list_bluetooth_off);
    final ContentResolver resolver = getActivity().getContentResolver();
    final boolean bleScanningMode = Settings.Global.getInt(resolver, Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE, 0) == 1;
    if (!bleScanningMode) {
        // Show only the brief text if the scanning mode has been turned off.
        emptyView.setText(briefText, TextView.BufferType.SPANNABLE);
    } else {
        final StringBuilder contentBuilder = new StringBuilder();
        contentBuilder.append(briefText);
        contentBuilder.append("\n\n");
        contentBuilder.append(getText(R.string.ble_scan_notify_text));
        LinkifyUtils.linkify(emptyView, contentBuilder, new LinkifyUtils.OnClickListener() {

            @Override
            public void onClick() {
                final SettingsActivity activity = (SettingsActivity) BluetoothSettings.this.getActivity();
                activity.startPreferencePanel(ScanningSettings.class.getName(), null, R.string.location_scanning_screen_title, null, null, 0);
            }
        });
    }
    getPreferenceScreen().removeAll();
}
Also used : LinkifyUtils(com.android.settings.LinkifyUtils) TextView(android.widget.TextView) SettingsActivity(com.android.settings.SettingsActivity) ContentResolver(android.content.ContentResolver)

Example 7 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PowerUsageSummary method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    final SettingsActivity sa = (SettingsActivity) getActivity();
    switch(item.getItemId()) {
        case MENU_STATS_RESET:
            resetStats();
            return true;
        case MENU_STATS_TYPE:
            if (mStatsType == BatteryStats.STATS_SINCE_CHARGED) {
                mStatsType = BatteryStats.STATS_SINCE_UNPLUGGED;
            } else {
                mStatsType = BatteryStats.STATS_SINCE_CHARGED;
            }
            refreshStats();
            return true;
        case MENU_BATTERY_SAVER:
            sa.startPreferencePanel(BatterySaverSettings.class.getName(), null, R.string.battery_saver, null, null, 0);
            return true;
        case MENU_HIGH_POWER_APPS:
            Bundle args = new Bundle();
            args.putString(ManageApplications.EXTRA_CLASSNAME, HighPowerApplicationsActivity.class.getName());
            sa.startPreferencePanel(ManageApplications.class.getName(), args, R.string.high_power_apps, null, null, 0);
            return true;
        case MENU_ADDITIONAL_BATTERY_INFO:
            startActivity(FeatureFactory.getFactory(getContext()).getPowerUsageFeatureProvider(getContext()).getAdditionalBatteryInfoIntent());
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
Also used : Bundle(android.os.Bundle) HighPowerApplicationsActivity(com.android.settings.Settings.HighPowerApplicationsActivity) ManageApplications(com.android.settings.applications.ManageApplications) SettingsActivity(com.android.settings.SettingsActivity)

Example 8 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class PrintServiceSettingsFragment method initComponents.

private void initComponents() {
    mPrintersAdapter = new PrintersAdapter();
    mPrintersAdapter.registerDataSetObserver(mDataObserver);
    final SettingsActivity activity = (SettingsActivity) getActivity();
    mSwitchBar = activity.getSwitchBar();
    mSwitchBar.addOnSwitchChangeListener(this);
    mSwitchBar.show();
    mToggleSwitch = mSwitchBar.getSwitch();
    mToggleSwitch.setOnBeforeCheckedChangeListener(new ToggleSwitch.OnBeforeCheckedChangeListener() {

        @Override
        public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
            onPreferenceToggled(mPreferenceKey, checked);
            return false;
        }
    });
    getBackupListView().setSelector(new ColorDrawable(Color.TRANSPARENT));
    getBackupListView().setAdapter(mPrintersAdapter);
    getBackupListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {

        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            PrinterInfo printer = (PrinterInfo) mPrintersAdapter.getItem(position);
            if (printer.getInfoIntent() != null) {
                try {
                    getActivity().startIntentSender(printer.getInfoIntent().getIntentSender(), null, 0, 0, 0);
                } catch (SendIntentException e) {
                    Log.e(LOG_TAG, "Could not execute info intent: %s", e);
                }
            }
        }
    });
}
Also used : ImageView(android.widget.ImageView) View(android.view.View) AdapterView(android.widget.AdapterView) TextView(android.widget.TextView) ListView(android.widget.ListView) SearchView(android.widget.SearchView) SendIntentException(android.content.IntentSender.SendIntentException) ColorDrawable(android.graphics.drawable.ColorDrawable) ToggleSwitch(com.android.settings.widget.ToggleSwitch) AdapterView(android.widget.AdapterView) PrinterInfo(android.print.PrinterInfo) SettingsActivity(com.android.settings.SettingsActivity)

Example 9 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AppInfoBase method setIntentAndFinish.

protected void setIntentAndFinish(boolean finish, boolean appChanged) {
    if (localLOGV)
        Log.i(TAG, "appChanged=" + appChanged);
    Intent intent = new Intent();
    intent.putExtra(ManageApplications.APP_CHG, appChanged);
    SettingsActivity sa = (SettingsActivity) getActivity();
    sa.finishPreferencePanel(this, Activity.RESULT_OK, intent);
    mFinishing = true;
}
Also used : Intent(android.content.Intent) SettingsActivity(com.android.settings.SettingsActivity)

Example 10 with SettingsActivity

use of com.android.settings.SettingsActivity in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class AppOpsCategory method startApplicationDetailsActivity.

// utility method used to start sub activity
private void startApplicationDetailsActivity() {
    // start new fragment to display extended information
    Bundle args = new Bundle();
    args.putString(AppOpsDetails.ARG_PACKAGE_NAME, mCurrentPkgName);
    SettingsActivity sa = (SettingsActivity) getActivity();
    sa.startPreferencePanel(AppOpsDetails.class.getName(), args, org.cyanogenmod.platform.internal.R.string.privacy_guard_manager_title, null, this, RESULT_APP_DETAILS);
}
Also used : Bundle(android.os.Bundle) 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