Search in sources :

Example 46 with SeekBarView

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

the class CPUHotplugFragment method msmHotplugInit.

private void msmHotplugInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> msmHotplug = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(R.string.msm_hotplug));
    if (MSMHotplug.hasMsmHotplugEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.msm_hotplug));
        enable.setSummary(getString(R.string.msm_hotplug_summary));
        enable.setChecked(MSMHotplug.isMsmHotplugEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                MSMHotplug.enableMsmHotplug(isChecked, getActivity());
            }
        });
        msmHotplug.add(enable);
        mEnableViews.add(enable);
    }
    if (MSMHotplug.hasMsmHotplugDebugMask()) {
        SwitchView debugMask = new SwitchView();
        debugMask.setTitle(getString(R.string.debug_mask));
        debugMask.setSummary(getString(R.string.debug_mask_summary));
        debugMask.setChecked(MSMHotplug.isMsmHotplugDebugMaskEnabled());
        debugMask.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                MSMHotplug.enableMsmHotplugDebugMask(isChecked, getActivity());
            }
        });
        msmHotplug.add(debugMask);
    }
    if (MSMHotplug.hasMsmHotplugMinCpusOnline()) {
        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(MSMHotplug.getMsmHotplugMinCpusOnline() - 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) {
                MSMHotplug.setMsmHotplugMinCpusOnline(position + 1, getActivity());
            }
        });
        msmHotplug.add(minCpusOnline);
    }
    if (MSMHotplug.hasMsmHotplugMaxCpusOnline()) {
        SeekBarView maxCpusOnline = new SeekBarView();
        maxCpusOnline.setTitle(getString(R.string.max_cpu_online));
        maxCpusOnline.setSummary(getString(R.string.max_cpu_online_summary));
        maxCpusOnline.setMax(CPUFreq.getCpuCount());
        maxCpusOnline.setMin(1);
        maxCpusOnline.setProgress(MSMHotplug.getMsmHotplugMaxCpusOnline() - 1);
        maxCpusOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugMaxCpusOnline(position + 1, getActivity());
            }
        });
        msmHotplug.add(maxCpusOnline);
    }
    if (MSMHotplug.hasMsmHotplugCpusBoosted()) {
        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(MSMHotplug.getMsmHotplugCpusBoosted());
        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) {
                MSMHotplug.setMsmHotplugCpusBoosted(position, getActivity());
            }
        });
        msmHotplug.add(cpusBoosted);
    }
    if (MSMHotplug.hasMsmHotplugMaxCpusOnlineSusp()) {
        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(MSMHotplug.getMsmHotplugMaxCpusOnlineSusp() - 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) {
                MSMHotplug.setMsmHotplugMaxCpusOnlineSusp(position + 1, getActivity());
            }
        });
        msmHotplug.add(maxCpusOnlineSusp);
    }
    if (MSMHotplug.hasMsmHotplugBoostLockDuration()) {
        SeekBarView boostLockDuration = new SeekBarView();
        boostLockDuration.setTitle(getString(R.string.boost_lock_duration));
        boostLockDuration.setSummary(getString(R.string.boost_lock_duration_summary));
        boostLockDuration.setMax(5000);
        boostLockDuration.setMin(1);
        boostLockDuration.setProgress(MSMHotplug.getMsmHotplugBoostLockDuration() - 1);
        boostLockDuration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugBoostLockDuration(position + 1, getActivity());
            }
        });
        msmHotplug.add(boostLockDuration);
    }
    if (MSMHotplug.hasMsmHotplugDownLockDuration()) {
        SeekBarView downLockDuration = new SeekBarView();
        downLockDuration.setTitle(getString(R.string.down_lock_duration));
        downLockDuration.setSummary(getString(R.string.down_lock_duration_summary));
        downLockDuration.setMax(5000);
        downLockDuration.setMin(1);
        downLockDuration.setProgress(MSMHotplug.getMsmHotplugDownLockDuration() - 1);
        downLockDuration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugDownLockDuration(position + 1, getActivity());
            }
        });
        msmHotplug.add(downLockDuration);
    }
    if (MSMHotplug.hasMsmHotplugHistorySize()) {
        SeekBarView historySize = new SeekBarView();
        historySize.setTitle(getString(R.string.history_size));
        historySize.setSummary(getString(R.string.history_size_summary));
        historySize.setMax(60);
        historySize.setMin(1);
        historySize.setProgress(MSMHotplug.getMsmHotplugHistorySize() - 1);
        historySize.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugHistorySize(position + 1, getActivity());
            }
        });
        msmHotplug.add(historySize);
    }
    if (MSMHotplug.hasMsmHotplugUpdateRate()) {
        SeekBarView updateRate = new SeekBarView();
        updateRate.setTitle(getString(R.string.update_rate));
        updateRate.setSummary(getString(R.string.update_rate_summary));
        updateRate.setMax(60);
        updateRate.setProgress(MSMHotplug.getMsmHotplugUpdateRate());
        updateRate.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugUpdateRate(position, getActivity());
            }
        });
        msmHotplug.add(updateRate);
    }
    if (MSMHotplug.hasMsmHotplugFastLaneLoad()) {
        SeekBarView fastLaneLoad = new SeekBarView();
        fastLaneLoad.setTitle(getString(R.string.fast_lane_load));
        fastLaneLoad.setSummary(getString(R.string.fast_lane_load_summary));
        fastLaneLoad.setMax(400);
        fastLaneLoad.setProgress(MSMHotplug.getMsmHotplugFastLaneLoad());
        fastLaneLoad.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugFastLaneLoad(position, getActivity());
            }
        });
        msmHotplug.add(fastLaneLoad);
    }
    if (MSMHotplug.hasMsmHotplugFastLaneMinFreq() && CPUFreq.getFreqs() != null) {
        SelectView fastLaneMinFreq = new SelectView();
        fastLaneMinFreq.setTitle(getString(R.string.fast_lane_min_freq));
        fastLaneMinFreq.setSummary(getString(R.string.fast_lane_min_freq_summary));
        fastLaneMinFreq.setItems(CPUFreq.getAdjustedFreq(getActivity()));
        fastLaneMinFreq.setItem((MSMHotplug.getMsmHotplugFastLaneMinFreq() / 1000) + getString(R.string.mhz));
        fastLaneMinFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                MSMHotplug.setMsmHotplugFastLaneMinFreq(CPUFreq.getFreqs().get(position), getActivity());
            }
        });
        msmHotplug.add(fastLaneMinFreq);
    }
    if (MSMHotplug.hasMsmHotplugOfflineLoad()) {
        SeekBarView offlineLoad = new SeekBarView();
        offlineLoad.setTitle(getString(R.string.offline_load));
        offlineLoad.setSummary(getString(R.string.offline_load_summary));
        offlineLoad.setProgress(MSMHotplug.getMsmHotplugOfflineLoad());
        offlineLoad.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugOfflineLoad(position, getActivity());
            }
        });
        msmHotplug.add(offlineLoad);
    }
    if (MSMHotplug.hasMsmHotplugIoIsBusy()) {
        SwitchView ioIsBusy = new SwitchView();
        ioIsBusy.setTitle(getString(R.string.io_is_busy));
        ioIsBusy.setSummary(getString(R.string.io_is_busy_summary));
        ioIsBusy.setChecked(MSMHotplug.isMsmHotplugIoIsBusyEnabled());
        ioIsBusy.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                MSMHotplug.enableMsmHotplugIoIsBusy(isChecked, getActivity());
            }
        });
        msmHotplug.add(ioIsBusy);
    }
    if (MSMHotplug.hasMsmHotplugSuspendMaxCpus()) {
        SeekBarView suspendMaxCpus = new SeekBarView();
        suspendMaxCpus.setTitle(getString(R.string.max_cpu_online_screen_off));
        suspendMaxCpus.setSummary(getString(R.string.max_cpu_online_screen_off_summary));
        suspendMaxCpus.setMax(CPUFreq.getCpuCount());
        suspendMaxCpus.setMin(1);
        suspendMaxCpus.setProgress(MSMHotplug.getMsmHotplugSuspendMaxCpus());
        suspendMaxCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugSuspendMaxCpus(position, getActivity());
            }
        });
        msmHotplug.add(suspendMaxCpus);
    }
    if (MSMHotplug.hasMsmHotplugSuspendFreq() && 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((MSMHotplug.getMsmHotplugSuspendFreq() / 1000) + getString(R.string.mhz));
        suspendFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                MSMHotplug.setMsmHotplugSuspendFreq(CPUFreq.getFreqs().get(position), getActivity());
            }
        });
        msmHotplug.add(suspendFreq);
    }
    if (MSMHotplug.hasMsmHotplugSuspendDeferTime()) {
        SeekBarView suspendDeferTime = new SeekBarView();
        suspendDeferTime.setTitle(getString(R.string.suspend_defer_time));
        suspendDeferTime.setUnit(getString(R.string.ms));
        suspendDeferTime.setMax(5000);
        suspendDeferTime.setOffset(10);
        suspendDeferTime.setProgress(MSMHotplug.getMsmHotplugSuspendDeferTime() / 10);
        suspendDeferTime.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MSMHotplug.setMsmHotplugSuspendDeferTime(position * 10, getActivity());
            }
        });
        msmHotplug.add(suspendDeferTime);
    }
    if (msmHotplug.size() > 0) {
        items.add(title);
        items.addAll(msmHotplug);
    }
}
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 47 with SeekBarView

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

the class CPUHotplugFragment method thunderPlugInit.

private void thunderPlugInit(List<RecyclerViewItem> items) {
    CardView thunderPlug = new CardView(getActivity());
    if (ThunderPlug.hasThunderPlugVersion()) {
        thunderPlug.setTitle(ThunderPlug.getThunderPlugVersion());
    } else {
        thunderPlug.setTitle(getString(R.string.thunderplug));
    }
    if (ThunderPlug.hasThunderPlugEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.thunderplug));
        enable.setSummary(getString(R.string.thunderplug_summary));
        enable.setChecked(ThunderPlug.isThunderPlugEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                if (isChecked) {
                    SamsungPlug.enableSamsungPlug(false, getActivity());
                    ThunderPlug.enableStateNotifier(true, getActivity());
                    ThunderPlug.enableThunderPlug(true, getActivity());
                } else {
                    ThunderPlug.enableThunderPlug(false, getActivity());
                    ThunderPlug.enableStateNotifier(false, getActivity());
                    SamsungPlug.enableSamsungPlug(true, getActivity());
                }
                refreshHotPlugs();
            }
        });
        thunderPlug.addItem(enable);
        mEnableViews.add(enable);
    }
    if (ThunderPlug.hasThunderPlugSuspendCpus()) {
        SeekBarView suspendCpus = new SeekBarView();
        suspendCpus.setTitle(getString(R.string.min_cpu_online_screen_off));
        suspendCpus.setSummary(getString(R.string.min_cpu_online_screen_off_summary));
        suspendCpus.setMax(CPUFreq.getCpuCount());
        suspendCpus.setMin(1);
        suspendCpus.setProgress(ThunderPlug.getThunderPlugSuspendCpus() - 1);
        suspendCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                ThunderPlug.setThunderPlugSuspendCpus(position + 1, getActivity());
            }
        });
        thunderPlug.addItem(suspendCpus);
    }
    if (ThunderPlug.hasThunderPlugEnduranceLevel()) {
        SelectView enduranceLevel = new SelectView();
        enduranceLevel.setTitle(getString(R.string.endurance_level));
        enduranceLevel.setSummary(getString(R.string.endurance_level_summary));
        enduranceLevel.setItems(Arrays.asList(getResources().getStringArray(R.array.endurance_level_items)));
        enduranceLevel.setItem(ThunderPlug.getThunderPlugEnduranceLevel());
        enduranceLevel.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                ThunderPlug.setThunderPlugEnduranceLevel(position, getActivity());
            }
        });
        thunderPlug.addItem(enduranceLevel);
    }
    if (ThunderPlug.hasThunderPlugSamplingRate()) {
        SeekBarView samplingRate = new SeekBarView();
        samplingRate.setTitle(getString(R.string.sampling_rate));
        samplingRate.setMax(500);
        samplingRate.setMin(10);
        samplingRate.setOffset(10);
        samplingRate.setProgress(ThunderPlug.getThunderPlugSamplingRate() / 10 - 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) {
                ThunderPlug.setThunderPlugSamplingRate((position + 1) * 10, getActivity());
            }
        });
        thunderPlug.addItem(samplingRate);
    }
    if (ThunderPlug.hasThunderPlugLoadThreshold()) {
        SeekBarView loadThreadshold = new SeekBarView();
        loadThreadshold.setTitle(getString(R.string.load_threshold));
        loadThreadshold.setSummary(getString(R.string.load_threshold_summary));
        loadThreadshold.setMin(11);
        loadThreadshold.setProgress(ThunderPlug.getThunderPlugLoadThreshold() - 11);
        loadThreadshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                ThunderPlug.setThunderPlugLoadThreshold(position + 11, getActivity());
            }
        });
        thunderPlug.addItem(loadThreadshold);
    }
    if (ThunderPlug.hasThunderPlugTouchBoost()) {
        SwitchView touchBoost = new SwitchView();
        touchBoost.setTitle(getString(R.string.touch_boost));
        touchBoost.setSummary(getString(R.string.touch_boost_summary));
        touchBoost.setChecked(ThunderPlug.isThunderPlugTouchBoostEnabled());
        touchBoost.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                ThunderPlug.enableThunderPlugTouchBoost(isChecked, getActivity());
            }
        });
        thunderPlug.addItem(touchBoost);
    }
    if (ThunderPlug.hasThunderPlugCpusBoosted()) {
        SeekBarView cpusBoosted = new SeekBarView();
        cpusBoosted.setTitle(getString(R.string.cpus_boosted));
        cpusBoosted.setSummary(getString(R.string.cpus_boosted_summary));
        cpusBoosted.setMax(8);
        cpusBoosted.setMin(1);
        cpusBoosted.setProgress(ThunderPlug.getThunderPlugCpusBoosted() - 1);
        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) {
                ThunderPlug.setThunderPlugLoadCpusBoosted(position + 1, getActivity());
            }
        });
        thunderPlug.addItem(cpusBoosted);
    }
    if (thunderPlug.size() > 0) {
        items.add(thunderPlug);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 48 with SeekBarView

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

the class CPUVoltageCl1Fragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    mVoltages.clear();
    final List<String> freqs = VoltageCl1.getFreqs();
    final List<String> voltages = VoltageCl1.getVoltages();
    final List<String> voltagesStock = VoltageCl1.getStockVoltages();
    if (freqs != null && voltages != null && voltagesStock != null && freqs.size() == voltages.size()) {
        CardView freqCard = new CardView(getActivity());
        freqCard.setTitle(getString(R.string.cpuCl1_volt_control));
        List<String> progress = new ArrayList<>();
        for (float i = -100000f; i < 31250f; i += 6250) {
            String global = String.valueOf(i / VoltageCl1.getOffset());
            progress.add(global);
        }
        seekbarProfInit(mSeekbarProf, freqs, voltages, voltagesStock, progress);
        freqCard.addItem(mSeekbarProf);
        Boolean enableGlobal = Prefs.getBoolean("CpuCl1_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("CpuCl1_global_volts", true, getActivity());
                    Prefs.saveBoolean("CpuCl1_individual_volts", false, getActivity());
                    reload();
                } else {
                    Prefs.saveBoolean("CpuCl1_global_volts", false, getActivity());
                    Prefs.saveBoolean("CpuCl1_individual_volts", true, getActivity());
                    Prefs.saveInt("CpuCl1_seekbarPref_value", 16, getActivity());
                    reload();
                }
            }
        });
        freqCard.addItem(voltControl);
        if (freqCard.size() > 0) {
            items.add(freqCard);
        }
        TitleView tunables = new TitleView();
        tunables.setText(getString(R.string.cpuCl1_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)

Example 49 with SeekBarView

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

the class DvfsFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    CardView dec = new CardView(getActivity());
    dec.setTitle(getString(R.string.dvfs_decision_mode));
    List<String> list = new ArrayList<>();
    list.addAll(Arrays.asList("Battery", "Balance", "Performance"));
    SelectView selectView = new SelectView();
    selectView.setTitle(getString(R.string.dvfs_decision_mode));
    selectView.setSummary(getString(R.string.dvfs_decision_mode_summary));
    selectView.setItems(list);
    selectView.setItem(Dvfs.getDecisionMode());
    selectView.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            Dvfs.setDecisionMode(item, getActivity());
        }
    });
    dec.addItem(selectView);
    if (dec.size() > 0) {
        items.add(dec);
    }
    CardView term = new CardView(getActivity());
    term.setTitle(getString(R.string.dvfs_thermal_control));
    SeekBarView seekBar = new SeekBarView();
    seekBar.setTitle(getString(R.string.dvfs_thermal_control));
    seekBar.setSummary(getString(R.string.dvfs_thermal_control_summary));
    seekBar.setMax(90);
    seekBar.setMin(40);
    seekBar.setProgress(Utils.strToInt(Dvfs.getThermalControl()) - 40);
    seekBar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

        @Override
        public void onStop(SeekBarView seekBarView, int position, String value) {
            Dvfs.setThermalControl(String.valueOf(position + 40), getActivity());
        }

        @Override
        public void onMove(SeekBarView seekBarView, int position, String value) {
        }
    });
    term.addItem(seekBar);
    if (term.size() > 0) {
        items.add(term);
    }
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) ArrayList(java.util.ArrayList) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 50 with SeekBarView

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

the class EntropyFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    int ps = Entropy.getPoolsize();
    mAvailable = new DescriptionView();
    mAvailable.setTitle(getString(R.string.available));
    mAvailable.setSummary(getAvailableDescription(Entropy.getAvailable(), ps));
    items.add(mAvailable);
    mPoolSize = new DescriptionView();
    mPoolSize.setTitle(getString(R.string.poolsize));
    mPoolSize.setSummary(String.valueOf(ps));
    items.add(mPoolSize);
    SeekBarView read = new SeekBarView();
    read.setTitle(getString(R.string.read));
    read.setMax(4096);
    read.setMin(64);
    read.setOffset(64);
    read.setProgress(Entropy.getRead() / 64 - 1);
    read.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

        @Override
        public void onStop(SeekBarView seekBarView, int position, String value) {
            Entropy.setRead((position + 1) * 64, getActivity());
        }

        @Override
        public void onMove(SeekBarView seekBarView, int position, String value) {
        }
    });
    items.add(read);
    SeekBarView write = new SeekBarView();
    write.setTitle(getString(R.string.write));
    write.setMax(4096);
    write.setMin(64);
    write.setOffset(64);
    write.setProgress(Entropy.getWrite() / 64 - 1);
    write.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

        @Override
        public void onStop(SeekBarView seekBarView, int position, String value) {
            Entropy.setWrite((position + 1) * 64, getActivity());
        }

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

Aggregations

SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)53 SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)31 CardView (com.moro.mtweaks.views.recyclerview.CardView)23 ArrayList (java.util.ArrayList)23 TitleView (com.moro.mtweaks.views.recyclerview.TitleView)18 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)14 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)12 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)4 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)2 Vibrator (android.os.Vibrator)1 Controls (com.moro.mtweaks.database.tools.customcontrols.Controls)1 Wakelocks (com.moro.mtweaks.utils.kernel.misc.Wakelocks)1 CustomControlException (com.moro.mtweaks.utils.tools.customcontrols.CustomControlException)1 GenericSelectView (com.moro.mtweaks.views.recyclerview.GenericSelectView)1 ErrorView (com.moro.mtweaks.views.recyclerview.customcontrols.ErrorView)1 List (java.util.List)1