Search in sources :

Example 6 with SeekBarView

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

the class SoundFragment method handsetMicrophoneGainInit.

private void handsetMicrophoneGainInit(List<RecyclerViewItem> items) {
    SeekBarView handsetMicrophoneGain = new SeekBarView();
    handsetMicrophoneGain.setTitle(getString(R.string.handset_microphone_gain));
    handsetMicrophoneGain.setItems(Sound.getHandsetMicrophoneGainLimits());
    handsetMicrophoneGain.setProgress(Sound.getHandsetMicrophoneGainLimits().indexOf(Sound.getHandsetMicrophoneGain()));
    handsetMicrophoneGain.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 7 with SeekBarView

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

the class SoundFragment method speakerGainInit.

private void speakerGainInit(List<RecyclerViewItem> items) {
    SeekBarView speakerGain = new SeekBarView();
    speakerGain.setTitle(getString(R.string.speaker_gain));
    speakerGain.setItems(Sound.getSpeakerGainLimits());
    speakerGain.setProgress(Sound.getSpeakerGainLimits().indexOf(Sound.getSpeakerGain()));
    speakerGain.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 8 with SeekBarView

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

the class SoundFragment method volumeGainInit.

private void volumeGainInit(List<RecyclerViewItem> items) {
    SeekBarView volumeGain = new SeekBarView();
    volumeGain.setTitle(getString(R.string.volume_gain));
    volumeGain.setItems(Sound.getVolumeGainLimits());
    volumeGain.setProgress(Sound.getVolumeGainLimits().indexOf(Sound.getVolumeGain()));
    volumeGain.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 9 with SeekBarView

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

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

the class CPUHotplugFragment method autoSmpInit.

private void autoSmpInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> autoSmp = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(R.string.autosmp));
    if (AutoSmp.hasAutoSmpEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.autosmp));
        enable.setSummary(getString(R.string.autosmp_summary));
        enable.setChecked(AutoSmp.isAutoSmpEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                AutoSmp.enableAutoSmp(isChecked, getActivity());
            }
        });
        autoSmp.add(enable);
        mEnableViews.add(enable);
    }
    if (AutoSmp.hasAutoSmpCpufreqDown()) {
        SeekBarView cpuFreqDown = new SeekBarView();
        cpuFreqDown.setTitle(getString(R.string.downrate_limits));
        cpuFreqDown.setUnit("%");
        cpuFreqDown.setProgress(AutoSmp.getAutoSmpCpufreqDown());
        cpuFreqDown.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpCpufreqDown(position, getActivity());
            }
        });
        autoSmp.add(cpuFreqDown);
    }
    if (AutoSmp.hasAutoSmpCpufreqUp()) {
        SeekBarView cpuFreqUp = new SeekBarView();
        cpuFreqUp.setTitle(getString(R.string.uprate_limits));
        cpuFreqUp.setUnit("%");
        cpuFreqUp.setProgress(AutoSmp.getAutoSmpCpufreqUp());
        cpuFreqUp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpCpufreqUp(position, getActivity());
            }
        });
        autoSmp.add(cpuFreqUp);
    }
    if (AutoSmp.hasAutoSmpCycleDown()) {
        SeekBarView cycleDown = new SeekBarView();
        cycleDown.setTitle(getString(R.string.cycle_down));
        cycleDown.setSummary(getString(R.string.cycle_down_summary));
        cycleDown.setMax(CPUFreq.getCpuCount());
        cycleDown.setProgress(AutoSmp.getAutoSmpCycleDown());
        cycleDown.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpCycleDown(position, getActivity());
            }
        });
        autoSmp.add(cycleDown);
    }
    if (AutoSmp.hasAutoSmpCycleUp()) {
        SeekBarView cycleUp = new SeekBarView();
        cycleUp.setTitle(getString(R.string.cycle_up));
        cycleUp.setSummary(getString(R.string.cycle_up_summary));
        cycleUp.setMax(CPUFreq.getCpuCount());
        cycleUp.setProgress(AutoSmp.getAutoSmpCycleUp());
        cycleUp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpCycleUp(position, getActivity());
            }
        });
        autoSmp.add(cycleUp);
    }
    if (AutoSmp.hasAutoSmpDelay()) {
        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(500);
        delay.setProgress(AutoSmp.getAutoSmpDelay());
        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) {
                AutoSmp.setAutoSmpDelay(position, getActivity());
            }
        });
        autoSmp.add(delay);
    }
    if (AutoSmp.hasAutoSmpMaxCpus()) {
        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(AutoSmp.getAutoSmpMaxCpus() - 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) {
                AutoSmp.setAutoSmpMaxCpus(position + 1, getActivity());
            }
        });
        autoSmp.add(maxCpus);
    }
    if (AutoSmp.hasAutoSmpMinCpus()) {
        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(AutoSmp.getAutoSmpMinCpus() - 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) {
                AutoSmp.setAutoSmpMinCpus(position + 1, getActivity());
            }
        });
        autoSmp.add(minCpus);
    }
    if (AutoSmp.hasAutoSmpScroffSingleCore()) {
        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(AutoSmp.isAutoSmpScroffSingleCoreEnabled());
        scroffSingleCore.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                AutoSmp.enableAutoSmpScroffSingleCoreActive(isChecked, getActivity());
            }
        });
        autoSmp.add(scroffSingleCore);
    }
    if (autoSmp.size() > 0) {
        items.add(title);
        items.addAll(autoSmp);
    }
}
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)

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