Search in sources :

Example 6 with SwitchView

use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.

the class LMKFragment method swapWait.

private void swapWait(List<RecyclerViewItem> items) {
    if (LMK.hasSwapWait()) {
        SwitchView swapWait = new SwitchView();
        swapWait.setTitle(getString(R.string.kill_lmk));
        swapWait.setSummary(getString(R.string.kill_lmk_summary));
        swapWait.setChecked(LMK.isSwapWaitEnabled());
        swapWait.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                LMK.enableSwapWait(isChecked, getActivity());
            }
        });
        items.add(swapWait);
    }
    if (LMK.hasSwapWaitPercent()) {
        Integer[] percentages = { 0, 50, 66, 75, 80, 90 };
        final Integer[] values = { 1, 2, 3, 4, 5, 10 };
        List<String> list = new ArrayList<>();
        for (int i : percentages) {
            list.add(i + "%");
        }
        SeekBarView swapWaitPercent = new SeekBarView();
        swapWaitPercent.setTitle(getString(R.string.kill_lmk_threshold));
        swapWaitPercent.setSummary(getString(R.string.kill_lmk_threshold_summary));
        swapWaitPercent.setItems(list);
        swapWaitPercent.setProgress(Arrays.asList(values).indexOf(LMK.getSwapWaitPercent()));
        swapWaitPercent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                LMK.setSwapWaitPercent(values[position], getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        items.add(swapWaitPercent);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) ArrayList(java.util.ArrayList) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

Example 7 with SwitchView

use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.

the class MiscFragment method pwmInit.

private void pwmInit(List<RecyclerViewItem> items) {
    CardView pwmCard = new CardView(getActivity());
    pwmCard.setTitle(getString(R.string.pwm));
    SwitchView enable = new SwitchView();
    enable.setTitle(getString(R.string.pwm));
    enable.setSummary(getString(R.string.pwm_summary));
    enable.setChecked(Pwm.isPwmEnabled());
    enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Pwm.enablePwm(isChecked, getActivity());
        }
    });
    pwmCard.addItem(enable);
    items.add(pwmCard);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView)

Example 8 with SwitchView

use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.

the class MiscFragment method powersuspendInit.

private void powersuspendInit(List<RecyclerViewItem> items) {
    String v = PowerSuspend.getVersion().replace("version: ", " v");
    CardView ps = new CardView(getActivity());
    ps.setTitle(getString(R.string.power_suspend) + v);
    if (PowerSuspend.hasMode()) {
        SelectView mode = new SelectView();
        mode.setTitle(getString(R.string.power_suspend_mode));
        mode.setSummary(getString(R.string.power_suspend_mode_summary));
        if (v.contains("1.5") || v.contains("1.8")) {
            mode.setItems(Arrays.asList(getResources().getStringArray(R.array.powersuspend_items)));
        } else {
            mode.setItems(Arrays.asList(getResources().getStringArray(R.array.powersuspend_items_lite)));
        }
        mode.setItem(PowerSuspend.getMode());
        mode.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                PowerSuspend.setMode(position, getActivity());
            }
        });
        ps.addItem(mode);
    }
    if (PowerSuspend.hasState()) {
        final SwitchView state = new SwitchView();
        state.setTitle(getString(R.string.power_suspend_state));
        state.setSummary(getString(R.string.power_suspend_state_summary));
        state.setChecked(PowerSuspend.isStateEnabled());
        state.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, final boolean isChecked) {
                PowerSuspend.enableState(isChecked, getActivity());
                getHandler().postDelayed(new Runnable() {

                    @Override
                    public void run() {
                        state.setChecked(PowerSuspend.isStateEnabled());
                        if (isChecked != PowerSuspend.isStateEnabled())
                            Utils.toast(getString(R.string.power_suspend_state_toast), getActivity());
                    }
                }, 500);
            }
        });
        ps.addItem(state);
    }
    if (ps.size() > 0) {
        items.add(ps);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView) GenericSelectView(com.moro.mtweaks.views.recyclerview.GenericSelectView)

Example 9 with SwitchView

use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.

the class MiscFragment method gentlefairsleepersInit.

private void gentlefairsleepersInit(List<RecyclerViewItem> items) {
    SwitchView gentleFairSleepers = new SwitchView();
    gentleFairSleepers.setTitle(getString(R.string.gentlefairsleepers));
    gentleFairSleepers.setSummary(getString(R.string.gentlefairsleepers_summary));
    gentleFairSleepers.setChecked(Misc.isGentleFairSleepersEnabled());
    gentleFairSleepers.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Misc.enableGentleFairSleepers(isChecked, getActivity());
        }
    });
    items.add(gentleFairSleepers);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView)

Example 10 with SwitchView

use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.

the class ScreenFragment method negativeToggleInit.

private void negativeToggleInit(List<RecyclerViewItem> items) {
    SwitchView negative = new SwitchView();
    negative.setTitle(getString(R.string.negative_toggle));
    negative.setSummary(getString(R.string.negative_toggle_summary));
    negative.setChecked(Misc.isNegativeToggleEnabled());
    negative.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Misc.enableNegativeToggle(isChecked, getActivity());
        }
    });
    items.add(negative);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView)

Aggregations

SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)64 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)31 CardView (com.moro.mtweaks.views.recyclerview.CardView)23 ArrayList (java.util.ArrayList)19 TitleView (com.moro.mtweaks.views.recyclerview.TitleView)16 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)15 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)14 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)4 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)3 GenericSelectView (com.moro.mtweaks.views.recyclerview.GenericSelectView)2 Intent (android.content.Intent)1 Controls (com.moro.mtweaks.database.tools.customcontrols.Controls)1 BoefflaWakelock (com.moro.mtweaks.utils.kernel.boefflawakelock.BoefflaWakelock)1 Wakelocks (com.moro.mtweaks.utils.kernel.misc.Wakelocks)1 CustomControlException (com.moro.mtweaks.utils.tools.customcontrols.CustomControlException)1 XYGraphView (com.moro.mtweaks.views.recyclerview.XYGraphView)1 ErrorView (com.moro.mtweaks.views.recyclerview.customcontrols.ErrorView)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1