コード例 #1
0
ファイル: ProxyDroid.java プロジェクト: ruobin/proxydroid
  private void enableAll() {
    hostText.setEnabled(true);

    if (!isPACCheck.isChecked()) {
      portText.setEnabled(true);
      proxyTypeList.setEnabled(true);
    }

    bypassAddrs.setEnabled(true);

    if (isAuthCheck.isChecked()) {
      userText.setEnabled(true);
      passwordText.setEnabled(true);
      isNTLMCheck.setEnabled(true);
      if (isNTLMCheck.isChecked()) domainText.setEnabled(true);
    }
    if (!isAutoSetProxyCheck.isChecked()) {
      proxyedApps.setEnabled(true);
      isBypassAppsCheck.setEnabled(true);
    }
    if (isAutoConnectCheck.isChecked()) ssidList.setEnabled(true);

    isDNSProxyCheck.setEnabled(true);
    profileList.setEnabled(true);
    isAutoSetProxyCheck.setEnabled(true);
    isAuthCheck.setEnabled(true);
    isAutoConnectCheck.setEnabled(true);
    isPACCheck.setEnabled(true);
  }
コード例 #2
0
ファイル: SettingsActivity.java プロジェクト: aitolos/Osmand
 private void updateApplicationDirTextAndSummary() {
   if (applicationDir != null) {
     String storageDir = osmandSettings.getExternalStorageDirectory().getAbsolutePath();
     applicationDir.setText(storageDir);
     applicationDir.setSummary(storageDir);
   }
 }
コード例 #3
0
  private void updateSummaries() {
    int t = PREFS_DEFAULT_LOCATION_TIMEOUT;
    try {
      t =
          Integer.parseInt(
              prefs.getString(PREFS_KEY_LOCATION_TIMEOUT, "" + PREFS_DEFAULT_LOCATION_TIMEOUT));
      if (t < 1) {
        t = PREFS_DEFAULT_LOCATION_TIMEOUT;
        final SharedPreferences.Editor edit = prefs.edit();
        edit.putString(PREFS_KEY_LOCATION_TIMEOUT, "" + t);
        edit.commit();
      }
    } catch (final Exception e) {
      t = PREFS_DEFAULT_LOCATION_TIMEOUT;
      final SharedPreferences.Editor edit = prefs.edit();
      edit.putString(PREFS_KEY_LOCATION_TIMEOUT, "" + t);
      edit.commit();
    }
    final EditTextPreference timeout =
        (EditTextPreference) prefFrag.findPreference(PREFS_KEY_LOCATION_TIMEOUT);
    String summary = getResources().getString(R.string.pref_geolocation_timeout_summary);
    summary += "\nTimeout: '" + t + "'";
    timeout.setSummary(summary);

    final Preference povider = prefFrag.findPreference(PREFS_KEY_OPENCELLID_PROVIDER);
    final Preference gps = prefFrag.findPreference(PREFS_KEY_GPS);
    final boolean en = prefs.getBoolean(PREFS_KEY_LOCATE, PREFS_DEFAULT_LOCATE);
    povider.setEnabled(en);
    timeout.setEnabled(en);
    gps.setEnabled(en);
  }
コード例 #4
0
ファイル: BroadVoice.java プロジェクト: zxcpoiu/CSipSimple
  @Override
  public void fillLayout(final SipProfile account) {
    super.fillLayout(account);

    accountUsername.setTitle(R.string.w_common_phone_number);
    accountUsername.setDialogTitle(R.string.w_common_phone_number);

    accountUsername.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);

    // Allow to add suffix x11
    boolean recycle = true;
    accountSuffix = (EditTextPreference) findPreference(SUFFIX_KEY);
    if (accountSuffix == null) {
      accountSuffix = new EditTextPreference(parent);
      accountSuffix.setKey(SUFFIX_KEY);
      accountSuffix.getEditText().setInputType(InputType.TYPE_CLASS_PHONE);
      accountSuffix.setTitle("Suffix for account id");
      accountSuffix.setSummary("For multipresence usage (leave blank if not want)");
      recycle = false;
    }

    if (!recycle) {
      addPreference(accountSuffix);
    }

    String uName = account.getSipUserName();
    String[] uNames = uName.split("x");

    accountUsername.setText(uNames[0]);
    if (uNames.length > 1) {
      accountSuffix.setText(uNames[1]);
    }
  }
コード例 #5
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    PreferenceScreen ps = getPreferenceManager().createPreferenceScreen(getActivity());
    ps.setTitle(R.string.quick_response_settings_title);

    mResponses = Utils.getQuickResponses(getActivity());

    if (mResponses != null) {
      mEditTextPrefs = new EditTextPreference[mResponses.length];

      Arrays.sort(mResponses);
      int i = 0;
      for (String response : mResponses) {
        EditTextPreference et = new EditTextPreference(getActivity());
        et.setDialogTitle(R.string.quick_response_settings_edit_title);
        et.setTitle(response); // Display Text
        et.setText(response); // Value to edit
        et.setOnPreferenceChangeListener(this);
        mEditTextPrefs[i++] = et;
        ps.addPreference(et);
      }
    } else {
      Log.wtf(TAG, "No responses found");
    }
    setPreferenceScreen(ps);
    /// M:Toast to alarm @{
    mToast = Toast.makeText(getActivity(), "", Toast.LENGTH_SHORT);
    /// @}
  }
コード例 #6
0
  /**
   * Basic implementation of the account building based on simple implementation fields. A
   * specification of this class could extend and add its own post processing here.
   *
   * <p>{@inheritDoc}
   */
  public SipProfile buildAccount(SipProfile account) {
    account.display_name = accountDisplayName.getText().trim();
    account.acc_id =
        "<sip:" + SipUri.encodeUser(accountUsername.getText().trim()) + "@" + getDomain() + ">";

    String regUri = "sip:" + getDomain();
    account.reg_uri = regUri;
    account.proxies = new String[] {regUri};

    account.realm = "*";
    account.username = getText(accountUsername).trim();
    account.data = getText(accountPassword);
    account.scheme = SipProfile.CRED_SCHEME_DIGEST;
    account.datatype = SipProfile.CRED_DATA_PLAIN_PASSWD;

    account.reg_timeout = 1800;

    if (canTcp()) {
      account.transport =
          accountUseTcp.isChecked() ? SipProfile.TRANSPORT_TCP : SipProfile.TRANSPORT_UDP;
    } else {
      account.transport = SipProfile.TRANSPORT_UDP;
    }

    return account;
  }
コード例 #7
0
  protected void refresh() {
    // refresh is called from our onResume, which can happen before the owning
    // Activity tells us about an account (via our public
    // refresh(AndroidFxAccount) method).
    if (fxAccount == null) {
      throw new IllegalArgumentException("fxAccount must not be null");
    }

    updateProfileInformation();
    updateAuthServerPreference();
    updateSyncServerPreference();

    try {
      // There are error states determined by Android, not the login state
      // machine, and we have a chance to present these states here. We handle
      // them specially, since we can't surface these states as part of syncing,
      // because they generally stop syncs from happening regularly. Right now
      // there are no such states.

      // Interrogate the Firefox Account's state.
      State state = fxAccount.getState();
      switch (state.getNeededAction()) {
        case NeedsUpgrade:
          showNeedsUpgrade();
          break;
        case NeedsPassword:
          showNeedsPassword();
          break;
        case NeedsVerification:
          showNeedsVerification();
          break;
        case NeedsFinishMigrating:
          showNeedsFinishMigrating();
          break;
        case None:
          showConnected();
          break;
      }

      // We check for the master setting last, since it is not strictly
      // necessary for the user to address this error state: it's really a
      // warning state. We surface it for the user's convenience, and to prevent
      // confused folks wondering why Sync is not working at all.
      final boolean masterSyncAutomatically = ContentResolver.getMasterSyncAutomatically();
      if (!masterSyncAutomatically) {
        showNeedsMasterSyncAutomaticallyEnabled();
        return;
      }
    } finally {
      // No matter our state, we should update the checkboxes.
      updateSelectedEngines();
    }

    final String clientName = clientsDataDelegate.getClientName();
    deviceNamePreference.setSummary(clientName);
    deviceNamePreference.setText(clientName);

    updateSyncNowPreference();
  }
コード例 #8
0
    @Override
    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      addPreferencesFromResource(R.xml.pref_general);
      setHasOptionsMenu(true);

      ((PreferencesActivity) getActivity()).setBasePreferenceActivity(false);

      ((PreferencesActivity) getActivity())
          .getSupportActionBar()
          .setTitle(R.string.pref_header_general);
      ((PreferencesActivity) getActivity())
          .firebaseAnalytics.logEvent(getString(R.string.analytics_tap_general_prefs), null);

      final EditTextPreference p =
          (EditTextPreference) findPreference(getString(R.string.pref_device_name));
      bindPreferenceSummaryToValue(p);

      if (p.getTitle().toString().equals(getString(R.string.pref_default_device_name))
          || p.getTitle().toString().isEmpty()) {
        ((PreferencesActivity) getActivity())
            .firebaseAnalytics.logEvent(
                getString(R.string.analytics_event_empty_device_name), null);
        p.setText(Build.MANUFACTURER + " " + Build.MODEL);
      }

      p.setOnPreferenceChangeListener(
          new Preference.OnPreferenceChangeListener() {
            @Override
            public boolean onPreferenceChange(Preference preference, Object newValue) {
              p.setSummary(newValue.toString());

              Intent i = new Intent("com.texasgamer.zephyr.SOCKET_SERVICE");
              i.putExtra("type", "update-devices");
              getActivity().sendBroadcast(i);

              Bundle b = new Bundle();
              b.putString(getString(R.string.analytics_param_new_value), newValue.toString());
              ((PreferencesActivity) getActivity())
                  .firebaseAnalytics.logEvent(getString(R.string.analytics_tap_device_name), b);
              return true;
            }
          });

      findPreference(getString(R.string.pref_start_on_boot))
          .setOnPreferenceChangeListener(
              new Preference.OnPreferenceChangeListener() {
                @Override
                public boolean onPreferenceChange(Preference preference, Object newValue) {
                  Bundle b = new Bundle();
                  String newValueStr = newValue.toString().equals("true") ? "enabled" : "disabled";
                  b.putString(getString(R.string.analytics_param_new_value), newValueStr);
                  ((PreferencesActivity) getActivity())
                      .firebaseAnalytics.logEvent(
                          getString(R.string.analytics_tap_start_on_boot), b);
                  return true;
                }
              });
    }
コード例 #9
0
 // Utilities functions
 protected boolean isEmpty(EditTextPreference edt) {
   if (edt.getText() == null) {
     return true;
   }
   if (edt.getText().equals("")) {
     return true;
   }
   return false;
 }
コード例 #10
0
 private void setLatLong(double latitude, double longitude) {
   EditTextPreference latPreference = (EditTextPreference) findPreference(LATITUDE);
   EditTextPreference longPreference = (EditTextPreference) findPreference(LONGITUDE);
   latPreference.setText(Double.toString(latitude));
   longPreference.setText(Double.toString(longitude));
   String message = String.format(getString(R.string.location_place_found), latitude, longitude);
   Log.d(TAG, message);
   Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
 }
コード例 #11
0
  @Override
  public void setText(final String text) {

    if (getEditText().getText().toString().length() > 0) {
      super.setText(mEncrypt.encrypt(text));
    } else {
      super.setText(text);
    }
  }
コード例 #12
0
        @Override
        public boolean onPreferenceChange(Preference preference, Object value) {
          // Do not bind toggles.
          if (preference instanceof CheckBoxPreference
              || (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH
                  && preference instanceof TwoStatePreference)) {
            return true;
          }

          String stringValue = value.toString();

          if (preference instanceof ListPreference) {
            // For list preferences, look up the correct display value in
            // the preference's 'entries' list.
            ListPreference listPreference = (ListPreference) preference;
            int index = listPreference.findIndexOfValue(stringValue);

            // Set the summary to reflect the new value.
            preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null);

          } else if (preference instanceof RingtonePreference) {
            // For ringtone preferences, look up the correct display value
            // using RingtoneManager.
            if (TextUtils.isEmpty(stringValue)) {
              // Empty values correspond to 'silent' (no ringtone).
              preference.setSummary(R.string.ringtone_silent);
            } else {
              Ringtone ringtone =
                  RingtoneManager.getRingtone(preference.getContext(), Uri.parse(stringValue));

              if (ringtone == null) {
                // Clear the summary if there was a lookup error.
                preference.setSummary(null);
              } else {
                // Set the summary to reflect the new ringtone display
                // name.
                String name = ringtone.getTitle(preference.getContext());
                preference.setSummary(name);
              }
            }

          } else if (preference instanceof EditTextPreference) {
            EditTextPreference textPreference = (EditTextPreference) preference;
            int inputType = textPreference.getEditText().getInputType();
            if (inputType == (InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD)) {
              preference.setSummary(stringValue.replaceAll(".", "*"));
            } else {
              preference.setSummary(stringValue);
            }
          } else {
            // For all other preferences, set the summary to the value's
            // simple string representation.
            preference.setSummary(stringValue);
          }
          return true;
        }
 private void setServerPort(int value) {
   String v = String.valueOf(value);
   getPreferenceScreen()
       .getSharedPreferences()
       .edit()
       .putString(LICENSING_SERVER_PORT, v)
       .commit();
   mServerPort.setText(v);
   mServerPort.setSummary(v);
 }
 private void setServerAddress(String value) {
   String v = String.valueOf(value);
   getPreferenceScreen()
       .getSharedPreferences()
       .edit()
       .putString(LICENSING_SERVER_ADDRESS, v)
       .commit();
   mServerAddress.setText(v);
   mServerAddress.setSummary(value);
 }
コード例 #15
0
  private void updatePrefSummary(Preference p, boolean updatevis) {
    if (p instanceof ListPreference) {
      ListPreference listPref = (ListPreference) p;
      p.setSummary(listPref.getEntry());

    } else if (p instanceof EditTextPreference) {
      EditTextPreference editTextPref = (EditTextPreference) p;
      p.setSummary(editTextPref.getText());
    }
  }
コード例 #16
0
ファイル: TaskPreferences.java プロジェクト: innozendz/GMM25
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.task_preferences);

    // Set the time default to a numeric number only
    EditTextPreference timeDefault =
        (EditTextPreference) findPreference(getString(R.string.pref_default_time_from_now_key));
    timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance());
  }
コード例 #17
0
  @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();
  }
コード例 #18
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);

    EditTextPreference videoStartPref = (EditTextPreference) findPreference(VIDEO_START_DELAY);
    videoStartPref.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);

    EditTextPreference emailAddressPref = (EditTextPreference) findPreference(SEND_EMAIL_ADDRESS);
    emailAddressPref.getEditText().setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
  }
コード例 #19
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    LinearLayout root =
        (LinearLayout) findViewById(android.R.id.list).getParent().getParent().getParent();
    View bar = LayoutInflater.from(this).inflate(R.layout.settings_toolbar, root, false);
    root.addView(bar, 0);
    Toolbar toolbar = (Toolbar) findViewById(R.id.settings_toolbar);
    toolbar.setNavigationOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });

    addPreferencesFromResource(R.xml.prefs);

    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    Resources res = getResources();

    ListPreference dateFormatPref = (ListPreference) findPreference("dateFormat");
    String[] dateFormatsValues = res.getStringArray(R.array.dateFormatsValues);
    String[] dateFormatsEntries = new String[dateFormatsValues.length];

    EditTextPreference customDateFormatPref =
        (EditTextPreference) findPreference("dateFormatCustom");
    customDateFormatPref.setDefaultValue(dateFormatsValues[0]);

    SimpleDateFormat sdformat = new SimpleDateFormat();
    for (int i = 0; i < dateFormatsValues.length; i++) {
      String value = dateFormatsValues[i];
      if ("custom".equals(value)) {
        sdformat.applyPattern(sp.getString("dateFormatCustom", dateFormatsValues[0]));
        String renderedCustom;
        try {
          renderedCustom = sdformat.format(SAMPLE_DATE);
        } catch (IllegalArgumentException e) {
          renderedCustom = res.getString(R.string.error_dateFormat);
        }
        dateFormatsEntries[i] =
            String.format(
                "%s:\n%s", res.getString(R.string.setting_dateFormatCustom), renderedCustom);
      } else {
        sdformat.applyPattern(value);
        dateFormatsEntries[i] = sdformat.format(SAMPLE_DATE);
      }
    }

    dateFormatPref.setDefaultValue(dateFormatsValues[0]);
    dateFormatPref.setEntries(dateFormatsEntries);
  }
コード例 #20
0
  private void addDevOptions() {
    SharedPreferences p = MultiROMMgrApplication.getPreferences();
    if (!p.getBoolean(DEV_ENABLE, false)) return;

    m_clickCounter = -1;
    addPreferencesFromResource(R.xml.dev_options);

    EditTextPreference pref = (EditTextPreference) findPreference(DEV_MANIFEST_URL);
    pref.setText(p.getString(DEV_MANIFEST_URL, Manifest.DEFAULT_URL));
    pref = (EditTextPreference) findPreference(DEV_DEVICE_NAME);
    pref.setText(p.getString(DEV_DEVICE_NAME, Build.BOARD));
  }
コード例 #21
0
ファイル: Settings.java プロジェクト: v1kko/Musica
  @SuppressWarnings("deprecation")
  @Override
  protected void onResume() {
    super.onResume();
    // Setup the initial values
    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);

    server.setSummary(sharedPreferences.getString("server", defaultserver));
    port.setSummary(sharedPreferences.getString("port", defaultport));
    password.setSummary(sharedPreferences.getString("password", defaultpassword));

    getPreferenceScreen().getSharedPreferences().registerOnSharedPreferenceChangeListener(this);
  }
コード例 #22
0
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);
    EditTextPreference editTextPreference = (EditTextPreference) findPreference("update_interval");
    editTextPreference.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);

    editTextPreference = (EditTextPreference) findPreference("password");
    editTextPreference
        .getEditText()
        .setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
  }
コード例 #23
0
ファイル: SetAlarm.java プロジェクト: WWlove/yangyangClock
 private void updatePrefs(Alarm alarm) {
   mId = alarm.id;
   mEnabledPref.setChecked(alarm.enabled);
   mLabel.setText(alarm.label);
   mLabel.setSummary(alarm.label);
   mHour = alarm.hour;
   mMinutes = alarm.minutes;
   mRepeatPref.setDaysOfWeek(alarm.daysOfWeek);
   mVibratePref.setChecked(alarm.vibrate);
   // Give the alert uri to the preference.
   mAlarmPref.setAlert(alarm.alert);
   updateTime();
 }
コード例 #24
0
  private void initPreference(String name) {
    Preference preference = findPreference(name);

    if (preference instanceof EditTextPreference) {
      preference.setOnPreferenceChangeListener(this);

      EditTextPreference p = (EditTextPreference) preference;
      preference.setSummary(p.getText());
    } else if (preference instanceof ButtonPreference) {
      preference.setOnPreferenceChangeListener(this);
      preference.setOnPreferenceClickListener(this);
    }
  }
コード例 #25
0
  /** Sets the default values for the the preferences */
  private void initPreferences() {

    // Phone name
    String phoneNum =
        ((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE)).getLine1Number();
    Log.d(TAG, "Phone number of this phone: " + phoneNum);
    if (TextUtils.isEmpty(phoneNum)) phoneNum = Constants.DEFAULT_PHONE_NUMBER;
    EditTextPreference prefPhoneName =
        (EditTextPreference) findPreference(Constants.PREFERENCE_PHONE_NAME);
    if (TextUtils.isEmpty(prefPhoneName.getText())) {
      prefPhoneName.setText(phoneNum);
    }

    // Health worker username for OpenMRS
    EditTextPreference prefEmrUsername =
        (EditTextPreference) findPreference(Constants.PREFERENCE_EMR_USERNAME);
    if (TextUtils.isEmpty(prefEmrUsername.getText())) {
      prefEmrUsername.setText(Constants.DEFAULT_USERNAME);
    }

    // Health worker password for OpenMRS
    EditTextPreference prefEmrPassword =
        (EditTextPreference) findPreference(Constants.PREFERENCE_EMR_PASSWORD);
    prefEmrPassword.getEditText().setTransformationMethod(new PasswordTransformationMethod());
    if (TextUtils.isEmpty(prefEmrPassword.getText())) {
      prefEmrPassword.setText(Constants.DEFAULT_PASSWORD);
    }

    // Whether barcode reading is enabled on the phone
    /*
     * CheckBoxPreference barcodeEnabled = new CheckBoxPreference(this);
     * barcodeEnabled.setKey(Constants.PREFERENCE_BARCODE_ENABLED);
     * barcodeEnabled.setTitle("Enable barcode reading");
     * barcodeEnabled.setSummary
     * ("Enable barcode reading of patient and physician ids");
     * barcodeEnabled.setDefaultValue(false);
     * dialogBasedPrefCat.addPreference(barcodeEnabled);
     */

    // Launches network preferences
    PreferenceScreen prefNetwork = (PreferenceScreen) findPreference("s_network_settings");
    if (prefNetwork != null) {
      prefNetwork.setIntent(new Intent(this, NetworkSettings.class));
    }

    // Launches resource preferences
    PreferenceScreen prefResource = (PreferenceScreen) findPreference("s_resource_settings");
    if (prefResource != null) {
      prefResource.setIntent(new Intent(this, ResourceSettings.class));
    }
  }
コード例 #26
0
ファイル: Preferences.java プロジェクト: eideo/K6nele
 public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
   Preference pref = findPreference(key);
   if (pref instanceof EditTextPreference) {
     EditTextPreference etp = (EditTextPreference) pref;
     pref.setSummary(etp.getText());
   } else if (pref instanceof ListPreference) {
     ListPreference lp = (ListPreference) pref;
     if (lp.getTitle().equals(getString(R.string.titleAutoStopAfterTime))) {
       setSummary(pref, getString(R.string.summaryAutoStopAfterTime), lp.getValue());
     } else if (lp.getTitle().equals(getString(R.string.titleRecordingRate))) {
       setSummary(pref, getString(R.string.summaryRecordingRate), lp.getValue());
     }
   }
 }
コード例 #27
0
ファイル: Plugin.java プロジェクト: 0359xiaodong/OpenCamera
 public void updatePrefSummary(Preference p) {
   if (p instanceof ListPreference) {
     ListPreference listPref = (ListPreference) p;
     p.setSummary(listPref.getEntry());
   }
   if (p instanceof EditTextPreference) {
     EditTextPreference editTextPref = (EditTextPreference) p;
     if (p.getKey().equalsIgnoreCase("editKey")) {
       p.setSummary("*****");
     } else {
       p.setSummary(editTextPref.getText());
     }
   }
 }
  private void setLicensingMode(LicensingMode mode) {
    getPreferenceScreen()
        .getSharedPreferences()
        .edit()
        .putString(LICENSING_MODE, mode.toString())
        .commit();
    mLicensingMode.setValue(mode.toString());
    mLicensingMode.setSummary(mode.getName(this));

    boolean value = mode.isServerConfigurable();
    mServerAddress.setEnabled(value);
    mServerAddress.setSelectable(value);
    mServerPort.setEnabled(value);
    mServerPort.setSelectable(value);
  }
コード例 #29
0
    // Preference.OnPreferenceChangeListener implementation
    public boolean onPreferenceChange(Preference preference, Object newValue) {
      if (DBG) log("onPreferenceChange: key = " + preference.getKey());
      if (VDBG) log("  preference = '" + preference + "'");
      if (VDBG) log("  newValue = '" + newValue + "'");

      EditTextPreference pref = (EditTextPreference) preference;

      // Copy the new text over to the title, just like in onCreate().
      // (Watch out: onPreferenceChange() is called *before* the
      // Preference itself gets updated, so we need to use newValue here
      // rather than pref.getText().)
      pref.setTitle((String) newValue);

      return true; // means it's OK to update the state of the Preference with the new value
    }
コード例 #30
0
  public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    if (key.equals(getString(R.string.prefSyncServerUrl_Key))) {

      mSyncServerUrlPref.setSummary(
          sharedPreferences.getString(getString(R.string.prefSyncServerUrl_Key), ""));
      mSyncServerUrlPref.setSummary(mSyncServerUrlPref.getEntry());

      ContentProviderClient client =
          getContentResolver().acquireContentProviderClient(DouiContentProvider.AUTHORITY);
      if (client != null) {
        ((DouiContentProvider) client.getLocalContentProvider()).resetDatabase();
        client.release();
        SyncAdapter.ResetUpdateDate();
        SyncAdapter.requestSync(getApplicationContext());
      }
    } else if (key.equals(getString(R.string.prefSyncRepeatTime_Key))) {
      mSyncRepeatTimePref.setSummary(
          sharedPreferences.getString(getString(R.string.prefSyncRepeatTime_Key), ""));
    } else if (key.equals(getString(R.string.prefIsSyncable_Key))) {
      loadDeviceAccounts();
      ContentResolver.setSyncAutomatically(
          new Account(mSyncAccountPref.getValue(), "com.google"),
          DouiContentProvider.AUTHORITY,
          sharedPreferences.getBoolean(key, false));
    } else if (key.equals(getString(R.string.prefSyncAccount_Key))) {
      mSyncAccountPref.setSummary(
          sharedPreferences.getString(getString(R.string.prefSyncAccount_Key), ""));
    }
  }