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


Java OnPreferenceClickListener類代碼示例

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


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

示例1: initSettings

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
private void initSettings() {
	initTunnelSettings();
	initAudioSettings();
	initVideoSettings();
	initCallSettings();
	initChatSettings();
	initNetworkSettings();
	initAdvancedSettings();

	findPreference(getString(R.string.pref_add_account_key)).setOnPreferenceClickListener(new OnPreferenceClickListener() {
		@Override
		public boolean onPreferenceClick(Preference preference) {
			int nbAccounts = mPrefs.getAccountCount();
			LinphoneActivity.instance().displayAccountSettings(nbAccounts);
			return true;
		}
	});
}
 
開發者ID:treasure-lau,項目名稱:Linphone4Android,代碼行數:19,代碼來源:SettingsFragment.java

示例2: onCreate

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	addPreferencesFromResource(R.xml.about_preferences);
	Context context = MakiApplication.getContextOfApplication();
	PreferenceManager.getDefaultSharedPreferences(context);

	//open about dialog
	Preference preferenceabout = findPreference("about");
	preferenceabout.setOnPreferenceClickListener(new OnPreferenceClickListener() {
		@Override
		public boolean onPreferenceClick(Preference preference) {
			AlertDialog.Builder builder =
					new AlertDialog.Builder(getActivity(), R.style.AppCompatAlertDialogStyle);
			builder.setTitle(getResources().getString(R.string.about_header));
			builder.setMessage(Html.fromHtml(getResources().getString(R.string.about_text)));
			builder.setPositiveButton(getResources().getString(R.string.ok), null);
			builder.setNegativeButton(null, null);
			builder.show();

			return true;
		}
	});


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

示例3: onCreate

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.pref_security);

      findPreference(KEY_PIN_ENABLED).setOnPreferenceClickListener(this);


      pin_set_preference = findPreference(KEY_PIN_SET);
pin_set_preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
	
	@Override
	public boolean onPreferenceClick(Preference preference) {
              SettingsActivity.logSettingEvent(preference.getKey());
		checkPin();
		return false;
	}
});
pin_set_preference.setSummary(SettingsActivity.isPinProtected(getActivity()) ? R.string.pin_set : R.string.pin_disabled);
  }
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:21,代碼來源:SecurityPreferenceFragment.java

示例4: configureSyncSettings

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
private void configureSyncSettings() {
    final Preferences preferences = (Preferences) getActivity();
    final Account account = ChromeSigninController.get(getActivity()).getSignedInUser();
    findPreference(PREF_SYNC_SETTINGS)
            .setOnPreferenceClickListener(new OnPreferenceClickListener() {
                @Override
                public boolean onPreferenceClick(Preference preference) {
                    if (!isVisible() || !isResumed()) return false;

                    if (ProfileSyncService.get() == null) return true;

                    Bundle args = new Bundle();
                    args.putString(SyncCustomizationFragment.ARGUMENT_ACCOUNT, account.name);
                    preferences.startFragment(SyncCustomizationFragment.class.getName(), args);

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

示例5: onCreate

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);
       addPreferencesFromResource(R.xml.preferences);
       
       Preference search = findPreference(SEARCH_KEY);
       Preference help = findPreference(HELP_KEY);
       
       initializeLists();
       
       getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
       
       search.setOnPreferenceClickListener(new OnPreferenceClickListener() {
		public boolean onPreferenceClick(Preference preference) {
			DuckDuckGoSettings.this.onSearchRequested();
			return true;
		}
	});

       help.setIntent(new Intent(this, Help.class));
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:23,代碼來源:DuckDuckGoSettings.java

示例6: onCreate

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getPreferenceManager().setSharedPreferencesName(MainActivity.PREF_NAME);
    addPreferencesFromResource(R.xml.preferences);
    
    final ListPreference listPreference = null;
    //listPreference = (ListPreference) findPreference(getResources().getString(R.string.const_pref_encoding));
    if (listPreference != null) {
        setListPreferenceData(listPreference);
    
        listPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
    
                setListPreferenceData(listPreference);
                return false;
            }
        });
    }            
}
 
開發者ID:anokhina,項目名稱:AudioBookPlayer,代碼行數:22,代碼來源:SettingsActivity.java

示例7: onCreate

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
@Override
public void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

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

	// click on clear button
	Preference clear = findPreference("clear_card");
	clear.setOnPreferenceClickListener(new OnPreferenceClickListener() {

		@Override
		public boolean onPreferenceClick(final Preference preference) {
			HomeActivity activity = (HomeActivity) getActivity();
			if (activity != null) {
				activity.clear();
				CroutonUtils.display(activity, getString(R.string.card_deleted), CoutonColor.GREEN);
				activity.backToHomeScreen();
			}
			return true;
		}
	});

}
 
開發者ID:JackuyLiu,項目名稱:Android-NFC-Paycard-Reader,代碼行數:25,代碼來源:ConfigurationFragment.java

示例8: createAddAccountPreference

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
/**
 * Create the preference for allow adding new accounts
 */
private void createAddAccountPreference() {
    Preference addAccountPref = new Preference(this);
    addAccountPref.setKey("add_account");
    addAccountPref.setTitle(getString(R.string.prefs_add_account));
    mAccountsPrefCategory.addPreference(addAccountPref);

    addAccountPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            AccountManager am = AccountManager.get(getApplicationContext());
            am.addAccount(MainApp.getAccountType(), null, null, null, Preferences.this,
                    null, null);
            return true;
        }
    });

}
 
開發者ID:skymania,項目名稱:Cirrus,代碼行數:21,代碼來源:Preferences.java

示例9: initDependencies

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
private void initDependencies(){
    final Preference buildDepend = findPreference(BUILD_DEPENDS);
    buildDepend.setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(final Preference preference) {
        	
        	final WebView webView = new WebView(mContext);
            webView.loadUrl("file:///android_asset/licenses.html");
            new AlertDialog.Builder(mContext)
                    .setTitle(R.string.dependencies_title)
                    .setView(webView)
                    .setPositiveButton(android.R.string.ok, null)
                    .create()
                    .show();
            return true;
        }
    });
}
 
開發者ID:hubcarl,項目名稱:mobile-manager-tool,代碼行數:19,代碼來源:SettingsHolder.java

示例10: onCreate

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle bundle) {
  super.onCreate(bundle);
  addPreferencesFromResource(R.xml.sensor_settings);

  boolean hasAntSupport = AntInterface.hasAntSupport(this);

  configSensorType(hasAntSupport);

  findPreference(getString(R.string.settings_sensor_bluetooth_pairing_key))
      .setOnPreferenceClickListener(new OnPreferenceClickListener() {
        public boolean onPreferenceClick(Preference preference) {
          Intent settingsIntent = new Intent(Settings.ACTION_BLUETOOTH_SETTINGS);
          startActivity(settingsIntent);
          return true;
        }
      });

  if (!hasAntSupport) {
    PreferenceScreen rootPreferenceScreen = (PreferenceScreen) findPreference(
        getString(R.string.settings_sensor_root_key));
    rootPreferenceScreen.removePreference(
        findPreference(getString(R.string.settings_sensor_ant_key)));
  }
}
 
開發者ID:Plonk42,項目名稱:mytracks,代碼行數:27,代碼來源:SensorSettingsActivity.java

示例11: updateAntSensor

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
/**
 * Updates an ant sensor.
 * 
 * @param preferenceKey the preference key
 * @param valueKey the value key
 * @param enabled true if enabled
 */
@SuppressWarnings("deprecation")
private void updateAntSensor(int preferenceKey, final int valueKey, boolean enabled) {
  Preference preference = findPreference(getString(preferenceKey));
  if (preference != null) {
    preference.setEnabled(enabled);
    int deviceId = PreferencesUtils.getInt(this, valueKey, AntSensorManager.WILDCARD);
    if (deviceId == AntSensorManager.WILDCARD) {
      preference.setSummary(R.string.settings_sensor_ant_not_connected);
    } else {
      preference.setSummary(getString(R.string.settings_sensor_ant_paired, deviceId));
    }
    preference.setOnPreferenceClickListener(new OnPreferenceClickListener() {
        @Override
      public boolean onPreferenceClick(Preference pref) {
        PreferencesUtils.setInt(SensorSettingsActivity.this, valueKey, AntSensorManager.WILDCARD);
        pref.setSummary(R.string.settings_sensor_ant_not_connected);
        return true;
      }
    });
  }
}
 
開發者ID:Plonk42,項目名稱:mytracks,代碼行數:29,代碼來源:SensorSettingsActivity.java

示例12: initializeShowCustomBottomSheetPreference

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
/**
 * Initializes the preference, which allows to show a bottom sheet with custom content.
 */
private void initializeShowCustomBottomSheetPreference() {
    Preference showCustomBottomSheetPreference =
            findPreference(getString(R.string.show_custom_bottom_sheet_preference_key));
    showCustomBottomSheetPreference
            .setOnPreferenceClickListener(new OnPreferenceClickListener() {

                @Override
                public boolean onPreferenceClick(final Preference preference) {
                    initializeCustomBottomSheet();
                    customBottomSheet.show();
                    return true;
                }

            });
}
 
開發者ID:michael-rapp,項目名稱:AndroidBottomSheet,代碼行數:19,代碼來源:PreferenceFragment.java

示例13: initializeShowIntentBottmSheetPreference

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
/**
 * Initializes the preference, which allows to display the applications, which are suited for
 * handling an intent.
 */
private void initializeShowIntentBottmSheetPreference() {
    Preference showIntentBottomSheetPreference =
            findPreference(getString(R.string.show_intent_bottom_sheet_preference_key));
    showIntentBottomSheetPreference
            .setOnPreferenceClickListener(new OnPreferenceClickListener() {

                @Override
                public boolean onPreferenceClick(Preference preference) {
                    initializeIntentBottomSheet();
                    intentBottomSheet.show();
                    return true;
                }

            });
}
 
開發者ID:michael-rapp,項目名稱:AndroidBottomSheet,代碼行數:20,代碼來源:PreferenceFragment.java

示例14: updateMapSettingsPreference

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
private boolean updateMapSettingsPreference(final String mapProviderName) {
    final DPMapProvider mapProvider = DPMapProvider.getMapProvider(mapProviderName);
    if (mapProvider == null)
        return false;

    final Preference providerPrefs = findPreference(getText(R.string.pref_map_provider_settings_key));
    if (providerPrefs != null) {
        providerPrefs.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
            @Override
            public boolean onPreferenceClick(Preference preference) {
                startActivity(new Intent(getActivity(), MapPreferencesActivity.class).putExtra(
                        MapPreferencesActivity.EXTRA_MAP_PROVIDER_NAME, mapProviderName));
                return true;
            }
        });
    }
    return true;
}
 
開發者ID:jiaminghan,項目名稱:droidplanner-master,代碼行數:19,代碼來源:SettingsFragment.java

示例15: onActivityResult

import android.preference.Preference.OnPreferenceClickListener; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == TEXT_TO_SPEECH_CHECK_CODE) {
        Preference ttsWarningPreference = findPreference("tts_warning");

        if (resultCode == TextToSpeech.Engine.CHECK_VOICE_DATA_PASS) {
            ttsWarningPreference.setEnabled(false);
        } else {
            ttsWarningPreference.setEnabled(true);
            ttsWarningPreference.setOnPreferenceClickListener(new OnPreferenceClickListener() {

                public boolean onPreferenceClick(Preference preference) {
                    Intent installIntent = new Intent();
                    installIntent.setAction(TextToSpeech.Engine.ACTION_INSTALL_TTS_DATA);
                    startActivity(installIntent);
                    return true;
                }
            });
        }
    }

    super.onActivityResult(requestCode, resultCode, data);
}
 
開發者ID:harleensahni,項目名稱:media-button-router,代碼行數:27,代碼來源:MediaButtonConfigure.java


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