Search in sources :

Example 26 with SelectView

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

the class GPUFragment method adrenoboostInit.

private void adrenoboostInit(List<RecyclerViewItem> items) {
    CardView abCard = new CardView(getActivity());
    abCard.setTitle(getString(R.string.gpu_adreno_boost_title));
    SelectView aB = new SelectView();
    aB.setTitle(getString(R.string.gpu_adreno_boost_title));
    aB.setSummary(getString(R.string.gpu_adreno_boost_summary));
    aB.setItems(Arrays.asList(getResources().getStringArray(R.array.gpu_adreno_boost)));
    aB.setItem(AdrenoBoost.getAdrenoBoost(getActivity()));
    aB.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            AdrenoBoost.setAdrenoBoost(position, getActivity());
        }
    });
    abCard.addItem(aB);
    if (abCard.size() > 0) {
        items.add(abCard);
    }
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 27 with SelectView

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

the class GPUFragment method freqInit.

private void freqInit(List<RecyclerViewItem> items) {
    CardView freqCard = new CardView(getActivity());
    freqCard.setTitle(getString(R.string.frequencies));
    if (GPUFreq.hasCurFreq() && GPUFreq.getAvailableFreqs() != null) {
        mCurFreq = new XYGraphView();
        mCurFreq.setTitle(getString(R.string.gpu_freq));
        freqCard.addItem(mCurFreq);
    }
    if (GPUFreq.hasMaxFreq() && GPUFreq.getAvailableFreqs() != null) {
        SelectView maxFreq = new SelectView();
        maxFreq.setTitle(getString(R.string.gpu_max_freq));
        maxFreq.setSummary(getString(R.string.gpu_max_freq_summary));
        maxFreq.setItems(GPUFreq.getAdjustedFreqs(getActivity()));
        maxFreq.setItem((GPUFreq.getMaxFreq() / GPUFreq.getMaxFreqOffset()) + getString(R.string.mhz));
        maxFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                GPUFreq.setMaxFreq(GPUFreq.getAvailableFreqs().get(position), getActivity());
            }
        });
        freqCard.addItem(maxFreq);
    }
    if (GPUFreq.hasMinFreq() && GPUFreq.getAvailableFreqs() != null) {
        SelectView minFreq = new SelectView();
        minFreq.setTitle(getString(R.string.gpu_min_freq));
        minFreq.setSummary(getString(R.string.gpu_min_freq_summary));
        minFreq.setItems(GPUFreq.getAdjustedFreqs(getActivity()));
        minFreq.setItem((GPUFreq.getMinFreq() / GPUFreq.getMinFreqOffset()) + getString(R.string.mhz));
        minFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                GPUFreq.setMinFreq(GPUFreq.getAvailableFreqs().get(position), getActivity());
            }
        });
        freqCard.addItem(minFreq);
    }
    if (freqCard.size() > 0) {
        items.add(freqCard);
    }
}
Also used : XYGraphView(com.moro.mtweaks.views.recyclerview.XYGraphView) CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 28 with SelectView

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

the class GPUFragment method powerPolicyInit.

private void powerPolicyInit(List<RecyclerViewItem> items) {
    CardView powCard = new CardView(getActivity());
    powCard.setTitle(getString(R.string.gpu_power_policy_card));
    SelectView powPol = new SelectView();
    powPol.setTitle(getString(R.string.gpu_power_policy));
    powPol.setSummary(getString(R.string.gpu_power_policy_summary));
    powPol.setItems(GPUFreq.getPowerPolicies());
    powPol.setItem(GPUFreq.getPowerPolicy());
    powPol.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            GPUFreq.setPowerPolicy(item, getActivity());
        }
    });
    powCard.addItem(powPol);
    if (powCard.size() > 0) {
        items.add(powCard);
    }
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 29 with SelectView

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

SelectView (com.moro.mtweaks.views.recyclerview.SelectView)29 CardView (com.moro.mtweaks.views.recyclerview.CardView)20 SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)14 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)12 ArrayList (java.util.ArrayList)10 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)8 TitleView (com.moro.mtweaks.views.recyclerview.TitleView)7 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)5 GenericSelectView (com.moro.mtweaks.views.recyclerview.GenericSelectView)3 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)2 XYGraphView (com.moro.mtweaks.views.recyclerview.XYGraphView)2