@Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);

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

      mEnabledToggles = findPreference(PREF_ENABLE_TOGGLES);

      mBrightnessLocation = (ListPreference) findPreference(PREF_BRIGHTNESS_LOC);
      mBrightnessLocation.setOnPreferenceChangeListener(this);
      mBrightnessLocation.setValue(
          Integer.toString(
              Settings.System.getInt(
                  getActivity().getContentResolver(),
                  Settings.System.STATUSBAR_TOGGLES_BRIGHTNESS_LOC,
                  1)));

      mToggleStyle = (ListPreference) findPreference(PREF_TOGGLES_STYLE);
      mToggleStyle.setOnPreferenceChangeListener(this);
      mToggleStyle.setValue(
          Integer.toString(
              Settings.System.getInt(
                  getActivity().getContentResolver(), Settings.System.STATUSBAR_TOGGLES_STYLE, 3)));

      mAlternateButtonLayout = (CheckBoxPreference) findPreference(PREF_ALT_BUTTON_LAYOUT);
      mAlternateButtonLayout.setChecked(
          Settings.System.getInt(
                  getContentResolver(), Settings.System.STATUSBAR_TOGGLES_USE_BUTTONS, 0)
              == 1);
    }
  private void loadSettings() {
    mPreferences = Preferences.getPreferences(getActivity());
    mAutoAdvance = (ListPreference) findPreference(PREFERENCE_KEY_AUTO_ADVANCE);
    mAutoAdvance.setValueIndex(mPreferences.getAutoAdvanceDirection());
    mAutoAdvance.setOnPreferenceChangeListener(this);

    mTextZoom = (ListPreference) findPreference(PREFERENCE_KEY_TEXT_ZOOM);
    if (mTextZoom != null) {
      mTextZoom.setValueIndex(mPreferences.getTextZoom());
      mTextZoom.setOnPreferenceChangeListener(this);
    }

    final CheckBoxPreference convListIcon =
        (CheckBoxPreference) findPreference(PREFERENCE_KEY_CONV_LIST_ICON);
    if (convListIcon != null) {
      final boolean showSenderImage = mMailPrefs.getShowSenderImages();
      convListIcon.setChecked(showSenderImage);
      convListIcon.setOnPreferenceChangeListener(this);
    }

    mConfirmDelete = (CheckBoxPreference) findPreference(PREFERENCE_KEY_CONFIRM_DELETE);
    mConfirmSend = (CheckBoxPreference) findPreference(PREFERENCE_KEY_CONFIRM_SEND);
    mSwipeDelete =
        (CheckBoxPreference) findPreference(MailPrefs.PreferenceKeys.CONVERSATION_LIST_SWIPE);
    mSwipeDelete.setChecked(mMailPrefs.getIsConversationListSwipeEnabled());

    final CheckBoxPreference replyAllPreference =
        (CheckBoxPreference) findPreference(MailPrefs.PreferenceKeys.DEFAULT_REPLY_ALL);
    replyAllPreference.setChecked(mMailPrefs.getDefaultReplyAll());
    replyAllPreference.setOnPreferenceChangeListener(this);

    reloadDynamicSummaries();
  }
예제 #3
0
 /** Sets up all the preference change listeners to use the specified listener. */
 private void setPreferenceListeners(OnPreferenceChangeListener listener) {
   mUseHomeTZ.setOnPreferenceChangeListener(listener);
   mHomeTZ.setOnPreferenceChangeListener(listener);
   mWeekStart.setOnPreferenceChangeListener(listener);
   mDefaultReminder.setOnPreferenceChangeListener(listener);
   mSnoozeDelay.setOnPreferenceChangeListener(listener);
   mRingtone.setOnPreferenceChangeListener(listener);
   mHideDeclined.setOnPreferenceChangeListener(listener);
   mVibrate.setOnPreferenceChangeListener(listener);
 }
예제 #4
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mGovernorFormat = getString(R.string.cpu_governors_summary);
    mMinFrequencyFormat = getString(R.string.cpu_min_freq_summary);
    mMaxFrequencyFormat = getString(R.string.cpu_max_freq_summary);

    String[] availableGovernors = readOneLine(GOVERNORS_LIST_FILE).split(" ");
    String[] availableFrequencies = new String[0];
    String availableFrequenciesLine = readOneLine(FREQ_LIST_FILE);
    if (availableFrequenciesLine != null)
      availableFrequencies = availableFrequenciesLine.split(" ");
    String[] frequencies;
    String temp;

    frequencies = new String[availableFrequencies.length];
    for (int i = 0; i < frequencies.length; i++) {
      frequencies[i] = toMHz(availableFrequencies[i]);
    }

    setTitle(R.string.cpu_title);
    addPreferencesFromResource(R.xml.cpu_settings);

    PreferenceScreen PrefScreen = getPreferenceScreen();

    temp = readOneLine(GOVERNOR);

    mGovernorPref = (ListPreference) PrefScreen.findPreference(GOV_PREF);
    mGovernorPref.setEntryValues(availableGovernors);
    mGovernorPref.setEntries(availableGovernors);
    mGovernorPref.setValue(temp);
    mGovernorPref.setSummary(String.format(mGovernorFormat, temp));
    mGovernorPref.setOnPreferenceChangeListener(this);

    temp = readOneLine(FREQ_MIN_FILE);

    mMinFrequencyPref = (ListPreference) PrefScreen.findPreference(MIN_FREQ_PREF);
    mMinFrequencyPref.setEntryValues(availableFrequencies);
    mMinFrequencyPref.setEntries(frequencies);
    mMinFrequencyPref.setValue(temp);
    mMinFrequencyPref.setSummary(String.format(mMinFrequencyFormat, toMHz(temp)));
    mMinFrequencyPref.setOnPreferenceChangeListener(this);

    temp = readOneLine(FREQ_MAX_FILE);

    mMaxFrequencyPref = (ListPreference) PrefScreen.findPreference(MAX_FREQ_PREF);
    mMaxFrequencyPref.setEntryValues(availableFrequencies);
    mMaxFrequencyPref.setEntries(frequencies);
    mMaxFrequencyPref.setValue(temp);
    mMaxFrequencyPref.setSummary(String.format(mMaxFrequencyFormat, toMHz(temp)));
    mMaxFrequencyPref.setOnPreferenceChangeListener(this);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.input_methods_settings);

    mDisableFullscreenKeyboard =
        (CheckBoxPreference) findPreference(PREF_DISABLE_FULLSCREEN_KEYBOARD);
    mDisableFullscreenKeyboard.setChecked(
        Settings.System.getInt(getContentResolver(), Settings.System.DISABLE_FULLSCREEN_KEYBOARD, 0)
            == 1);
    mDisableFullscreenKeyboard.setOnPreferenceChangeListener(this);

    // Enable or disable mStatusBarImeSwitcher based on boolean value: config_show_cmIMESwitcher
    final Preference keyImeSwitcherPref = findPreference(KEY_IME_SWITCHER);
    if (keyImeSwitcherPref != null) {
      if (!getResources().getBoolean(com.android.internal.R.bool.config_show_IMESwitcher)) {
        getPreferenceScreen().removePreference(keyImeSwitcherPref);
      } else {
        mStatusBarImeSwitcher = (CheckBoxPreference) keyImeSwitcherPref;
        mStatusBarImeSwitcher.setOnPreferenceChangeListener(this);
      }
    }

    mVolumeKeyCursorControl = (ListPreference) findPreference(VOLUME_KEY_CURSOR_CONTROL);
    if (mVolumeKeyCursorControl != null) {
      mVolumeKeyCursorControl.setValue(
          Integer.toString(
              Settings.System.getInt(
                  getContentResolver(), Settings.System.VOLUME_KEY_CURSOR_CONTROL, 0)));
      mVolumeKeyCursorControl.setSummary(mVolumeKeyCursorControl.getEntry());
      mVolumeKeyCursorControl.setOnPreferenceChangeListener(this);
    }

    mKeyboardRotationToggle = (CheckBoxPreference) findPreference(KEYBOARD_ROTATION_TOGGLE);
    mKeyboardRotationToggle.setChecked(
        Settings.System.getInt(getContentResolver(), Settings.System.KEYBOARD_ROTATION_TIMEOUT, 0)
            > 0);
    mKeyboardRotationToggle.setOnPreferenceChangeListener(this);

    mKeyboardRotationTimeout = (ListPreference) findPreference(KEYBOARD_ROTATION_TIMEOUT);
    mKeyboardRotationTimeout.setOnPreferenceChangeListener(this);
    updateRotationTimeout(
        Settings.System.getInt(
            getContentResolver(),
            Settings.System.KEYBOARD_ROTATION_TIMEOUT,
            KEYBOARD_ROTATION_TIMEOUT_DEFAULT));

    mShowEnterKey = (CheckBoxPreference) findPreference(SHOW_ENTER_KEY);
    mShowEnterKey.setChecked(
        Settings.System.getInt(getContentResolver(), Settings.System.FORMAL_TEXT_INPUT, 0) == 1);
    mShowEnterKey.setOnPreferenceChangeListener(this);
  }
  private void initPreferences() {
    CheckBoxPreference notifyOpenNetworks =
        (CheckBoxPreference) findPreference(KEY_NOTIFY_OPEN_NETWORKS);
    notifyOpenNetworks.setChecked(
        Secure.getInt(getContentResolver(), Secure.WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON, 0)
            == 1);
    notifyOpenNetworks.setEnabled(mWifiManager.isWifiEnabled());

    CheckBoxPreference watchdogEnabled =
        (CheckBoxPreference) findPreference(KEY_ENABLE_WIFI_WATCHDOG);
    if (watchdogEnabled != null) {
      watchdogEnabled.setChecked(
          Secure.getInt(getContentResolver(), Secure.WIFI_WATCHDOG_ON, 1) == 1);

      // TODO: Bring this back after changing watchdog behavior
      getPreferenceScreen().removePreference(watchdogEnabled);
    }

    ListPreference frequencyPref = (ListPreference) findPreference(KEY_FREQUENCY_BAND);

    if (mWifiManager.isDualBandSupported()) {
      frequencyPref.setOnPreferenceChangeListener(this);
      int value = mWifiManager.getFrequencyBand();
      if (value != -1) {
        frequencyPref.setValue(String.valueOf(value));
      } else {
        Log.e(TAG, "Failed to fetch frequency band");
      }
    } else {
      if (frequencyPref != null) {
        // null if it has already been removed before resume
        getPreferenceScreen().removePreference(frequencyPref);
      }
    }

    ListPreference sleepPolicyPref = (ListPreference) findPreference(KEY_SLEEP_POLICY);
    if (sleepPolicyPref != null) {
      if (Utils.isWifiOnly(getActivity())) {
        sleepPolicyPref.setEntries(R.array.wifi_sleep_policy_entries_wifi_only);
      }
      sleepPolicyPref.setOnPreferenceChangeListener(this);
      int value =
          Settings.System.getInt(
              getContentResolver(),
              Settings.System.WIFI_SLEEP_POLICY,
              Settings.System.WIFI_SLEEP_POLICY_NEVER);
      String stringValue = String.valueOf(value);
      sleepPolicyPref.setValue(stringValue);
      updateSleepPolicySummary(sleepPolicyPref, stringValue);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getPreferenceManager() != null) {
      addPreferencesFromResource(R.xml.operator_preferences);
      PreferenceScreen prefSet = getPreferenceScreen();

      mOperatorDisplayStyle = (ListPreference) prefSet.findPreference(OPERATOR_STYLE);
      mOperatorDisplayStyle.setOnPreferenceChangeListener(this);

      mOperatorDisplayText = (EditTextPreference) prefSet.findPreference(OPERATOR_TEXT);
      mOperatorDisplayText.setOnPreferenceChangeListener(this);

      if (mOperatorDisplayText != null) {
        String operLabel = mOperatorDisplayText.getText();
        if (TextUtils.isEmpty(operLabel)) {
          mOperatorDisplayText.setSummary(getString(R.string.operator_display_summary));
        } else {
          mOperatorDisplayText.setSummary(mOperatorDisplayText.getText());
        }
      }

      int index = Settings.System.getInt(getContentResolver(), CARRIER_LABEL_TYPE, 0);
      index = index > (mOperatorDisplayStyle.getEntries().length - 1) ? 0 : index;
      mOperatorDisplayStyle.setSummary(mOperatorDisplayStyle.getEntries()[index]);

      mOperatorDisplayText.setEnabled(index == 3);
    }
  }
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.recents_panel_settings);

    PreferenceScreen prefSet = getPreferenceScreen();
    ContentResolver resolver = getActivity().getContentResolver();
    PackageManager pm = getPackageManager();

    mRecentsClearAll = (SwitchPreference) prefSet.findPreference(SHOW_CLEAR_ALL_RECENTS);
    mRecentsClearAll.setChecked(
        Settings.System.getIntForUser(
                resolver, Settings.System.SHOW_CLEAR_ALL_RECENTS, 1, UserHandle.USER_CURRENT)
            == 1);
    mRecentsClearAll.setOnPreferenceChangeListener(this);

    mRecentsClearAllLocation = (ListPreference) prefSet.findPreference(RECENTS_CLEAR_ALL_LOCATION);
    int location =
        Settings.System.getIntForUser(
            resolver, Settings.System.RECENTS_CLEAR_ALL_LOCATION, 3, UserHandle.USER_CURRENT);
    mRecentsClearAllLocation.setValue(String.valueOf(location));
    mRecentsClearAllLocation.setOnPreferenceChangeListener(this);
    updateRecentsLocation(location);

    mOmniSwitch = (Preference) prefSet.findPreference(KEY_OMNISWITCH);
    if (!Helpers.isPackageInstalled(OMNISWITCH_PACKAGE_NAME, pm)) {
      prefSet.removePreference(mOmniSwitch);
    }
  }
  public void refreshSettings() {

    int lockscreenTargets =
        Settings.System.getInt(getContentResolver(), Settings.System.LOCKSCREEN_LAYOUT, 2);

    PreferenceGroup targetGroup = (PreferenceGroup) findPreference("lockscreen_targets");
    targetGroup.removeAll();

    // quad only uses first 4, but we make the system think there's 6 for the alternate layout
    // so only show 4
    if (lockscreenTargets == 6) {
      Settings.System.putString(
          getContentResolver(), Settings.System.LOCKSCREEN_CUSTOM_APP_ACTIVITIES[4], "**null**");
      Settings.System.putString(
          getContentResolver(), Settings.System.LOCKSCREEN_CUSTOM_APP_ACTIVITIES[5], "**null**");
      lockscreenTargets = 4;
    }

    for (int i = 0; i < lockscreenTargets; i++) {
      ListPreference p = new ListPreference(getActivity());
      String dialogTitle =
          String.format(getResources().getString(R.string.custom_app_n_dialog_title), i + 1);
      ;
      p.setDialogTitle(dialogTitle);
      p.setEntries(R.array.lockscreen_choice_entries);
      p.setEntryValues(R.array.lockscreen_choice_values);
      String title = String.format(getResources().getString(R.string.custom_app_n), i + 1);
      p.setTitle(title);
      p.setKey("lockscreen_target_" + i);
      p.setSummary(getProperSummary(i));
      p.setOnPreferenceChangeListener(this);
      targetGroup.addPreference(p);
    }
  }
  /**
   * onCreate
   *
   * <p>Called when the activity is first created. This is where you should do all of your normal
   * static set up: create views, bind data to lists, etc. This method also provides you with a
   * Bundle containing the activity's previously frozen state, if there was one.
   *
   * <p>Always followed by onStart().
   *
   * @param savedInstanceState Bundle
   */
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);
    setContentView(R.layout.activity_preferences);
    setTitleFromActivityLabel(R.id.title_text);

    Preference serversbutton = (Preference) findPreference("managesevers");
    serversbutton.setOnPreferenceClickListener(
        new OnPreferenceClickListener() {
          @Override
          public boolean onPreferenceClick(Preference arg0) {
            openServersManager();
            return true;
          }
        });

    final ListPreference testbedslist = (ListPreference) findPreference("selecttestbed");

    SharedPreferences prefs = getSharedPreferences("prefs", MODE_PRIVATE);
    ServerDatabaseHandler serverDatabase = new ServerDatabaseHandler(this);
    Server currentServer = serverDatabase.getServer(prefs.getInt("prefServerId", 0));
    serverDatabase.close();

    DataSource tempDS = new DataSource(currentServer);
    List<Testbed> testbeds = tempDS.getTestbeds();
    ArrayList<CharSequence> testbedName = new ArrayList<CharSequence>();
    ArrayList<CharSequence> testbedValues = new ArrayList<CharSequence>();
    int i;
    for (i = 0; i < testbeds.size(); i++) {
      testbedName.add(testbeds.get(i).getName());
      testbedValues.add(Integer.toString(i));
    }
    final CharSequence[] items = testbedName.toArray(new CharSequence[testbedName.size()]);
    final CharSequence[] values = testbedValues.toArray(new CharSequence[testbedValues.size()]);

    testbedslist.setEntries(items);
    testbedslist.setEntryValues(values);

    testbedslist.setOnPreferenceChangeListener(
        new OnPreferenceChangeListener() {

          @Override
          public boolean onPreferenceChange(Preference preference, Object newValue) {
            setCurrentTestbed(newValue);
            return true;
          }
        });

    Preference clearcache = (Preference) findPreference("clearcache");
    clearcache.setOnPreferenceClickListener(
        new OnPreferenceClickListener() {
          @Override
          public boolean onPreferenceClick(Preference arg0) {
            clearCache();
            return true;
          }
        });
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.lcd_density_setup);

    String currentDensity = SystemProperties.get("ro.sf.lcd_density");
    PreferenceScreen prefs = getPreferenceScreen();

    mStockDensity = (ListPreference) findPreference("stock_density");
    mStockDensity.setOnPreferenceChangeListener(this);

    mReboot = findPreference("reboot");
    mClearMarketData = findPreference("clear_market_data");
    mOpenMarket = findPreference("open_market");

    mCustomDensity = (ListPreference) findPreference("lcd_density");
    mCustomDensity.setOnPreferenceChangeListener(this);
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   addPreferencesFromResource(R.xml.settings);
   PreferenceScreen preferenceScreen = getPreferenceScreen();
   listPreference = (ListPreference) preferenceScreen.findPreference(PREF_MODE);
   listPreference.setDefaultValue(getResources().getString(R.string.default_mode));
   listPreference.setOnPreferenceChangeListener(this);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.general_system_property_pref);

    mSetting = new SystemPropertySetting(this);

    boolean value;

    value = mSetting.getCameraSound();
    mCameraSound = (CheckBoxPreference) findPreference(SystemPropertySetting.KEY_CAMERA_SOUND);
    mCameraSound.setChecked(value);
    mCameraSound.setOnPreferenceChangeListener(this);

    String lcdDensity = mSetting.getLcdDensity();
    mLcdDensity = (SeekBarPreference) findPreference(SystemPropertySetting.KEY_LCD_DENSITY);
    mLcdDensity.setValue(300, 120, Integer.valueOf(lcdDensity));
    mLcdDensity.setSummary(Misc.getCurrentValueText(this, lcdDensity));
    mLcdDensity.setOnPreferenceDoneListener(this);

    value = mSetting.getCrtEffect();
    mCrtEffect = (CheckBoxPreference) findPreference(SystemPropertySetting.KEY_CRT_EFFECT);
    mCrtEffect.setChecked(value);
    mCrtEffect.setOnPreferenceChangeListener(this);

    value = mSetting.getLogger();
    mLogger = (CheckBoxPreference) findPreference(SystemPropertySetting.KEY_LOGGER);
    mLogger.setChecked(value);
    mLogger.setOnPreferenceChangeListener(this);

    value = mSetting.getCifs();
    mCifs = (CheckBoxPreference) findPreference(SystemPropertySetting.KEY_CIFS);
    mCifs.setChecked(value);
    mCifs.setOnPreferenceChangeListener(this);

    value = mSetting.getNtfs();
    mNtfs = (CheckBoxPreference) findPreference(SystemPropertySetting.KEY_NTFS);
    mNtfs.setChecked(value);
    mNtfs.setOnPreferenceChangeListener(this);

    value = mSetting.getJ4fs();
    mJ4fs = (CheckBoxPreference) findPreference(SystemPropertySetting.KEY_J4FS);
    mJ4fs.setChecked(value);
    mJ4fs.setOnPreferenceChangeListener(this);

    String strValue = mSetting.getUsbConfig();
    mUsbConfig = (ListPreference) findPreference(SystemPropertySetting.KEY_USB_CONFIG);
    mUsbConfig.setValue(strValue);
    mUsbConfig.setSummary(
        Misc.getCurrentValueText(
            this,
            Misc.getEntryFromEntryValue(
                mUsbConfig.getEntries(), mUsbConfig.getEntryValues(), strValue)));
    mUsbConfig.setOnPreferenceChangeListener(this);
  }
  @Override
  public void onResume() {
    super.onResume();

    mSettingsObserver.resume();
    mIm.registerInputDeviceListener(this, null);

    if (!mIsOnlyImeSettings) {
      if (mLanguagePref != null) {
        Configuration conf = getResources().getConfiguration();
        String language = conf.locale.getLanguage();
        String localeString;
        // TODO: This is not an accurate way to display the locale, as it is
        // just working around the fact that we support limited dialects
        // and want to pretend that the language is valid for all locales.
        // We need a way to support languages that aren't tied to a particular
        // locale instead of hiding the locale qualifier.
        if (hasOnlyOneLanguageInstance(language, Resources.getSystem().getAssets().getLocales())) {
          localeString = conf.locale.getDisplayLanguage(conf.locale);
        } else {
          localeString = conf.locale.getDisplayName(conf.locale);
        }
        if (localeString.length() > 1) {
          localeString = Character.toUpperCase(localeString.charAt(0)) + localeString.substring(1);
          mLanguagePref.setSummary(localeString);
        }
      }

      updateUserDictionaryPreference(findPreference(KEY_USER_DICTIONARY_SETTINGS));
      if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) {
        mShowInputMethodSelectorPref.setOnPreferenceChangeListener(this);
      }
    }

    if (mStatusBarImeSwitcher != null) {
      mStatusBarImeSwitcher.setChecked(
          Settings.System.getInt(
                  getActivity().getContentResolver(), Settings.System.STATUS_BAR_IME_SWITCHER, 1)
              != 0);
    }

    // Hard keyboard
    if (!mHardKeyboardPreferenceList.isEmpty()) {
      for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
        CheckBoxPreference chkPref =
            (CheckBoxPreference) mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i]);
        chkPref.setChecked(System.getInt(getContentResolver(), sSystemSettingNames[i], 1) > 0);
      }
    }

    updateInputDevices();

    // IME
    InputMethodAndSubtypeUtil.loadInputMethodSubtypeList(this, getContentResolver(), mImis, null);
    updateActiveInputMethodsSummary();
  }
예제 #15
0
 /** Create the "Key Signature" preference */
 private void createKeySignaturePrefs(PreferenceScreen root) {
   key = new ListPreference(this);
   key.setOnPreferenceChangeListener(this);
   key.setTitle(R.string.key_signature);
   key.setEntries(R.array.key_signature_entries);
   key.setEntryValues(R.array.key_signature_values);
   key.setValueIndex(options.key + 1);
   key.setSummary(key.getEntry());
   root.addPreference(key);
 }
예제 #16
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);

    PreferenceManager.setDefaultValues(Settings.this, R.xml.preferences, false);
    settingPreference = this.getSharedPreferences(SHARED_PREF_FILE, MODE_PRIVATE);
    PreferenceScreen prefSet = getPreferenceScreen();

    mRemoteIP = (EditTextPreference) prefSet.findPreference(KEY_REMOTE_IP);
    mRemoteIP.setOnPreferenceChangeListener(this);

    mLocalPort = (EditTextPreference) prefSet.findPreference(KEY_LOCAL_PORT);
    mLocalPort.setOnPreferenceChangeListener(this);

    mRemotePort = (EditTextPreference) prefSet.findPreference(KEY_REMOTE_PORT);
    mRemotePort.setOnPreferenceChangeListener(this);

    mEnableAudio = (CheckBoxPreference) prefSet.findPreference(KEY_ENABLE_AUDIO);

    mEnableAudioViaCss = (CheckBoxPreference) prefSet.findPreference(KEY_ENABLE_AUDIO_VIA_CSS);

    mEnableVideo = (CheckBoxPreference) prefSet.findPreference(KEY_ENABLE_VIDEO);

    mEnableLog = (CheckBoxPreference) prefSet.findPreference(KEY_ENABLE_LOGGING);

    mEnableFullScreen = (CheckBoxPreference) prefSet.findPreference(KEY_FULL_SCREEN);

    mAudioEncoder = (ListPreference) prefSet.findPreference(KEY_AUDIO_CODECS);
    mAudioEncoder.setOnPreferenceChangeListener(this);

    /*   mAudioChannel = (ListPreference)prefSet.findPreference(KEY_AUDIO_CHANNEL);
      mAudioChannel.setOnPreferenceChangeListener(this);
    */

    mVideoEncoder = (ListPreference) prefSet.findPreference(KEY_VIDEO_CODECS);
    mVideoEncoder.setOnPreferenceChangeListener(this);

    /* TBD: Video resolution needs to be made dynamic */
    mVideoResolution = (ListPreference) prefSet.findPreference(KEY_RESOLUTION);
    mVideoResolution.setOnPreferenceChangeListener(this);
  }
예제 #17
0
 /** Create the "Show Note Letters" preference */
 private void createShowLetterPrefs(PreferenceScreen root) {
   showNoteLetters = new ListPreference(this);
   showNoteLetters.setOnPreferenceChangeListener(this);
   showNoteLetters.setTitle(R.string.show_note_letters);
   showNoteLetters.setEntries(R.array.show_note_letter_entries);
   showNoteLetters.setEntryValues(R.array.show_note_letter_values);
   showNoteLetters.setValueIndex(options.showNoteLetters);
   showNoteLetters.setSummary(showNoteLetters.getEntry());
   root.addPreference(showNoteLetters);
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.activity_settings);

    bluetoothPC = (PreferenceCategory) findPreference("bluetooth_pc");
    btRFIDDefaultDevLP = (ListPreference) findPreference("bt_rfid_default_dev_lp");
    btRFIDDefaultDevLP.setOnPreferenceChangeListener(this);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.gesture_anywhere);

    mEnabledPref = (SwitchPreference) findPreference(KEY_ENABLED);
    mEnabledPref.setChecked(
        (Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_ENABLED, 0)
            == 1));
    mEnabledPref.setOnPreferenceChangeListener(this);

    mGestureAnywhereFloatingWindow = (SwitchPreference) findPreference(GESTURE_ANYWHERE_FLOATING);
    mGestureAnywhereFloatingWindow.setChecked(
        Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_FLOATING, 0)
            == 1);
    mGestureAnywhereFloatingWindow.setOnPreferenceChangeListener(this);

    PreferenceScreen prefSet = getPreferenceScreen();
    mPositionPref = (ListPreference) prefSet.findPreference(KEY_POSITION);
    mPositionPref.setOnPreferenceChangeListener(this);
    int position =
        Settings.System.getInt(
            getContentResolver(), Settings.System.GESTURE_ANYWHERE_POSITION, Gravity.LEFT);
    mPositionPref.setValue(String.valueOf(position));
    updatePositionSummary(position);

    mTriggerWidthPref = (SeekBarPreferenceCham) findPreference(KEY_TRIGGER_WIDTH);
    mTriggerWidthPref.setValue(
        Settings.System.getInt(
            getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_WIDTH, 10));
    mTriggerWidthPref.setOnPreferenceChangeListener(this);

    mTriggerTopPref = (SeekBarPreferenceCham) findPreference(KEY_TRIGGER_TOP);
    mTriggerTopPref.setValue(
        Settings.System.getInt(
            getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_TOP, 0));
    mTriggerTopPref.setOnPreferenceChangeListener(this);

    mTriggerBottomPref = (SeekBarPreferenceCham) findPreference(KEY_TRIGGER_BOTTOM);
    mTriggerBottomPref.setValue(
        Settings.System.getInt(
            getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_HEIGHT, 100));
    mTriggerBottomPref.setOnPreferenceChangeListener(this);

    Preference pref = findPreference(KEY_GESTURES);
    pref.setOnPreferenceClickListener(
        new Preference.OnPreferenceClickListener() {
          @Override
          public boolean onPreferenceClick(Preference preference) {
            startActivity(new Intent(getActivity(), GestureAnywhereBuilderActivity.class));
            return true;
          }
        });
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.live_wallpaper_settings);
    // SharedPreferences p = getSharedPreferences(getPackageName(), Context.MODE_PRIVATE);

    mCheckBoxBackgroundEnabled =
        (CheckBoxPreference) findPreference(BACKGROUND_ENABLED_CHECKBOX_KEY);
    mCheckBoxBackgroundEnabled.setOnPreferenceChangeListener(this);

    // mListPreferenceBackgroundSpeed = (ListPreference) findPreference(BACKGROUND_SPEED_LIST_KEY);
    // mListPreferenceBackgroundSpeed.setOnPreferenceChangeListener(this);

    mCheckBoxHEnabled = (CheckBoxPreference) findPreference(H_ENABLED_CHECKBOX_KEY);
    mCheckBoxHEnabled.setOnPreferenceChangeListener(this);

    mListPreferenceHBCount = (ListPreference) findPreference(HB_COUNT_LIST_KEY);
    mListPreferenceHBCount.setOnPreferenceChangeListener(this);

    mListPreferenceHBSpeed = (ListPreference) findPreference(HB_SPEED_LIST_KEY);
    mListPreferenceHBSpeed.setOnPreferenceChangeListener(this);

    mListPreferenceHFCount = (ListPreference) findPreference(HF_COUNT_LIST_KEY);
    mListPreferenceHFCount.setOnPreferenceChangeListener(this);

    mListPreferenceHFSpeed = (ListPreference) findPreference(HF_SPEED_LIST_KEY);
    mListPreferenceHFSpeed.setOnPreferenceChangeListener(this);

    mCheckBoxVEnabled = (CheckBoxPreference) findPreference(V_ENABLED_CHECKBOX_KEY);
    mCheckBoxVEnabled.setOnPreferenceChangeListener(this);

    mListPreferenceVFCount = (ListPreference) findPreference(VF_COUNT_LIST_KEY);
    mListPreferenceVFCount.setOnPreferenceChangeListener(this);

    mListPreferenceVFSpeed = (ListPreference) findPreference(VF_SPEED_LIST_KEY);
    mListPreferenceVFSpeed.setOnPreferenceChangeListener(this);

    // mCheckBoxVFTouchEnabled = (CheckBoxPreference) findPreference(VF_TOUCH_ENABLED_CHECKBOX_KEY);
    // mCheckBoxVFTouchEnabled.setOnPreferenceChangeListener(this);

    mListPreferenceVBCount = (ListPreference) findPreference(VB_COUNT_LIST_KEY);
    mListPreferenceVBCount.setOnPreferenceChangeListener(this);

    mListPreferenceVBSpeed = (ListPreference) findPreference(VB_SPEED_LIST_KEY);
    mListPreferenceVBSpeed.setOnPreferenceChangeListener(this);

    // mCheckBoxVScrollEnabled = (CheckBoxPreference) findPreference(V_SCROLL_ENABLED_CHECKBOX_KEY);
    // mCheckBoxVScrollEnabled.setOnPreferenceChangeListener(this);

    // mListPreferenceVScrollSpeed = (ListPreference) findPreference(V_SCROLL_SPEED_LIST_KEY);
    // mListPreferenceVScrollSpeed.setOnPreferenceChangeListener(this);
  }
예제 #21
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
    mBackupManager =
        IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));

    addPreferencesFromResource(R.xml.development_prefs);

    mEnableAdb = (CheckBoxPreference) findPreference(ENABLE_ADB);
    mKeepScreenOn = (CheckBoxPreference) findPreference(KEEP_SCREEN_ON);
    mAllowMockLocation = (CheckBoxPreference) findPreference(ALLOW_MOCK_LOCATION);
    mPassword = (PreferenceScreen) findPreference(LOCAL_BACKUP_PASSWORD);

    mStrictMode = (CheckBoxPreference) findPreference(STRICT_MODE_KEY);
    mPointerLocation = (CheckBoxPreference) findPreference(POINTER_LOCATION_KEY);
    mShowTouches = (CheckBoxPreference) findPreference(SHOW_TOUCHES_KEY);
    mShowScreenUpdates = (CheckBoxPreference) findPreference(SHOW_SCREEN_UPDATES_KEY);
    mShowCpuUsage = (CheckBoxPreference) findPreference(SHOW_CPU_USAGE_KEY);
    mForceHardwareUi = (CheckBoxPreference) findPreference(FORCE_HARDWARE_UI_KEY);
    mWindowAnimationScale = (ListPreference) findPreference(WINDOW_ANIMATION_SCALE_KEY);
    mWindowAnimationScale.setOnPreferenceChangeListener(this);
    mTransitionAnimationScale = (ListPreference) findPreference(TRANSITION_ANIMATION_SCALE_KEY);
    mTransitionAnimationScale.setOnPreferenceChangeListener(this);

    mImmediatelyDestroyActivities =
        (CheckBoxPreference) findPreference(IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
    mAppProcessLimit = (ListPreference) findPreference(APP_PROCESS_LIMIT_KEY);
    mAppProcessLimit.setOnPreferenceChangeListener(this);

    mShowAllANRs = (CheckBoxPreference) findPreference(SHOW_ALL_ANRS_KEY);

    final Preference verifierDeviceIdentifier = findPreference(VERIFIER_DEVICE_IDENTIFIER);
    final PackageManager pm = getActivity().getPackageManager();
    final VerifierDeviceIdentity verifierIndentity = pm.getVerifierDeviceIdentity();
    if (verifierIndentity != null) {
      verifierDeviceIdentifier.setSummary(verifierIndentity.toString());
    }

    removeHdcpOptionsForProduction();
  }
예제 #22
0
 /**
  * Create the "Combine Notes Within Interval" preference. Notes within N milliseconds are combined
  * into a single chord, even though their start times may be slightly different.
  */
 private void createCombineIntervalPrefs(PreferenceScreen root) {
   int selected = options.combineInterval / 20 - 1;
   combineInterval = new ListPreference(this);
   combineInterval.setOnPreferenceChangeListener(this);
   combineInterval.setTitle(R.string.combine_interval);
   combineInterval.setEntries(R.array.combine_interval_entries);
   combineInterval.setEntryValues(R.array.combine_interval_values);
   combineInterval.setValueIndex(selected);
   combineInterval.setSummary(combineInterval.getEntry());
   root.addPreference(combineInterval);
 }
예제 #23
0
 /** Create the "Transpose Notes" preference. The values range from 12, 11, 10, .. -10, -11, -12 */
 private void createTransposePrefs(PreferenceScreen root) {
   int transposeIndex = 12 - options.transpose;
   transpose = new ListPreference(this);
   transpose.setOnPreferenceChangeListener(this);
   transpose.setTitle(R.string.transpose);
   transpose.setEntries(R.array.transpose_entries);
   transpose.setEntryValues(R.array.transpose_values);
   transpose.setValueIndex(transposeIndex);
   transpose.setSummary(transpose.getEntry());
   root.addPreference(transpose);
 }
  private void initializeAllPreferences() {
    mServicesCategory = (PreferenceCategory) findPreference(SERVICES_CATEGORY);
    mSystemsCategory = (PreferenceCategory) findPreference(SYSTEM_CATEGORY);

    // Large text.
    mToggleLargeTextPreference = (CheckBoxPreference) findPreference(TOGGLE_LARGE_TEXT_PREFERENCE);

    // Power button ends calls.
    mTogglePowerButtonEndsCallPreference =
        (CheckBoxPreference) findPreference(TOGGLE_POWER_BUTTON_ENDS_CALL_PREFERENCE);
    if (!KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_POWER)
        || !Utils.isVoiceCapable(getActivity())) {
      mSystemsCategory.removePreference(mTogglePowerButtonEndsCallPreference);
    }

    // Auto-rotate screen
    mToggleAutoRotateScreenPreference =
        (CheckBoxPreference) findPreference(TOGGLE_AUTO_ROTATE_SCREEN_PREFERENCE);

    // Speak passwords.
    mToggleSpeakPasswordPreference =
        (CheckBoxPreference) findPreference(TOGGLE_SPEAK_PASSWORD_PREFERENCE);

    // Touch exploration enabled.
    mToggleTouchExplorationPreference = findPreference(TOGGLE_TOUCH_EXPLORATION_PREFERENCE);

    // Long press timeout.
    mSelectLongPressTimeoutPreference =
        (ListPreference) findPreference(SELECT_LONG_PRESS_TIMEOUT_PREFERENCE);
    mSelectLongPressTimeoutPreference.setOnPreferenceChangeListener(this);
    if (mLongPressTimeoutValuetoTitleMap.size() == 0) {
      String[] timeoutValues =
          getResources().getStringArray(R.array.long_press_timeout_selector_values);
      mLongPressTimeoutDefault = Integer.parseInt(timeoutValues[0]);
      String[] timeoutTitles =
          getResources().getStringArray(R.array.long_press_timeout_selector_titles);
      final int timeoutValueCount = timeoutValues.length;
      for (int i = 0; i < timeoutValueCount; i++) {
        mLongPressTimeoutValuetoTitleMap.put(timeoutValues[i], timeoutTitles[i]);
      }
    }

    // Script injection.
    mToggleScriptInjectionPreference =
        (AccessibilityEnableScriptInjectionPreference)
            findPreference(TOGGLE_SCRIPT_INJECTION_PREFERENCE);

    // IPO
    mIpoSetting = (CheckBoxPreference) findPreference(IPO_SETTING);
    if (!FeatureOption.MTK_IPO_SUPPORT) {
      mSystemsCategory.removePreference(mIpoSetting);
    }
  }
예제 #25
0
 private <T> void prepareListPreference(
     OsmandPreference<T> b, String[] names, T[] values, ListPreference p) {
   p.setOnPreferenceChangeListener(this);
   LinkedHashMap<String, Object> vals = new LinkedHashMap<String, Object>();
   screenPreferences.put(b.getId(), p);
   listPreferences.put(b.getId(), b);
   listPrefValues.put(b.getId(), vals);
   assert names.length == values.length;
   for (int i = 0; i < names.length; i++) {
     vals.put(names[i], values[i]);
   }
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    SettingsActivityComponent cmp = DaggerService.getDaggerComponent(getActivity());
    cmp.inject(this);

    mSettings.setCached(true);

    addPreferencesFromResource(R.xml.prefs_service);

    runWhen = (ListPreference) findPreference(ServiceSettings.RUN_WHEN);
    runWhen.setPersistent(false);
    runWhen.setValue(mSettings.runWhen());
    runWhen.setOnPreferenceChangeListener(this);

    onlyOnWifi = (CheckBoxPreference) findPreference(ServiceSettings.ONLY_WIFI);
    onlyOnWifi.setPersistent(false);
    onlyOnWifi.setChecked(mSettings.onlyOnWifi());
    onlyOnWifi.setOnPreferenceChangeListener(this);

    wifiNetwork = (MultiSelectListPreference) findPreference(ServiceSettings.WIFI_NETWORKS);
    wifiNetwork.setPersistent(false);
    String[] ssids = getWifiNetworks();
    wifiNetwork.setEntries(ssids);
    wifiNetwork.setEntryValues(ssids);
    wifiNetwork.setValues(mSettings.allowedWifiNetworks());
    wifiNetwork.setOnPreferenceChangeListener(this);

    onlyCharging = (CheckBoxPreference) findPreference(ServiceSettings.ONLY_CHARGING);
    onlyCharging.setPersistent(false);
    onlyCharging.setChecked(mSettings.onlyWhenCharging());
    onlyCharging.setOnPreferenceChangeListener(this);

    catBetween = (PreferenceCategory) findPreference("cat_between");
    hideShowRunWhenCategories(mSettings.runWhen());

    scheduleStart = (TimePreference) findPreference(ServiceSettings.RANGE_START);
    scheduleStart.setPersistent(false);
    scheduleStart.setValue(mSettings.getScheduledStartTime());
    scheduleStart.setOnPreferenceChangeListener(this);

    scheduleEnd = (TimePreference) findPreference(ServiceSettings.RANGE_END);
    scheduleEnd.setPersistent(false);
    scheduleEnd.setValue(mSettings.getScheduledEndTime());
    scheduleEnd.setOnPreferenceChangeListener(this);

    exportConfig = findPreference("export");
    exportConfig.setOnPreferenceClickListener(this);
    importConfig = findPreference("import");
    importConfig.setOnPreferenceClickListener(this);
  }
  @Override
  public void onPause() {
    super.onPause();

    mIm.unregisterInputDeviceListener(this);
    mSettingsObserver.pause();

    if (SHOW_INPUT_METHOD_SWITCHER_SETTINGS) {
      mShowInputMethodSelectorPref.setOnPreferenceChangeListener(null);
    }
    InputMethodAndSubtypeUtil.saveInputMethodSubtypeList(
        this, getContentResolver(), mImis, !mHardKeyboardPreferenceList.isEmpty());
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.propmodder);
    prefSet = getPreferenceScreen();

    mWifiScanPref = (ListPreference) prefSet.findPreference(WIFI_SCAN_PREF);
    mWifiScanPref.setOnPreferenceChangeListener(this);

    mMaxEventsPref = (ListPreference) prefSet.findPreference(MAX_EVENTS_PREF);
    mMaxEventsPref.setOnPreferenceChangeListener(this);

    mRingDelayPref = (ListPreference) prefSet.findPreference(RING_DELAY_PREF);
    mRingDelayPref.setOnPreferenceChangeListener(this);

    mVmHeapsizePref = (ListPreference) prefSet.findPreference(VM_HEAPSIZE_PREF);
    mVmHeapsizePref.setOnPreferenceChangeListener(this);

    mFastUpPref = (ListPreference) prefSet.findPreference(FAST_UP_PREF);
    mFastUpPref.setOnPreferenceChangeListener(this);

    mProxDelayPref = (ListPreference) prefSet.findPreference(PROX_DELAY_PREF);
    mProxDelayPref.setOnPreferenceChangeListener(this);

    mSleepPref = (ListPreference) prefSet.findPreference(SLEEP_PREF);
    mSleepPref.setOnPreferenceChangeListener(this);

    mTcpStackPref = (CheckBoxPreference) prefSet.findPreference(TCP_STACK_PREF);

    mJitPref = (CheckBoxPreference) prefSet.findPreference(JIT_PREF);

    mModVersionPref = (EditTextPreference) prefSet.findPreference(MOD_VERSION_PREF);
    String mod = Helpers.findBuildPropValueOf(MOD_VERSION_PROP);
    if (mModVersionPref != null) {
      EditText modET = mModVersionPref.getEditText();
      ModPrefHolder = mModVersionPref.getEditText().toString();
      if (modET != null) {
        InputFilter lengthFilter = new InputFilter.LengthFilter(32);
        modET.setFilters(new InputFilter[] {lengthFilter});
        modET.setSingleLine(true);
      }
      mModVersionPref.setSummary(
          String.format(getString(R.string.pref_mod_version_alt_summary), mod));
    }
    Log.d(TAG, String.format("ModPrefHoler = '%s' found build number = '%s'", ModPrefHolder, mod));
    mModVersionPref.setOnPreferenceChangeListener(this);

    m3gSpeedPref = (CheckBoxPreference) prefSet.findPreference(THREE_G_PREF);

    mGpuPref = (CheckBoxPreference) prefSet.findPreference(GPU_PREF);

    updateScreen();
  }
 @SuppressWarnings("deprecation")
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   addPreferencesFromResource(R.xml.preference);
   m_rememberUser = (CheckBoxPreference) findPreference(Preferences.REMEMBER_USER);
   m_autoLogin = (CheckBoxPreference) findPreference(Preferences.AUTO_LOGIN);
   m_defaultTab = (ListPreference) findPreference(Preferences.DEFAULT_TAB);
   m_rememberUser.setOnPreferenceChangeListener(this);
   m_rememberUser.setOnPreferenceClickListener(this);
   m_defaultTab.setOnPreferenceChangeListener(this);
   m_defaultTab.setOnPreferenceClickListener(this);
 }
예제 #30
0
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
    addPreferencesFromResource(R.xml.stocksettings);
    mFlashRecovery = (Preference) findPreference(FLASH_RECOVERY);
    mCrtLockscreen = (CheckBoxPreference) findPreference(ALLOW__CRT_LOCKSCREEN);
    mCameraChange = (ListPreference) findPreference(KEY_DEVICE);
    mSwitchVold = (ListPreference) findPreference(SWITCH_VOLD);
    mCameraChange.setOnPreferenceChangeListener(this);
    mSwitchVold.setOnPreferenceChangeListener(this);
    setListPreferenceSummary(mCameraChange);
    setListPreferenceSummary(mSwitchVold);

    // 在程序启动时验证值是否正确
    if ((!this.Coolpad8297.equals("8297_xs")) || (!this.XS.equals("weibo.com/acexs"))) {
      Toast.makeText(
              getApplicationContext(), "您可能是盗版ROM受害者,请前往MIUI官网下载正版ROM,认准作者XS!", Toast.LENGTH_SHORT)
          .show();
      finish();
    }
  }