use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUVoltageCl0Fragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
mVoltages.clear();
final List<String> freqs = VoltageCl0.getFreqs();
final List<String> voltages = VoltageCl0.getVoltages();
final List<String> voltagesStock = VoltageCl0.getStockVoltages();
if (freqs != null && voltages != null && voltagesStock != null && freqs.size() == voltages.size()) {
CardView freqCard = new CardView(getActivity());
freqCard.setTitle(getString(R.string.cpuCl0_volt_control));
List<String> progress = new ArrayList<>();
for (float i = -100000f; i < 31250f; i += 6250) {
String global = String.valueOf(i / VoltageCl0.getOffset());
progress.add(global);
}
seekbarProfInit(mSeekbarProf, freqs, voltages, voltagesStock, progress);
freqCard.addItem(mSeekbarProf);
Boolean enableGlobal = Prefs.getBoolean("CpuCl0_global_volts", true, getActivity());
SwitchView voltControl = new SwitchView();
voltControl.setTitle(getString(R.string.cpu_manual_volt));
voltControl.setSummaryOn(getString(R.string.cpu_manual_volt_summaryOn));
voltControl.setSummaryOff(getString(R.string.cpu_manual_volt_summaryOff));
voltControl.setChecked(enableGlobal);
voltControl.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
if (isChecked) {
Prefs.saveBoolean("CpuCl0_global_volts", true, getActivity());
Prefs.saveBoolean("CpuCl0_individual_volts", false, getActivity());
reload();
} else {
Prefs.saveBoolean("CpuCl0_global_volts", false, getActivity());
Prefs.saveBoolean("CpuCl0_individual_volts", true, getActivity());
Prefs.saveInt("CpuCl0_seekbarPref_value", 16, getActivity());
reload();
}
}
});
freqCard.addItem(voltControl);
if (freqCard.size() > 0) {
items.add(freqCard);
}
TitleView tunables = new TitleView();
tunables.setText(getString(R.string.cpuCl0_volt));
items.add(tunables);
for (int i = 0; i < freqs.size(); i++) {
SeekBarView seekbar = new SeekBarView();
seekbarInit(seekbar, freqs.get(i), voltages.get(i), voltagesStock.get(i));
mVoltages.add(seekbar);
}
}
items.addAll(mVoltages);
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class WakeFrament method vibrationInit.
private void vibrationInit(List<RecyclerViewItem> items) {
if (Misc.hasVibration()) {
SwitchView vibration = new SwitchView();
vibration.setSummary(getString(R.string.vibration));
vibration.setChecked(Misc.isVibrationEnabled());
vibration.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableVibration(isChecked, getActivity());
}
});
items.add(vibration);
}
if (Misc.hasVibVibration()) {
SeekBarView vibVibration = new SeekBarView();
vibVibration.setTitle(getString(R.string.vibration_strength));
vibVibration.setUnit("%");
vibVibration.setMax(90);
vibVibration.setProgress(Misc.getVibVibration());
vibVibration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Misc.setVibVibration(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
items.add(vibVibration);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class WakeFrament method gestureInit.
private void gestureInit(List<RecyclerViewItem> items) {
List<String> gestures = Gestures.getMenu(getActivity());
for (int i = 0; i < gestures.size(); i++) {
SwitchView gesture = new SwitchView();
gesture.setSummary(gestures.get(i));
gesture.setChecked(Gestures.isEnabled(i));
final int position = i;
gesture.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Gestures.enable(isChecked, position, getActivity());
}
});
items.add(gesture);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class KSMFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
infoInit(items);
CardView ksm = new CardView(getActivity());
if (KSM.isUKSM()) {
ksm.setTitle(getString(R.string.uksm_name));
} else {
ksm.setTitle(getString(R.string.ksm));
}
ksm.setFullSpan(true);
if (KSM.hasEnable()) {
SwitchView enable = new SwitchView();
if (KSM.isUKSM()) {
enable.setTitle(getString(R.string.uksm_name));
} else {
enable.setTitle(getString(R.string.ksm));
}
enable.setSummary(getString(R.string.ksm_summary));
enable.setChecked(KSM.isEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
KSM.enableKsm(isChecked, getActivity());
}
});
ksm.addItem(enable);
}
if (KSM.hasCpuGovernor()) {
SelectView governor = new SelectView();
governor.setTitle(getString(R.string.uksm_governor));
governor.setSummary(getString(R.string.uksm_governor_summary));
governor.setItems(KSM.getCpuGovernors());
governor.setItem(KSM.getCpuGovernor());
governor.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
KSM.setCpuGovernor(item, getActivity());
}
});
ksm.addItem(governor);
}
if (KSM.hasDeferredTimer()) {
SwitchView deferredTimer = new SwitchView();
deferredTimer.setTitle(getString(R.string.deferred_timer));
deferredTimer.setSummary(getString(R.string.deferred_timer_summary));
deferredTimer.setChecked(KSM.isDeferredTimerEnabled());
deferredTimer.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
KSM.enableDeferredTimer(isChecked, getActivity());
}
});
ksm.addItem(deferredTimer);
}
if (KSM.hasPagesToScan()) {
SeekBarView pagesToScan = new SeekBarView();
pagesToScan.setTitle(getString(R.string.pages_to_scan));
pagesToScan.setMax(1024);
pagesToScan.setProgress(KSM.getPagesToScan());
pagesToScan.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
KSM.setPagesToScan(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
ksm.addItem(pagesToScan);
}
if (KSM.hasSleepMilliseconds()) {
SeekBarView sleepMilliseconds = new SeekBarView();
sleepMilliseconds.setTitle(getString(R.string.sleep_milliseconds));
sleepMilliseconds.setUnit(getString(R.string.ms));
sleepMilliseconds.setMax(5000);
sleepMilliseconds.setOffset(50);
sleepMilliseconds.setProgress(KSM.getSleepMilliseconds() / 50);
sleepMilliseconds.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
KSM.setSleepMilliseconds(position * 50, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
ksm.addItem(sleepMilliseconds);
}
if (KSM.hasMaxCpuPercentage()) {
SeekBarView maxCpuPercentage = new SeekBarView();
maxCpuPercentage.setTitle(getString(R.string.max_cpu_usage));
maxCpuPercentage.setSummary(getString(R.string.max_cpu_usage_summary));
maxCpuPercentage.setUnit("%");
maxCpuPercentage.setProgress(KSM.getMaxCpuPercentage());
maxCpuPercentage.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
KSM.setMaxCpuPercentage(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
ksm.addItem(maxCpuPercentage);
}
if (ksm.size() > 0) {
items.add(ksm);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class LEDFragment method testInit.
private void testInit(List<RecyclerViewItem> items) {
SwitchView test = new SwitchView();
test.setTitle(getString(R.string.test));
test.setSummary(getString(R.string.led_test_summary));
test.setChecked(Sec.isTestingPattern());
test.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Sec.testPattern(isChecked);
}
});
items.add(test);
}
Aggregations