Search in sources :

Example 6 with SelectView

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

the class CPUHotplugFragment method makoHotplugInit.

private void makoHotplugInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> makoHotplug = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(R.string.mako_hotplug));
    if (MakoHotplug.hasMakoHotplugEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.mako_hotplug));
        enable.setSummary(getString(R.string.mako_hotplug_summary));
        enable.setChecked(MakoHotplug.isMakoHotplugEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                MakoHotplug.enableMakoHotplug(isChecked, getActivity());
            }
        });
        makoHotplug.add(enable);
        mEnableViews.add(enable);
    }
    if (MakoHotplug.hasMakoHotplugCoresOnTouch()) {
        SeekBarView coresOnTouch = new SeekBarView();
        coresOnTouch.setTitle(getString(R.string.cpus_on_touch));
        coresOnTouch.setSummary(getString(R.string.cpus_on_touch_summary));
        coresOnTouch.setMax(CPUFreq.getCpuCount());
        coresOnTouch.setMin(1);
        coresOnTouch.setProgress(MakoHotplug.getMakoHotplugCoresOnTouch() - 1);
        coresOnTouch.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugCoresOnTouch(position + 1, getActivity());
            }
        });
        makoHotplug.add(coresOnTouch);
    }
    if (MakoHotplug.hasMakoHotplugCpuFreqUnplugLimit() && CPUFreq.getFreqs() != null) {
        SelectView cpufreqUnplugLimit = new SelectView();
        cpufreqUnplugLimit.setSummary(getString(R.string.cpu_freq_unplug_limit));
        cpufreqUnplugLimit.setItems(CPUFreq.getAdjustedFreq(getActivity()));
        cpufreqUnplugLimit.setItem((MakoHotplug.getMakoHotplugCpuFreqUnplugLimit() / 1000) + getString(R.string.mhz));
        cpufreqUnplugLimit.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                MakoHotplug.setMakoHotplugCpuFreqUnplugLimit(CPUFreq.getFreqs().get(position), getActivity());
            }
        });
        makoHotplug.add(cpufreqUnplugLimit);
    }
    if (MakoHotplug.hasMakoHotplugFirstLevel()) {
        SeekBarView firstLevel = new SeekBarView();
        firstLevel.setTitle(getString(R.string.first_level));
        firstLevel.setSummary(getString(R.string.first_level_summary));
        firstLevel.setUnit("%");
        firstLevel.setProgress(MakoHotplug.getMakoHotplugFirstLevel());
        firstLevel.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugFirstLevel(position, getActivity());
            }
        });
        makoHotplug.add(firstLevel);
    }
    if (MakoHotplug.hasMakoHotplugHighLoadCounter()) {
        SeekBarView highLoadCounter = new SeekBarView();
        highLoadCounter.setTitle(getString(R.string.high_load_counter));
        highLoadCounter.setProgress(MakoHotplug.getMakoHotplugHighLoadCounter());
        highLoadCounter.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugHighLoadCounter(position, getActivity());
            }
        });
        makoHotplug.add(highLoadCounter);
    }
    if (MakoHotplug.hasMakoHotplugLoadThreshold()) {
        SeekBarView loadThreshold = new SeekBarView();
        loadThreshold.setTitle(getString(R.string.load_threshold));
        loadThreshold.setSummary(getString(R.string.load_threshold_summary));
        loadThreshold.setUnit("%");
        loadThreshold.setProgress(MakoHotplug.getMakoHotplugLoadThreshold());
        loadThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugLoadThreshold(position, getActivity());
            }
        });
        makoHotplug.add(loadThreshold);
    }
    if (MakoHotplug.hasMakoHotplugMaxLoadCounter()) {
        SeekBarView maxLoadCounter = new SeekBarView();
        maxLoadCounter.setTitle(getString(R.string.max_load_counter));
        maxLoadCounter.setProgress(MakoHotplug.getMakoHotplugMaxLoadCounter());
        maxLoadCounter.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugMaxLoadCounter(position, getActivity());
            }
        });
        makoHotplug.add(maxLoadCounter);
    }
    if (MakoHotplug.hasMakoHotplugMinTimeCpuOnline()) {
        SeekBarView minTimeCpuOnline = new SeekBarView();
        minTimeCpuOnline.setTitle(getString(R.string.min_time_cpu_online));
        minTimeCpuOnline.setProgress(MakoHotplug.getMakoHotplugMinTimeCpuOnline());
        minTimeCpuOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugMinTimeCpuOnline(position, getActivity());
            }
        });
        makoHotplug.add(minTimeCpuOnline);
    }
    if (MakoHotplug.hasMakoHotplugMinCoresOnline()) {
        SeekBarView minCoresOnline = new SeekBarView();
        minCoresOnline.setTitle(getString(R.string.min_cpu_online));
        minCoresOnline.setSummary(getString(R.string.min_cpu_online_summary));
        minCoresOnline.setMax(CPUFreq.getCpuCount());
        minCoresOnline.setMin(1);
        minCoresOnline.setProgress(MakoHotplug.getMakoHotplugMinCoresOnline() - 1);
        minCoresOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugMinCoresOnline(position + 1, getActivity());
            }
        });
        makoHotplug.add(minCoresOnline);
    }
    if (MakoHotplug.hasMakoHotplugTimer()) {
        SeekBarView timer = new SeekBarView();
        timer.setTitle(getString(R.string.timer));
        timer.setProgress(MakoHotplug.getMakoHotplugTimer());
        timer.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugTimer(position, getActivity());
            }
        });
        makoHotplug.add(timer);
    }
    if (MakoHotplug.hasMakoHotplugSuspendFreq() && CPUFreq.getFreqs() != null) {
        SelectView suspendFreq = new SelectView();
        suspendFreq.setTitle(getString(R.string.cpu_max_screen_off_freq));
        suspendFreq.setSummary(getString(R.string.cpu_max_screen_off_freq_summary));
        suspendFreq.setItems(CPUFreq.getAdjustedFreq(getActivity()));
        suspendFreq.setItem((MakoHotplug.getMakoHotplugSuspendFreq() / 1000) + getString(R.string.mhz));
        suspendFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                MakoHotplug.setMakoHotplugSuspendFreq(CPUFreq.getFreqs().get(position), getActivity());
            }
        });
        makoHotplug.add(suspendFreq);
    }
    if (makoHotplug.size() > 0) {
        items.add(title);
        items.addAll(makoHotplug);
    }
}
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 SelectView

use of com.moro.mtweaks.views.recyclerview.SelectView 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 8 with SelectView

use of com.moro.mtweaks.views.recyclerview.SelectView 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 9 with SelectView

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

the class GPUFragment method governorInit.

private void governorInit(List<RecyclerViewItem> items) {
    CardView govCard = new CardView(getActivity());
    govCard.setTitle(getString(R.string.gpu_governor));
    if (GPUFreq.hasGovernor()) {
        SelectView governor = new SelectView();
        governor.setTitle(getString(R.string.gpu_governor));
        governor.setSummary(getString(R.string.gpu_governor_summary));
        governor.setItems(GPUFreq.getAvailableGovernors());
        governor.setItem(GPUFreq.getGovernor());
        governor.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                GPUFreq.setGovernor(item, getActivity());
            }
        });
        govCard.addItem(governor);
    }
    TitleView tunables = new TitleView();
    tunables.setText(getString(R.string.gov_tunables));
    govCard.addItem(tunables);
    if (GPUFreq.hasHighspeedClock()) {
        List<String> freqs = new ArrayList<>();
        List<Integer> list = GPUFreq.getAvailableFreqsSort();
        if (list != null) {
            int value = 0;
            for (int i = 0; i < list.size(); i++) {
                freqs.add(String.valueOf(list.get(i)));
                if (list.get(i) == GPUFreq.getHighspeedClock()) {
                    value = i;
                }
            }
            SeekBarView seekbar = new SeekBarView();
            seekbar.setTitle(getString(R.string.tun_highspeed_clock));
            seekbar.setSummary(getString(R.string.tun_highspeed_clock_summary));
            seekbar.setUnit(getString(R.string.mhz));
            seekbar.setItems(freqs);
            seekbar.setProgress(value);
            seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

                @Override
                public void onMove(SeekBarView seekBarView, int position, String value) {
                }
            });
            govCard.addItem(seekbar);
        }
    }
    if (GPUFreq.hasHighspeedLoad()) {
        SeekBarView seekbar = new SeekBarView();
        seekbar.setTitle(getString(R.string.tun_highspeed_load));
        seekbar.setSummary(getString(R.string.tun_highspeed_load_summary));
        seekbar.setUnit(getString(R.string.percent));
        seekbar.setMax(100);
        seekbar.setMin(1);
        seekbar.setProgress(GPUFreq.getHighspeedLoad() - 1);
        seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        govCard.addItem(seekbar);
    }
    if (GPUFreq.hasHighspeedDelay()) {
        SeekBarView seekbar = new SeekBarView();
        seekbar.setTitle(getString(R.string.tun_highspeed_delay));
        seekbar.setSummary(getString(R.string.tun_highspeed_delay_summary));
        seekbar.setUnit(getString(R.string.ms));
        seekbar.setMax(5);
        seekbar.setMin(0);
        seekbar.setProgress(GPUFreq.getHighspeedDelay());
        seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        govCard.addItem(seekbar);
    }
    if (govCard.size() > 0) {
        items.add(govCard);
    }
}
Also used : 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) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 10 with SelectView

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

the class WakeFrament method t2wInit.

private void t2wInit(List<RecyclerViewItem> items) {
    CardView t2wCard = new CardView(getActivity());
    t2wCard.setTitle(getString(R.string.t2w));
    SelectView t2w = new SelectView();
    t2w.setTitle(getString(R.string.t2w));
    t2w.setSummary(getString(R.string.t2w_summary));
    t2w.setItems(T2w.getMenu(getActivity()));
    t2w.setItem(T2w.get());
    t2w.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            T2w.set(position, getActivity());
        }
    });
    t2wCard.addItem(t2w);
    items.add(t2wCard);
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Aggregations

SelectView (com.moro.mtweaks.views.recyclerview.SelectView)29 CardView (com.moro.mtweaks.views.recyclerview.CardView)20 SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)14 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)12 ArrayList (java.util.ArrayList)10 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)8 TitleView (com.moro.mtweaks.views.recyclerview.TitleView)7 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)5 GenericSelectView (com.moro.mtweaks.views.recyclerview.GenericSelectView)3 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)2 XYGraphView (com.moro.mtweaks.views.recyclerview.XYGraphView)2