コード例 #1
0
 @Override
 public void onStopTrackingTouch(SeekBar seekBar) {
   // TODO Auto-generated method stub
   switch (seekBar.getId()) {
     case R.id.seekBar_minLevel:
       spe.putInt(SEEKBAR_MIN_LEVEL, seekBar.getProgress());
       while (!spe.commit()) {}
       mainFragment.rebuildSeekbar();
       break;
     case R.id.seekBar_maxLevel:
       spe.putInt(SEEKBAR_MAX_LEVEL, seekBar.getProgress());
       while (!spe.commit()) {}
       mainFragment.rebuildSeekbar();
       break;
     case R.id.seekBar_safetyLevel:
       spe.putInt(SEEKBAR_SAFETY_LEVEL, seekBar.getProgress());
       while (!spe.commit()) {}
       mainFragment.rebuildSeekbar();
       break;
     case R.id.seekBar_VolumeButtonHack:
       spe.putInt(SEEKBAR_VOLUME_BUTTON_HACK, seekBar.getProgress());
       while (!spe.commit()) {}
       Intent service = new Intent(this, MainService.class);
       service.putExtra(MainService.HEADSET_STATUS, MainActivity.TOGGLE_VOLUME_HACK);
       startService(service);
       break;
   }
 }
コード例 #2
0
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // Retrieve preferences
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    isBalanced = sp.getBoolean(MainActivity.CHECKBOX_BALANCE, false);

    // Get and initialize views
    View v = inflater.inflate(R.layout.control, container, false);
    textViewLevel = (TextView) v.findViewById(R.id.textView_level);
    textViewLevelRight = (TextView) v.findViewById(R.id.textView_levelRight);
    seekBarMain = (SeekBar) v.findViewById(R.id.seekBar_main);
    seekBarMainRight = (SeekBar) v.findViewById(R.id.seekBar_mainRight);
    CheckBox checkBoxBalance = (CheckBox) v.findViewById(R.id.checkBox_Balance);
    checkBoxBalance.setChecked(isBalanced);

    // Set view listeners
    seekBarMain.setOnSeekBarChangeListener(this);
    seekBarMainRight.setOnSeekBarChangeListener(this);
    checkBoxBalance.setOnCheckedChangeListener(this);

    rebuildSeekbar();

    // Set up idle kill timer
    idleKillTimer = new Handler(); // Make your Main UIWorker Thread to execute this statement
    idleTimerRunnable = new IdleTimer();
    if (getActivity().getClass() == DialogActivity.class) {
      idleKillTimer.postDelayed(idleTimerRunnable, FINISH_DELAY);
    }

    return v;
  }
コード例 #3
0
  @Override
  public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());

    if (isChecked) {
      sp.edit().putBoolean(MainActivity.CHECKBOX_BALANCE, true).commit();
      isBalanced = true;

    } else {
      sp.edit().putBoolean(MainActivity.CHECKBOX_BALANCE, false).commit();
      isBalanced = false;
    }
    rebuildSeekbar();

    if (getActivity().getClass() == DialogActivity.class) {
      resetTimer();
    }
  }
コード例 #4
0
 @Override
 public void onResume() {
   super.onResume();
   mainFragment.rebuildSeekbar();
 }