Search in sources :

Example 16 with SeekBarView

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

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

the class WakeFrament method vibrationInit.

private void vibrationInit(List<RecyclerViewItem> items) {
    if (Misc.hasVibration()) {
        SwitchView vibration = new SwitchView();
        vibration.setSummary(getString(R.string.vibration));
        vibration.setChecked(Misc.isVibrationEnabled());
        vibration.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableVibration(isChecked, getActivity());
            }
        });
        items.add(vibration);
    }
    if (Misc.hasVibVibration()) {
        SeekBarView vibVibration = new SeekBarView();
        vibVibration.setTitle(getString(R.string.vibration_strength));
        vibVibration.setUnit("%");
        vibVibration.setMax(90);
        vibVibration.setProgress(Misc.getVibVibration());
        vibVibration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 18 with SeekBarView

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

the class WakeFrament method timeoutInit.

private void timeoutInit(List<RecyclerViewItem> items) {
    List<String> list = new ArrayList<>();
    list.add(getString(R.string.disabled));
    for (int i = 1; i <= Misc.getTimeoutMax(); i++) list.add(i + getString(R.string.min));
    SeekBarView timeout = new SeekBarView();
    timeout.setTitle(getString(R.string.timeout));
    timeout.setSummary(getString(R.string.timeout_summary));
    timeout.setItems(list);
    timeout.setProgress(Misc.getTimeout());
    timeout.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 19 with SeekBarView

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

the class WakeFrament method areaInit.

private void areaInit(List<RecyclerViewItem> items) {
    CardView areaCard = new CardView(getActivity());
    areaCard.setTitle(getString(R.string.area));
    if (Dt2s.hasWidth()) {
        final int w = getResources().getDisplayMetrics().widthPixels;
        SeekBarView width = new SeekBarView();
        width.setTitle(getString(R.string.width));
        width.setUnit(getString(R.string.px));
        width.setMax(w);
        width.setMin(Math.round(w / 28.8f));
        width.setProgress(Dt2s.getWidth() - Math.round(w / 28.8f));
        width.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Dt2s.setWidth(position + Math.round(w / 28.8f), getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        areaCard.addItem(width);
    }
    if (Dt2s.hasHeight()) {
        final int h = getResources().getDisplayMetrics().heightPixels;
        SeekBarView height = new SeekBarView();
        height.setTitle(getString(R.string.height));
        height.setUnit(getString(R.string.px));
        height.setMax(h);
        height.setMin(Math.round(h / 51.2f));
        height.setProgress(Dt2s.getHeight() - Math.round(h / 51.2f));
        height.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Dt2s.setHeight(position + Math.round(h / 51.2f), getActivity());
            }

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

Example 20 with SeekBarView

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

the class KSMFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    infoInit(items);
    CardView ksm = new CardView(getActivity());
    if (KSM.isUKSM()) {
        ksm.setTitle(getString(R.string.uksm_name));
    } else {
        ksm.setTitle(getString(R.string.ksm));
    }
    ksm.setFullSpan(true);
    if (KSM.hasEnable()) {
        SwitchView enable = new SwitchView();
        if (KSM.isUKSM()) {
            enable.setTitle(getString(R.string.uksm_name));
        } else {
            enable.setTitle(getString(R.string.ksm));
        }
        enable.setSummary(getString(R.string.ksm_summary));
        enable.setChecked(KSM.isEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                KSM.enableKsm(isChecked, getActivity());
            }
        });
        ksm.addItem(enable);
    }
    if (KSM.hasCpuGovernor()) {
        SelectView governor = new SelectView();
        governor.setTitle(getString(R.string.uksm_governor));
        governor.setSummary(getString(R.string.uksm_governor_summary));
        governor.setItems(KSM.getCpuGovernors());
        governor.setItem(KSM.getCpuGovernor());
        governor.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                KSM.setCpuGovernor(item, getActivity());
            }
        });
        ksm.addItem(governor);
    }
    if (KSM.hasDeferredTimer()) {
        SwitchView deferredTimer = new SwitchView();
        deferredTimer.setTitle(getString(R.string.deferred_timer));
        deferredTimer.setSummary(getString(R.string.deferred_timer_summary));
        deferredTimer.setChecked(KSM.isDeferredTimerEnabled());
        deferredTimer.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                KSM.enableDeferredTimer(isChecked, getActivity());
            }
        });
        ksm.addItem(deferredTimer);
    }
    if (KSM.hasPagesToScan()) {
        SeekBarView pagesToScan = new SeekBarView();
        pagesToScan.setTitle(getString(R.string.pages_to_scan));
        pagesToScan.setMax(1024);
        pagesToScan.setProgress(KSM.getPagesToScan());
        pagesToScan.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        ksm.addItem(pagesToScan);
    }
    if (KSM.hasSleepMilliseconds()) {
        SeekBarView sleepMilliseconds = new SeekBarView();
        sleepMilliseconds.setTitle(getString(R.string.sleep_milliseconds));
        sleepMilliseconds.setUnit(getString(R.string.ms));
        sleepMilliseconds.setMax(5000);
        sleepMilliseconds.setOffset(50);
        sleepMilliseconds.setProgress(KSM.getSleepMilliseconds() / 50);
        sleepMilliseconds.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                KSM.setSleepMilliseconds(position * 50, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        ksm.addItem(sleepMilliseconds);
    }
    if (KSM.hasMaxCpuPercentage()) {
        SeekBarView maxCpuPercentage = new SeekBarView();
        maxCpuPercentage.setTitle(getString(R.string.max_cpu_usage));
        maxCpuPercentage.setSummary(getString(R.string.max_cpu_usage_summary));
        maxCpuPercentage.setUnit("%");
        maxCpuPercentage.setProgress(KSM.getMaxCpuPercentage());
        maxCpuPercentage.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        ksm.addItem(maxCpuPercentage);
    }
    if (ksm.size() > 0) {
        items.add(ksm);
    }
}
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)

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