Search in sources :

Example 51 with SeekBarView

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

the class GPUFragment method voltageInit.

private void voltageInit(List<RecyclerViewItem> items) {
    List<Integer> freqs = GPUFreq.getAvailableFreqs();
    List<String> voltages = GPUFreq.getVoltages();
    List<String> voltagesStock = GPUFreq.getStockVoltages();
    if (freqs != null && voltages != null && voltagesStock != null && freqs.size() == voltages.size()) {
        CardView voltCard = new CardView(getActivity());
        voltCard.setTitle(getString(R.string.gpu_voltage));
        List<String> progress = new ArrayList<>();
        for (float i = -100000f; i < 31250f; i += 6250) {
            String global = String.valueOf(i / GPUFreq.getVoltageOffset());
            progress.add(global);
        }
        seekbarProfInit(mSeekbarProf, freqs, voltages, voltagesStock, progress);
        voltCard.addItem(mSeekbarProf);
        Boolean enableGlobal = Prefs.getBoolean("gpu_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("gpu_global_volts", true, getActivity());
                    Prefs.saveBoolean("gpu_individual_volts", false, getActivity());
                    reload();
                } else {
                    Prefs.saveBoolean("gpu_global_volts", false, getActivity());
                    Prefs.saveBoolean("gpu_individual_volts", true, getActivity());
                    Prefs.saveInt("gpu_seekbarPref_value", 16, getActivity());
                    reload();
                }
            }
        });
        voltCard.addItem(voltControl);
        if (voltCard.size() > 0) {
            items.add(voltCard);
        }
        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 52 with SeekBarView

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

the class HmpFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    CardView card = new CardView(getActivity());
    card.setTitle(getString(R.string.hmp_long));
    DescriptionView hmp = new DescriptionView();
    hmp.setSummary(getString(R.string.hmp_desc));
    card.addItem(hmp);
    if (Hmp.hasUpThreshold()) {
        mUpThreshold = new SeekBarView();
        mUpThreshold.setTitle(getString(R.string.hmp_up_threshold));
        mUpThreshold.setSummary(getString(R.string.hmp_up_threshold_summary));
        mUpThreshold.setMax(1024);
        mUpThreshold.setMin(1);
        mUpThreshold.setProgress(Utils.strToInt(Hmp.getUpThreshold()) - 1);
        mUpThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        card.addItem(mUpThreshold);
    }
    if (Hmp.hasDownThreshold()) {
        mDownThreshold = new SeekBarView();
        mDownThreshold.setTitle(getString(R.string.hmp_down_threshold));
        mDownThreshold.setSummary(getString(R.string.hmp_down_threshold_summary));
        mDownThreshold.setMax(1024);
        mDownThreshold.setMin(1);
        mDownThreshold.setProgress(Utils.strToInt(Hmp.getDownThreshold()) - 1);
        mDownThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        card.addItem(mDownThreshold);
    }
    if (card.size() > 0) {
        items.add(card);
    }
    if (Hmp.hasUpThreshold() && Hmp.hasDownThreshold()) {
        TitleView profilesTitle = new TitleView();
        profilesTitle.setText(getString(R.string.profile));
        items.add(profilesTitle);
        for (int id : sProfiles.keySet()) {
            DescriptionView profile = new DescriptionView();
            profile.setTitle(getString(id));
            profile.setSummary(sProfiles.get(id));
            profile.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {

                @Override
                public void onClick(RecyclerViewItem item) {
                    Hmp.setHmpProfile(((DescriptionView) item).getSummary().toString(), getActivity());
                    refreshHmpProfile();
                }
            });
            items.add(profile);
        }
    }
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) CardView(com.moro.mtweaks.views.recyclerview.CardView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

Example 53 with SeekBarView

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

the class IOFragment method storageInit.

private void storageInit(final IO.Storage storage, List<RecyclerViewItem> items) {
    CardView io = new CardView(getActivity());
    io.setTitle(getString(storage == IO.Storage.Internal ? R.string.internal_storage : R.string.external_storage));
    if (IO.hasScheduler(storage)) {
        SelectView scheduler = new SelectView();
        scheduler.setTitle(getString(R.string.scheduler));
        scheduler.setSummary(getString(R.string.scheduler_summary));
        scheduler.setItems(IO.getSchedulers(storage));
        scheduler.setItem(IO.getScheduler(storage));
        scheduler.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                IO.setScheduler(storage, item, getActivity());
            }
        });
        io.addItem(scheduler);
        DescriptionView tunable = new DescriptionView();
        tunable.setTitle(getString(R.string.scheduler_tunable));
        tunable.setSummary(getString(R.string.scheduler_tunable_summary));
        tunable.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {

            @Override
            public void onClick(RecyclerViewItem item) {
                showTunables(IO.getScheduler(storage), IO.getIOSched(storage));
            }
        });
        io.addItem(tunable);
    }
    if (IO.hasReadahead(storage)) {
        SeekBarView readahead = new SeekBarView();
        readahead.setTitle(getString(R.string.read_ahead));
        readahead.setSummary(getString(R.string.read_ahead_summary));
        readahead.setUnit(getString(R.string.kb));
        readahead.setMax(8192);
        readahead.setMin(128);
        readahead.setOffset(128);
        readahead.setProgress(IO.getReadahead(storage) / 128 - 1);
        readahead.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                IO.setReadahead(storage, (position + 1) * 128, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        io.addItem(readahead);
    }
    if (IO.hasRotational(storage)) {
        SwitchView rotational = new SwitchView();
        rotational.setTitle(getString(R.string.rotational));
        rotational.setSummary(getString(R.string.rotational_summary));
        rotational.setChecked(IO.isRotationalEnabled(storage));
        rotational.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                IO.enableRotational(storage, isChecked, getActivity());
            }
        });
        io.addItem(rotational);
    }
    if (IO.hasIOStats(storage)) {
        SwitchView iostats = new SwitchView();
        iostats.setTitle(getString(R.string.iostats));
        iostats.setSummary(getString(R.string.iostats_summary));
        iostats.setChecked(IO.isIOStatsEnabled(storage));
        iostats.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                IO.enableIOstats(storage, isChecked, getActivity());
            }
        });
        io.addItem(iostats);
    }
    if (IO.hasAddRandom(storage)) {
        SwitchView addRandom = new SwitchView();
        addRandom.setTitle(getString(R.string.add_random));
        addRandom.setSummary(getString(R.string.add_random_summary));
        addRandom.setChecked(IO.isAddRandomEnabled(storage));
        addRandom.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                IO.enableAddRandom(storage, isChecked, getActivity());
            }
        });
        io.addItem(addRandom);
    }
    if (IO.hasRqAffinity(storage)) {
        SeekBarView rqAffinity = new SeekBarView();
        rqAffinity.setTitle(getString(R.string.rq_affitiny));
        rqAffinity.setSummary(getString(R.string.rq_affinity_summary));
        rqAffinity.setMax(2);
        rqAffinity.setProgress(IO.getRqAffinity(storage));
        rqAffinity.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                IO.setRqAffinity(storage, position, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        io.addItem(rqAffinity);
    }
    if (IO.hasNomerges(storage)) {
        SeekBarView Nomerges = new SeekBarView();
        Nomerges.setTitle(getString(R.string.nomerges));
        Nomerges.setSummary(getString(R.string.nomerges_summary));
        Nomerges.setMax(2);
        Nomerges.setProgress(IO.getNomerges(storage));
        Nomerges.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                IO.setNomerges(storage, position, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        io.addItem(Nomerges);
    }
    if (IO.hasNrRequests(storage)) {
        GenericSelectView2 NrRequests = new GenericSelectView2();
        NrRequests.setTitle(getString(R.string.nr_requests));
        NrRequests.setValue(IO.getNrRequests(storage));
        NrRequests.setValueRaw(NrRequests.getValue());
        NrRequests.setInputType(InputType.TYPE_CLASS_NUMBER);
        NrRequests.setOnGenericValueListener(new GenericSelectView2.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView2 genericSelectView, String value) {
                IO.setNrRequests(storage, value, getActivity());
                genericSelectView.setValue(value);
            }
        });
        io.addItem(NrRequests);
    }
    if (io.size() > 0) {
        items.add(io);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) GenericSelectView2(com.moro.mtweaks.views.recyclerview.GenericSelectView2) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) 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