Example #1
0
 @Override
 public void onStop(SeekBarCardView.DSeekBarCard dSeekBarCard, int position) {
   if (dSeekBarCard == mWakeTimeoutCard) Wake.setWakeTimeout(position, getActivity());
   else if (dSeekBarCard == mWakeVibrationCard) Wake.setWakeVibration(position, getActivity());
   else if (dSeekBarCard == mDt2sWidthCard) Wake.setDt2sWidth(position, getActivity());
   else if (dSeekBarCard == mDt2sHeightCard) Wake.setDt2sHeight(position, getActivity());
 }
Example #2
0
  private void sleepMiscInit() {
    mSleepMiscCard = new PopupCardView.DPopupCard(Wake.getSleepMiscMenu(getActivity()));
    mSleepMiscCard.setDescription(getString(R.string.sleep));
    mSleepMiscCard.setItem(Wake.getSleepMisc());
    mSleepMiscCard.setOnDPopupCardListener(this);

    addView(mSleepMiscCard);
  }
Example #3
0
  private void s2wInit() {
    mS2wCard = new PopupCardView.DPopupCard(Wake.getS2wMenu(getActivity()));
    mS2wCard.setTitle(getString(R.string.s2w));
    mS2wCard.setDescription(getString(R.string.s2w_summary));
    mS2wCard.setItem(Wake.getS2wValue());
    mS2wCard.setOnDPopupCardListener(this);

    addView(mS2wCard);
  }
Example #4
0
  private void dt2sInit() {
    mDt2sCard = new PopupCardView.DPopupCard(Wake.getDt2sMenu(getActivity()));
    mDt2sCard.setTitle(getString(R.string.dt2s));
    mDt2sCard.setDescription(getString(R.string.dt2s_summary));
    mDt2sCard.setItem(Wake.getDt2sValue());
    mDt2sCard.setOnDPopupCardListener(this);

    addView(mDt2sCard);
  }
Example #5
0
  private void gestureInit() {
    List<String> gestures = Wake.getGestures(getActivity());
    mGestureCards = new SwitchCardView.DSwitchCard[gestures.size()];
    for (int i = 0; i < mGestureCards.length; i++) {
      mGestureCards[i] = new SwitchCardView.DSwitchCard();
      mGestureCards[i].setDescription(gestures.get(i));
      mGestureCards[i].setChecked(Wake.isGestureActive(i));
      mGestureCards[i].setOnDSwitchCardListener(this);

      addView(mGestureCards[i]);
    }
  }
Example #6
0
  private void wakeTimeoutInit() {
    List<String> list = new ArrayList<>();
    list.add(getString(R.string.disabled));
    for (int i = 1; i <= Wake.getWakeTimeoutMax(); i++) list.add(i + getString(R.string.min));

    mWakeTimeoutCard = new SeekBarCardView.DSeekBarCard(list);
    mWakeTimeoutCard.setTitle(getString(R.string.wake_timeout));
    mWakeTimeoutCard.setDescription(getString(R.string.wake_timeout_summary));
    mWakeTimeoutCard.setProgress(Wake.getWakeTimeout());
    mWakeTimeoutCard.setOnDSeekBarCardListener(this);

    addView(mWakeTimeoutCard);
  }
Example #7
0
 @Override
 public void onChecked(SwitchCardView.DSwitchCard dSwitchCard, boolean checked) {
   if (dSwitchCard == mLenientCard) Wake.activateLenient(checked, getActivity());
   else if (dSwitchCard == mPowerKeySuspendCard)
     Wake.activatePowerKeySuspend(checked, getActivity());
   else if (dSwitchCard == mCameraGestureCard) Wake.activateCameraGesture(checked, getActivity());
   else {
     for (int i = 0; i < mGestureCards.length; i++)
       if (dSwitchCard == mGestureCards[i]) {
         Wake.activateGesture(checked, i, getActivity());
         return;
       }
   }
 }
Example #8
0
  private void lenientInit() {
    mLenientCard = new SwitchCardView.DSwitchCard();
    mLenientCard.setTitle(getString(R.string.lenient));
    mLenientCard.setDescription(getString(R.string.lenient_summary));
    mLenientCard.setChecked(Wake.isLenientActive());
    mLenientCard.setOnDSwitchCardListener(this);

    addView(mLenientCard);
  }
Example #9
0
  private void cameraGestureInit() {
    mCameraGestureCard = new SwitchCardView.DSwitchCard();
    mCameraGestureCard.setTitle(getString(R.string.camera_gesture));
    mCameraGestureCard.setDescription(getString(R.string.camera_gesture_summary));
    mCameraGestureCard.setChecked(Wake.isCameraGestureActive());
    mCameraGestureCard.setOnDSwitchCardListener(this);

    addView(mCameraGestureCard);
  }
Example #10
0
  private void powerKeySuspendInit() {
    mPowerKeySuspendCard = new SwitchCardView.DSwitchCard();
    mPowerKeySuspendCard.setTitle(getString(R.string.power_key_suspend));
    mPowerKeySuspendCard.setDescription(getString(R.string.power_key_suspend_summary));
    mPowerKeySuspendCard.setChecked(Wake.isPowerKeySuspendActive());
    mPowerKeySuspendCard.setOnDSwitchCardListener(this);

    addView(mPowerKeySuspendCard);
  }
Example #11
0
  private void dt2sHeightInit() {
    List<String> list = new ArrayList<>();
    for (int i = 50; i < 2561; i++) list.add(i + getString(R.string.px));

    mDt2sHeightCard = new SeekBarCardView.DSeekBarCard(list);
    mDt2sHeightCard.setTitle(getString(R.string.dt2s_height));
    mDt2sHeightCard.setDescription(getString(R.string.dt2s_height_summary));
    mDt2sHeightCard.setProgress(Wake.getDt2sHeight());
    mDt2sHeightCard.setOnDSeekBarCardListener(this);

    addView(mDt2sHeightCard);
  }
Example #12
0
  private void wakeVibrationInit() {
    List<String> list = new ArrayList<>();
    list.add(getString(R.string.disabled));
    for (int i = 1; i < 91; i++) list.add(i + "%");

    mWakeVibrationCard = new SeekBarCardView.DSeekBarCard(list);
    mWakeVibrationCard.setTitle(getString(R.string.wake_vibration));
    mWakeVibrationCard.setDescription(getString(R.string.wake_vibration_summary));
    mWakeVibrationCard.setProgress(Wake.getWakeVibration());
    mWakeVibrationCard.setOnDSeekBarCardListener(this);

    addView(mWakeVibrationCard);
  }
Example #13
0
 @Override
 public void onItemSelected(PopupCardView.DPopupCard dPopupCard, int position) {
   if (dPopupCard == mDt2wCard) Wake.setDt2w(position, getActivity());
   else if (dPopupCard == mS2wCard) Wake.setS2w(position, getActivity());
   else if (dPopupCard == mT2wCard) Wake.setT2w(position, getActivity());
   else if (dPopupCard == mWakeMiscCard) Wake.setWakeMisc(position, getActivity());
   else if (dPopupCard == mSleepMiscCard) Wake.setSleepMisc(position, getActivity());
   else if (dPopupCard == mDt2sCard) Wake.setDt2s(position, getActivity());
 }
Example #14
0
  @Override
  public void init(Bundle savedInstanceState) {
    super.init(savedInstanceState);

    if (Wake.hasDt2w()) dt2wInit();
    if (Wake.hasS2w()) s2wInit();
    if (Wake.hasLenient()) lenientInit();
    if (Wake.hasT2w()) t2wInit();
    if (Wake.hasWakeMisc()) wakeMiscInit();
    if (Wake.hasSleepMisc()) sleepMiscInit();
    if (Wake.hasDt2s()) dt2sInit();
    if (Wake.hasDt2sWidth()) dt2sWidthInit();
    if (Wake.hasDt2sHeight()) dt2sHeightInit();
    if (Wake.hasGesture()) gestureInit();
    if (Wake.hasWakeTimeout()) wakeTimeoutInit();
    if (Wake.hasPowerKeySuspend()) powerKeySuspendInit();
    if (Wake.hasWakeVibration()) wakeVibrationInit();
    if (Wake.hasCameraGesture()) cameraGestureInit();
  }