Search in sources :

Example 51 with SwitchView

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

the class CPUFragment method powerSavingWqInit.

private void powerSavingWqInit(List<RecyclerViewItem> items) {
    SwitchView powerSavingWq = new SwitchView();
    powerSavingWq.setSummary(getString(R.string.power_saving_wq));
    powerSavingWq.setChecked(Misc.isPowerSavingWqEnabled());
    powerSavingWq.addOnSwitchListener(new SwitchView.OnSwitchListener() {

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

Example 52 with SwitchView

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

the class CPUFragment method cpuQuietInit.

private void cpuQuietInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> views = new ArrayList<>();
    CardView cpuQuietCard = new CardView(getActivity());
    cpuQuietCard.setTitle(getString(R.string.cpu_quiet));
    if (Misc.hasCpuQuietEnable()) {
        SwitchView cpuQuietEnable = new SwitchView();
        cpuQuietEnable.setSummary(getString(R.string.cpu_quiet));
        cpuQuietEnable.setChecked(Misc.isCpuQuietEnabled());
        cpuQuietEnable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableCpuQuiet(isChecked, getActivity());
            }
        });
        views.add(cpuQuietEnable);
    }
    if (Misc.hasCpuQuietGovernors()) {
        SelectView cpuQuietGovernors = new SelectView();
        cpuQuietGovernors.setSummary(getString(R.string.cpu_quiet_governor));
        cpuQuietGovernors.setItems(Misc.getCpuQuietAvailableGovernors());
        cpuQuietGovernors.setItem(Misc.getCpuQuietCurGovernor());
        cpuQuietGovernors.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                Misc.setCpuQuietGovernor(item, getActivity());
            }
        });
        views.add(cpuQuietGovernors);
    }
    if (views.size() > 0) {
        DescriptionView descriptionView = new DescriptionView();
        descriptionView.setSummary(getString(R.string.cpu_quiet_summary));
        cpuQuietCard.addItem(descriptionView);
        for (RecyclerViewItem item : views) {
            cpuQuietCard.addItem(item);
        }
        items.add(cpuQuietCard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) ArrayList(java.util.ArrayList) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 53 with SwitchView

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

the class CPUFragment method cpuTouchBoostInit.

private void cpuTouchBoostInit(List<RecyclerViewItem> items) {
    SwitchView touchBoost = new SwitchView();
    touchBoost.setTitle(getString(R.string.touch_boost));
    touchBoost.setSummary(getString(R.string.touch_boost_summary));
    touchBoost.setChecked(Misc.isCpuTouchBoostEnabled());
    touchBoost.addOnSwitchListener(new SwitchView.OnSwitchListener() {

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

Example 54 with SwitchView

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

the class CPUFragment method cpuBoostInit.

private void cpuBoostInit(List<RecyclerViewItem> items) {
    CardView cpuBoostCard = new CardView(getActivity());
    cpuBoostCard.setTitle(getString(R.string.ib_enabled));
    if (CPUBoost.hasEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.ib_enabled));
        enable.setSummaryOn(getString(R.string.cpu_boost_summary_on));
        enable.setSummaryOff(getString(R.string.cpu_boost_summary_off));
        enable.setChecked(CPUBoost.isEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                CPUBoost.enableCpuBoost(isChecked, getActivity());
            }
        });
        cpuBoostCard.addItem(enable);
    }
    if (CPUBoost.hasCpuBoostExynosInputMs()) {
        GenericSelectView2 ms = new GenericSelectView2();
        ms.setTitle(getString(R.string.ib_duration_ms));
        ms.setValue(CPUBoost.getCpuBootExynosInputMs() + " ms");
        ms.setValueRaw(ms.getValue().replace(" ms", ""));
        ms.setInputType(InputType.TYPE_CLASS_NUMBER);
        ms.setOnGenericValueListener(new GenericSelectView2.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView2 genericSelectView, String value) {
                CPUBoost.setCpuBoostExynosInputMs(Utils.strToInt(value), getActivity());
                genericSelectView.setValue(value + " ms");
            }
        });
        cpuBoostCard.addItem(ms);
    }
    if (CPUBoost.hasCpuBoostExynosInputFreq()) {
        List<String> freqs = CPUBoost.getCpuBootExynosInputFreq();
        final String[] littleFreq = { freqs.get(0) };
        final String[] bigFreq = { freqs.get(1) };
        GenericSelectView2 little = new GenericSelectView2();
        little.setTitle(getString(R.string.ib_freq_little));
        little.setValue(littleFreq[0] + " Hz");
        little.setValueRaw(little.getValue().replace(" Hz", ""));
        little.setInputType(InputType.TYPE_CLASS_NUMBER);
        little.setOnGenericValueListener(new GenericSelectView2.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView2 genericSelectView, String value) {
                CPUBoost.setCpuBoostExynosInputFreq(value, bigFreq[0], getActivity());
                genericSelectView.setValue(value + " Hz");
                littleFreq[0] = value;
            }
        });
        cpuBoostCard.addItem(little);
        GenericSelectView2 big = new GenericSelectView2();
        big.setTitle(getString(R.string.ib_freq_big));
        big.setValue(bigFreq[0] + " Hz");
        big.setValueRaw(big.getValue().replace(" Hz", ""));
        big.setInputType(InputType.TYPE_CLASS_NUMBER);
        big.setOnGenericValueListener(new GenericSelectView2.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView2 genericSelectView, String value) {
                CPUBoost.setCpuBoostExynosInputFreq(littleFreq[0], value, getActivity());
                genericSelectView.setValue(value + " Hz");
                bigFreq[0] = value;
            }
        });
        cpuBoostCard.addItem(big);
    }
    if (CPUBoost.hasCpuBoostDebugMask()) {
        SwitchView debugMask = new SwitchView();
        debugMask.setTitle(getString(R.string.debug_mask));
        debugMask.setSummary(getString(R.string.debug_mask_summary));
        debugMask.setChecked(CPUBoost.isCpuBoostDebugMaskEnabled());
        debugMask.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                CPUBoost.enableCpuBoostDebugMask(isChecked, getActivity());
            }
        });
        cpuBoostCard.addItem(debugMask);
    }
    if (CPUBoost.hasCpuBoostMs()) {
        SeekBarView ms = new SeekBarView();
        ms.setTitle(getString(R.string.interval));
        ms.setSummary(getString(R.string.interval_summary));
        ms.setUnit(getString(R.string.ms));
        ms.setMax(5000);
        ms.setOffset(10);
        ms.setProgress(CPUBoost.getCpuBootMs() / 10);
        ms.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                CPUBoost.setCpuBoostMs(position * 10, getActivity());
            }
        });
        cpuBoostCard.addItem(ms);
    }
    if (CPUBoost.hasCpuBoostSyncThreshold() && CPUFreq.getFreqs() != null) {
        List<String> list = new ArrayList<>();
        list.add(getString(R.string.disabled));
        list.addAll(CPUFreq.getAdjustedFreq(getActivity()));
        SelectView syncThreshold = new SelectView();
        syncThreshold.setTitle(getString(R.string.sync_threshold));
        syncThreshold.setSummary(getString(R.string.sync_threshold_summary));
        syncThreshold.setItems(list);
        syncThreshold.setItem(CPUBoost.getCpuBootSyncThreshold());
        syncThreshold.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                CPUBoost.setCpuBoostSyncThreshold(position == 0 ? 0 : CPUFreq.getFreqs().get(position - 1), getActivity());
            }
        });
        cpuBoostCard.addItem(syncThreshold);
    }
    if (CPUBoost.hasCpuBoostInputMs()) {
        SeekBarView inputMs = new SeekBarView();
        inputMs.setTitle(getString(R.string.input_interval));
        inputMs.setSummary(getString(R.string.input_interval_summary));
        inputMs.setUnit(getString(R.string.ms));
        inputMs.setMax(5000);
        inputMs.setOffset(10);
        inputMs.setProgress(CPUBoost.getCpuBootInputMs() / 10);
        inputMs.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                CPUBoost.setCpuBoostInputMs(position * 10, getActivity());
            }
        });
        cpuBoostCard.addItem(inputMs);
    }
    if (CPUBoost.hasCpuBoostInputFreq()) {
        List<Integer> freqs = CPUBoost.getCpuBootInputFreq();
        for (int i = 0; i < freqs.size(); i++) {
            List<String> list = new ArrayList<>();
            list.add(getString(R.string.disabled));
            list.addAll(CPUFreq.getAdjustedFreq(i, getActivity()));
            SelectView inputCard = new SelectView();
            if (freqs.size() > 1) {
                inputCard.setTitle(getString(R.string.input_boost_freq_core, i + 1));
            } else {
                inputCard.setTitle(getString(R.string.input_boost_freq));
            }
            inputCard.setSummary(getString(R.string.input_boost_freq_summary));
            inputCard.setItems(list);
            inputCard.setItem(freqs.get(i));
            final int core = i;
            inputCard.setOnItemSelected(new SelectView.OnItemSelected() {

                @Override
                public void onItemSelected(SelectView selectView, int position, String item) {
                    CPUBoost.setCpuBoostInputFreq(position == 0 ? 0 : CPUFreq.getFreqs(core).get(position - 1), core, getActivity());
                }
            });
            cpuBoostCard.addItem(inputCard);
        }
    }
    if (CPUBoost.hasCpuBoostWakeup()) {
        SwitchView wakeup = new SwitchView();
        wakeup.setTitle(getString(R.string.wakeup_boost));
        wakeup.setSummary(getString(R.string.wakeup_boost_summary));
        wakeup.setChecked(CPUBoost.isCpuBoostWakeupEnabled());
        wakeup.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                CPUBoost.enableCpuBoostWakeup(isChecked, getActivity());
            }
        });
        cpuBoostCard.addItem(wakeup);
    }
    if (CPUBoost.hasCpuBoostHotplug()) {
        SwitchView hotplug = new SwitchView();
        hotplug.setTitle(getString(R.string.hotplug_boost));
        hotplug.setSummary(getString(R.string.hotplug_boost_summary));
        hotplug.setChecked(CPUBoost.isCpuBoostHotplugEnabled());
        hotplug.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                CPUBoost.enableCpuBoostHotplug(isChecked, getActivity());
            }
        });
        cpuBoostCard.addItem(hotplug);
    }
    if (cpuBoostCard.size() > 0) {
        items.add(cpuBoostCard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) ArrayList(java.util.ArrayList) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) GenericSelectView2(com.moro.mtweaks.views.recyclerview.GenericSelectView2) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 55 with SwitchView

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

the class CPUHotplugFragment method aioHotplugInit.

private void aioHotplugInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> aioHotplug = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(R.string.aio_hotplug));
    if (AiOHotplug.hasToggle()) {
        SwitchView toggle = new SwitchView();
        toggle.setTitle(getString(R.string.aio_hotplug));
        toggle.setSummary(getString(R.string.aio_hotplug_summary));
        toggle.setChecked(AiOHotplug.isEnabled());
        toggle.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                AiOHotplug.enable(isChecked, getActivity());
            }
        });
        aioHotplug.add(toggle);
        mEnableViews.add(toggle);
    }
    if (AiOHotplug.hasCores()) {
        SeekBarView maxCpus = new SeekBarView();
        maxCpus.setTitle(getString(R.string.max_cpu_online));
        maxCpus.setSummary(getString(R.string.max_cpu_online_summary));
        maxCpus.setMax(CPUFreq.getCpuCount());
        maxCpus.setMin(1);
        maxCpus.setProgress(AiOHotplug.getCores() - 1);
        maxCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AiOHotplug.setCores(position + 1, getActivity());
            }
        });
        aioHotplug.add(maxCpus);
    }
    if (CPUFreq.isBigLITTLE() && AiOHotplug.hasBigCores()) {
        List<String> list = new ArrayList<>();
        list.add("Disable");
        for (int i = 1; i <= CPUFreq.getBigCpuRange().size(); i++) {
            list.add(String.valueOf(i));
        }
        SeekBarView bigMaxCpus = new SeekBarView();
        bigMaxCpus.setTitle(getString(R.string.max_cpu_online_big));
        bigMaxCpus.setSummary(getString(R.string.max_cpu_online_big_summary));
        bigMaxCpus.setItems(list);
        bigMaxCpus.setProgress(AiOHotplug.getBigCores());
        bigMaxCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AiOHotplug.setBigCores(position, getActivity());
            }
        });
        aioHotplug.add(bigMaxCpus);
    }
    if (CPUFreq.isBigLITTLE() && AiOHotplug.hasLITTLECores()) {
        List<String> list = new ArrayList<>();
        list.add("Disable");
        for (int i = 1; i <= CPUFreq.getLITTLECpuRange().size(); i++) {
            list.add(String.valueOf(i));
        }
        SeekBarView LITTLEMaxCpus = new SeekBarView();
        LITTLEMaxCpus.setTitle(getString(R.string.max_cpu_online_little));
        LITTLEMaxCpus.setSummary(getString(R.string.max_cpu_online_little_summary));
        LITTLEMaxCpus.setItems(list);
        LITTLEMaxCpus.setProgress(AiOHotplug.getLITTLECores());
        LITTLEMaxCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AiOHotplug.setLITTLECores(position, getActivity());
            }
        });
        aioHotplug.add(LITTLEMaxCpus);
    }
    if (aioHotplug.size() > 0) {
        items.add(title);
        items.addAll(aioHotplug);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) ArrayList(java.util.ArrayList) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView)

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