use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method wakelockInit.
private void wakelockInit(List<RecyclerViewItem> items) {
List<RecyclerViewItem> wakelocks = new ArrayList<>();
for (final Wakelocks.Wakelock wakelock : Wakelocks.getWakelocks()) {
if (!wakelock.exists())
continue;
String description = wakelock.getDescription(getActivity());
SwitchView switchView = new SwitchView();
if (description == null) {
switchView.setSummary(wakelock.getTitle(getActivity()));
} else {
switchView.setTitle(wakelock.getTitle(getActivity()));
switchView.setSummary(description);
}
switchView.setChecked(wakelock.isEnabled());
switchView.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
wakelock.enable(isChecked, getActivity());
}
});
wakelocks.add(switchView);
}
if (Wakelocks.hasWlanrxDivider()) {
List<String> list = new ArrayList<>();
for (int i = 1; i < 17; i++) {
list.add((100 / i) + "%");
}
list.add("0%");
SeekBarView wlanrxDivider = new SeekBarView();
wlanrxDivider.setTitle(getString(R.string.wlan_rx_wakelock_divider));
wlanrxDivider.setItems(list);
wlanrxDivider.setProgress(Wakelocks.getWlanrxDivider());
wlanrxDivider.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Wakelocks.setWlanrxDivider(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
wakelocks.add(wlanrxDivider);
}
if (Wakelocks.hasWlanctrlDivider()) {
List<String> list = new ArrayList<>();
for (int i = 1; i < 17; i++) {
list.add((100 / i) + "%");
}
list.add("0%");
SeekBarView wlanctrlDivider = new SeekBarView();
wlanctrlDivider.setTitle(getString(R.string.wlan_ctrl_wakelock_divider));
wlanctrlDivider.setItems(list);
wlanctrlDivider.setProgress(Wakelocks.getWlanctrlDivider());
wlanctrlDivider.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Wakelocks.setWlanctrlDivider(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
wakelocks.add(wlanctrlDivider);
}
if (Wakelocks.hasMsmHsicDivider()) {
List<String> list = new ArrayList<>();
for (int i = 1; i < 17; i++) {
list.add((100 / i) + "%");
}
list.add("0%");
SeekBarView msmHsicDivider = new SeekBarView();
msmHsicDivider.setTitle(getString(R.string.msm_hsic_wakelock_divider));
msmHsicDivider.setItems(list);
msmHsicDivider.setProgress(Wakelocks.getMsmHsicDivider());
msmHsicDivider.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Wakelocks.setMsmHsicDivider(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
wakelocks.add(msmHsicDivider);
}
if (Wakelocks.hasBCMDHDDivider()) {
SeekBarView bcmdhdDivider = new SeekBarView();
bcmdhdDivider.setTitle(getString(R.string.bcmdhd_wakelock_divider));
bcmdhdDivider.setMax(9);
bcmdhdDivider.setMin(1);
bcmdhdDivider.setProgress(Wakelocks.getBCMDHDDivider() - 1);
bcmdhdDivider.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Wakelocks.setBCMDHDDivider(position + 1, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
wakelocks.add(bcmdhdDivider);
}
if (wakelocks.size() > 0) {
TitleView wakelockTitle = new TitleView();
wakelockTitle.setText(getString(R.string.wakelock));
items.add(wakelockTitle);
items.addAll(wakelocks);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method fsyncInit.
private void fsyncInit(List<RecyclerViewItem> items) {
if (Misc.hasFsync()) {
SwitchView fsync = new SwitchView();
fsync.setTitle(getString(R.string.fsync));
fsync.setSummary(getString(R.string.fsync_summary));
fsync.setChecked(Misc.isFsyncEnabled());
fsync.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableFsync(isChecked, getActivity());
}
});
items.add(fsync);
}
if (Misc.hasDynamicFsync()) {
SwitchView dynamicFsync = new SwitchView();
dynamicFsync.setTitle(getString(R.string.dynamic_fsync));
dynamicFsync.setSummary(getString(R.string.dynamic_fsync_summary));
dynamicFsync.setChecked(Misc.isDynamicFsyncEnabled());
dynamicFsync.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableDynamicFsync(isChecked, getActivity());
}
});
items.add(dynamicFsync);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method archPowerInit.
private void archPowerInit(List<RecyclerViewItem> items) {
SwitchView archPower = new SwitchView();
archPower.setTitle(getString(R.string.arch_power));
archPower.setSummary(getString(R.string.arch_power_summary));
archPower.setChecked(Misc.isArchPowerEnabled());
archPower.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableArchPower(isChecked, getActivity());
}
});
items.add(archPower);
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method loggerInit.
private void loggerInit(List<RecyclerViewItem> items) {
SwitchView logger = new SwitchView();
logger.setSummary(getString(R.string.android_logger));
logger.setChecked(Misc.isLoggerEnabled());
logger.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableLogger(isChecked, getActivity());
}
});
items.add(logger);
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method crcInit.
private void crcInit(List<RecyclerViewItem> items) {
SwitchView crc = new SwitchView();
crc.setTitle(getString(R.string.crc));
crc.setSummary(getString(R.string.crc_summary));
crc.setChecked(Misc.isCrcEnabled());
crc.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableCrc(isChecked, getActivity());
}
});
items.add(crc);
}
Aggregations