Search in sources :

Example 6 with TitleView

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

the class CPUHotplugFragment method mbHotplugInit.

private void mbHotplugInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> mbHotplug = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(MBHotplug.getMBName(getActivity()));
    if (MBHotplug.hasMBGHotplugEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(MBHotplug.getMBName(getActivity()));
        enable.setSummary(getString(R.string.mb_hotplug_summary));
        enable.setChecked(MBHotplug.isMBHotplugEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                MBHotplug.enableMBHotplug(isChecked, getActivity());
            }
        });
        mbHotplug.add(enable);
        mEnableViews.add(enable);
    }
    if (MBHotplug.hasMBHotplugScroffSingleCore()) {
        SwitchView scroffSingleCore = new SwitchView();
        scroffSingleCore.setTitle(getString(R.string.screen_off_single_cpu));
        scroffSingleCore.setSummary(getString(R.string.screen_off_single_cpu_summary));
        scroffSingleCore.setChecked(MBHotplug.isMBHotplugScroffSingleCoreEnabled());
        scroffSingleCore.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                MBHotplug.enableMBHotplugScroffSingleCore(isChecked, getActivity());
            }
        });
        mbHotplug.add(scroffSingleCore);
    }
    if (MBHotplug.hasMBHotplugMinCpus()) {
        SeekBarView minCpus = new SeekBarView();
        minCpus.setTitle(getString(R.string.min_cpu_online));
        minCpus.setSummary(getString(R.string.min_cpu_online_summary));
        minCpus.setMax(CPUFreq.getCpuCount());
        minCpus.setMin(1);
        minCpus.setProgress(MBHotplug.getMBHotplugMinCpus() - 1);
        minCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MBHotplug.setMBHotplugMinCpus(position + 1, getActivity());
            }
        });
        mbHotplug.add(minCpus);
    }
    if (MBHotplug.hasMBHotplugMaxCpus()) {
        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(MBHotplug.getMBHotplugMaxCpus() - 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) {
                MBHotplug.setMBHotplugMaxCpus(position + 1, getActivity());
            }
        });
        mbHotplug.add(maxCpus);
    }
    if (MBHotplug.hasMBHotplugMaxCpusOnlineSusp()) {
        SeekBarView maxCpusOnlineSusp = new SeekBarView();
        maxCpusOnlineSusp.setTitle(getString(R.string.max_cpu_online_screen_off));
        maxCpusOnlineSusp.setSummary(getString(R.string.max_cpu_online_screen_off_summary));
        maxCpusOnlineSusp.setMax(CPUFreq.getCpuCount());
        maxCpusOnlineSusp.setMin(1);
        maxCpusOnlineSusp.setProgress(MBHotplug.getMBHotplugMaxCpusOnlineSusp() - 1);
        maxCpusOnlineSusp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MBHotplug.setMBHotplugMaxCpusOnlineSusp(position + 1, getActivity());
            }
        });
        mbHotplug.add(maxCpusOnlineSusp);
    }
    if (MBHotplug.hasMBHotplugIdleFreq() && CPUFreq.getFreqs() != null) {
        SelectView idleFreq = new SelectView();
        idleFreq.setTitle(getString(R.string.idle_frequency));
        idleFreq.setSummary(getString(R.string.idle_frequency_summary));
        idleFreq.setItems(CPUFreq.getAdjustedFreq(getActivity()));
        idleFreq.setItem((MBHotplug.getMBHotplugIdleFreq() / 1000) + getString(R.string.mhz));
        idleFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                MBHotplug.setMBHotplugIdleFreq(CPUFreq.getFreqs().get(position), getActivity());
            }
        });
        mbHotplug.add(idleFreq);
    }
    if (MBHotplug.hasMBHotplugBoostEnable()) {
        SwitchView boost = new SwitchView();
        boost.setTitle(getString(R.string.touch_boost));
        boost.setSummary(getString(R.string.touch_boost_summary));
        boost.setChecked(MBHotplug.isMBHotplugBoostEnabled());
        boost.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                MBHotplug.enableMBHotplugBoost(isChecked, getActivity());
            }
        });
        mbHotplug.add(boost);
    }
    if (MBHotplug.hasMBHotplugBoostTime()) {
        SeekBarView boostTime = new SeekBarView();
        boostTime.setTitle(getString(R.string.touch_boost_time));
        boostTime.setSummary(getString(R.string.touch_boost_time_summary));
        boostTime.setUnit(getString(R.string.ms));
        boostTime.setMax(5000);
        boostTime.setOffset(100);
        boostTime.setProgress(MBHotplug.getMBHotplugBoostTime() / 100);
        boostTime.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MBHotplug.setMBHotplugBoostTime(position * 100, getActivity());
            }
        });
        mbHotplug.add(boostTime);
    }
    if (MBHotplug.hasMBHotplugCpusBoosted()) {
        SeekBarView cpusBoosted = new SeekBarView();
        cpusBoosted.setTitle(getString(R.string.cpus_boosted));
        cpusBoosted.setSummary(getString(R.string.cpus_boosted_summary));
        cpusBoosted.setMax(CPUFreq.getCpuCount());
        cpusBoosted.setMin(1);
        cpusBoosted.setProgress(MBHotplug.getMBHotplugCpusBoosted());
        cpusBoosted.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MBHotplug.setMBHotplugCpusBoosted(position, getActivity());
            }
        });
        mbHotplug.add(cpusBoosted);
    }
    if (MBHotplug.hasMBHotplugBoostFreqs() && CPUFreq.getFreqs() != null) {
        List<Integer> freqs = MBHotplug.getMBHotplugBoostFreqs();
        for (int i = 0; i < freqs.size(); i++) {
            SelectView boostFreq = new SelectView();
            boostFreq.setSummary(getString(R.string.boost_frequency_core, i));
            boostFreq.setItems(CPUFreq.getAdjustedFreq(getActivity()));
            boostFreq.setItem((freqs.get(i) / 1000) + getString(R.string.mhz));
            final int pos = i;
            boostFreq.setOnItemSelected(new SelectView.OnItemSelected() {

                @Override
                public void onItemSelected(SelectView selectView, int position, String item) {
                    MBHotplug.setMBHotplugBoostFreqs(pos, CPUFreq.getFreqs().get(position), getActivity());
                }
            });
            mbHotplug.add(boostFreq);
        }
    }
    if (MBHotplug.hasMBHotplugStartDelay()) {
        SeekBarView startDelay = new SeekBarView();
        startDelay.setTitle(getString(R.string.start_delay));
        startDelay.setSummary(getString(R.string.start_delay_summary));
        startDelay.setUnit(getString(R.string.ms));
        startDelay.setMax(5000);
        startDelay.setOffset(1000);
        startDelay.setProgress(MBHotplug.getMBHotplugStartDelay() / 1000);
        startDelay.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MBHotplug.setMBHotplugStartDelay(position * 1000, getActivity());
            }
        });
        mbHotplug.add(startDelay);
    }
    if (MBHotplug.hasMBHotplugDelay()) {
        SeekBarView delay = new SeekBarView();
        delay.setTitle(getString(R.string.delay));
        delay.setSummary(getString(R.string.delay_summary));
        delay.setUnit(getString(R.string.ms));
        delay.setMax(200);
        delay.setProgress(MBHotplug.getMBHotplugDelay());
        delay.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MBHotplug.setMBHotplugDelay(position, getActivity());
            }
        });
        mbHotplug.add(delay);
    }
    if (MBHotplug.hasMBHotplugPause()) {
        SeekBarView pause = new SeekBarView();
        pause.setTitle(getString(R.string.pause));
        pause.setSummary(getString(R.string.pause_summary));
        pause.setUnit(getString(R.string.ms));
        pause.setMax(5000);
        pause.setOffset(1000);
        pause.setProgress(MBHotplug.getMBHotplugPause() / 1000);
        pause.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MBHotplug.setMBHotplugPause(position * 1000, getActivity());
            }
        });
        mbHotplug.add(pause);
    }
    if (mbHotplug.size() > 0) {
        items.add(title);
        items.addAll(mbHotplug);
    }
}
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) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 7 with TitleView

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

the class CPUHotplugFragment method alucardHotplugInit.

private void alucardHotplugInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> alucardHotplug = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(R.string.alucard_hotplug));
    if (AlucardHotplug.hasAlucardHotplugEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.alucard_hotplug));
        enable.setSummary(getString(R.string.alucard_hotplug_summary));
        enable.setChecked(AlucardHotplug.isAlucardHotplugEnable());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                AlucardHotplug.enableAlucardHotplug(isChecked, getActivity());
            }
        });
        alucardHotplug.add(enable);
        mEnableViews.add(enable);
    }
    if (AlucardHotplug.hasAlucardHotplugHpIoIsBusy()) {
        SwitchView ioIsBusy = new SwitchView();
        ioIsBusy.setTitle(getString(R.string.io_is_busy));
        ioIsBusy.setSummary(getString(R.string.io_is_busy_summary));
        ioIsBusy.setChecked(AlucardHotplug.isAlucardHotplugHpIoIsBusyEnable());
        ioIsBusy.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                AlucardHotplug.enableAlucardHotplugHpIoIsBusy(isChecked, getActivity());
            }
        });
        alucardHotplug.add(ioIsBusy);
    }
    if (AlucardHotplug.hasAlucardHotplugSamplingRate()) {
        SeekBarView samplingRate = new SeekBarView();
        samplingRate.setTitle(getString(R.string.sampling_rate));
        samplingRate.setUnit("%");
        samplingRate.setMin(1);
        samplingRate.setProgress(AlucardHotplug.getAlucardHotplugSamplingRate() - 1);
        samplingRate.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AlucardHotplug.setAlucardHotplugSamplingRate(position + 1, getActivity());
            }
        });
        alucardHotplug.add(samplingRate);
    }
    if (AlucardHotplug.hasAlucardHotplugSuspend()) {
        SwitchView suspend = new SwitchView();
        suspend.setTitle(getString(R.string.suspend));
        suspend.setSummary(getString(R.string.suspend_summary));
        suspend.setChecked(AlucardHotplug.isAlucardHotplugSuspendEnabled());
        suspend.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                AlucardHotplug.enableAlucardHotplugSuspend(isChecked, getActivity());
            }
        });
        alucardHotplug.add(suspend);
    }
    if (AlucardHotplug.hasAlucardHotplugMinCpusOnline()) {
        SeekBarView minCpusOnline = new SeekBarView();
        minCpusOnline.setTitle(getString(R.string.min_cpu_online));
        minCpusOnline.setSummary(getString(R.string.min_cpu_online_summary));
        minCpusOnline.setMax(CPUFreq.getCpuCount());
        minCpusOnline.setMin(1);
        minCpusOnline.setProgress(AlucardHotplug.getAlucardHotplugMinCpusOnline() - 1);
        minCpusOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AlucardHotplug.setAlucardHotplugMinCpusOnline(position + 1, getActivity());
            }
        });
        alucardHotplug.add(minCpusOnline);
    }
    if (AlucardHotplug.hasAlucardHotplugMaxCoresLimit()) {
        SeekBarView maxCoresLimit = new SeekBarView();
        maxCoresLimit.setTitle(getString(R.string.max_cpu_online));
        maxCoresLimit.setSummary(getString(R.string.max_cpu_online_summary));
        maxCoresLimit.setMax(CPUFreq.getCpuCount());
        maxCoresLimit.setMin(1);
        maxCoresLimit.setProgress(AlucardHotplug.getAlucardHotplugMaxCoresLimit() - 1);
        maxCoresLimit.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AlucardHotplug.setAlucardHotplugMaxCoresLimit(position + 1, getActivity());
            }
        });
        alucardHotplug.add(maxCoresLimit);
    }
    if (AlucardHotplug.hasAlucardHotplugMaxCoresLimitSleep()) {
        SeekBarView maxCoresLimitSleep = new SeekBarView();
        maxCoresLimitSleep.setTitle(getString(R.string.max_cpu_online_screen_off));
        maxCoresLimitSleep.setSummary(getString(R.string.max_cpu_online_screen_off_summary));
        maxCoresLimitSleep.setMax(CPUFreq.getCpuCount());
        maxCoresLimitSleep.setMin(1);
        maxCoresLimitSleep.setProgress(AlucardHotplug.getAlucardHotplugMaxCoresLimitSleep() - 1);
        maxCoresLimitSleep.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AlucardHotplug.setAlucardHotplugMaxCoresLimitSleep(position + 1, getActivity());
            }
        });
        alucardHotplug.add(maxCoresLimitSleep);
    }
    if (AlucardHotplug.hasAlucardHotplugCpuDownRate()) {
        SeekBarView cpuDownRate = new SeekBarView();
        cpuDownRate.setTitle(getString(R.string.cpu_down_rate));
        cpuDownRate.setUnit("%");
        cpuDownRate.setMin(1);
        cpuDownRate.setProgress(AlucardHotplug.getAlucardHotplugCpuDownRate() - 1);
        cpuDownRate.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AlucardHotplug.setAlucardHotplugCpuDownRate(position + 1, getActivity());
            }
        });
        alucardHotplug.add(cpuDownRate);
    }
    if (AlucardHotplug.hasAlucardHotplugCpuUpRate()) {
        SeekBarView cpuUpRate = new SeekBarView();
        cpuUpRate.setTitle(getString(R.string.cpu_up_rate));
        cpuUpRate.setUnit("%");
        cpuUpRate.setMin(1);
        cpuUpRate.setProgress(AlucardHotplug.getAlucardHotplugCpuUpRate() - 1);
        cpuUpRate.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 8 with TitleView

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

the class CPUHotplugFragment method coreCtlInit.

private void coreCtlInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> coreCtl = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(CoreCtl.hasEnable() ? R.string.hcube : R.string.core_control));
    if (CoreCtl.hasMinCpus(CPUFreq.getBigCpu())) {
        SeekBarView minCpus = new SeekBarView();
        minCpus.setTitle(getString(R.string.min_cpus_big));
        minCpus.setSummary(getString(R.string.min_cpus_big_summary));
        minCpus.setMax(CPUFreq.getBigCpuRange().size());
        minCpus.setProgress(CoreCtl.getMinCpus(CPUFreq.getBigCpu()));
        minCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                CoreCtl.setMinCpus(position, CPUFreq.getBigCpu(), getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        coreCtl.add(minCpus);
    }
    if (CoreCtl.hasBusyDownThreshold()) {
        SeekBarView busyDownThreshold = new SeekBarView();
        busyDownThreshold.setTitle(getString(R.string.busy_down_threshold));
        busyDownThreshold.setSummary(getString(R.string.busy_down_threshold_summary));
        busyDownThreshold.setProgress(CoreCtl.getBusyDownThreshold());
        busyDownThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                CoreCtl.setBusyDownThreshold(position, getActivity());
            }
        });
        coreCtl.add(busyDownThreshold);
    }
    if (CoreCtl.hasBusyUpThreshold()) {
        SeekBarView busyUpThreshold = new SeekBarView();
        busyUpThreshold.setTitle(getString(R.string.busy_up_threshold));
        busyUpThreshold.setSummary(getString(R.string.busy_up_threshold_summary));
        busyUpThreshold.setProgress(CoreCtl.getBusyUpThreshold());
        busyUpThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                CoreCtl.setBusyUpThreshold(position, getActivity());
            }
        });
        coreCtl.add(busyUpThreshold);
    }
    if (CoreCtl.hasOfflineDelayMs()) {
        SeekBarView offlineDelayMs = new SeekBarView();
        offlineDelayMs.setTitle(getString(R.string.offline_delay));
        offlineDelayMs.setSummary(getString(R.string.offline_delay_summary));
        offlineDelayMs.setUnit(getString(R.string.ms));
        offlineDelayMs.setMax(5000);
        offlineDelayMs.setOffset(100);
        offlineDelayMs.setProgress(CoreCtl.getOfflineDelayMs() / 100);
        offlineDelayMs.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                CoreCtl.setOfflineDelayMs(position * 100, getActivity());
            }
        });
        coreCtl.add(offlineDelayMs);
    }
    if (CoreCtl.hasOnlineDelayMs()) {
        SeekBarView onlineDelayMs = new SeekBarView();
        onlineDelayMs.setTitle(getString(R.string.online_delay));
        onlineDelayMs.setSummary(getString(R.string.online_delay_summary));
        onlineDelayMs.setUnit(getString(R.string.ms));
        onlineDelayMs.setMax(5000);
        onlineDelayMs.setOffset(100);
        onlineDelayMs.setProgress(CoreCtl.getOnlineDelayMs() / 100);
        onlineDelayMs.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                CoreCtl.setOnlineDelayMs(position * 100, getActivity());
            }
        });
        coreCtl.add(onlineDelayMs);
    }
    if (coreCtl.size() > 0) {
        items.add(title);
        if (CoreCtl.hasEnable()) {
            SwitchView enable = new SwitchView();
            enable.setTitle(getString(R.string.hcube));
            enable.setSummary(getString(R.string.hcube_summary));
            enable.setChecked(CoreCtl.isEnabled());
            enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

                @Override
                public void onChanged(SwitchView switchView, boolean isChecked) {
                    CoreCtl.enable(isChecked, getActivity());
                }
            });
            items.add(enable);
            mEnableViews.add(enable);
        } else {
            DescriptionView description = new DescriptionView();
            description.setTitle(getString(R.string.core_control));
            description.setSummary(getString(R.string.core_control_summary));
            items.add(description);
        }
        items.addAll(coreCtl);
    }
}
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) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView)

Example 9 with TitleView

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

the class CPUHotplugFragment method lazyPlugInit.

private void lazyPlugInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> lazyplug = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(R.string.lazyplug));
    if (LazyPlug.hasEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.lazyplug));
        enable.setSummary(getString(R.string.lazyplug_summary));
        enable.setChecked(LazyPlug.isEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                LazyPlug.enable(isChecked, getActivity());
            }
        });
        lazyplug.add(enable);
        mEnableViews.add(enable);
    }
    if (LazyPlug.hasProfile()) {
        SelectView profile = new SelectView();
        profile.setTitle(getString(R.string.profile));
        profile.setSummary(getString(R.string.cpu_hotplug_profile_summary));
        profile.setItems(LazyPlug.getProfileMenu(getActivity()));
        profile.setItem(LazyPlug.getProfile());
        profile.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                LazyPlug.setProfile(position, getActivity());
            }
        });
        lazyplug.add(profile);
    }
    if (LazyPlug.hasTouchBoost()) {
        SwitchView touchBoost = new SwitchView();
        touchBoost.setTitle(getString(R.string.touch_boost));
        touchBoost.setSummary(getString(R.string.touch_boost_summary));
        touchBoost.setChecked(LazyPlug.isTouchBoostEnabled());
        touchBoost.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                LazyPlug.enableTouchBoost(isChecked, getActivity());
            }
        });
        lazyplug.add(touchBoost);
    }
    if (LazyPlug.hasHysteresis()) {
        SeekBarView hysteresis = new SeekBarView();
        hysteresis.setTitle(getString(R.string.hysteresis));
        hysteresis.setSummary(getString(R.string.hysteresis_summary));
        hysteresis.setMax(17);
        hysteresis.setProgress(LazyPlug.getHysteresis());
        hysteresis.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                LazyPlug.setHysteresis(position, getActivity());
            }
        });
        lazyplug.add(hysteresis);
    }
    if (LazyPlug.hasThreshold()) {
        SeekBarView threshold = new SeekBarView();
        threshold.setTitle(getString(R.string.cpu_threshold));
        threshold.setSummary(getString(R.string.cpu_threshold_summary));
        threshold.setMax(1250);
        threshold.setProgress(LazyPlug.getThreshold());
        threshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                LazyPlug.setThreshold(position, getActivity());
            }
        });
        lazyplug.add(threshold);
    }
    if (LazyPlug.hasPossibleCores()) {
        SeekBarView possibleCores = new SeekBarView();
        possibleCores.setTitle(getString(R.string.max_cpu_online));
        possibleCores.setSummary(getString(R.string.possible_cpu_cores_summary));
        possibleCores.setMax(CPUFreq.getCpuCount());
        possibleCores.setMin(1);
        possibleCores.setProgress(LazyPlug.getPossibleCores() - 1);
        possibleCores.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                LazyPlug.setPossibleCores(position + 1, getActivity());
            }
        });
        lazyplug.add(possibleCores);
    }
    if (lazyplug.size() > 0) {
        items.add(title);
        items.addAll(lazyplug);
    }
}
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) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 10 with TitleView

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

the class CPUVoltageCl0Fragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    mVoltages.clear();
    final List<String> freqs = VoltageCl0.getFreqs();
    final List<String> voltages = VoltageCl0.getVoltages();
    final List<String> voltagesStock = VoltageCl0.getStockVoltages();
    if (freqs != null && voltages != null && voltagesStock != null && freqs.size() == voltages.size()) {
        CardView freqCard = new CardView(getActivity());
        freqCard.setTitle(getString(R.string.cpuCl0_volt_control));
        List<String> progress = new ArrayList<>();
        for (float i = -100000f; i < 31250f; i += 6250) {
            String global = String.valueOf(i / VoltageCl0.getOffset());
            progress.add(global);
        }
        seekbarProfInit(mSeekbarProf, freqs, voltages, voltagesStock, progress);
        freqCard.addItem(mSeekbarProf);
        Boolean enableGlobal = Prefs.getBoolean("CpuCl0_global_volts", true, getActivity());
        SwitchView voltControl = new SwitchView();
        voltControl.setTitle(getString(R.string.cpu_manual_volt));
        voltControl.setSummaryOn(getString(R.string.cpu_manual_volt_summaryOn));
        voltControl.setSummaryOff(getString(R.string.cpu_manual_volt_summaryOff));
        voltControl.setChecked(enableGlobal);
        voltControl.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                if (isChecked) {
                    Prefs.saveBoolean("CpuCl0_global_volts", true, getActivity());
                    Prefs.saveBoolean("CpuCl0_individual_volts", false, getActivity());
                    reload();
                } else {
                    Prefs.saveBoolean("CpuCl0_global_volts", false, getActivity());
                    Prefs.saveBoolean("CpuCl0_individual_volts", true, getActivity());
                    Prefs.saveInt("CpuCl0_seekbarPref_value", 16, getActivity());
                    reload();
                }
            }
        });
        freqCard.addItem(voltControl);
        if (freqCard.size() > 0) {
            items.add(freqCard);
        }
        TitleView tunables = new TitleView();
        tunables.setText(getString(R.string.cpuCl0_volt));
        items.add(tunables);
        for (int i = 0; i < freqs.size(); i++) {
            SeekBarView seekbar = new SeekBarView();
            seekbarInit(seekbar, freqs.get(i), voltages.get(i), voltagesStock.get(i));
            mVoltages.add(seekbar);
        }
    }
    items.addAll(mVoltages);
}
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) TitleView(com.moro.mtweaks.views.recyclerview.TitleView)

Aggregations

TitleView (com.moro.mtweaks.views.recyclerview.TitleView)25 ArrayList (java.util.ArrayList)19 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)18 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)18 SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)16 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)7 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)7 CardView (com.moro.mtweaks.views.recyclerview.CardView)6 DialogInterface (android.content.DialogInterface)1 Controls (com.moro.mtweaks.database.tools.customcontrols.Controls)1 Profiles (com.moro.mtweaks.database.tools.profiles.Profiles)1 Device (com.moro.mtweaks.utils.Device)1 Wakelocks (com.moro.mtweaks.utils.kernel.misc.Wakelocks)1 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)1 ImageView (com.moro.mtweaks.views.recyclerview.ImageView)1 HashMap (java.util.HashMap)1