Esempio n. 1
0
  public boolean onPreferenceChange(Preference var1, Object var2) {
    ListPreference var3 = this.mModeValueSetting;
    boolean var15;
    if (var1.equals(var3)) {
      int var4 = Log.d("PowerSavingModeSettings", "set battery level is changed");
      int var5 = Integer.parseInt((String) var2);
      System.putInt(this.mContentResolver, "psm_battery_level", var5);
      ListPreference var7 = this.mModeValueSetting;
      Context var8 = this.getApplicationContext();
      Object[] var9 = new Object[1];
      StringBuilder var10 = new StringBuilder();
      String var11 = var2.toString();
      String var12 = var10.append(var11).append("%").toString();
      var9[0] = var12;
      String var13 = var8.getString(2131232375, var9);
      var7.setSummary(var13);
      Intent var14 = new Intent("android.settings.POWERSAVING_CHANGED");
      this.sendBroadcast(var14);
      var15 = true;
    } else {
      ListPreference var16 = this.mBrightnessSetting;
      if (var1.equals(var16)) {
        int var17 = Log.d("PowerSavingModeSettings", "Brightness level is changed");
        int var18 = Integer.parseInt((String) var2);
        System.putInt(this.mContentResolver, "psm_brightness_level", var18);
        ListPreference var20 = this.mBrightnessSetting;
        Context var21 = this.getApplicationContext();
        Object[] var22 = new Object[1];
        StringBuilder var23 = new StringBuilder();
        String var24 = var2.toString();
        String var25 = var23.append(var24).append("%").toString();
        var22[0] = var25;
        String var26 = var21.getString(2131232387, var22);
        var20.setSummary(var26);
        var15 = true;
      } else {
        ListPreference var27 = this.mScreentimeout;
        if (var1.equals(var27)) {
          int var28 = Log.d("PowerSavingModeSettings", "Screentimeout is changed");
          int var29 = Integer.parseInt((String) var2);
          System.putInt(this.mContentResolver, "psm_screen_timeout", var29);
          var15 = true;
        } else {
          var15 = false;
        }
      }
    }

    return var15;
  }
 @Override
 public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
   // Input Method stuff
   if (Utils.isMonkeyRunning()) {
     return false;
   }
   if (preference == mStatusBarImeSwitcher) {
     Settings.System.putInt(
         getActivity().getContentResolver(),
         Settings.System.STATUS_BAR_IME_SWITCHER,
         mStatusBarImeSwitcher.isChecked() ? 1 : 0);
     return true;
   } else if (preference instanceof PreferenceScreen) {
     if (preference.getFragment() != null) {
       // Fragment will be handled correctly by the super class.
     } else if (KEY_CURRENT_INPUT_METHOD.equals(preference.getKey())) {
       final InputMethodManager imm =
           (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
       imm.showInputMethodPicker();
     }
   } else if (preference instanceof CheckBoxPreference) {
     final CheckBoxPreference chkPref = (CheckBoxPreference) preference;
     if (!mHardKeyboardPreferenceList.isEmpty()) {
       for (int i = 0; i < sHardKeyboardKeys.length; ++i) {
         if (chkPref == mHardKeyboardCategory.findPreference(sHardKeyboardKeys[i])) {
           System.putInt(
               getContentResolver(), sSystemSettingNames[i], chkPref.isChecked() ? 1 : 0);
           return true;
         }
       }
     }
     if (chkPref == mGameControllerCategory.findPreference("vibrate_input_devices")) {
       System.putInt(
           getContentResolver(),
           Settings.System.VIBRATE_INPUT_DEVICES,
           chkPref.isChecked() ? 1 : 0);
       return true;
     }
   }
   return super.onPreferenceTreeClick(preferenceScreen, preference);
 }
Esempio n. 3
0
  public boolean onPreferenceChange(Preference preference, Object value) {
    String key = preference.getKey();
    Xlog.d(TAG, "onPreferenceChange key=" + key);
    if (TETHERED_IPV6.equals(key)) {
      /// M: save value to provider @{
      ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
      int ipv6Value = Integer.parseInt(String.valueOf(value));
      if (cm != null) {
        cm.setTetheringIpv6Enable(ipv6Value == 1);
      }
      mTetherIpv6.setValueIndex(ipv6Value);
      mTetherIpv6.setSummary(
          getResources().getStringArray(R.array.tethered_ipv6_entries)[ipv6Value]);
      /// @}
    } else if (USB_TETHERING_TYPE.equals(key)) {
      int index = Integer.parseInt(((String) value));
      System.putInt(getContentResolver(), System.USB_TETHERING_TYPE, index);
      mUsbTetherType.setSummary(
          getResources().getStringArray(R.array.usb_tether_type_entries)[index]);

      Xlog.d(TAG, "onPreferenceChange USB_TETHERING_TYPE value = " + index);
    }
    return true;
  }
Esempio n. 4
0
  public boolean onPreferenceTreeClick(PreferenceScreen var1, Preference var2) {
    String var3 = "PowerSavingModeSettings";
    if (PowerSavingModeLog.LOGV) {
      PowerSavingModeLog.v("onPreferenceTreeClick");
    }

    CheckBoxPreference var4 = this.mEnableMode;
    String var11;
    boolean var14;
    byte var31;
    if (var2.equals(var4)) {
      int var5 = Log.d("PowerSavingModeSettings", "mEnableMode is selected");
      StringBuilder var6 = (new StringBuilder()).append("mEnableMode : ");
      boolean var7 = this.mEnableMode.isChecked();
      String var8 = var6.append(var7).toString();
      int var9 = Log.d("PowerSavingModeSettings", var8);
      this.updateUIFromPreferences();
      ContentResolver var10 = this.mContentResolver;
      var11 = "new_power_saving_mode";
      if (this.mEnableMode.isChecked()) {
        var31 = 1;
      } else {
        var31 = 0;
      }

      System.putInt(var10, var11, var31);
      Intent var13 = new Intent("android.settings.POWERSAVING_CHANGED");
      this.sendBroadcast(var13);
      var14 = true;
    } else {
      CheckBoxPreference var15 = this.mDisableWifi;
      if (var2.equals(var15)) {
        ContentResolver var16 = this.mContentResolver;
        var11 = "psm_wifi";
        if (this.mDisableWifi.isChecked()) {
          var31 = 1;
        } else {
          var31 = 0;
        }

        System.putInt(var16, var11, var31);
        var14 = true;
      } else {
        CheckBoxPreference var18 = this.mDisableBluetooth;
        if (var2.equals(var18)) {
          ContentResolver var19 = this.mContentResolver;
          var11 = "psm_bluetooth";
          if (this.mDisableBluetooth.isChecked()) {
            var31 = 1;
          } else {
            var31 = 0;
          }

          System.putInt(var19, var11, var31);
          var14 = true;
        } else {
          CheckBoxPreference var21 = this.mDisableGps;
          if (var2.equals(var21)) {
            ContentResolver var22 = this.mContentResolver;
            var11 = "psm_gps";
            if (this.mDisableGps.isChecked()) {
              var31 = 1;
            } else {
              var31 = 0;
            }

            System.putInt(var22, var11, var31);
            var14 = true;
          } else {
            CheckBoxPreference var24 = this.mDisableSync;
            if (var2.equals(var24)) {
              ContentResolver var25 = this.mContentResolver;
              var11 = "psm_sync";
              if (this.mDisableSync.isChecked()) {
                var31 = 1;
              } else {
                var31 = 0;
              }

              System.putInt(var25, var11, var31);
              var14 = true;
            } else {
              CheckBoxPreference var27 = this.mAdjustBrightness;
              if (var2.equals(var27)) {
                ContentResolver var28 = this.mContentResolver;
                var11 = "psm_brightness";
                if (this.mAdjustBrightness.isChecked()) {
                  var31 = 1;
                } else {
                  var31 = 0;
                }

                System.putInt(var28, var11, var31);
                boolean var30 = this.mEnableMode.isChecked();
                this.toggleBrightnessSetting(var30);
                var14 = true;
              } else {
                var14 = false;
              }
            }
          }
        }
      }
    }

    return var14;
  }