use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class LMKFragment method swapWait.
private void swapWait(List<RecyclerViewItem> items) {
if (LMK.hasSwapWait()) {
SwitchView swapWait = new SwitchView();
swapWait.setTitle(getString(R.string.kill_lmk));
swapWait.setSummary(getString(R.string.kill_lmk_summary));
swapWait.setChecked(LMK.isSwapWaitEnabled());
swapWait.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
LMK.enableSwapWait(isChecked, getActivity());
}
});
items.add(swapWait);
}
if (LMK.hasSwapWaitPercent()) {
Integer[] percentages = { 0, 50, 66, 75, 80, 90 };
final Integer[] values = { 1, 2, 3, 4, 5, 10 };
List<String> list = new ArrayList<>();
for (int i : percentages) {
list.add(i + "%");
}
SeekBarView swapWaitPercent = new SeekBarView();
swapWaitPercent.setTitle(getString(R.string.kill_lmk_threshold));
swapWaitPercent.setSummary(getString(R.string.kill_lmk_threshold_summary));
swapWaitPercent.setItems(list);
swapWaitPercent.setProgress(Arrays.asList(values).indexOf(LMK.getSwapWaitPercent()));
swapWaitPercent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
LMK.setSwapWaitPercent(values[position], getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
items.add(swapWaitPercent);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method pwmInit.
private void pwmInit(List<RecyclerViewItem> items) {
CardView pwmCard = new CardView(getActivity());
pwmCard.setTitle(getString(R.string.pwm));
SwitchView enable = new SwitchView();
enable.setTitle(getString(R.string.pwm));
enable.setSummary(getString(R.string.pwm_summary));
enable.setChecked(Pwm.isPwmEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Pwm.enablePwm(isChecked, getActivity());
}
});
pwmCard.addItem(enable);
items.add(pwmCard);
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method powersuspendInit.
private void powersuspendInit(List<RecyclerViewItem> items) {
String v = PowerSuspend.getVersion().replace("version: ", " v");
CardView ps = new CardView(getActivity());
ps.setTitle(getString(R.string.power_suspend) + v);
if (PowerSuspend.hasMode()) {
SelectView mode = new SelectView();
mode.setTitle(getString(R.string.power_suspend_mode));
mode.setSummary(getString(R.string.power_suspend_mode_summary));
if (v.contains("1.5") || v.contains("1.8")) {
mode.setItems(Arrays.asList(getResources().getStringArray(R.array.powersuspend_items)));
} else {
mode.setItems(Arrays.asList(getResources().getStringArray(R.array.powersuspend_items_lite)));
}
mode.setItem(PowerSuspend.getMode());
mode.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
PowerSuspend.setMode(position, getActivity());
}
});
ps.addItem(mode);
}
if (PowerSuspend.hasState()) {
final SwitchView state = new SwitchView();
state.setTitle(getString(R.string.power_suspend_state));
state.setSummary(getString(R.string.power_suspend_state_summary));
state.setChecked(PowerSuspend.isStateEnabled());
state.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, final boolean isChecked) {
PowerSuspend.enableState(isChecked, getActivity());
getHandler().postDelayed(new Runnable() {
@Override
public void run() {
state.setChecked(PowerSuspend.isStateEnabled());
if (isChecked != PowerSuspend.isStateEnabled())
Utils.toast(getString(R.string.power_suspend_state_toast), getActivity());
}
}, 500);
}
});
ps.addItem(state);
}
if (ps.size() > 0) {
items.add(ps);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method gentlefairsleepersInit.
private void gentlefairsleepersInit(List<RecyclerViewItem> items) {
SwitchView gentleFairSleepers = new SwitchView();
gentleFairSleepers.setTitle(getString(R.string.gentlefairsleepers));
gentleFairSleepers.setSummary(getString(R.string.gentlefairsleepers_summary));
gentleFairSleepers.setChecked(Misc.isGentleFairSleepersEnabled());
gentleFairSleepers.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableGentleFairSleepers(isChecked, getActivity());
}
});
items.add(gentleFairSleepers);
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class ScreenFragment method negativeToggleInit.
private void negativeToggleInit(List<RecyclerViewItem> items) {
SwitchView negative = new SwitchView();
negative.setTitle(getString(R.string.negative_toggle));
negative.setSummary(getString(R.string.negative_toggle_summary));
negative.setChecked(Misc.isNegativeToggleEnabled());
negative.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableNegativeToggle(isChecked, getActivity());
}
});
items.add(negative);
}
Aggregations