Search in sources :

Example 1 with XYGraphView

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

the class CPUFragment method freqInit.

private void freqInit(List<RecyclerViewItem> items) {
    CardView bigCard = new CardView(getActivity());
    if (CPUFreq.isBigLITTLE()) {
        bigCard.setTitle(getString(R.string.cluster_big));
    }
    mCPUUsageBig = new XYGraphView();
    mCPUUsageBig.setTitle(getString(R.string.cpu_usage));
    bigCard.addItem(mCPUUsageBig);
    final List<Integer> bigCores = CPUFreq.getBigCpuRange();
    mCoresBig.clear();
    for (final int core : bigCores) {
        SwitchView coreSwitch = new SwitchView();
        coreSwitch.setSummary(getString(R.string.core, core + 1));
        mCoresBig.put(core, coreSwitch);
        bigCard.addItem(coreSwitch);
    }
    mCPUMaxBig = new SelectView();
    mCPUMaxBig.setTitle(getString(R.string.cpu_max_freq));
    mCPUMaxBig.setSummary(getString(R.string.cpu_max_freq_summary));
    mCPUMaxBig.setItems(CPUFreq.getAdjustedFreq(getActivity()));
    mCPUMaxBig.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            CPUFreq.setMaxFreq(CPUFreq.getFreqs().get(position), bigCores.get(0), bigCores.get(bigCores.size() - 1), getActivity());
        }
    });
    bigCard.addItem(mCPUMaxBig);
    mCPUMinBig = new SelectView();
    mCPUMinBig.setTitle(getString(R.string.cpu_min_freq));
    mCPUMinBig.setSummary(getString(R.string.cpu_min_freq_summary));
    mCPUMinBig.setItems(CPUFreq.getAdjustedFreq(getActivity()));
    mCPUMinBig.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            CPUFreq.setMinFreq(CPUFreq.getFreqs().get(position), bigCores.get(0), bigCores.get(bigCores.size() - 1), getActivity());
        }
    });
    bigCard.addItem(mCPUMinBig);
    if (CPUFreq.hasMaxScreenOffFreq()) {
        mCPUMaxScreenOffBig = new SelectView();
        mCPUMaxScreenOffBig.setTitle(getString(R.string.cpu_max_screen_off_freq));
        mCPUMaxScreenOffBig.setSummary(getString(R.string.cpu_max_screen_off_freq_summary));
        mCPUMaxScreenOffBig.setItems(CPUFreq.getAdjustedFreq(getActivity()));
        mCPUMaxScreenOffBig.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                CPUFreq.setMaxScreenOffFreq(CPUFreq.getFreqs().get(position), bigCores.get(0), bigCores.get(bigCores.size() - 1), getActivity());
            }
        });
        bigCard.addItem(mCPUMaxScreenOffBig);
    }
    mCPUGovernorBig = new SelectView();
    mCPUGovernorBig.setTitle(getString(R.string.cpu_governor));
    mCPUGovernorBig.setSummary(getString(R.string.cpu_governor_summary));
    mCPUGovernorBig.setItems(CPUFreq.getGovernors());
    mCPUGovernorBig.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            CPUFreq.setGovernor(item, bigCores.get(0), bigCores.get(bigCores.size() - 1), getActivity());
        }
    });
    bigCard.addItem(mCPUGovernorBig);
    DescriptionView governorTunablesBig = new DescriptionView();
    governorTunablesBig.setTitle(getString(R.string.cpu_governor_tunables));
    governorTunablesBig.setSummary(getString(R.string.governor_tunables_summary));
    governorTunablesBig.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {

        @Override
        public void onClick(RecyclerViewItem item) {
            showGovernorTunables(bigCores.get(0), bigCores.get(bigCores.size() - 1));
        }
    });
    bigCard.addItem(governorTunablesBig);
    items.add(bigCard);
    if (CPUFreq.isBigLITTLE()) {
        CardView LITTLECard = new CardView(getActivity());
        LITTLECard.setTitle(getString(R.string.cluster_little));
        mCPUUsageLITTLE = new XYGraphView();
        mCPUUsageLITTLE.setTitle(getString(R.string.cpu_usage));
        LITTLECard.addItem(mCPUUsageLITTLE);
        final List<Integer> LITTLECores = CPUFreq.getLITTLECpuRange();
        mCoresLITTLE.clear();
        for (final int core : LITTLECores) {
            SwitchView coreSwitch = new SwitchView();
            coreSwitch.setSummary(getString(R.string.core, core + 1));
            mCoresLITTLE.put(core, coreSwitch);
            LITTLECard.addItem(coreSwitch);
        }
        mCPUMaxLITTLE = new SelectView();
        mCPUMaxLITTLE.setTitle(getString(R.string.cpu_max_freq));
        mCPUMaxLITTLE.setSummary(getString(R.string.cpu_max_freq_summary));
        mCPUMaxLITTLE.setItems(CPUFreq.getAdjustedFreq(CPUFreq.getLITTLECpu(), getActivity()));
        mCPUMaxLITTLE.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                CPUFreq.setMaxFreq(CPUFreq.getFreqs(CPUFreq.getLITTLECpu()).get(position), LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1), getActivity());
            }
        });
        LITTLECard.addItem(mCPUMaxLITTLE);
        mCPUMinLITTLE = new SelectView();
        mCPUMinLITTLE.setTitle(getString(R.string.cpu_min_freq));
        mCPUMinLITTLE.setSummary(getString(R.string.cpu_min_freq_summary));
        mCPUMinLITTLE.setItems(CPUFreq.getAdjustedFreq(CPUFreq.getLITTLECpu(), getActivity()));
        mCPUMinLITTLE.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                CPUFreq.setMinFreq(CPUFreq.getFreqs(CPUFreq.getLITTLECpu()).get(position), LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1), getActivity());
            }
        });
        LITTLECard.addItem(mCPUMinLITTLE);
        if (CPUFreq.hasMaxScreenOffFreq(CPUFreq.getLITTLECpu())) {
            mCPUMaxScreenOffLITTLE = new SelectView();
            mCPUMaxScreenOffLITTLE.setTitle(getString(R.string.cpu_max_screen_off_freq));
            mCPUMaxScreenOffLITTLE.setSummary(getString(R.string.cpu_max_screen_off_freq_summary));
            mCPUMaxScreenOffLITTLE.setItems(CPUFreq.getAdjustedFreq(CPUFreq.getLITTLECpu(), getActivity()));
            mCPUMaxScreenOffLITTLE.setOnItemSelected(new SelectView.OnItemSelected() {

                @Override
                public void onItemSelected(SelectView selectView, int position, String item) {
                    CPUFreq.setMaxScreenOffFreq(CPUFreq.getFreqs(CPUFreq.getLITTLECpu()).get(position), LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1), getActivity());
                }
            });
            LITTLECard.addItem(mCPUMaxScreenOffLITTLE);
        }
        mCPUGovernorLITTLE = new SelectView();
        mCPUGovernorLITTLE.setTitle(getString(R.string.cpu_governor));
        mCPUGovernorLITTLE.setSummary(getString(R.string.cpu_governor_summary));
        mCPUGovernorLITTLE.setItems(CPUFreq.getGovernors());
        mCPUGovernorLITTLE.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                CPUFreq.setGovernor(item, LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1), getActivity());
            }
        });
        LITTLECard.addItem(mCPUGovernorLITTLE);
        DescriptionView governorTunablesLITTLE = new DescriptionView();
        governorTunablesLITTLE.setTitle(getString(R.string.cpu_governor_tunables));
        governorTunablesLITTLE.setSummary(getString(R.string.governor_tunables_summary));
        governorTunablesLITTLE.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {

            @Override
            public void onClick(RecyclerViewItem item) {
                showGovernorTunables(LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1));
            }
        });
        LITTLECard.addItem(governorTunablesLITTLE);
        items.add(LITTLECard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) XYGraphView(com.moro.mtweaks.views.recyclerview.XYGraphView) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 2 with XYGraphView

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

Aggregations

CardView (com.moro.mtweaks.views.recyclerview.CardView)2 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)2 XYGraphView (com.moro.mtweaks.views.recyclerview.XYGraphView)2 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)1 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)1 SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)1