use of com.moro.mtweaks.views.recyclerview.SelectView in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUFragment method cpuBoostInit.
private void cpuBoostInit(List<RecyclerViewItem> items) {
CardView cpuBoostCard = new CardView(getActivity());
cpuBoostCard.setTitle(getString(R.string.ib_enabled));
if (CPUBoost.hasEnable()) {
SwitchView enable = new SwitchView();
enable.setTitle(getString(R.string.ib_enabled));
enable.setSummaryOn(getString(R.string.cpu_boost_summary_on));
enable.setSummaryOff(getString(R.string.cpu_boost_summary_off));
enable.setChecked(CPUBoost.isEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
CPUBoost.enableCpuBoost(isChecked, getActivity());
}
});
cpuBoostCard.addItem(enable);
}
if (CPUBoost.hasCpuBoostExynosInputMs()) {
GenericSelectView2 ms = new GenericSelectView2();
ms.setTitle(getString(R.string.ib_duration_ms));
ms.setValue(CPUBoost.getCpuBootExynosInputMs() + " ms");
ms.setValueRaw(ms.getValue().replace(" ms", ""));
ms.setInputType(InputType.TYPE_CLASS_NUMBER);
ms.setOnGenericValueListener(new GenericSelectView2.OnGenericValueListener() {
@Override
public void onGenericValueSelected(GenericSelectView2 genericSelectView, String value) {
CPUBoost.setCpuBoostExynosInputMs(Utils.strToInt(value), getActivity());
genericSelectView.setValue(value + " ms");
}
});
cpuBoostCard.addItem(ms);
}
if (CPUBoost.hasCpuBoostExynosInputFreq()) {
List<String> freqs = CPUBoost.getCpuBootExynosInputFreq();
final String[] littleFreq = { freqs.get(0) };
final String[] bigFreq = { freqs.get(1) };
GenericSelectView2 little = new GenericSelectView2();
little.setTitle(getString(R.string.ib_freq_little));
little.setValue(littleFreq[0] + " Hz");
little.setValueRaw(little.getValue().replace(" Hz", ""));
little.setInputType(InputType.TYPE_CLASS_NUMBER);
little.setOnGenericValueListener(new GenericSelectView2.OnGenericValueListener() {
@Override
public void onGenericValueSelected(GenericSelectView2 genericSelectView, String value) {
CPUBoost.setCpuBoostExynosInputFreq(value, bigFreq[0], getActivity());
genericSelectView.setValue(value + " Hz");
littleFreq[0] = value;
}
});
cpuBoostCard.addItem(little);
GenericSelectView2 big = new GenericSelectView2();
big.setTitle(getString(R.string.ib_freq_big));
big.setValue(bigFreq[0] + " Hz");
big.setValueRaw(big.getValue().replace(" Hz", ""));
big.setInputType(InputType.TYPE_CLASS_NUMBER);
big.setOnGenericValueListener(new GenericSelectView2.OnGenericValueListener() {
@Override
public void onGenericValueSelected(GenericSelectView2 genericSelectView, String value) {
CPUBoost.setCpuBoostExynosInputFreq(littleFreq[0], value, getActivity());
genericSelectView.setValue(value + " Hz");
bigFreq[0] = value;
}
});
cpuBoostCard.addItem(big);
}
if (CPUBoost.hasCpuBoostDebugMask()) {
SwitchView debugMask = new SwitchView();
debugMask.setTitle(getString(R.string.debug_mask));
debugMask.setSummary(getString(R.string.debug_mask_summary));
debugMask.setChecked(CPUBoost.isCpuBoostDebugMaskEnabled());
debugMask.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
CPUBoost.enableCpuBoostDebugMask(isChecked, getActivity());
}
});
cpuBoostCard.addItem(debugMask);
}
if (CPUBoost.hasCpuBoostMs()) {
SeekBarView ms = new SeekBarView();
ms.setTitle(getString(R.string.interval));
ms.setSummary(getString(R.string.interval_summary));
ms.setUnit(getString(R.string.ms));
ms.setMax(5000);
ms.setOffset(10);
ms.setProgress(CPUBoost.getCpuBootMs() / 10);
ms.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
CPUBoost.setCpuBoostMs(position * 10, getActivity());
}
});
cpuBoostCard.addItem(ms);
}
if (CPUBoost.hasCpuBoostSyncThreshold() && CPUFreq.getFreqs() != null) {
List<String> list = new ArrayList<>();
list.add(getString(R.string.disabled));
list.addAll(CPUFreq.getAdjustedFreq(getActivity()));
SelectView syncThreshold = new SelectView();
syncThreshold.setTitle(getString(R.string.sync_threshold));
syncThreshold.setSummary(getString(R.string.sync_threshold_summary));
syncThreshold.setItems(list);
syncThreshold.setItem(CPUBoost.getCpuBootSyncThreshold());
syncThreshold.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUBoost.setCpuBoostSyncThreshold(position == 0 ? 0 : CPUFreq.getFreqs().get(position - 1), getActivity());
}
});
cpuBoostCard.addItem(syncThreshold);
}
if (CPUBoost.hasCpuBoostInputMs()) {
SeekBarView inputMs = new SeekBarView();
inputMs.setTitle(getString(R.string.input_interval));
inputMs.setSummary(getString(R.string.input_interval_summary));
inputMs.setUnit(getString(R.string.ms));
inputMs.setMax(5000);
inputMs.setOffset(10);
inputMs.setProgress(CPUBoost.getCpuBootInputMs() / 10);
inputMs.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
CPUBoost.setCpuBoostInputMs(position * 10, getActivity());
}
});
cpuBoostCard.addItem(inputMs);
}
if (CPUBoost.hasCpuBoostInputFreq()) {
List<Integer> freqs = CPUBoost.getCpuBootInputFreq();
for (int i = 0; i < freqs.size(); i++) {
List<String> list = new ArrayList<>();
list.add(getString(R.string.disabled));
list.addAll(CPUFreq.getAdjustedFreq(i, getActivity()));
SelectView inputCard = new SelectView();
if (freqs.size() > 1) {
inputCard.setTitle(getString(R.string.input_boost_freq_core, i + 1));
} else {
inputCard.setTitle(getString(R.string.input_boost_freq));
}
inputCard.setSummary(getString(R.string.input_boost_freq_summary));
inputCard.setItems(list);
inputCard.setItem(freqs.get(i));
final int core = i;
inputCard.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUBoost.setCpuBoostInputFreq(position == 0 ? 0 : CPUFreq.getFreqs(core).get(position - 1), core, getActivity());
}
});
cpuBoostCard.addItem(inputCard);
}
}
if (CPUBoost.hasCpuBoostWakeup()) {
SwitchView wakeup = new SwitchView();
wakeup.setTitle(getString(R.string.wakeup_boost));
wakeup.setSummary(getString(R.string.wakeup_boost_summary));
wakeup.setChecked(CPUBoost.isCpuBoostWakeupEnabled());
wakeup.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
CPUBoost.enableCpuBoostWakeup(isChecked, getActivity());
}
});
cpuBoostCard.addItem(wakeup);
}
if (CPUBoost.hasCpuBoostHotplug()) {
SwitchView hotplug = new SwitchView();
hotplug.setTitle(getString(R.string.hotplug_boost));
hotplug.setSummary(getString(R.string.hotplug_boost_summary));
hotplug.setChecked(CPUBoost.isCpuBoostHotplugEnabled());
hotplug.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
CPUBoost.enableCpuBoostHotplug(isChecked, getActivity());
}
});
cpuBoostCard.addItem(hotplug);
}
if (cpuBoostCard.size() > 0) {
items.add(cpuBoostCard);
}
}
use of com.moro.mtweaks.views.recyclerview.SelectView in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUHotplugFragment method intelliPlugInit.
private void intelliPlugInit(List<RecyclerViewItem> items) {
List<RecyclerViewItem> intelliplug = new ArrayList<>();
TitleView title = new TitleView();
title.setText(getString(R.string.intelliplug));
if (IntelliPlug.hasIntelliPlugEnable()) {
SwitchView enable = new SwitchView();
enable.setTitle(getString(R.string.intelliplug));
enable.setSummary(getString(R.string.intelliplug_summary));
enable.setChecked(IntelliPlug.isIntelliPlugEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
IntelliPlug.enableIntelliPlug(isChecked, getActivity());
}
});
intelliplug.add(enable);
mEnableViews.add(enable);
}
if (IntelliPlug.hasIntelliPlugProfile()) {
SelectView profile = new SelectView();
profile.setTitle(getString(R.string.profile));
profile.setSummary(getString(R.string.cpu_hotplug_profile_summary));
profile.setItems(IntelliPlug.getIntelliPlugProfileMenu(getActivity()));
profile.setItem(IntelliPlug.getIntelliPlugProfile());
profile.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
IntelliPlug.setIntelliPlugProfile(position, getActivity());
}
});
intelliplug.add(profile);
}
if (IntelliPlug.hasIntelliPlugEco()) {
SwitchView eco = new SwitchView();
eco.setTitle(getString(R.string.eco_mode));
eco.setSummary(getString(R.string.eco_mode_summary));
eco.setChecked(IntelliPlug.isIntelliPlugEcoEnabled());
eco.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
IntelliPlug.enableIntelliPlugEco(isChecked, getActivity());
}
});
intelliplug.add(eco);
}
if (IntelliPlug.hasIntelliPlugTouchBoost()) {
SwitchView touchBoost = new SwitchView();
touchBoost.setTitle(getString(R.string.touch_boost));
touchBoost.setSummary(getString(R.string.touch_boost_summary));
touchBoost.setChecked(IntelliPlug.isIntelliPlugTouchBoostEnabled());
touchBoost.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
IntelliPlug.enableIntelliPlugTouchBoost(isChecked, getActivity());
}
});
intelliplug.add(touchBoost);
}
if (IntelliPlug.hasIntelliPlugHysteresis()) {
SeekBarView hysteresis = new SeekBarView();
hysteresis.setTitle(getString(R.string.hysteresis));
hysteresis.setSummary(getString(R.string.hysteresis_summary));
hysteresis.setMax(17);
hysteresis.setProgress(IntelliPlug.getIntelliPlugHysteresis());
hysteresis.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugHysteresis(position, getActivity());
}
});
intelliplug.add(hysteresis);
}
if (IntelliPlug.hasIntelliPlugThresold()) {
SeekBarView threshold = new SeekBarView();
threshold.setTitle(getString(R.string.cpu_threshold));
threshold.setSummary(getString(R.string.cpu_threshold_summary));
threshold.setMax(1000);
threshold.setProgress(IntelliPlug.getIntelliPlugThresold());
threshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugThresold(position, getActivity());
}
});
intelliplug.add(threshold);
}
if (IntelliPlug.hasIntelliPlugScreenOffMax() && CPUFreq.getFreqs() != null) {
List<String> list = new ArrayList<>();
list.add(getString(R.string.disabled));
list.addAll(CPUFreq.getAdjustedFreq(getActivity()));
SelectView maxScreenOffFreq = new SelectView();
maxScreenOffFreq.setTitle(getString(R.string.cpu_max_screen_off_freq));
maxScreenOffFreq.setSummary(getString(R.string.cpu_max_screen_off_freq_summary));
maxScreenOffFreq.setItems(list);
maxScreenOffFreq.setItem(IntelliPlug.getIntelliPlugScreenOffMax());
maxScreenOffFreq.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
IntelliPlug.setIntelliPlugScreenOffMax(position, getActivity());
}
});
intelliplug.add(maxScreenOffFreq);
}
if (IntelliPlug.hasIntelliPlugDebug()) {
SwitchView debug = new SwitchView();
debug.setTitle(getString(R.string.debug_mask));
debug.setSummary(getString(R.string.debug_mask_summary));
debug.setChecked(IntelliPlug.isIntelliPlugDebugEnabled());
debug.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
IntelliPlug.enableIntelliPlugDebug(isChecked, getActivity());
}
});
intelliplug.add(debug);
}
if (IntelliPlug.hasIntelliPlugSuspend()) {
SwitchView suspend = new SwitchView();
suspend.setTitle(getString(R.string.suspend));
suspend.setSummary(getString(R.string.suspend_summary));
suspend.setChecked(IntelliPlug.isIntelliPlugSuspendEnabled());
suspend.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
IntelliPlug.enableIntelliPlugSuspend(isChecked, getActivity());
}
});
intelliplug.add(suspend);
}
if (IntelliPlug.hasIntelliPlugCpusBoosted()) {
SeekBarView cpusBoosted = new SeekBarView();
cpusBoosted.setTitle(getString(R.string.cpus_boosted));
cpusBoosted.setSummary(getString(R.string.cpus_boosted_summary));
cpusBoosted.setMax(CPUFreq.getCpuCount());
cpusBoosted.setMin(1);
cpusBoosted.setProgress(IntelliPlug.getIntelliPlugCpusBoosted() - 1);
cpusBoosted.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugCpusBoosted(position + 1, getActivity());
}
});
intelliplug.add(cpusBoosted);
}
if (IntelliPlug.hasIntelliPlugMinCpusOnline()) {
SeekBarView minCpusOnline = new SeekBarView();
minCpusOnline.setTitle(getString(R.string.min_cpu_online));
minCpusOnline.setSummary(getString(R.string.min_cpu_online_summary));
minCpusOnline.setMax(CPUFreq.getCpuCount());
minCpusOnline.setMin(1);
minCpusOnline.setProgress(IntelliPlug.getIntelliPlugMinCpusOnline() - 1);
minCpusOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugMinCpusOnline(position + 1, getActivity());
}
});
intelliplug.add(minCpusOnline);
}
if (IntelliPlug.hasIntelliPlugMaxCpusOnline()) {
SeekBarView maxCpusOnline = new SeekBarView();
maxCpusOnline.setTitle(getString(R.string.max_cpu_online));
maxCpusOnline.setSummary(getString(R.string.max_cpu_online_summary));
maxCpusOnline.setMax(CPUFreq.getCpuCount());
maxCpusOnline.setMin(1);
maxCpusOnline.setProgress(IntelliPlug.getIntelliPlugMaxCpusOnline() - 1);
maxCpusOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugMaxCpusOnline(position + 1, getActivity());
}
});
intelliplug.add(maxCpusOnline);
}
if (IntelliPlug.hasIntelliPlugMaxCpusOnlineSusp()) {
SeekBarView maxCpusOnlineSusp = new SeekBarView();
maxCpusOnlineSusp.setTitle(getString(R.string.max_cpu_online_screen_off));
maxCpusOnlineSusp.setSummary(getString(R.string.max_cpu_online_screen_off_summary));
maxCpusOnlineSusp.setMax(CPUFreq.getCpuCount());
maxCpusOnlineSusp.setMin(1);
maxCpusOnlineSusp.setProgress(IntelliPlug.getIntelliPlugMaxCpusOnlineSusp() - 1);
maxCpusOnlineSusp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugMaxCpusOnlineSusp(position + 1, getActivity());
}
});
intelliplug.add(maxCpusOnlineSusp);
}
if (IntelliPlug.hasIntelliPlugSuspendDeferTime()) {
SeekBarView suspendDeferTime = new SeekBarView();
suspendDeferTime.setTitle(getString(R.string.suspend_defer_time));
suspendDeferTime.setUnit(getString(R.string.ms));
suspendDeferTime.setMax(5000);
suspendDeferTime.setOffset(10);
suspendDeferTime.setProgress(IntelliPlug.getIntelliPlugSuspendDeferTime() / 10);
suspendDeferTime.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugSuspendDeferTime(position * 10, getActivity());
}
});
intelliplug.add(suspendDeferTime);
}
if (IntelliPlug.hasIntelliPlugDeferSampling()) {
SeekBarView deferSampling = new SeekBarView();
deferSampling.setTitle(getString(R.string.defer_sampling));
deferSampling.setUnit(getString(R.string.ms));
deferSampling.setMax(1000);
deferSampling.setProgress(IntelliPlug.getIntelliPlugDeferSampling());
deferSampling.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugDeferSampling(position, getActivity());
}
});
intelliplug.add(deferSampling);
}
if (IntelliPlug.hasIntelliPlugBoostLockDuration()) {
SeekBarView boostLockDuration = new SeekBarView();
boostLockDuration.setTitle(getString(R.string.boost_lock_duration));
boostLockDuration.setSummary(getString(R.string.boost_lock_duration_summary));
boostLockDuration.setUnit(getString(R.string.ms));
boostLockDuration.setMax(5000);
boostLockDuration.setMin(1);
boostLockDuration.setProgress(IntelliPlug.getIntelliPlugBoostLockDuration() - 1);
boostLockDuration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugBoostLockDuration(position + 1, getActivity());
}
});
intelliplug.add(boostLockDuration);
}
if (IntelliPlug.hasIntelliPlugDownLockDuration()) {
SeekBarView downLockDuration = new SeekBarView();
downLockDuration.setTitle(getString(R.string.down_lock_duration));
downLockDuration.setSummary(getString(R.string.down_lock_duration_summary));
downLockDuration.setUnit(getString(R.string.ms));
downLockDuration.setMax(5000);
downLockDuration.setMin(1);
downLockDuration.setProgress(IntelliPlug.getIntelliPlugDownLockDuration() - 1);
downLockDuration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugDownLockDuration(position + 1, getActivity());
}
});
intelliplug.add(downLockDuration);
}
if (IntelliPlug.hasIntelliPlugFShift()) {
SeekBarView fShift = new SeekBarView();
fShift.setTitle(getString(R.string.fshift));
fShift.setMax(4);
fShift.setProgress(IntelliPlug.getIntelliPlugFShift());
fShift.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
IntelliPlug.setIntelliPlugFShift(position, getActivity());
}
});
intelliplug.add(fShift);
}
if (intelliplug.size() > 0) {
items.add(title);
items.addAll(intelliplug);
}
}
use of com.moro.mtweaks.views.recyclerview.SelectView in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUHotplugFragment method msmHotplugInit.
private void msmHotplugInit(List<RecyclerViewItem> items) {
List<RecyclerViewItem> msmHotplug = new ArrayList<>();
TitleView title = new TitleView();
title.setText(getString(R.string.msm_hotplug));
if (MSMHotplug.hasMsmHotplugEnable()) {
SwitchView enable = new SwitchView();
enable.setTitle(getString(R.string.msm_hotplug));
enable.setSummary(getString(R.string.msm_hotplug_summary));
enable.setChecked(MSMHotplug.isMsmHotplugEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
MSMHotplug.enableMsmHotplug(isChecked, getActivity());
}
});
msmHotplug.add(enable);
mEnableViews.add(enable);
}
if (MSMHotplug.hasMsmHotplugDebugMask()) {
SwitchView debugMask = new SwitchView();
debugMask.setTitle(getString(R.string.debug_mask));
debugMask.setSummary(getString(R.string.debug_mask_summary));
debugMask.setChecked(MSMHotplug.isMsmHotplugDebugMaskEnabled());
debugMask.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
MSMHotplug.enableMsmHotplugDebugMask(isChecked, getActivity());
}
});
msmHotplug.add(debugMask);
}
if (MSMHotplug.hasMsmHotplugMinCpusOnline()) {
SeekBarView minCpusOnline = new SeekBarView();
minCpusOnline.setTitle(getString(R.string.min_cpu_online));
minCpusOnline.setSummary(getString(R.string.min_cpu_online_summary));
minCpusOnline.setMax(CPUFreq.getCpuCount());
minCpusOnline.setMin(1);
minCpusOnline.setProgress(MSMHotplug.getMsmHotplugMinCpusOnline() - 1);
minCpusOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugMinCpusOnline(position + 1, getActivity());
}
});
msmHotplug.add(minCpusOnline);
}
if (MSMHotplug.hasMsmHotplugMaxCpusOnline()) {
SeekBarView maxCpusOnline = new SeekBarView();
maxCpusOnline.setTitle(getString(R.string.max_cpu_online));
maxCpusOnline.setSummary(getString(R.string.max_cpu_online_summary));
maxCpusOnline.setMax(CPUFreq.getCpuCount());
maxCpusOnline.setMin(1);
maxCpusOnline.setProgress(MSMHotplug.getMsmHotplugMaxCpusOnline() - 1);
maxCpusOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugMaxCpusOnline(position + 1, getActivity());
}
});
msmHotplug.add(maxCpusOnline);
}
if (MSMHotplug.hasMsmHotplugCpusBoosted()) {
SeekBarView cpusBoosted = new SeekBarView();
cpusBoosted.setTitle(getString(R.string.cpus_boosted));
cpusBoosted.setSummary(getString(R.string.cpus_boosted_summary));
cpusBoosted.setMax(CPUFreq.getCpuCount());
cpusBoosted.setMin(1);
cpusBoosted.setProgress(MSMHotplug.getMsmHotplugCpusBoosted());
cpusBoosted.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugCpusBoosted(position, getActivity());
}
});
msmHotplug.add(cpusBoosted);
}
if (MSMHotplug.hasMsmHotplugMaxCpusOnlineSusp()) {
SeekBarView maxCpusOnlineSusp = new SeekBarView();
maxCpusOnlineSusp.setTitle(getString(R.string.max_cpu_online_screen_off));
maxCpusOnlineSusp.setSummary(getString(R.string.max_cpu_online_screen_off_summary));
maxCpusOnlineSusp.setMax(CPUFreq.getCpuCount());
maxCpusOnlineSusp.setMin(1);
maxCpusOnlineSusp.setProgress(MSMHotplug.getMsmHotplugMaxCpusOnlineSusp() - 1);
maxCpusOnlineSusp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugMaxCpusOnlineSusp(position + 1, getActivity());
}
});
msmHotplug.add(maxCpusOnlineSusp);
}
if (MSMHotplug.hasMsmHotplugBoostLockDuration()) {
SeekBarView boostLockDuration = new SeekBarView();
boostLockDuration.setTitle(getString(R.string.boost_lock_duration));
boostLockDuration.setSummary(getString(R.string.boost_lock_duration_summary));
boostLockDuration.setMax(5000);
boostLockDuration.setMin(1);
boostLockDuration.setProgress(MSMHotplug.getMsmHotplugBoostLockDuration() - 1);
boostLockDuration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugBoostLockDuration(position + 1, getActivity());
}
});
msmHotplug.add(boostLockDuration);
}
if (MSMHotplug.hasMsmHotplugDownLockDuration()) {
SeekBarView downLockDuration = new SeekBarView();
downLockDuration.setTitle(getString(R.string.down_lock_duration));
downLockDuration.setSummary(getString(R.string.down_lock_duration_summary));
downLockDuration.setMax(5000);
downLockDuration.setMin(1);
downLockDuration.setProgress(MSMHotplug.getMsmHotplugDownLockDuration() - 1);
downLockDuration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugDownLockDuration(position + 1, getActivity());
}
});
msmHotplug.add(downLockDuration);
}
if (MSMHotplug.hasMsmHotplugHistorySize()) {
SeekBarView historySize = new SeekBarView();
historySize.setTitle(getString(R.string.history_size));
historySize.setSummary(getString(R.string.history_size_summary));
historySize.setMax(60);
historySize.setMin(1);
historySize.setProgress(MSMHotplug.getMsmHotplugHistorySize() - 1);
historySize.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugHistorySize(position + 1, getActivity());
}
});
msmHotplug.add(historySize);
}
if (MSMHotplug.hasMsmHotplugUpdateRate()) {
SeekBarView updateRate = new SeekBarView();
updateRate.setTitle(getString(R.string.update_rate));
updateRate.setSummary(getString(R.string.update_rate_summary));
updateRate.setMax(60);
updateRate.setProgress(MSMHotplug.getMsmHotplugUpdateRate());
updateRate.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugUpdateRate(position, getActivity());
}
});
msmHotplug.add(updateRate);
}
if (MSMHotplug.hasMsmHotplugFastLaneLoad()) {
SeekBarView fastLaneLoad = new SeekBarView();
fastLaneLoad.setTitle(getString(R.string.fast_lane_load));
fastLaneLoad.setSummary(getString(R.string.fast_lane_load_summary));
fastLaneLoad.setMax(400);
fastLaneLoad.setProgress(MSMHotplug.getMsmHotplugFastLaneLoad());
fastLaneLoad.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugFastLaneLoad(position, getActivity());
}
});
msmHotplug.add(fastLaneLoad);
}
if (MSMHotplug.hasMsmHotplugFastLaneMinFreq() && CPUFreq.getFreqs() != null) {
SelectView fastLaneMinFreq = new SelectView();
fastLaneMinFreq.setTitle(getString(R.string.fast_lane_min_freq));
fastLaneMinFreq.setSummary(getString(R.string.fast_lane_min_freq_summary));
fastLaneMinFreq.setItems(CPUFreq.getAdjustedFreq(getActivity()));
fastLaneMinFreq.setItem((MSMHotplug.getMsmHotplugFastLaneMinFreq() / 1000) + getString(R.string.mhz));
fastLaneMinFreq.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
MSMHotplug.setMsmHotplugFastLaneMinFreq(CPUFreq.getFreqs().get(position), getActivity());
}
});
msmHotplug.add(fastLaneMinFreq);
}
if (MSMHotplug.hasMsmHotplugOfflineLoad()) {
SeekBarView offlineLoad = new SeekBarView();
offlineLoad.setTitle(getString(R.string.offline_load));
offlineLoad.setSummary(getString(R.string.offline_load_summary));
offlineLoad.setProgress(MSMHotplug.getMsmHotplugOfflineLoad());
offlineLoad.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugOfflineLoad(position, getActivity());
}
});
msmHotplug.add(offlineLoad);
}
if (MSMHotplug.hasMsmHotplugIoIsBusy()) {
SwitchView ioIsBusy = new SwitchView();
ioIsBusy.setTitle(getString(R.string.io_is_busy));
ioIsBusy.setSummary(getString(R.string.io_is_busy_summary));
ioIsBusy.setChecked(MSMHotplug.isMsmHotplugIoIsBusyEnabled());
ioIsBusy.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
MSMHotplug.enableMsmHotplugIoIsBusy(isChecked, getActivity());
}
});
msmHotplug.add(ioIsBusy);
}
if (MSMHotplug.hasMsmHotplugSuspendMaxCpus()) {
SeekBarView suspendMaxCpus = new SeekBarView();
suspendMaxCpus.setTitle(getString(R.string.max_cpu_online_screen_off));
suspendMaxCpus.setSummary(getString(R.string.max_cpu_online_screen_off_summary));
suspendMaxCpus.setMax(CPUFreq.getCpuCount());
suspendMaxCpus.setMin(1);
suspendMaxCpus.setProgress(MSMHotplug.getMsmHotplugSuspendMaxCpus());
suspendMaxCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugSuspendMaxCpus(position, getActivity());
}
});
msmHotplug.add(suspendMaxCpus);
}
if (MSMHotplug.hasMsmHotplugSuspendFreq() && 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((MSMHotplug.getMsmHotplugSuspendFreq() / 1000) + getString(R.string.mhz));
suspendFreq.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
MSMHotplug.setMsmHotplugSuspendFreq(CPUFreq.getFreqs().get(position), getActivity());
}
});
msmHotplug.add(suspendFreq);
}
if (MSMHotplug.hasMsmHotplugSuspendDeferTime()) {
SeekBarView suspendDeferTime = new SeekBarView();
suspendDeferTime.setTitle(getString(R.string.suspend_defer_time));
suspendDeferTime.setUnit(getString(R.string.ms));
suspendDeferTime.setMax(5000);
suspendDeferTime.setOffset(10);
suspendDeferTime.setProgress(MSMHotplug.getMsmHotplugSuspendDeferTime() / 10);
suspendDeferTime.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
MSMHotplug.setMsmHotplugSuspendDeferTime(position * 10, getActivity());
}
});
msmHotplug.add(suspendDeferTime);
}
if (msmHotplug.size() > 0) {
items.add(title);
items.addAll(msmHotplug);
}
}
use of com.moro.mtweaks.views.recyclerview.SelectView in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUHotplugFragment method thunderPlugInit.
private void thunderPlugInit(List<RecyclerViewItem> items) {
CardView thunderPlug = new CardView(getActivity());
if (ThunderPlug.hasThunderPlugVersion()) {
thunderPlug.setTitle(ThunderPlug.getThunderPlugVersion());
} else {
thunderPlug.setTitle(getString(R.string.thunderplug));
}
if (ThunderPlug.hasThunderPlugEnable()) {
SwitchView enable = new SwitchView();
enable.setTitle(getString(R.string.thunderplug));
enable.setSummary(getString(R.string.thunderplug_summary));
enable.setChecked(ThunderPlug.isThunderPlugEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
if (isChecked) {
SamsungPlug.enableSamsungPlug(false, getActivity());
ThunderPlug.enableStateNotifier(true, getActivity());
ThunderPlug.enableThunderPlug(true, getActivity());
} else {
ThunderPlug.enableThunderPlug(false, getActivity());
ThunderPlug.enableStateNotifier(false, getActivity());
SamsungPlug.enableSamsungPlug(true, getActivity());
}
refreshHotPlugs();
}
});
thunderPlug.addItem(enable);
mEnableViews.add(enable);
}
if (ThunderPlug.hasThunderPlugSuspendCpus()) {
SeekBarView suspendCpus = new SeekBarView();
suspendCpus.setTitle(getString(R.string.min_cpu_online_screen_off));
suspendCpus.setSummary(getString(R.string.min_cpu_online_screen_off_summary));
suspendCpus.setMax(CPUFreq.getCpuCount());
suspendCpus.setMin(1);
suspendCpus.setProgress(ThunderPlug.getThunderPlugSuspendCpus() - 1);
suspendCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
ThunderPlug.setThunderPlugSuspendCpus(position + 1, getActivity());
}
});
thunderPlug.addItem(suspendCpus);
}
if (ThunderPlug.hasThunderPlugEnduranceLevel()) {
SelectView enduranceLevel = new SelectView();
enduranceLevel.setTitle(getString(R.string.endurance_level));
enduranceLevel.setSummary(getString(R.string.endurance_level_summary));
enduranceLevel.setItems(Arrays.asList(getResources().getStringArray(R.array.endurance_level_items)));
enduranceLevel.setItem(ThunderPlug.getThunderPlugEnduranceLevel());
enduranceLevel.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
ThunderPlug.setThunderPlugEnduranceLevel(position, getActivity());
}
});
thunderPlug.addItem(enduranceLevel);
}
if (ThunderPlug.hasThunderPlugSamplingRate()) {
SeekBarView samplingRate = new SeekBarView();
samplingRate.setTitle(getString(R.string.sampling_rate));
samplingRate.setMax(500);
samplingRate.setMin(10);
samplingRate.setOffset(10);
samplingRate.setProgress(ThunderPlug.getThunderPlugSamplingRate() / 10 - 1);
samplingRate.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
ThunderPlug.setThunderPlugSamplingRate((position + 1) * 10, getActivity());
}
});
thunderPlug.addItem(samplingRate);
}
if (ThunderPlug.hasThunderPlugLoadThreshold()) {
SeekBarView loadThreadshold = new SeekBarView();
loadThreadshold.setTitle(getString(R.string.load_threshold));
loadThreadshold.setSummary(getString(R.string.load_threshold_summary));
loadThreadshold.setMin(11);
loadThreadshold.setProgress(ThunderPlug.getThunderPlugLoadThreshold() - 11);
loadThreadshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
ThunderPlug.setThunderPlugLoadThreshold(position + 11, getActivity());
}
});
thunderPlug.addItem(loadThreadshold);
}
if (ThunderPlug.hasThunderPlugTouchBoost()) {
SwitchView touchBoost = new SwitchView();
touchBoost.setTitle(getString(R.string.touch_boost));
touchBoost.setSummary(getString(R.string.touch_boost_summary));
touchBoost.setChecked(ThunderPlug.isThunderPlugTouchBoostEnabled());
touchBoost.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
ThunderPlug.enableThunderPlugTouchBoost(isChecked, getActivity());
}
});
thunderPlug.addItem(touchBoost);
}
if (ThunderPlug.hasThunderPlugCpusBoosted()) {
SeekBarView cpusBoosted = new SeekBarView();
cpusBoosted.setTitle(getString(R.string.cpus_boosted));
cpusBoosted.setSummary(getString(R.string.cpus_boosted_summary));
cpusBoosted.setMax(8);
cpusBoosted.setMin(1);
cpusBoosted.setProgress(ThunderPlug.getThunderPlugCpusBoosted() - 1);
cpusBoosted.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
ThunderPlug.setThunderPlugLoadCpusBoosted(position + 1, getActivity());
}
});
thunderPlug.addItem(cpusBoosted);
}
if (thunderPlug.size() > 0) {
items.add(thunderPlug);
}
}
use of com.moro.mtweaks.views.recyclerview.SelectView in project MTweaks-KernelAdiutorMOD by morogoku.
the class DvfsFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
CardView dec = new CardView(getActivity());
dec.setTitle(getString(R.string.dvfs_decision_mode));
List<String> list = new ArrayList<>();
list.addAll(Arrays.asList("Battery", "Balance", "Performance"));
SelectView selectView = new SelectView();
selectView.setTitle(getString(R.string.dvfs_decision_mode));
selectView.setSummary(getString(R.string.dvfs_decision_mode_summary));
selectView.setItems(list);
selectView.setItem(Dvfs.getDecisionMode());
selectView.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
Dvfs.setDecisionMode(item, getActivity());
}
});
dec.addItem(selectView);
if (dec.size() > 0) {
items.add(dec);
}
CardView term = new CardView(getActivity());
term.setTitle(getString(R.string.dvfs_thermal_control));
SeekBarView seekBar = new SeekBarView();
seekBar.setTitle(getString(R.string.dvfs_thermal_control));
seekBar.setSummary(getString(R.string.dvfs_thermal_control_summary));
seekBar.setMax(90);
seekBar.setMin(40);
seekBar.setProgress(Utils.strToInt(Dvfs.getThermalControl()) - 40);
seekBar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Dvfs.setThermalControl(String.valueOf(position + 40), getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
term.addItem(seekBar);
if (term.size() > 0) {
items.add(term);
}
}
Aggregations