Search in sources :

Example 1 with FrequencyButtonView

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

the class OverallFragment method frequenciesInit.

private void frequenciesInit(List<RecyclerViewItem> items) {
    FrequencyButtonView frequencyButtonView = new FrequencyButtonView();
    frequencyButtonView.setRefreshListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            updateFrequency();
        }
    });
    frequencyButtonView.setResetListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            CpuStateMonitor cpuStateMonitor = mCpuSpyBig.getCpuStateMonitor();
            CpuStateMonitor cpuStateMonitorLITTLE = null;
            if (mCpuSpyLITTLE != null) {
                cpuStateMonitorLITTLE = mCpuSpyLITTLE.getCpuStateMonitor();
            }
            try {
                cpuStateMonitor.setOffsets();
                if (cpuStateMonitorLITTLE != null) {
                    cpuStateMonitorLITTLE.setOffsets();
                }
            } catch (CpuStateMonitor.CpuStateMonitorException ignored) {
            }
            mCpuSpyBig.saveOffsets(getActivity());
            if (mCpuSpyLITTLE != null) {
                mCpuSpyLITTLE.saveOffsets(getActivity());
            }
            updateView(cpuStateMonitor, mFreqBig);
            if (cpuStateMonitorLITTLE != null) {
                updateView(cpuStateMonitorLITTLE, mFreqLITTLE);
            }
            adjustScrollPosition();
        }
    });
    frequencyButtonView.setRestoreListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            CpuStateMonitor cpuStateMonitor = mCpuSpyBig.getCpuStateMonitor();
            CpuStateMonitor cpuStateMonitorLITTLE = null;
            if (mCpuSpyLITTLE != null) {
                cpuStateMonitorLITTLE = mCpuSpyLITTLE.getCpuStateMonitor();
            }
            cpuStateMonitor.removeOffsets();
            if (cpuStateMonitorLITTLE != null) {
                cpuStateMonitorLITTLE.removeOffsets();
            }
            mCpuSpyBig.saveOffsets(getActivity());
            if (mCpuSpyLITTLE != null) {
                mCpuSpyLITTLE.saveOffsets(getActivity());
            }
            updateView(cpuStateMonitor, mFreqBig);
            if (mCpuSpyLITTLE != null) {
                updateView(cpuStateMonitorLITTLE, mFreqLITTLE);
            }
            adjustScrollPosition();
        }
    });
    items.add(frequencyButtonView);
    mFreqBig = new CardView(getActivity());
    if (CPUFreq.isBigLITTLE()) {
        mFreqBig.setTitle(getString(R.string.cluster_big));
    } else {
        mFreqBig.setFullSpan(true);
    }
    items.add(mFreqBig);
    if (CPUFreq.isBigLITTLE()) {
        mFreqLITTLE = new CardView(getActivity());
        mFreqLITTLE.setTitle(getString(R.string.cluster_little));
        items.add(mFreqLITTLE);
    }
    mCpuSpyBig = new CpuSpyApp(CPUFreq.getBigCpu(), getActivity());
    if (CPUFreq.isBigLITTLE()) {
        mCpuSpyLITTLE = new CpuSpyApp(CPUFreq.getLITTLECpu(), getActivity());
    }
    updateFrequency();
}
Also used : FrequencyButtonView(com.moro.mtweaks.views.recyclerview.overallstatistics.FrequencyButtonView) CpuStateMonitor(com.bvalosek.cpuspy.CpuStateMonitor) CpuSpyApp(com.bvalosek.cpuspy.CpuSpyApp) CardView(com.moro.mtweaks.views.recyclerview.CardView) CardView(com.moro.mtweaks.views.recyclerview.CardView) View(android.view.View) TemperatureView(com.moro.mtweaks.views.recyclerview.overallstatistics.TemperatureView) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) StatsView(com.moro.mtweaks.views.recyclerview.StatsView) FrequencyButtonView(com.moro.mtweaks.views.recyclerview.overallstatistics.FrequencyButtonView) TextView(android.widget.TextView) FrequencyTableView(com.moro.mtweaks.views.recyclerview.overallstatistics.FrequencyTableView)

Aggregations

View (android.view.View)1 TextView (android.widget.TextView)1 CpuSpyApp (com.bvalosek.cpuspy.CpuSpyApp)1 CpuStateMonitor (com.bvalosek.cpuspy.CpuStateMonitor)1 CardView (com.moro.mtweaks.views.recyclerview.CardView)1 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)1 StatsView (com.moro.mtweaks.views.recyclerview.StatsView)1 FrequencyButtonView (com.moro.mtweaks.views.recyclerview.overallstatistics.FrequencyButtonView)1 FrequencyTableView (com.moro.mtweaks.views.recyclerview.overallstatistics.FrequencyTableView)1 TemperatureView (com.moro.mtweaks.views.recyclerview.overallstatistics.TemperatureView)1