use of com.bvalosek.cpuspy.CpuSpyApp 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();
}
Aggregations