コード例 #1
0
 private boolean setLcdDensity(int newDensity) {
   Helpers.getMount("rw");
   if (!(new CMDProcessor()
       .su
       .runWaitFor(
           "busybox sed -i 's|ro.sf.lcd_density=.*|"
               + "ro.sf.lcd_density"
               + "="
               + newDensity
               + "|' "
               + "/system/build.prop")
       .success())) {
     showRootDeniedInfoDialog();
     return false;
   }
   Helpers.getMount("ro");
   return true;
 }
コード例 #2
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();
  }
コード例 #3
0
  @Override
  public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
    if (preference == mEnableNavigationBar) {

      Settings.System.putInt(
          mContentRes,
          Settings.System.NAVIGATION_BAR_SHOW,
          ((CheckBoxPreference) preference).isChecked() ? 1 : 0);
      Helpers.restartSystemUI();
      return true;
    } else if (preference == mColorizeAllIcons) {
      Settings.System.putBoolean(
          mContentRes,
          Settings.System.NAVIGATION_BAR_ALLCOLOR,
          ((CheckBoxPreference) preference).isChecked() ? true : false);
      return true;
    } else if (preference == mNavBarHideEnable) {
      Settings.System.putBoolean(
          mContentRes,
          Settings.System.NAV_HIDE_ENABLE,
          ((CheckBoxPreference) preference).isChecked());
      mDragHandleOpacity.setInitValue(
          Settings.System.getInt(
              getActivity().getContentResolver(), Settings.System.DRAG_HANDLE_OPACITY, 50));
      mDragHandleWidth.setInitValue(
          Settings.System.getInt(
              getActivity().getContentResolver(), Settings.System.DRAG_HANDLE_WEIGHT, 5));
      mNavBarHideTimeout.setValue(
          Settings.System.getInt(
                  getActivity().getContentResolver(), Settings.System.NAV_HIDE_TIMEOUT, 3000)
              + "");
      refreshSettings();
      return true;
    } else if (preference == mConfigureWidgets) {
      FragmentTransaction ft = getFragmentManager().beginTransaction();
      WidgetConfigurationFragment fragment = new WidgetConfigurationFragment();
      ft.addToBackStack("config_widgets");
      ft.replace(this.getId(), fragment);
      ft.commit();
      return true;
    } else if (preference == mMenuArrowKeysCheckBox) {
      Settings.System.putBoolean(
          mContentRes,
          Settings.System.NAVIGATION_BAR_MENU_ARROW_KEYS,
          ((CheckBoxPreference) preference).isChecked());
      return true;
    }
    return super.onPreferenceTreeClick(preferenceScreen, preference);
  }
コード例 #4
0
 public void updateScreen() {
   // update all the summaries
   String wifi = Helpers.findBuildPropValueOf(WIFI_SCAN_PROP);
   if (!wifi.equals(DISABLE)) {
     mWifiScanPref.setValue(wifi);
     mWifiScanPref.setSummary(String.format(getString(R.string.pref_wifi_scan_alt_summary), wifi));
   } else {
     mWifiScanPref.setValue(WIFI_SCAN_DEFAULT);
   }
   String maxE = Helpers.findBuildPropValueOf(MAX_EVENTS_PROP);
   if (!maxE.equals(DISABLE)) {
     mMaxEventsPref.setValue(maxE);
     mMaxEventsPref.setSummary(
         String.format(getString(R.string.pref_max_events_alt_summary), maxE));
   } else {
     mMaxEventsPref.setValue(MAX_EVENTS_DEFAULT);
   }
   String ring = Helpers.findBuildPropValueOf(RING_DELAY_PROP);
   if (!ring.equals(DISABLE)) {
     mRingDelayPref.setValue(ring);
     mRingDelayPref.setSummary(
         String.format(getString(R.string.pref_ring_delay_alt_summary), ring));
   } else {
     mRingDelayPref.setValue(RING_DELAY_DEFAULT);
   }
   String vm = Helpers.findBuildPropValueOf(VM_HEAPSIZE_PROP);
   if (!vm.equals(DISABLE)) {
     mVmHeapsizePref.setValue(vm);
     mVmHeapsizePref.setSummary(
         String.format(getString(R.string.pref_vm_heapsize_alt_summary), vm));
   } else {
     mVmHeapsizePref.setValue(VM_HEAPSIZE_DEFAULT);
   }
   String fast = Helpers.findBuildPropValueOf(FAST_UP_PROP);
   if (!fast.equals(DISABLE)) {
     mFastUpPref.setValue(fast);
     mFastUpPref.setSummary(String.format(getString(R.string.pref_fast_up_alt_summary), fast));
   } else {
     mFastUpPref.setValue(FAST_UP_DEFAULT);
   }
   String prox = Helpers.findBuildPropValueOf(PROX_DELAY_PROP);
   if (!prox.equals(DISABLE)) {
     mProxDelayPref.setValue(prox);
     mProxDelayPref.setSummary(
         String.format(getString(R.string.pref_prox_delay_alt_summary), prox));
   } else {
     mProxDelayPref.setValue(PROX_DELAY_DEFAULT);
   }
   String sleep = Helpers.findBuildPropValueOf(SLEEP_PROP);
   if (!sleep.equals(DISABLE)) {
     mSleepPref.setValue(sleep);
     mSleepPref.setSummary(String.format(getString(R.string.pref_sleep_alt_summary), sleep));
   } else {
     mSleepPref.setValue(SLEEP_DEFAULT);
   }
   String tcp = Helpers.findBuildPropValueOf(TCP_STACK_PROP_0);
   if (tcp.equals(TCP_STACK_BUFFER)) {
     mTcpStackPref.setChecked(true);
   } else {
     mTcpStackPref.setChecked(false);
   }
   String jit = Helpers.findBuildPropValueOf(JIT_PROP);
   if (jit.equals("int:jit")) {
     mJitPref.setChecked(true);
   } else {
     mJitPref.setChecked(false);
   }
   String mod = Helpers.findBuildPropValueOf(MOD_VERSION_PROP);
   mModVersionPref.setSummary(
       String.format(getString(R.string.pref_mod_version_alt_summary), mod));
   String g0 = Helpers.findBuildPropValueOf(THREE_G_PROP_0);
   String g3 = Helpers.findBuildPropValueOf(THREE_G_PROP_3);
   String g6 = Helpers.findBuildPropValueOf(THREE_G_PROP_6);
   if (g0.equals("1") && g3.equals("1") && g6.equals("1")) {
     m3gSpeedPref.setChecked(true);
   } else {
     m3gSpeedPref.setChecked(false);
   }
   String gpu = Helpers.findBuildPropValueOf(GPU_PROP);
   if (!gpu.equals(DISABLE)) {
     mGpuPref.setChecked(true);
   } else {
     mGpuPref.setChecked(false);
   }
 }