當前位置: 首頁>>代碼示例>>Java>>正文


Java Preference.getKey方法代碼示例

本文整理匯總了Java中android.preference.Preference.getKey方法的典型用法代碼示例。如果您正苦於以下問題:Java Preference.getKey方法的具體用法?Java Preference.getKey怎麽用?Java Preference.getKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.preference.Preference的用法示例。


在下文中一共展示了Preference.getKey方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onPreferenceChange

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    WCFPXSharedPreferencesUtil.notifyReload();
    switch (preference.getKey()) {
        case VersionInfo.PREF_KEY_ENABLE:
            break;
        case VersionInfo.PREF_KEY_PWD:
            if (!((String) newValue).matches("\\d{6}")) {
                new AlertDialog.Builder(getActivity())
                        .setTitle(getString(R.string.title_error))
                        .setPositiveButton(getString(R.string.hint_confirm), null)
                        .setMessage(getString(R.string.error_six_digit))
                        .show();
                return false;
            }
            spEditor = sharedPreferences.edit();
            final String android_id = WCFPXSharedPreferencesUtil.getID(getContext());
            final String key = AESHelper.encrypt(android_id, VersionInfo.DU_EN_KEY);
            spEditor.putString(VersionInfo.PREF_KEY_PWD, AESHelper.encrypt((String) newValue, key));
            spEditor.apply();
            return false;
        default:
            break;
    }
    return true;
}
 
開發者ID:aboutZZ,項目名稱:WeChatFingerprintPay,代碼行數:27,代碼來源:PaySettingActivity.java

示例2: onPreferenceClick

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceClick(Preference preference) {
    String key = preference.getKey();
    if (key.equals(prefAboutPageKey)) {

        ActivityOptionsCompat options =
                ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity());
        ((NavigationDrawerActivity) getActivity()).newAchievementUnlocked(1L << Constants.CURIOUS);
        startActivity(new Intent(getActivity(), AboutActivity.class), options.toBundle());
        return true;
    } else if (key.equals(prefLogoutButtonKey)) {
        //Clear login cache
        CacheUtils.clearLoginInfo(context);
        //Now launch on-board activity
        startActivity(new Intent(context, OnBoardActivity.class));
        //Now finish the activity
        ((NavigationDrawerActivity) context).finish();
        return true;
    }
    return false;
}
 
開發者ID:Protino,項目名稱:CodeWatch,代碼行數:22,代碼來源:SettingsFragment.java

示例3: onPreferenceClick

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceClick(Preference preference) {
    switch (preference.getKey()) {
        case KEY_ABOUT_VERSION :
            if (mDevHitCountdown > 0) {
                mDevHitCountdown--;
                if (mDevHitCountdown == 0) {
                    getActivity().getSharedPreferences(DeveloperOptionsFragment.PREF_FILE,
                            Context.MODE_PRIVATE).edit().putBoolean(
                            DeveloperOptionsFragment.PREF_SHOW, true).apply();
                    // This is good time to index the Developer Options
                    startActivity(new Intent(getActivity(), SettingsActivity.class));
                    getActivity().finish();
                }
            }
            return true;
    }
    return false;
}
 
開發者ID:TaRGroup,項目名稱:IFWManager,代碼行數:20,代碼來源:SettingsMainFragment.java

示例4: onPreferenceTreeClick

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
    final String key = preference.getKey();
    switch (key) {
        case KEY_CHECK_UPDATE:
            mTask = CheckUpdateTask.getInstance(false);
            if (!mTask.getStatus().equals(AsyncTask.Status.RUNNING)) {
                mTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, getActivity());
            }
            return true;
        case KEY_CHANGELOG:
            ChangelogFragment changelogFrag = new ChangelogFragment();
            FragmentTransaction transaction = getFragmentManager().beginTransaction();
            transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            transaction.replace(this.getId(), changelogFrag);
            transaction.addToBackStack(this.getClass().getName());
            transaction.commit();
            return true;
        default:
            OTALink link = LinkConfig.getInstance().findLink(key, getActivity());
            if (link != null) {
                OTAUtils.launchUrl(link.getUrl(), getActivity());
            }
            break;
    }
    return super.onPreferenceTreeClick(preferenceScreen, preference);
}
 
開發者ID:DroidThug,項目名稱:VulcanOTA,代碼行數:28,代碼來源:SlimOTAFragment.java

示例5: onPreferenceChange

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String key = preference.getKey();
    if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
        PrefServiceBridge.getInstance().setSearchSuggestEnabled((boolean) newValue);
    } else if (PREF_SAFE_BROWSING.equals(key)) {
        PrefServiceBridge.getInstance().setSafeBrowsingEnabled((boolean) newValue);
    } else if (PREF_SAFE_BROWSING_EXTENDED_REPORTING.equals(key)
               || PREF_SAFE_BROWSING_SCOUT_REPORTING.equals(key)) {
        PrefServiceBridge.getInstance().setSafeBrowsingExtendedReportingEnabled(
                (boolean) newValue);
    } else if (PREF_NETWORK_PREDICTIONS.equals(key)) {
        PrefServiceBridge.getInstance().setNetworkPredictionEnabled((boolean) newValue);
        PrecacheLauncher.updatePrecachingEnabled(getActivity());
    } else if (PREF_NAVIGATION_ERROR.equals(key)) {
        PrefServiceBridge.getInstance().setResolveNavigationErrorEnabled((boolean) newValue);
    }

    return true;
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:21,代碼來源:PrivacyPreferences.java

示例6: createManagedPreferenceDelegate

import android.preference.Preference; //導入方法依賴的package包/類
private ManagedPreferenceDelegate createManagedPreferenceDelegate() {
    return new ManagedPreferenceDelegate() {
        @Override
        public boolean isPreferenceControlledByPolicy(Preference preference) {
            String key = preference.getKey();
            PrefServiceBridge prefs = PrefServiceBridge.getInstance();
            if (PREF_NAVIGATION_ERROR.equals(key)) {
                return prefs.isResolveNavigationErrorManaged();
            }
            if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
                return prefs.isSearchSuggestManaged();
            }
            if (PREF_SAFE_BROWSING_EXTENDED_REPORTING.equals(key)
                    || PREF_SAFE_BROWSING_SCOUT_REPORTING.equals(key)) {
                return prefs.isSafeBrowsingExtendedReportingManaged();
            }
            if (PREF_SAFE_BROWSING.equals(key)) {
                return prefs.isSafeBrowsingManaged();
            }
            if (PREF_NETWORK_PREDICTIONS.equals(key)) {
                return prefs.isNetworkPredictionManaged();
            }
            return false;
        }
    };
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:27,代碼來源:PrivacyPreferences.java

示例7: onPreferenceClick

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceClick(@NonNull Preference preference) {
    switch (preference.getKey()) {
        case SETTINGS_RENDERINGMODE:
            renderPicker();
            return true;
        case SETTINGS_URLCONTENT:
            urlBoxPicker();
            return true;
        case SETTINGS_TEXTENCODING:
            textEncodingPicker();
            return true;
        default:
            return false;
    }
}
 
開發者ID:XndroidDev,項目名稱:Xndroid,代碼行數:17,代碼來源:AdvancedSettingsFragment.java

示例8: onPreferenceClick

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceClick(Preference preference) {
    switch (preference.getKey()){
        case "platform_WeChat_setting":
            getActivity().startActivity(new Intent(getActivity(), PreferenceActivity.class)
                    .putExtra(PreferenceActivity.TYPE_FRAGMENT, WeChatSettingFragment.class));
            break;
        case "platform_QQ_setting":
            getActivity().startActivity(new Intent(getActivity(), PreferenceActivity.class)
                    .putExtra(PreferenceActivity.TYPE_FRAGMENT, QQSettingFragment.class));
            break;
        case "setting":
            getActivity().startActivity(new Intent(getActivity(), PreferenceActivity.class)
                    .putExtra(PreferenceActivity.TYPE_FRAGMENT, OtherSettingFragment.class));
            break;
        case "exit":
            exit();
            break;
        case "about":
            getActivity().startActivity(new Intent(getActivity(), AboutActivity.class));
            break;
    }
    return true;
}
 
開發者ID:A-Miracle,項目名稱:QiangHongBao,代碼行數:25,代碼來源:MainActivity.java

示例9: onPreferenceClick

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceClick(@NonNull Preference preference) {
    switch (preference.getKey()) {
        case SETTINGS_PROXY:
            proxyChoicePicker();
            return true;
        case SETTINGS_USERAGENT:
            agentDialog();
            return true;
        case SETTINGS_DOWNLOAD:
            downloadLocDialog();
            return true;
        case SETTINGS_HOME:
            homepageDialog();
            return true;
        case SETTINGS_SEARCHENGINE:
            searchDialog();
            return true;
        case SETTINGS_SUGGESTIONS:
            suggestionsDialog();
            return true;
        default:
            return false;
    }
}
 
開發者ID:XndroidDev,項目名稱:Xndroid,代碼行數:26,代碼來源:GeneralSettingsFragment.java

示例10: onPreferenceClick

import android.preference.Preference; //導入方法依賴的package包/類
public boolean onPreferenceClick(Preference preference) {
    String key = preference.getKey();
    switch (key) {
        case "pro1":
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.get_key))));
            break;

        case "pro2":
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.get_key))));
            break;
    }

    return false;

}
 
開發者ID:sfilmak,項目名稱:MakiLite,代碼行數:16,代碼來源:Customize.java

示例11: onPreferenceChange

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) {
    boolean checked = false;
    if (newValue instanceof Boolean) {
        checked = Boolean.TRUE.equals(newValue);
    }
    // switch preferences
    switch (preference.getKey()) {
        case SETTINGS_HIDESTATUSBAR:
            mPreferenceManager.setHideStatusBarEnabled(checked);
            return true;
        case SETTINGS_FULLSCREEN:
            mPreferenceManager.setFullScreenEnabled(checked);
            return true;
        case SETTINGS_VIEWPORT:
            mPreferenceManager.setUseWideViewportEnabled(checked);
            return true;
        case SETTINGS_OVERVIEWMODE:
            mPreferenceManager.setOverviewModeEnabled(checked);
            return true;
        case SETTINGS_REFLOW:
            mPreferenceManager.setTextReflowEnabled(checked);
            return true;
        case SETTINGS_DRAWERTABS:
            mPreferenceManager.setShowTabsInDrawer(checked);
            return true;
        case SETTINGS_SWAPTABS:
            mPreferenceManager.setBookmarkAndTabsSwapped(checked);
            return true;
        case SETTINGS_BLACK_STATUS:
            mPreferenceManager.setUseBlackStatusBar(checked);
            return true;
        default:
            return false;
    }
}
 
開發者ID:XndroidDev,項目名稱:Xndroid,代碼行數:37,代碼來源:DisplaySettingsFragment.java

示例12: onPreferenceChange

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String stringValue = newValue.toString();

    //only used the first "load". Subsequent changes not because in SeekbarPreferences don't call
    //to update listeners
    if (preference instanceof SeekBarPreference) {
        preference.setSummary(("" + stringValue + " Km"));


    } else if (preference instanceof Preference) {
        String key = preference.getKey();
        //we take the versionName and assign it to the pref var.
        if (key == getString(R.string.pref_version_key)) {
            String versionName;
            try {
                versionName = getActivity().getPackageManager().getPackageInfo(
                        getActivity().getPackageName(), 0).versionName;

            } catch (PackageManager.NameNotFoundException e) {
                versionName = null;
            }
            preference.setSummary(versionName);

        }
    }
    return true;
}
 
開發者ID:cahergil,項目名稱:Farmacias,代碼行數:29,代碼來源:SettingsFragment.java

示例13: onPreferenceClick

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceClick(Preference preference) {
    String key = preference.getKey();
    if (key.equals(getString(R.string.pref_email_key))) {

        Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts("mailto",
                getString(R.string.mailto), null));
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.subject));
        startActivity(Intent.createChooser(emailIntent, "Send mail..."));

    }  else if (key.equals(getString(R.string.pref_share_app_key))) {

        Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        //https://play.google.com/store/apps/details?id=com.carlos.capstone
        sendIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.app_play_store_address));
        sendIntent.setType("text/plain");
        startActivity(sendIntent);
    } else if (key.equals(getString(R.string.pref_delete_history_key))) {

        DialogBorrarHistorialBusqueda dialog = new DialogBorrarHistorialBusqueda();
        dialog.show(((SettingsActivity)getActivity()).getSupportFragmentManager(),"HISTORIAL");

    }

    return true;
}
 
開發者ID:cahergil,項目名稱:Farmacias,代碼行數:28,代碼來源:SettingsFragment.java

示例14: onPreferenceChange

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    String key = preference.getKey();
    if(automaticUpdatesKey.equals(key)) {
        onAutomaticUpdatesToggle((Boolean) newValue);
    }
    else {
        throw new RuntimeException("Unknown preference change event received!");
    }

    return true;
}
 
開發者ID:tbolender,項目名稱:fefereader,代碼行數:13,代碼來源:SettingsFragment.java

示例15: onPreferenceChange

import android.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(@NonNull Preference preference, Object newValue) {
    boolean checked = false;
    if (newValue instanceof Boolean) {
        checked = Boolean.TRUE.equals(newValue);
    }
    switch (preference.getKey()) {
        case SETTINGS_FLASH:
            if (!Utils.isFlashInstalled(mActivity) && checked) {
                Utils.createInformativeDialog(mActivity, R.string.title_warning, R.string.dialog_adobe_not_installed);
                mPreferenceManager.setFlashSupport(0);
                return false;
            } else {
                if (checked) {
                    getFlashChoice();
                } else {
                    mPreferenceManager.setFlashSupport(0);
                }
            }
            return true;
        case SETTINGS_ADS:
            mPreferenceManager.setAdBlockEnabled(checked);
            return true;
        case SETTINGS_IMAGES:
            mPreferenceManager.setBlockImagesEnabled(checked);
            return true;
        case SETTINGS_JAVASCRIPT:
            mPreferenceManager.setJavaScriptEnabled(checked);
            return true;
        case SETTINGS_COLORMODE:
            mPreferenceManager.setColorModeEnabled(checked);
            return true;
        default:
            return false;
    }
}
 
開發者ID:XndroidDev,項目名稱:Xndroid,代碼行數:37,代碼來源:GeneralSettingsFragment.java


注:本文中的android.preference.Preference.getKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。