Search in sources :

Example 26 with SwitchView

use of com.moro.mtweaks.views.recyclerview.SwitchView 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)

Example 27 with SwitchView

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

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

the class WakeFrament method gestureInit.

private void gestureInit(List<RecyclerViewItem> items) {
    List<String> gestures = Gestures.getMenu(getActivity());
    for (int i = 0; i < gestures.size(); i++) {
        SwitchView gesture = new SwitchView();
        gesture.setSummary(gestures.get(i));
        gesture.setChecked(Gestures.isEnabled(i));
        final int position = i;
        gesture.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Gestures.enable(isChecked, position, getActivity());
            }
        });
        items.add(gesture);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView)

Example 29 with SwitchView

use of com.moro.mtweaks.views.recyclerview.SwitchView 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)

Example 30 with SwitchView

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

the class LEDFragment method testInit.

private void testInit(List<RecyclerViewItem> items) {
    SwitchView test = new SwitchView();
    test.setTitle(getString(R.string.test));
    test.setSummary(getString(R.string.led_test_summary));
    test.setChecked(Sec.isTestingPattern());
    test.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Sec.testPattern(isChecked);
        }
    });
    items.add(test);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView)

Aggregations

SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)64 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)31 CardView (com.moro.mtweaks.views.recyclerview.CardView)23 ArrayList (java.util.ArrayList)19 TitleView (com.moro.mtweaks.views.recyclerview.TitleView)16 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)15 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)14 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)4 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)3 GenericSelectView (com.moro.mtweaks.views.recyclerview.GenericSelectView)2 Intent (android.content.Intent)1 Controls (com.moro.mtweaks.database.tools.customcontrols.Controls)1 BoefflaWakelock (com.moro.mtweaks.utils.kernel.boefflawakelock.BoefflaWakelock)1 Wakelocks (com.moro.mtweaks.utils.kernel.misc.Wakelocks)1 CustomControlException (com.moro.mtweaks.utils.tools.customcontrols.CustomControlException)1 XYGraphView (com.moro.mtweaks.views.recyclerview.XYGraphView)1 ErrorView (com.moro.mtweaks.views.recyclerview.customcontrols.ErrorView)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1