当前位置: 首页>>代码示例>>Java>>正文


Java PreferenceScreen.removePreference方法代码示例

本文整理汇总了Java中android.preference.PreferenceScreen.removePreference方法的典型用法代码示例。如果您正苦于以下问题:Java PreferenceScreen.removePreference方法的具体用法?Java PreferenceScreen.removePreference怎么用?Java PreferenceScreen.removePreference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.PreferenceScreen的用法示例。


在下文中一共展示了PreferenceScreen.removePreference方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPreExecute

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
@Override
protected void onPreExecute() {
    autoExpandFolder = (ListPreference) findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
    autoExpandFolder.setEnabled(false);
    archiveFolder = (ListPreference) findPreference(PREFERENCE_ARCHIVE_FOLDER);
    archiveFolder.setEnabled(false);
    draftsFolder = (ListPreference) findPreference(PREFERENCE_DRAFTS_FOLDER);
    draftsFolder.setEnabled(false);
    sentFolder = (ListPreference) findPreference(PREFERENCE_SENT_FOLDER);
    sentFolder.setEnabled(false);
    spamFolder = (ListPreference) findPreference(PREFERENCE_SPAM_FOLDER);
    spamFolder.setEnabled(false);
    trashFolder = (ListPreference) findPreference(PREFERENCE_TRASH_FOLDER);
    trashFolder.setEnabled(false);

    if (!isMoveCapable) {
        PreferenceScreen foldersCategory =
                (PreferenceScreen) findPreference(PREFERENCE_CATEGORY_FOLDERS);
        foldersCategory.removePreference(archiveFolder);
        foldersCategory.removePreference(spamFolder);
        foldersCategory.removePreference(draftsFolder);
        foldersCategory.removePreference(sentFolder);
        foldersCategory.removePreference(trashFolder);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:26,代码来源:AccountSettings.java

示例2: initializePlatformSpecificOptions

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
private void initializePlatformSpecificOptions() {
  PreferenceScreen preferenceScreen    = getPreferenceScreen();
  Preference       defaultPreference   = findPreference(KITKAT_DEFAULT_PREF);
  Preference       allSmsPreference    = findPreference(TextSecurePreferences.ALL_SMS_PREF);
  Preference       allMmsPreference    = findPreference(TextSecurePreferences.ALL_MMS_PREF);
  Preference       manualMmsPreference = findPreference(MMS_PREF);

  if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
    if (allSmsPreference != null) preferenceScreen.removePreference(allSmsPreference);
    if (allMmsPreference != null) preferenceScreen.removePreference(allMmsPreference);
  } else if (defaultPreference != null) {
    preferenceScreen.removePreference(defaultPreference);
  }

  if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP && manualMmsPreference != null) {
    preferenceScreen.removePreference(manualMmsPreference);
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:19,代码来源:SmsMmsPreferenceFragment.java

示例3: onCreate

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.battery_light_settings);

    PreferenceScreen prefSet = getPreferenceScreen();

    PreferenceGroup mGeneralPrefs = (PreferenceGroup) prefSet.findPreference("general_section");

    mLightEnabledPref = (CMSystemSettingSwitchPreference) prefSet.findPreference(LIGHT_ENABLED_PREF);
    mPulseEnabledPref = (CMSystemSettingSwitchPreference) prefSet.findPreference(PULSE_ENABLED_PREF);

    if (!getResources().getBoolean(com.android.internal.R.bool.config_ledCanPulse) ||
            getResources().getBoolean(org.cyanogenmod.platform.internal.R.bool.config_useSegmentedBatteryLed)) {
        mGeneralPrefs.removePreference(mPulseEnabledPref);
    }

    // Does the Device support changing battery LED colors?
    if (getResources().getBoolean(com.android.internal.R.bool.config_multiColorBatteryLed)) {
        setHasOptionsMenu(true);

        // Low, Medium and full color preferences
        mLowColorPref = (ApplicationLightPreference) prefSet.findPreference(LOW_COLOR_PREF);
        mLowColorPref.setOnPreferenceChangeListener(this);

        mMediumColorPref = (ApplicationLightPreference) prefSet.findPreference(MEDIUM_COLOR_PREF);
        mMediumColorPref.setOnPreferenceChangeListener(this);

        mFullColorPref = (ApplicationLightPreference) prefSet.findPreference(FULL_COLOR_PREF);
        mFullColorPref.setOnPreferenceChangeListener(this);
    } else {
        prefSet.removePreference(prefSet.findPreference("colors_list"));
        resetColors();
    }
}
 
开发者ID:ric96,项目名称:lineagex86,代码行数:36,代码来源:BatteryLightSettings.java

示例4: onCreate

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	addPreferencesFromResource(R.xml.pref_infos);
	setHasOptionsMenu(true);

	findPreference("version").setSummary(getString(R.string.version, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));

	PreferenceScreen prefScreen = getPreferenceScreen();
	for (int i = 0; i < prefScreen.getPreferenceCount(); i++) {
		Preference pref = prefScreen.getPreference(i);
		if (!BuildConfig.DEBUG && pref.getKey().startsWith("debug_"))
			prefScreen.removePreference(pref);
	}

	if (BuildConfig.DEBUG) {
		findPreference("debug_send_notification").setSummary("Package name: " + BuildConfig.APPLICATION_ID);
		findPreference("debug_send_notification").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
			@Override
			public boolean onPreferenceClick(Preference preference) {
				((NotificationManager) getActivity().getSystemService(Context.NOTIFICATION_SERVICE)).notify(0,
						new NotificationCompat.Builder(getActivity())
								.setSmallIcon(R.drawable.info)
								.setContentTitle("Test Notification")
								.setContentText("Use " + BuildConfig.APPLICATION_ID + " as the package name to test your actions")
								.build());
				return true;
			}
		});
	}
}
 
开发者ID:SapuSeven,项目名称:NotiCap,代码行数:32,代码来源:SettingsActivity.java

示例5: initializePlatformSpecificOptions

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
private void initializePlatformSpecificOptions() {
  PreferenceScreen preferenceScreen    = getPreferenceScreen();
  Preference       defaultPreference   = findPreference(KITKAT_DEFAULT_PREF);
  Preference       allSmsPreference    = findPreference(TextSecurePreferences.ALL_SMS_PREF);
  Preference       allMmsPreference    = findPreference(TextSecurePreferences.ALL_MMS_PREF);
  Preference       manualMmsPreference = findPreference(MMS_PREF);

  if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) {
    if (allSmsPreference != null) preferenceScreen.removePreference(allSmsPreference);
    if (allMmsPreference != null) preferenceScreen.removePreference(allMmsPreference);

    if (Util.isDefaultSmsProvider(getActivity())) {
      defaultPreference.setIntent(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
      defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_enabled));
      defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_change_your_default_sms_app));
    } else {
      Intent intent = new Intent(Telephony.Sms.Intents.ACTION_CHANGE_DEFAULT);
      intent.putExtra(Telephony.Sms.Intents.EXTRA_PACKAGE_NAME, getActivity().getPackageName());
      defaultPreference.setIntent(intent);
      defaultPreference.setTitle(getString(R.string.ApplicationPreferencesActivity_sms_disabled));
      defaultPreference.setSummary(getString(R.string.ApplicationPreferencesActivity_touch_to_make_signal_your_default_sms_app));
    }
  } else if (defaultPreference != null) {
    preferenceScreen.removePreference(defaultPreference);
  }

  if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP && manualMmsPreference != null) {
    preferenceScreen.removePreference(manualMmsPreference);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:31,代码来源:SmsMmsPreferenceFragment.java

示例6: initializePlatformSpecificOptions

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
private void initializePlatformSpecificOptions() {
  PreferenceScreen preferenceScreen         = getPreferenceScreen();
  Preference       screenSecurityPreference = findPreference(TextSecurePreferences.SCREEN_SECURITY_PREF);

  if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH &&
      screenSecurityPreference != null) {
    preferenceScreen.removePreference(screenSecurityPreference);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:10,代码来源:AppProtectionPreferenceFragment.java

示例7: updateAccountsList

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
private void updateAccountsList() {
    PreferenceScreen prefScreen = getPreferenceScreen();
    if (prefScreen == null) return;

    for (int i = 0; i < mAccountsListPreferences.size(); i++) {
        prefScreen.removePreference(mAccountsListPreferences.get(i));
    }
    mAccountsListPreferences.clear();

    final Preferences activity = (Preferences) getActivity();
    Account[] accounts = AccountManagerHelper.get(activity).getGoogleAccounts();
    int nextPrefOrder = FIRST_ACCOUNT_PREF_ORDER;

    for (Account account : accounts) {
        ChromeBasePreference pref = new ChromeBasePreference(activity);
        pref.setSelectable(false);
        pref.setTitle(account.name);

        boolean isChildAccount = ChildAccountService.isChildAccount();

        pref.setIcon(new BitmapDrawable(getResources(),
                isChildAccount ? getBadgedUserPicture(account.name, getResources()) :
                    getUserPicture(account.name, getResources())));

        pref.setOrder(nextPrefOrder++);
        prefScreen.addPreference(pref);
        mAccountsListPreferences.add(pref);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:30,代码来源:AccountManagementFragment.java

示例8: onPreferenceClick

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
@Override
public boolean onPreferenceClick(Preference preference) {
    Bundle extras = preference.peekExtras();
    if (extras != null) {
        UsbInfo usbInfo = (UsbInfo) extras.getSerializable(EXTRA_USB_INFO);
        if (usbInfo != null) {
            usbInfo.revoke();

            PreferenceScreen preferenceScreen = getPreferenceScreen();
            preferenceScreen.removePreference(preference);
            mUsbPermissionCount--;
            if (!hasPermissionsPreferences()) {
                Preference heading = preferenceScreen.findPreference(PREF_PERMISSIONS);
                preferenceScreen.removePreference(heading);
            }
            return true;
        }
    }

    // Handle the Clear & Reset preference click by showing a confirmation.
    new AlertDialog.Builder(getActivity(), R.style.AlertDialogTheme)
            .setTitle(R.string.website_reset)
            .setMessage(R.string.website_reset_confirmation)
            .setPositiveButton(R.string.website_reset, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    resetSite();
                }
            })
            .setNegativeButton(R.string.cancel, null)
            .show();
    return true;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:34,代码来源:SingleWebsitePreferences.java

示例9: onCreate

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle icicle) {
    super.onCreate(icicle);
    setHasOptionsMenu(true);
    setInputMethodSettingsCategoryTitle(R.string.language_selection_title);
    setSubtypeEnablerTitle(R.string.select_language);
    addPreferencesFromResource(R.xml.prefs);
    final PreferenceScreen preferenceScreen = getPreferenceScreen();
    preferenceScreen.setTitle(
            ApplicationUtils.getActivityTitleResId(getActivity(), SettingsActivity.class));
    if (!ProductionFlags.ENABLE_ACCOUNT_SIGN_IN) {
        final Preference accountsPreference = findPreference(Settings.SCREEN_ACCOUNTS);
        preferenceScreen.removePreference(accountsPreference);
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:16,代码来源:SettingsFragment.java

示例10: removePreference

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
static void removePreference(final String prefKey, final PreferenceScreen screen) {
    final Preference preference = screen.findPreference(prefKey);
    if (preference != null) {
        screen.removePreference(preference);
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:7,代码来源:SubScreenFragment.java

示例11: configureChildAccountPreferences

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
private void configureChildAccountPreferences() {
    Preference parentAccounts = findPreference(PREF_PARENT_ACCOUNTS);
    Preference childContent = findPreference(PREF_CHILD_CONTENT);
    Preference childSafeSites = findPreference(PREF_CHILD_SAFE_SITES);
    if (ChildAccountService.isChildAccount()) {
        Resources res = getActivity().getResources();
        PrefServiceBridge prefService = PrefServiceBridge.getInstance();

        String firstParent = prefService.getSupervisedUserCustodianEmail();
        String secondParent = prefService.getSupervisedUserSecondCustodianEmail();
        String parentText;

        if (!secondParent.isEmpty()) {
            parentText = res.getString(R.string.account_management_two_parent_names,
                    firstParent, secondParent);
        } else if (!firstParent.isEmpty()) {
            parentText = res.getString(R.string.account_management_one_parent_name,
                    firstParent);
        } else {
            parentText = res.getString(R.string.account_management_no_parental_data);
        }
        parentAccounts.setSummary(parentText);
        parentAccounts.setSelectable(false);

        final boolean unapprovedContentBlocked =
                prefService.getDefaultSupervisedUserFilteringBehavior()
                == PrefServiceBridge.SUPERVISED_USER_FILTERING_BLOCK;
        final String contentText = res.getString(
                unapprovedContentBlocked ? R.string.account_management_child_content_approved
                        : R.string.account_management_child_content_all);
        childContent.setSummary(contentText);
        childContent.setSelectable(false);

        final String safeSitesText = res.getString(
                prefService.isSupervisedUserSafeSitesEnabled()
                        ? R.string.text_on : R.string.text_off);
        childSafeSites.setSummary(safeSitesText);
        childSafeSites.setSelectable(false);
    } else {
        PreferenceScreen prefScreen = getPreferenceScreen();
        prefScreen.removePreference(findPreference(PREF_PARENTAL_SETTINGS));
        prefScreen.removePreference(parentAccounts);
        prefScreen.removePreference(childContent);
        prefScreen.removePreference(childSafeSites);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:47,代码来源:AccountManagementFragment.java

示例12: resetSite

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
/**
 * Resets the current site, clearing all permissions and storage used (inc. cookies).
 */
@VisibleForTesting
protected void resetSite() {
    if (getActivity() == null) return;
    // Clear the screen.
    // TODO(mvanouwerkerk): Refactor this class so that it does not depend on the screen state
    // for its logic. This class should maintain its own data model, and only update the screen
    // after a change is made.
    PreferenceScreen screen = getPreferenceScreen();
    for (String key : PERMISSION_PREFERENCE_KEYS) {
        Preference preference = screen.findPreference(key);
        if (preference != null) screen.removePreference(preference);
    }

    String origin = mSite.getAddress().getOrigin();
    WebsitePreferenceBridge.nativeClearCookieData(origin);
    WebsitePreferenceBridge.nativeClearBannerData(origin);

    // Clear the permissions.
    mSite.setAutoplayPermission(ContentSetting.DEFAULT);
    mSite.setBackgroundSyncPermission(ContentSetting.DEFAULT);
    mSite.setCameraPermission(ContentSetting.DEFAULT);
    mSite.setCookiePermission(ContentSetting.DEFAULT);
    mSite.setGeolocationPermission(ContentSetting.DEFAULT);
    mSite.setJavaScriptPermission(ContentSetting.DEFAULT);
    mSite.setKeygenPermission(ContentSetting.DEFAULT);
    mSite.setMicrophonePermission(ContentSetting.DEFAULT);
    mSite.setMidiPermission(ContentSetting.DEFAULT);
    mSite.setNotificationPermission(ContentSetting.DEFAULT);
    mSite.setPopupPermission(ContentSetting.DEFAULT);
    mSite.setProtectedMediaIdentifierPermission(ContentSetting.DEFAULT);

    for (UsbInfo info : mSite.getUsbInfo()) info.revoke();

    // Clear the storage and finish the activity if necessary.
    if (mSite.getTotalUsage() > 0) {
        clearStoredData();
    } else {
        // Clearing stored data implies popping back to parent menu if there
        // is nothing left to show. Therefore, we only need to explicitly
        // close the activity if there's no stored data to begin with.
        getActivity().finish();
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:47,代码来源:SingleWebsitePreferences.java

示例13: onCreate

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PrivacyPreferencesManager privacyPrefManager = PrivacyPreferencesManager.getInstance();
    privacyPrefManager.migrateNetworkPredictionPreferences();
    addPreferencesFromResource(R.xml.privacy_preferences);
    getActivity().setTitle(R.string.prefs_privacy);
    setHasOptionsMenu(true);
    PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance();

    mManagedPreferenceDelegate = createManagedPreferenceDelegate();

    ChromeBaseCheckBoxPreference networkPredictionPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NETWORK_PREDICTIONS);
    networkPredictionPref.setChecked(prefServiceBridge.getNetworkPredictionEnabled());
    networkPredictionPref.setOnPreferenceChangeListener(this);
    networkPredictionPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference navigationErrorPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_NAVIGATION_ERROR);
    navigationErrorPref.setOnPreferenceChangeListener(this);
    navigationErrorPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    ChromeBaseCheckBoxPreference searchSuggestionsPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SEARCH_SUGGESTIONS);
    searchSuggestionsPref.setOnPreferenceChangeListener(this);
    searchSuggestionsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    PreferenceScreen preferenceScreen = getPreferenceScreen();
    if (!ContextualSearchFieldTrial.isEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_CONTEXTUAL_SEARCH));
    }

    // Listen to changes to both Extended Reporting prefs.
    ChromeBaseCheckBoxPreference legacyExtendedReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(
                PREF_SAFE_BROWSING_EXTENDED_REPORTING);
    legacyExtendedReportingPref.setOnPreferenceChangeListener(this);
    legacyExtendedReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    ChromeBaseCheckBoxPreference scoutReportingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING_SCOUT_REPORTING);
    scoutReportingPref.setOnPreferenceChangeListener(this);
    scoutReportingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
    // Remove the extended reporting preference that is NOT active.
    String extended_reporting_pref_to_remove =
            prefServiceBridge.isSafeBrowsingScoutReportingActive()
                ? PREF_SAFE_BROWSING_EXTENDED_REPORTING : PREF_SAFE_BROWSING_SCOUT_REPORTING;
    preferenceScreen.removePreference(findPreference(extended_reporting_pref_to_remove));

    ChromeBaseCheckBoxPreference safeBrowsingPref =
            (ChromeBaseCheckBoxPreference) findPreference(PREF_SAFE_BROWSING);
    safeBrowsingPref.setOnPreferenceChangeListener(this);
    safeBrowsingPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);

    if (!PhysicalWeb.featureIsEnabled()) {
        preferenceScreen.removePreference(findPreference(PREF_PHYSICAL_WEB));
    }

    updateSummaries();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:61,代码来源:PrivacyPreferences.java

示例14: onCreate

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        getPreferenceManager().setStorageDeviceProtected();
    }

    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.settings);

    PreferenceScreen preferenceScreen = getPreferenceScreen();

    preferenceDonation = (SwitchPreference) preferenceScreen.findPreference(SHOW_DONATION);

    preferenceStandbyTimeout = preferenceScreen
            .findPreference(BreventConfiguration.BREVENT_STANDBY_TIMEOUT);

    preferenceScreen.findPreference("brevent_language")
            .setOnPreferenceChangeListener(this);

    BreventApplication application = (BreventApplication) getActivity().getApplication();
    if (!application.supportStandby()) {
        ((PreferenceCategory) preferenceScreen.findPreference("brevent_list"))
                .removePreference(preferenceStandbyTimeout);
    }
    if (!application.supportUpgrade()) {
        SwitchPreference preferenceAutoUpdate = (SwitchPreference) preferenceScreen
                .findPreference(BreventConfiguration.BREVENT_AUTO_UPDATE);
        preferenceAutoUpdate.setEnabled(false);
    }

    if (!BuildConfig.RELEASE) {
        preferenceScreen.removePreference(preferenceScreen.findPreference("brevent"));
    }
    if (!application.supportAppops()) {
        ((PreferenceCategory) preferenceScreen.findPreference("brevent"))
                .removePreference(preferenceScreen.findPreference(BREVENT_APPOPS));
    }
    if (BuildConfig.RELEASE) {
        preferenceScreen.findPreference("brevent_about_version")
                .setOnPreferenceClickListener(this);
        updateDonation();
    }
    onUpdateBreventMethod();
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:46,代码来源:SettingsFragment.java

示例15: onCreate

import android.preference.PreferenceScreen; //导入方法依赖的package包/类
@Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            addPreferencesFromResource(R.xml.pref_general);


            mInterstitialAd = new InterstitialAd(getActivity());
            mInterstitialAd.setAdUnitId("");
            AdRequest adRequestInterstial = new AdRequest.Builder()
                    .addTestDevice("E9DEB34031182776A4E765DCEF19F10D")
                    .addTestDevice("5C195A4AE6121C0D42702AAAE118DC01")
                    .build();
            mInterstitialAd.loadAd(adRequestInterstial);

//listner for adClosed
            mInterstitialAd.setAdListener(new AdListener() {
                @Override
                public void onAdClosed() {
                    AdRequest adRequest = new AdRequest.Builder()
                            .addTestDevice("E9DEB34031182776A4E765DCEF19F10D")
                            .addTestDevice("5C195A4AE6121C0D42702AAAE118DC01")
                            .build();
                    mInterstitialAd.loadAd(adRequest);
                }

                @Override
                public void onAdLoaded() {
                    Log.d("ADS_REACH","Main interstitial loaded");
                }
            });




            Preference ip = findPreference("ip");
            PreferenceScreen screen = getPreferenceScreen();
            if (Server.BLUETOOTH_ENABLED) {
                screen.removePreference(ip);

            } else {
                ip.setSummary(getLocalIpAddress());
            }
            Preference myPref = (Preference) findPreference("qrcode");
            myPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                public boolean onPreferenceClick(Preference preference) {
                    IntentIntegrator integrator = new IntentIntegrator(getActivity());
                    integrator.initiateScan();
                    return true;
                }
            });

            //Interventie 4 - acum ads work cum trebuie pe switch

            /*
            final Preference myPrefAd1 = (Preference) findPreference("main_enable_switch");
            myPrefAd1.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
                public boolean onPreferenceClick(Preference preference) {

                    if(!preloadedAdShown) {
                        InterstitialAd ad2 = AdManager.getAd2();
                        if (ad2.isLoaded()) {
                            ad2.show();
                        }
                    }

                    else{
                        mInterstitialAd.show();
                    }

                    preloadedAdShown = true;

                    return true;
                }
            });
            */





        }
 
开发者ID:RomascuAndrei,项目名称:BTNotifierAndroid,代码行数:82,代码来源:SettingsActivity.java


注:本文中的android.preference.PreferenceScreen.removePreference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。