use of com.moro.mtweaks.views.recyclerview.RecyclerViewItem in project MTweaks-KernelAdiutorMOD by morogoku.
the class ScreenFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
restoreValuesInit(items);
screenColorInit(items);
List<RecyclerViewItem> gammas = new ArrayList<>();
if (Gamma.hasKGamma()) {
kgammaInit(gammas);
} else if (Gamma.hasGammaControl()) {
gammacontrolInit(gammas);
} else if (Gamma.hasDsiPanel()) {
dsipanelInit(gammas);
}
if (gammas.size() > 0) {
CardView gamma = new CardView(getActivity());
gamma.setTitle(getString(R.string.gamma));
for (RecyclerViewItem item : gammas) {
gamma.addItem(item);
}
items.add(gamma);
}
lcdBackLightInit(items);
backlightDimmerInit(items);
if (Misc.hasNegativeToggle()) {
negativeToggleInit(items);
}
mdnieGlobalInit(items);
if (Misc.hasGloveMode()) {
gloveModeInit(items);
}
}
use of com.moro.mtweaks.views.recyclerview.RecyclerViewItem in project MTweaks-KernelAdiutorMOD by morogoku.
the class SpectrumFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
final int balColor = ContextCompat.getColor(getContext(), R.color.colorBalance);
final int perColor = ContextCompat.getColor(getContext(), R.color.colorPerformance);
final int batColor = ContextCompat.getColor(getContext(), R.color.colorBattery);
final int gamColor = ContextCompat.getColor(getContext(), R.color.colorGaming);
// CardView Balanced
final CardView card0 = new CardView(getActivity());
card0.setTitle(getString(R.string.spec_balanced));
card0.setExpandable(false);
final DescriptionView desc0 = new DescriptionView();
desc0.setSummary(getString(R.string.spec_balanced_summary));
desc0.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_balanced));
card0.setOnItemClickListener(new CardView.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
cardClick(card0, desc0, 0, balColor);
}
});
card0.addItem(desc0);
items.add(card0);
// CardView Performance
final CardView card1 = new CardView(getActivity());
card1.setTitle(getString(R.string.spec_performance));
card1.setExpandable(false);
final DescriptionView desc1 = new DescriptionView();
desc1.setSummary(getString(R.string.spec_performance_summary));
desc1.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_performance));
card1.setOnItemClickListener(new CardView.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
cardClick(card1, desc1, 1, perColor);
}
});
card1.addItem(desc1);
items.add(card1);
// CardView Battery
final CardView card2 = new CardView(getActivity());
card2.setTitle(getString(R.string.spec_battery));
card2.setExpandable(false);
final DescriptionView desc2 = new DescriptionView();
desc2.setSummary(getString(R.string.spec_battery_summary));
desc2.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_battery));
card2.setOnItemClickListener(new CardView.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
cardClick(card2, desc2, 2, batColor);
}
});
card2.addItem(desc2);
items.add(card2);
// CardView Gaming
final CardView card3 = new CardView(getActivity());
card3.setTitle(getString(R.string.spec_gaming));
card3.setExpandable(false);
final DescriptionView desc3 = new DescriptionView();
desc3.setSummary(getString(R.string.spec_gaming_summary));
desc3.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_game));
card3.setOnItemClickListener(new CardView.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
cardClick(card3, desc3, 3, gamColor);
}
});
card3.addItem(desc3);
items.add(card3);
// Detects the selected profile on launch
int mProfile = Prefs.getInt("spectrum_profile", 0, getActivity());
if (mProfile == 0) {
card0.GrxSetInitSelection(true, balColor);
desc0.GrxSetInitSelection(true, Color.WHITE);
oldCard = card0;
oldDesc = desc0;
} else if (mProfile == 1) {
card1.GrxSetInitSelection(true, perColor);
desc1.GrxSetInitSelection(true, Color.WHITE);
oldCard = card1;
oldDesc = desc1;
} else if (mProfile == 2) {
card2.GrxSetInitSelection(true, batColor);
desc2.GrxSetInitSelection(true, Color.WHITE);
oldCard = card2;
oldDesc = desc2;
} else if (mProfile == 3) {
card3.GrxSetInitSelection(true, gamColor);
desc3.GrxSetInitSelection(true, Color.WHITE);
oldCard = card3;
oldDesc = desc3;
}
}
use of com.moro.mtweaks.views.recyclerview.RecyclerViewItem 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);
}
}
use of com.moro.mtweaks.views.recyclerview.RecyclerViewItem in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUHotplugFragment method makoHotplugInit.
private void makoHotplugInit(List<RecyclerViewItem> items) {
List<RecyclerViewItem> makoHotplug = new ArrayList<>();
TitleView title = new TitleView();
title.setText(getString(R.string.mako_hotplug));
if (MakoHotplug.hasMakoHotplugEnable()) {
SwitchView enable = new SwitchView();
enable.setTitle(getString(R.string.mako_hotplug));
enable.setSummary(getString(R.string.mako_hotplug_summary));
enable.setChecked(MakoHotplug.isMakoHotplugEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
MakoHotplug.enableMakoHotplug(isChecked, getActivity());
}
});
makoHotplug.add(enable);
mEnableViews.add(enable);
}
if (MakoHotplug.hasMakoHotplugCoresOnTouch()) {
SeekBarView coresOnTouch = new SeekBarView();
coresOnTouch.setTitle(getString(R.string.cpus_on_touch));
coresOnTouch.setSummary(getString(R.string.cpus_on_touch_summary));
coresOnTouch.setMax(CPUFreq.getCpuCount());
coresOnTouch.setMin(1);
coresOnTouch.setProgress(MakoHotplug.getMakoHotplugCoresOnTouch() - 1);
coresOnTouch.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MakoHotplug.setMakoHotplugCoresOnTouch(position + 1, getActivity());
}
});
makoHotplug.add(coresOnTouch);
}
if (MakoHotplug.hasMakoHotplugCpuFreqUnplugLimit() && CPUFreq.getFreqs() != null) {
SelectView cpufreqUnplugLimit = new SelectView();
cpufreqUnplugLimit.setSummary(getString(R.string.cpu_freq_unplug_limit));
cpufreqUnplugLimit.setItems(CPUFreq.getAdjustedFreq(getActivity()));
cpufreqUnplugLimit.setItem((MakoHotplug.getMakoHotplugCpuFreqUnplugLimit() / 1000) + getString(R.string.mhz));
cpufreqUnplugLimit.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
MakoHotplug.setMakoHotplugCpuFreqUnplugLimit(CPUFreq.getFreqs().get(position), getActivity());
}
});
makoHotplug.add(cpufreqUnplugLimit);
}
if (MakoHotplug.hasMakoHotplugFirstLevel()) {
SeekBarView firstLevel = new SeekBarView();
firstLevel.setTitle(getString(R.string.first_level));
firstLevel.setSummary(getString(R.string.first_level_summary));
firstLevel.setUnit("%");
firstLevel.setProgress(MakoHotplug.getMakoHotplugFirstLevel());
firstLevel.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MakoHotplug.setMakoHotplugFirstLevel(position, getActivity());
}
});
makoHotplug.add(firstLevel);
}
if (MakoHotplug.hasMakoHotplugHighLoadCounter()) {
SeekBarView highLoadCounter = new SeekBarView();
highLoadCounter.setTitle(getString(R.string.high_load_counter));
highLoadCounter.setProgress(MakoHotplug.getMakoHotplugHighLoadCounter());
highLoadCounter.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MakoHotplug.setMakoHotplugHighLoadCounter(position, getActivity());
}
});
makoHotplug.add(highLoadCounter);
}
if (MakoHotplug.hasMakoHotplugLoadThreshold()) {
SeekBarView loadThreshold = new SeekBarView();
loadThreshold.setTitle(getString(R.string.load_threshold));
loadThreshold.setSummary(getString(R.string.load_threshold_summary));
loadThreshold.setUnit("%");
loadThreshold.setProgress(MakoHotplug.getMakoHotplugLoadThreshold());
loadThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MakoHotplug.setMakoHotplugLoadThreshold(position, getActivity());
}
});
makoHotplug.add(loadThreshold);
}
if (MakoHotplug.hasMakoHotplugMaxLoadCounter()) {
SeekBarView maxLoadCounter = new SeekBarView();
maxLoadCounter.setTitle(getString(R.string.max_load_counter));
maxLoadCounter.setProgress(MakoHotplug.getMakoHotplugMaxLoadCounter());
maxLoadCounter.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MakoHotplug.setMakoHotplugMaxLoadCounter(position, getActivity());
}
});
makoHotplug.add(maxLoadCounter);
}
if (MakoHotplug.hasMakoHotplugMinTimeCpuOnline()) {
SeekBarView minTimeCpuOnline = new SeekBarView();
minTimeCpuOnline.setTitle(getString(R.string.min_time_cpu_online));
minTimeCpuOnline.setProgress(MakoHotplug.getMakoHotplugMinTimeCpuOnline());
minTimeCpuOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MakoHotplug.setMakoHotplugMinTimeCpuOnline(position, getActivity());
}
});
makoHotplug.add(minTimeCpuOnline);
}
if (MakoHotplug.hasMakoHotplugMinCoresOnline()) {
SeekBarView minCoresOnline = new SeekBarView();
minCoresOnline.setTitle(getString(R.string.min_cpu_online));
minCoresOnline.setSummary(getString(R.string.min_cpu_online_summary));
minCoresOnline.setMax(CPUFreq.getCpuCount());
minCoresOnline.setMin(1);
minCoresOnline.setProgress(MakoHotplug.getMakoHotplugMinCoresOnline() - 1);
minCoresOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MakoHotplug.setMakoHotplugMinCoresOnline(position + 1, getActivity());
}
});
makoHotplug.add(minCoresOnline);
}
if (MakoHotplug.hasMakoHotplugTimer()) {
SeekBarView timer = new SeekBarView();
timer.setTitle(getString(R.string.timer));
timer.setProgress(MakoHotplug.getMakoHotplugTimer());
timer.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MakoHotplug.setMakoHotplugTimer(position, getActivity());
}
});
makoHotplug.add(timer);
}
if (MakoHotplug.hasMakoHotplugSuspendFreq() && CPUFreq.getFreqs() != null) {
SelectView suspendFreq = new SelectView();
suspendFreq.setTitle(getString(R.string.cpu_max_screen_off_freq));
suspendFreq.setSummary(getString(R.string.cpu_max_screen_off_freq_summary));
suspendFreq.setItems(CPUFreq.getAdjustedFreq(getActivity()));
suspendFreq.setItem((MakoHotplug.getMakoHotplugSuspendFreq() / 1000) + getString(R.string.mhz));
suspendFreq.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
MakoHotplug.setMakoHotplugSuspendFreq(CPUFreq.getFreqs().get(position), getActivity());
}
});
makoHotplug.add(suspendFreq);
}
if (makoHotplug.size() > 0) {
items.add(title);
items.addAll(makoHotplug);
}
}
use of com.moro.mtweaks.views.recyclerview.RecyclerViewItem in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUHotplugFragment method autoSmpInit.
private void autoSmpInit(List<RecyclerViewItem> items) {
List<RecyclerViewItem> autoSmp = new ArrayList<>();
TitleView title = new TitleView();
title.setText(getString(R.string.autosmp));
if (AutoSmp.hasAutoSmpEnable()) {
SwitchView enable = new SwitchView();
enable.setTitle(getString(R.string.autosmp));
enable.setSummary(getString(R.string.autosmp_summary));
enable.setChecked(AutoSmp.isAutoSmpEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
AutoSmp.enableAutoSmp(isChecked, getActivity());
}
});
autoSmp.add(enable);
mEnableViews.add(enable);
}
if (AutoSmp.hasAutoSmpCpufreqDown()) {
SeekBarView cpuFreqDown = new SeekBarView();
cpuFreqDown.setTitle(getString(R.string.downrate_limits));
cpuFreqDown.setUnit("%");
cpuFreqDown.setProgress(AutoSmp.getAutoSmpCpufreqDown());
cpuFreqDown.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
AutoSmp.setAutoSmpCpufreqDown(position, getActivity());
}
});
autoSmp.add(cpuFreqDown);
}
if (AutoSmp.hasAutoSmpCpufreqUp()) {
SeekBarView cpuFreqUp = new SeekBarView();
cpuFreqUp.setTitle(getString(R.string.uprate_limits));
cpuFreqUp.setUnit("%");
cpuFreqUp.setProgress(AutoSmp.getAutoSmpCpufreqUp());
cpuFreqUp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
AutoSmp.setAutoSmpCpufreqUp(position, getActivity());
}
});
autoSmp.add(cpuFreqUp);
}
if (AutoSmp.hasAutoSmpCycleDown()) {
SeekBarView cycleDown = new SeekBarView();
cycleDown.setTitle(getString(R.string.cycle_down));
cycleDown.setSummary(getString(R.string.cycle_down_summary));
cycleDown.setMax(CPUFreq.getCpuCount());
cycleDown.setProgress(AutoSmp.getAutoSmpCycleDown());
cycleDown.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
AutoSmp.setAutoSmpCycleDown(position, getActivity());
}
});
autoSmp.add(cycleDown);
}
if (AutoSmp.hasAutoSmpCycleUp()) {
SeekBarView cycleUp = new SeekBarView();
cycleUp.setTitle(getString(R.string.cycle_up));
cycleUp.setSummary(getString(R.string.cycle_up_summary));
cycleUp.setMax(CPUFreq.getCpuCount());
cycleUp.setProgress(AutoSmp.getAutoSmpCycleUp());
cycleUp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
AutoSmp.setAutoSmpCycleUp(position, getActivity());
}
});
autoSmp.add(cycleUp);
}
if (AutoSmp.hasAutoSmpDelay()) {
SeekBarView delay = new SeekBarView();
delay.setTitle(getString(R.string.delay));
delay.setSummary(getString(R.string.delay_summary));
delay.setUnit(getString(R.string.ms));
delay.setMax(500);
delay.setProgress(AutoSmp.getAutoSmpDelay());
delay.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
AutoSmp.setAutoSmpDelay(position, getActivity());
}
});
autoSmp.add(delay);
}
if (AutoSmp.hasAutoSmpMaxCpus()) {
SeekBarView maxCpus = new SeekBarView();
maxCpus.setTitle(getString(R.string.max_cpu_online));
maxCpus.setSummary(getString(R.string.max_cpu_online_summary));
maxCpus.setMax(CPUFreq.getCpuCount());
maxCpus.setMin(1);
maxCpus.setProgress(AutoSmp.getAutoSmpMaxCpus() - 1);
maxCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
AutoSmp.setAutoSmpMaxCpus(position + 1, getActivity());
}
});
autoSmp.add(maxCpus);
}
if (AutoSmp.hasAutoSmpMinCpus()) {
SeekBarView minCpus = new SeekBarView();
minCpus.setTitle(getString(R.string.min_cpu_online));
minCpus.setSummary(getString(R.string.min_cpu_online_summary));
minCpus.setMax(CPUFreq.getCpuCount());
minCpus.setMin(1);
minCpus.setProgress(AutoSmp.getAutoSmpMinCpus() - 1);
minCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
AutoSmp.setAutoSmpMinCpus(position + 1, getActivity());
}
});
autoSmp.add(minCpus);
}
if (AutoSmp.hasAutoSmpScroffSingleCore()) {
SwitchView scroffSingleCore = new SwitchView();
scroffSingleCore.setTitle(getString(R.string.screen_off_single_cpu));
scroffSingleCore.setSummary(getString(R.string.screen_off_single_cpu_summary));
scroffSingleCore.setChecked(AutoSmp.isAutoSmpScroffSingleCoreEnabled());
scroffSingleCore.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
AutoSmp.enableAutoSmpScroffSingleCoreActive(isChecked, getActivity());
}
});
autoSmp.add(scroffSingleCore);
}
if (autoSmp.size() > 0) {
items.add(title);
items.addAll(autoSmp);
}
}
Aggregations