diff options
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/settings/SettingsActivity.java | 2 | ||||
-rw-r--r-- | src/com/android/settings/blacklist/BlacklistPreferences.java (renamed from src/com/android/settings/blacklist/PreferenceFragment.java) | 9 | ||||
-rw-r--r-- | src/com/android/settings/blacklist/BlacklistSettings.java | 121 | ||||
-rw-r--r-- | src/com/android/settings/blacklist/EntryEditDialogFragment.java | 29 | ||||
-rw-r--r-- | src/com/android/settings/cyanogenmod/BaseSystemSettingSwitchBar.java (renamed from src/com/android/settings/profiles/ProfileEnabler.java) | 103 | ||||
-rw-r--r-- | src/com/android/settings/cyanogenmod/PrivacySettings.java | 14 | ||||
-rw-r--r-- | src/com/android/settings/profiles/ProfilesList.java | 16 | ||||
-rw-r--r-- | src/com/android/settings/profiles/ProfilesSettings.java | 19 |
8 files changed, 188 insertions, 125 deletions
diff --git a/src/com/android/settings/SettingsActivity.java b/src/com/android/settings/SettingsActivity.java index 74b8ff9..c8c8ec7 100644 --- a/src/com/android/settings/SettingsActivity.java +++ b/src/com/android/settings/SettingsActivity.java @@ -364,7 +364,7 @@ public class SettingsActivity extends Activity DrawOverlayDetails.class.getName(), WriteSettingsDetails.class.getName(), LiveDisplay.class.getName(), - com.android.settings.cyanogenmod.PrivacySettings.class.getName() + com.android.settings.cyanogenmod.PrivacySettings.class.getName(), BlacklistSettings.class.getName() }; diff --git a/src/com/android/settings/blacklist/PreferenceFragment.java b/src/com/android/settings/blacklist/BlacklistPreferences.java index b8ecddd..2ee449f 100644 --- a/src/com/android/settings/blacklist/PreferenceFragment.java +++ b/src/com/android/settings/blacklist/BlacklistPreferences.java @@ -24,14 +24,16 @@ import android.preference.Preference; import android.preference.PreferenceScreen; import android.provider.Settings; +import com.android.internal.logging.MetricsLogger; import com.android.internal.telephony.util.BlacklistUtils; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; +import com.android.settings.SubSettings; import java.util.HashSet; import java.util.Set; -public class PreferenceFragment extends SettingsPreferenceFragment implements +public class BlacklistPreferences extends SettingsPreferenceFragment implements Preference.OnPreferenceChangeListener { private static final String BUTTON_BLACKLIST_PRIVATE = "button_blacklist_private_numbers"; @@ -141,4 +143,9 @@ public class PreferenceFragment extends SettingsPreferenceFragment implements pref.setSummary(getString(summaryResId, getString(typeResId))); } + + @Override + protected int getMetricsCategory() { + return MetricsLogger.PRIVACY; + } } diff --git a/src/com/android/settings/blacklist/BlacklistSettings.java b/src/com/android/settings/blacklist/BlacklistSettings.java index c30d410..db7fe5a 100644 --- a/src/com/android/settings/blacklist/BlacklistSettings.java +++ b/src/com/android/settings/blacklist/BlacklistSettings.java @@ -16,14 +16,12 @@ package com.android.settings.blacklist; -import android.app.ActionBar; -import android.app.Activity; -import android.app.FragmentTransaction; import android.app.ListFragment; import android.content.ContentResolver; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; +import android.database.ContentObserver; import android.database.Cursor; import android.location.CountryDetector; import android.net.Uri; @@ -39,22 +37,22 @@ import android.provider.Telephony.Blacklist; import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.util.SparseArray; -import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.CompoundButton; -import android.widget.ListAdapter; +import android.widget.FrameLayout; import android.widget.ListView; import android.widget.ResourceCursorAdapter; -import android.widget.Switch; import android.widget.TextView; import com.android.internal.telephony.util.BlacklistUtils; import com.android.settings.R; +import com.android.settings.SettingsActivity; +import com.android.settings.SubSettings; +import com.android.settings.cyanogenmod.BaseSystemSettingSwitchBar; import java.util.HashMap; @@ -62,7 +60,7 @@ import java.util.HashMap; * Blacklist settings UI for the Phone app. */ public class BlacklistSettings extends ListFragment - implements CompoundButton.OnCheckedChangeListener { + implements BaseSystemSettingSwitchBar.SwitchBarChangeCallback { private static final String[] BLACKLIST_PROJECTION = { Blacklist._ID, @@ -75,18 +73,37 @@ public class BlacklistSettings extends ListFragment private static final int COLUMN_PHONE = 2; private static final int COLUMN_MESSAGE = 3; - private Switch mEnabledSwitch; + private BaseSystemSettingSwitchBar mEnabledSwitch; private boolean mLastEnabledState; private BlacklistAdapter mAdapter; private Cursor mCursor; private TextView mEmptyView; + private Context mContext; + private View mFab; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + mContext = getActivity(); + } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - return inflater.inflate(com.android.internal.R.layout.preference_list_fragment, - container, false); + return inflater.inflate(R.layout.preference_blacklist, container, false); + } + + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + mFab = view.findViewById(R.id.floating_action_button); + mFab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + showEntryEditDialog(-1); + } + }); } @Override @@ -95,14 +112,6 @@ public class BlacklistSettings extends ListFragment setHasOptionsMenu(true); - final Activity activity = getActivity(); - mEnabledSwitch = new Switch(activity); - - final int padding = activity.getResources().getDimensionPixelSize( - R.dimen.action_bar_switch_padding); - mEnabledSwitch.setPaddingRelative(0, 0, padding, 0); - mEnabledSwitch.setOnCheckedChangeListener(this); - mCursor = getActivity().managedQuery(Blacklist.CONTENT_URI, BLACKLIST_PROJECTION, null, null, null); mAdapter = new BlacklistAdapter(getActivity(), null); @@ -112,6 +121,14 @@ public class BlacklistSettings extends ListFragment final ListView listView = getListView(); listView.setAdapter(mAdapter); listView.setEmptyView(mEmptyView); + + // Add a footer to avoid a situation where the FAB would cover the last + // item's options in a non-scrollable listview. + View footer = LayoutInflater.from(getActivity()) + .inflate(R.layout.empty_list_entry_footer, listView, false); + listView.addFooterView(footer); + listView.setFooterDividersEnabled(false); + footer.setOnClickListener(null); } @Override @@ -123,23 +140,16 @@ public class BlacklistSettings extends ListFragment @Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); - menu.findItem(R.id.blacklist_add).setEnabled(mLastEnabledState); - menu.findItem(R.id.blacklist_prefs).setEnabled(mLastEnabledState); + menu.findItem(R.id.blacklist_prefs).setVisible(mLastEnabledState); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { - case R.id.blacklist_add: - showEntryEditDialog(-1); - return true; case R.id.blacklist_prefs: - PreferenceFragment prefs = new PreferenceFragment(); - FragmentTransaction ft = getFragmentManager().beginTransaction(); - ft.replace(android.R.id.content, prefs); - ft.hide(this); - ft.addToBackStack(null); - ft.commitAllowingStateLoss(); + SettingsActivity pa = (SettingsActivity) getActivity(); + pa.startPreferencePanel(BlacklistPreferences.class.getCanonicalName(), null, + 0, null, this, 0); return true; } @@ -149,31 +159,35 @@ public class BlacklistSettings extends ListFragment @Override public void onStart() { super.onStart(); - final Activity activity = getActivity(); - activity.getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, - ActionBar.DISPLAY_SHOW_CUSTOM); - activity.getActionBar().setCustomView(mEnabledSwitch, new ActionBar.LayoutParams( - ActionBar.LayoutParams.WRAP_CONTENT, - ActionBar.LayoutParams.WRAP_CONTENT, - Gravity.CENTER_VERTICAL | Gravity.END)); + final SettingsActivity activity = (SettingsActivity) getActivity(); + mEnabledSwitch = new BaseSystemSettingSwitchBar(activity, activity.getSwitchBar(), + Settings.System.PHONE_BLACKLIST_ENABLED, true, this); } @Override - public void onStop() { - super.onStop(); - final Activity activity = getActivity(); - activity.getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_CUSTOM); - activity.getActionBar().setCustomView(null); + public void onResume() { + super.onResume(); + + final SettingsActivity activity = (SettingsActivity) getActivity(); + if (mEnabledSwitch != null) { + mEnabledSwitch.resume(activity); + } } @Override - public void onResume() { - super.onResume(); + public void onPause() { + super.onPause(); + if (mEnabledSwitch != null) { + mEnabledSwitch.pause(); + } + } - final Context context = getActivity(); - mLastEnabledState = BlacklistUtils.isBlacklistEnabled(context); - mEnabledSwitch.setChecked(mLastEnabledState); - updateEnabledState(); + @Override + public void onDestroyView() { + super.onDestroyView(); + if (mEnabledSwitch != null) { + mEnabledSwitch.teardownSwitchBar(); + } } @Override @@ -187,6 +201,7 @@ public class BlacklistSettings extends ListFragment } private void updateEnabledState() { + mFab.setVisibility(mLastEnabledState ? View.VISIBLE : View.GONE); getListView().setEnabled(mLastEnabledState); getActivity().invalidateOptionsMenu(); @@ -197,13 +212,9 @@ public class BlacklistSettings extends ListFragment } @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (buttonView == mEnabledSwitch && isChecked != mLastEnabledState) { - Settings.System.putInt(getActivity().getContentResolver(), - Settings.System.PHONE_BLACKLIST_ENABLED, isChecked ? 1 : 0); - mLastEnabledState = isChecked; - updateEnabledState(); - } + public void onEnablerChanged(boolean isEnabled) { + mLastEnabledState = BlacklistUtils.isBlacklistEnabled(mContext); + updateEnabledState(); } private static class BlacklistAdapter extends ResourceCursorAdapter diff --git a/src/com/android/settings/blacklist/EntryEditDialogFragment.java b/src/com/android/settings/blacklist/EntryEditDialogFragment.java index 3e29279..9fda2ba 100644 --- a/src/com/android/settings/blacklist/EntryEditDialogFragment.java +++ b/src/com/android/settings/blacklist/EntryEditDialogFragment.java @@ -21,7 +21,6 @@ import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.ContentUris; -import android.content.ContentValues; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -31,10 +30,11 @@ import android.os.Bundle; import android.provider.ContactsContract.CommonDataKinds; import android.provider.Telephony.Blacklist; import android.text.Editable; +import android.text.TextUtils; import android.text.TextWatcher; import android.text.method.ArrowKeyMovementMethod; import android.text.method.DialerKeyListener; -import android.util.Log; +import android.util.Pair; import android.view.LayoutInflater; import android.view.View; import android.widget.Button; @@ -199,6 +199,7 @@ public class EntryEditDialogFragment extends DialogFragment private void updateBlacklistEntry() { String number = mEditText.getText().toString(); int flags = 0; + int valid = BlacklistUtils.BLOCK_CALLS | BlacklistUtils.BLOCK_MESSAGES; if (mBlockCalls.isChecked()) { flags = flags | BlacklistUtils.BLOCK_CALLS; } @@ -207,7 +208,7 @@ public class EntryEditDialogFragment extends DialogFragment } // Since BlacklistProvider enforces validity for a number to be added // we should alert the user if and when it gets rejected - if (!BlacklistUtils.addOrUpdate(getActivity(), number, flags, flags)) { + if (!BlacklistUtils.addOrUpdate(getActivity(), number, flags, valid)) { Toast.makeText(getActivity(), getString(R.string.blacklist_bad_number_add), Toast.LENGTH_LONG).show(); } @@ -221,8 +222,24 @@ public class EntryEditDialogFragment extends DialogFragment } } + boolean validInput = false; + String input = mEditText.getText().toString(); + if (!TextUtils.isEmpty(input)) { + Pair<String, Boolean> normalizeResult = + BlacklistUtils.isValidBlacklistInput(getActivity(), input); + if (normalizeResult.second) { + validInput = true; + } + } + + if (!validInput && !TextUtils.isEmpty(input)) { + mEditText.setError(getString(R.string.wifi_error)); + } else { + mEditText.setError(null); + } + if (mOkButton != null) { - mOkButton.setEnabled(mEditText.getText().length() != 0); + mOkButton.setEnabled(validInput); } } @@ -269,8 +286,10 @@ public class EntryEditDialogFragment extends DialogFragment } } - private static class DeleteConfirmationFragment extends DialogFragment + public static class DeleteConfirmationFragment extends DialogFragment implements DialogInterface.OnClickListener { + public DeleteConfirmationFragment() { + } public static DialogFragment newInstance(EntryEditDialogFragment parent) { DialogFragment fragment = new DeleteConfirmationFragment(); fragment.setTargetFragment(parent, 0); diff --git a/src/com/android/settings/profiles/ProfileEnabler.java b/src/com/android/settings/cyanogenmod/BaseSystemSettingSwitchBar.java index 8bf450c..22f5277 100644 --- a/src/com/android/settings/profiles/ProfileEnabler.java +++ b/src/com/android/settings/cyanogenmod/BaseSystemSettingSwitchBar.java @@ -1,48 +1,31 @@ /* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.settings.profiles; - -import cyanogenmod.app.ProfileManager; -import android.content.BroadcastReceiver; +* Copyright (C) 2014 The CyanogenMod Project +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +package com.android.settings.cyanogenmod; + import android.content.ContentResolver; import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; import android.database.ContentObserver; -import android.net.NetworkInfo; import android.net.Uri; -import android.net.wifi.SupplicantState; -import android.net.wifi.WifiInfo; -import android.net.wifi.WifiManager; import android.os.Handler; -import android.os.Message; +import android.provider.Settings; import android.widget.Switch; -import android.widget.Toast; -import com.android.settings.R; -import com.android.settings.WirelessSettings; -import com.android.settings.search.Index; import com.android.settings.widget.SwitchBar; -import com.android.settings.wifi.WifiSettings; - -import cyanogenmod.providers.CMSettings; -import java.util.concurrent.atomic.AtomicBoolean; - -public class ProfileEnabler implements SwitchBar.OnSwitchChangeListener { +public class BaseSystemSettingSwitchBar implements SwitchBar.OnSwitchChangeListener { private Context mContext; private SwitchBar mSwitchBar; private SettingsObserver mSettingsObserver; @@ -50,9 +33,21 @@ public class ProfileEnabler implements SwitchBar.OnSwitchChangeListener { private boolean mStateMachineEvent; - public ProfileEnabler(Context context, SwitchBar switchBar) { + private final String mSettingKey; + private final int mDefaultState; + + private final SwitchBarChangeCallback mCallback; + public interface SwitchBarChangeCallback { + public void onEnablerChanged(boolean isEnabled); + } + + public BaseSystemSettingSwitchBar(Context context, SwitchBar switchBar, String key, + boolean defaultState, SwitchBarChangeCallback callback) { mContext = context; mSwitchBar = switchBar; + mSettingKey = key; + mDefaultState = defaultState ? 1 : 0; + mCallback = callback; mSettingsObserver = new SettingsObserver(new Handler()); setupSwitchBar(); } @@ -97,11 +92,14 @@ public class ProfileEnabler implements SwitchBar.OnSwitchChangeListener { mStateMachineEvent = true; mSwitchBar.setChecked(checked); mStateMachineEvent = false; + if (mCallback != null) { + mCallback.onEnablerChanged(checked); + } } private void setSwitchState() { - boolean enabled = CMSettings.System.getInt(mContext.getContentResolver(), - CMSettings.System.SYSTEM_PROFILES_ENABLED, 1) == 1; + boolean enabled = Settings.System.getInt(mContext.getContentResolver(), + mSettingKey, mDefaultState) == 1; mStateMachineEvent = true; setSwitchBarChecked(enabled); mStateMachineEvent = false; @@ -115,18 +113,12 @@ public class ProfileEnabler implements SwitchBar.OnSwitchChangeListener { } // Handle a switch change - CMSettings.System.putInt(mContext.getContentResolver(), - CMSettings.System.SYSTEM_PROFILES_ENABLED, isChecked ? 1 : 0); - - // Send a broadcast intent to the world - // TODO Enabling or disabling profiles should be at ProfileManager, not here - Intent intent=new Intent(ProfileManager.PROFILES_STATE_CHANGED_ACTION); - intent.putExtra( - ProfileManager.EXTRA_PROFILES_STATE, - isChecked ? - ProfileManager.PROFILES_STATE_ENABLED : - ProfileManager.PROFILES_STATE_DISABLED); - mContext.sendBroadcast(intent); + Settings.System.putInt(mContext.getContentResolver(), + mSettingKey, isChecked ? 1 : 0); + + if (mCallback != null) { + mCallback.onEnablerChanged(isChecked); + } } class SettingsObserver extends ContentObserver { @@ -136,8 +128,8 @@ public class ProfileEnabler implements SwitchBar.OnSwitchChangeListener { void observe() { ContentResolver resolver = mContext.getContentResolver(); - resolver.registerContentObserver(CMSettings.System.getUriFor( - CMSettings.System.SYSTEM_PROFILES_ENABLED), false, this); + resolver.registerContentObserver(Settings.System.getUriFor( + mSettingKey), false, this); update(); } @@ -151,6 +143,11 @@ public class ProfileEnabler implements SwitchBar.OnSwitchChangeListener { update(); } + @Override + public void onChange(boolean selfChange, Uri uri) { + update(); + } + public void update() { setSwitchState(); } diff --git a/src/com/android/settings/cyanogenmod/PrivacySettings.java b/src/com/android/settings/cyanogenmod/PrivacySettings.java index ced0832..0e62915 100644 --- a/src/com/android/settings/cyanogenmod/PrivacySettings.java +++ b/src/com/android/settings/cyanogenmod/PrivacySettings.java @@ -40,13 +40,15 @@ public class PrivacySettings extends SettingsPreferenceFragment { super.onCreate(savedInstanceState); addPreferencesFromResource(R.xml.privacy_settings_cyanogenmod); + mBlacklist = (PreferenceScreen) findPreference(KEY_BLACKLIST); + // Add package manager to check if features are available PackageManager pm = getPackageManager(); // Determine options based on device telephony support if (!pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) { // No telephony, remove dependent options - PreferenceScreen root = getPreferenceScreen(); + PreferenceScreen root = getPreferenceScreen(); root.removePreference(mBlacklist); } } @@ -63,12 +65,10 @@ public class PrivacySettings extends SettingsPreferenceFragment { } private void updateBlacklistSummary() { - if (mBlacklist != null) { - if (BlacklistUtils.isBlacklistEnabled(getActivity())) { - mBlacklist.setSummary(R.string.blacklist_summary); - } else { - mBlacklist.setSummary(R.string.blacklist_summary_disabled); - } + if (BlacklistUtils.isBlacklistEnabled(getActivity())) { + mBlacklist.setSummary(R.string.blacklist_summary); + } else { + mBlacklist.setSummary(R.string.blacklist_summary_disabled); } } diff --git a/src/com/android/settings/profiles/ProfilesList.java b/src/com/android/settings/profiles/ProfilesList.java index 250051a..34e53a0 100644 --- a/src/com/android/settings/profiles/ProfilesList.java +++ b/src/com/android/settings/profiles/ProfilesList.java @@ -26,9 +26,12 @@ import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceScreen; import android.text.TextUtils; +import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; +import android.view.View; +import android.widget.ListView; import com.android.settings.R; import com.android.settings.SettingsPreferenceFragment; @@ -59,6 +62,19 @@ public class ProfilesList extends SettingsPreferenceFragment implements refreshList(); } + @Override + public void onViewCreated(View view, Bundle savedInstanceState) { + super.onViewCreated(view, savedInstanceState); + // Add a footer to avoid a situation where the FAB would cover the last + // item's options in a non-scrollable listview. + ListView listView = getListView(); + View footer = LayoutInflater.from(getActivity()) + .inflate(R.layout.empty_list_entry_footer, listView, false); + listView.addFooterView(footer); + listView.setFooterDividersEnabled(false); + footer.setOnClickListener(null); + } + public void refreshList() { PreferenceScreen plist = getPreferenceScreen(); plist.removeAll(); diff --git a/src/com/android/settings/profiles/ProfilesSettings.java b/src/com/android/settings/profiles/ProfilesSettings.java index 59078ae..cf6c161 100644 --- a/src/com/android/settings/profiles/ProfilesSettings.java +++ b/src/com/android/settings/profiles/ProfilesSettings.java @@ -50,11 +50,13 @@ import com.android.settings.SettingsActivity; import com.android.settings.SettingsPreferenceFragment; import com.android.settings.SubSettings; import com.android.settings.Utils; +import com.android.settings.cyanogenmod.BaseSystemSettingSwitchBar; import cyanogenmod.providers.CMSettings; import java.util.UUID; -public class ProfilesSettings extends SettingsPreferenceFragment { +public class ProfilesSettings extends SettingsPreferenceFragment + implements BaseSystemSettingSwitchBar.SwitchBarChangeCallback { private static final String TAG = "ProfilesSettings"; public static final String EXTRA_PROFILE = "Profile"; @@ -67,7 +69,7 @@ public class ProfilesSettings extends SettingsPreferenceFragment { private final BroadcastReceiver mReceiver; private ProfileManager mProfileManager; - private ProfileEnabler mProfileEnabler; + private BaseSystemSettingSwitchBar mProfileEnabler; private ViewPager mViewPager; private TextView mEmptyText; @@ -156,7 +158,8 @@ public class ProfilesSettings extends SettingsPreferenceFragment { public void onStart() { super.onStart(); final SettingsActivity activity = (SettingsActivity) getActivity(); - mProfileEnabler = new ProfileEnabler(activity, activity.getSwitchBar()); + mProfileEnabler = new BaseSystemSettingSwitchBar(activity, activity.getSwitchBar(), + CMSettings.System.SYSTEM_PROFILES_ENABLED, true, this); } @Override @@ -231,6 +234,16 @@ public class ProfilesSettings extends SettingsPreferenceFragment { mEmptyText.setVisibility(mEnabled ? View.GONE : View.VISIBLE); } + @Override + public void onEnablerChanged(boolean isEnabled) { + Intent intent = new Intent(ProfileManager.PROFILES_STATE_CHANGED_ACTION); + intent.putExtra(ProfileManager.EXTRA_PROFILES_STATE, + isEnabled ? + ProfileManager.PROFILES_STATE_ENABLED : + ProfileManager.PROFILES_STATE_DISABLED); + getActivity().sendBroadcast(intent); + } + class ProfilesPagerAdapter extends FragmentStatePagerAdapter { Fragment[] frags = { new ProfilesList() }; String[] titles = { getString(R.string.profile_profiles_manage) }; |