Search in sources :

Example 31 with SwitchView

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

the class MiscFragment method wakelockInit.

private void wakelockInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> wakelocks = new ArrayList<>();
    for (final Wakelocks.Wakelock wakelock : Wakelocks.getWakelocks()) {
        if (!wakelock.exists())
            continue;
        String description = wakelock.getDescription(getActivity());
        SwitchView switchView = new SwitchView();
        if (description == null) {
            switchView.setSummary(wakelock.getTitle(getActivity()));
        } else {
            switchView.setTitle(wakelock.getTitle(getActivity()));
            switchView.setSummary(description);
        }
        switchView.setChecked(wakelock.isEnabled());
        switchView.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                wakelock.enable(isChecked, getActivity());
            }
        });
        wakelocks.add(switchView);
    }
    if (Wakelocks.hasWlanrxDivider()) {
        List<String> list = new ArrayList<>();
        for (int i = 1; i < 17; i++) {
            list.add((100 / i) + "%");
        }
        list.add("0%");
        SeekBarView wlanrxDivider = new SeekBarView();
        wlanrxDivider.setTitle(getString(R.string.wlan_rx_wakelock_divider));
        wlanrxDivider.setItems(list);
        wlanrxDivider.setProgress(Wakelocks.getWlanrxDivider());
        wlanrxDivider.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Wakelocks.setWlanrxDivider(position, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        wakelocks.add(wlanrxDivider);
    }
    if (Wakelocks.hasWlanctrlDivider()) {
        List<String> list = new ArrayList<>();
        for (int i = 1; i < 17; i++) {
            list.add((100 / i) + "%");
        }
        list.add("0%");
        SeekBarView wlanctrlDivider = new SeekBarView();
        wlanctrlDivider.setTitle(getString(R.string.wlan_ctrl_wakelock_divider));
        wlanctrlDivider.setItems(list);
        wlanctrlDivider.setProgress(Wakelocks.getWlanctrlDivider());
        wlanctrlDivider.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Wakelocks.setWlanctrlDivider(position, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        wakelocks.add(wlanctrlDivider);
    }
    if (Wakelocks.hasMsmHsicDivider()) {
        List<String> list = new ArrayList<>();
        for (int i = 1; i < 17; i++) {
            list.add((100 / i) + "%");
        }
        list.add("0%");
        SeekBarView msmHsicDivider = new SeekBarView();
        msmHsicDivider.setTitle(getString(R.string.msm_hsic_wakelock_divider));
        msmHsicDivider.setItems(list);
        msmHsicDivider.setProgress(Wakelocks.getMsmHsicDivider());
        msmHsicDivider.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Wakelocks.setMsmHsicDivider(position, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        wakelocks.add(msmHsicDivider);
    }
    if (Wakelocks.hasBCMDHDDivider()) {
        SeekBarView bcmdhdDivider = new SeekBarView();
        bcmdhdDivider.setTitle(getString(R.string.bcmdhd_wakelock_divider));
        bcmdhdDivider.setMax(9);
        bcmdhdDivider.setMin(1);
        bcmdhdDivider.setProgress(Wakelocks.getBCMDHDDivider() - 1);
        bcmdhdDivider.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Wakelocks.setBCMDHDDivider(position + 1, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        wakelocks.add(bcmdhdDivider);
    }
    if (wakelocks.size() > 0) {
        TitleView wakelockTitle = new TitleView();
        wakelockTitle.setText(getString(R.string.wakelock));
        items.add(wakelockTitle);
        items.addAll(wakelocks);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) ArrayList(java.util.ArrayList) Wakelocks(com.moro.mtweaks.utils.kernel.misc.Wakelocks) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView)

Example 32 with SwitchView

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

the class MiscFragment method fsyncInit.

private void fsyncInit(List<RecyclerViewItem> items) {
    if (Misc.hasFsync()) {
        SwitchView fsync = new SwitchView();
        fsync.setTitle(getString(R.string.fsync));
        fsync.setSummary(getString(R.string.fsync_summary));
        fsync.setChecked(Misc.isFsyncEnabled());
        fsync.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableFsync(isChecked, getActivity());
            }
        });
        items.add(fsync);
    }
    if (Misc.hasDynamicFsync()) {
        SwitchView dynamicFsync = new SwitchView();
        dynamicFsync.setTitle(getString(R.string.dynamic_fsync));
        dynamicFsync.setSummary(getString(R.string.dynamic_fsync_summary));
        dynamicFsync.setChecked(Misc.isDynamicFsyncEnabled());
        dynamicFsync.addOnSwitchListener(new SwitchView.OnSwitchListener() {

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

Example 33 with SwitchView

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

the class MiscFragment method archPowerInit.

private void archPowerInit(List<RecyclerViewItem> items) {
    SwitchView archPower = new SwitchView();
    archPower.setTitle(getString(R.string.arch_power));
    archPower.setSummary(getString(R.string.arch_power_summary));
    archPower.setChecked(Misc.isArchPowerEnabled());
    archPower.addOnSwitchListener(new SwitchView.OnSwitchListener() {

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

Example 34 with SwitchView

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

the class MiscFragment method loggerInit.

private void loggerInit(List<RecyclerViewItem> items) {
    SwitchView logger = new SwitchView();
    logger.setSummary(getString(R.string.android_logger));
    logger.setChecked(Misc.isLoggerEnabled());
    logger.addOnSwitchListener(new SwitchView.OnSwitchListener() {

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

Example 35 with SwitchView

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

the class MiscFragment method crcInit.

private void crcInit(List<RecyclerViewItem> items) {
    SwitchView crc = new SwitchView();
    crc.setTitle(getString(R.string.crc));
    crc.setSummary(getString(R.string.crc_summary));
    crc.setChecked(Misc.isCrcEnabled());
    crc.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Misc.enableCrc(isChecked, getActivity());
        }
    });
    items.add(crc);
}
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