use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class BatteryFragment method chargeS7Init.
private void chargeS7Init(List<RecyclerViewItem> items) {
CardView unsCharge = new CardView(getActivity());
unsCharge.setTitle(getString(R.string.unstable_charge_card));
unsCharge.setFullSpan(true);
if (Battery.hasUnstableCharge()) {
SwitchView uCharge = new SwitchView();
uCharge.setTitle(getString(R.string.enable_unstable_charge));
uCharge.setSummary(getString(R.string.enable_unstable_charge_summary));
uCharge.setChecked(Battery.isUnstableChargeEnabled());
uCharge.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Battery.enableUnstableCharge(isChecked, getActivity());
}
});
unsCharge.addItem(uCharge);
}
if (unsCharge.size() > 0) {
items.add(unsCharge);
}
CardView storeCard = new CardView(getActivity());
storeCard.setTitle(getString(R.string.store_mode));
storeCard.setFullSpan(true);
if (Battery.hasS7StoreMode()) {
SwitchView sMode = new SwitchView();
sMode.setTitle(getString(R.string.store_mode));
sMode.setSummary(getString(R.string.store_mode_summary));
sMode.setChecked(Battery.isS7StoreModeEnabled());
sMode.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Battery.enableS7StoreMode(isChecked, getActivity());
}
});
storeCard.addItem(sMode);
SeekBarView smMax = new SeekBarView();
smMax.setTitle(getString(R.string.store_mode_max));
smMax.setSummary(getString(R.string.store_mode_max_summary));
smMax.setMax(100);
smMax.setMin(1);
smMax.setUnit(getString(R.string.percent));
smMax.setProgress(Utils.strToInt(Battery.getS7StoreModeMax()) - 1);
smMax.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7StoreModeMax(position + 1, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
storeCard.addItem(smMax);
SeekBarView smMin = new SeekBarView();
smMin.setTitle(getString(R.string.store_mode_min));
smMin.setSummary(getString(R.string.store_mode_min_summary));
smMin.setMax(100);
smMin.setMin(1);
smMin.setUnit(getString(R.string.percent));
smMin.setProgress(Utils.strToInt(Battery.getS7StoreModeMin()) - 1);
smMin.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7StoreModeMin(position + 1, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
storeCard.addItem(smMin);
}
if (storeCard.size() > 0) {
items.add(storeCard);
}
CardView hvPower = new CardView(getActivity());
hvPower.setTitle(getString(R.string.hv_power_supply));
hvPower.setFullSpan(true);
if (Battery.hasS7HvInput()) {
SeekBarView hv_input = new SeekBarView();
hv_input.setTitle(getString(R.string.hv_input));
hv_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_hv_input", "", getActivity()) + getString(R.string.ma));
hv_input.setMax(3000);
hv_input.setMin(400);
hv_input.setUnit(getString(R.string.ma));
hv_input.setOffset(25);
hv_input.setProgress(Utils.strToInt(Battery.getS7HvInput()) / 25 - 16);
hv_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7HvInput((position + 16) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
hvPower.addItem(hv_input);
}
if (Battery.hasS7HvCharge()) {
SeekBarView hv_charge = new SeekBarView();
hv_charge.setTitle(getString(R.string.hv_charge));
hv_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_hv_charge", "", getActivity()) + getString(R.string.ma));
hv_charge.setMax(3150);
hv_charge.setMin(1000);
hv_charge.setUnit(getString(R.string.ma));
hv_charge.setOffset(25);
hv_charge.setProgress(Utils.strToInt(Battery.getS7HvCharge()) / 25 - 40);
hv_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7HvCharge((position + 40) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
hvPower.addItem(hv_charge);
}
if (hvPower.size() > 0) {
items.add(hvPower);
}
CardView acMains = new CardView(getActivity());
acMains.setTitle(getString(R.string.ac_mains));
acMains.setFullSpan(true);
if (Battery.hasS7AcInput()) {
SeekBarView ac_input = new SeekBarView();
ac_input.setTitle(getString(R.string.ac_input));
ac_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_ac_input", "", getActivity()) + getString(R.string.ma));
ac_input.setMax(3150);
ac_input.setMin(400);
ac_input.setUnit(getString(R.string.ma));
ac_input.setOffset(25);
ac_input.setProgress(Utils.strToInt(Battery.getS7AcInput()) / 25 - 16);
ac_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7AcInput((position + 16) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
acMains.addItem(ac_input);
}
if (Battery.hasS7AcCharge()) {
SeekBarView ac_charge = new SeekBarView();
ac_charge.setTitle(getString(R.string.ac_charge));
ac_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_ac_charge", "", getActivity()) + getString(R.string.ma));
ac_charge.setMax(3150);
ac_charge.setMin(400);
ac_charge.setUnit(getString(R.string.ma));
ac_charge.setOffset(25);
ac_charge.setProgress(Utils.strToInt(Battery.getS7AcCharge()) / 25 - 16);
ac_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7AcCharge((position + 16) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
acMains.addItem(ac_charge);
}
if (Battery.hasS7AcInputScreen()) {
SeekBarView ac_input_screen = new SeekBarView();
ac_input_screen.setTitle(getString(R.string.ac_input_screen));
ac_input_screen.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_ac_input_screen", "", getActivity()) + getString(R.string.ma));
ac_input_screen.setMax(3150);
ac_input_screen.setMin(400);
ac_input_screen.setUnit(getString(R.string.ma));
ac_input_screen.setOffset(25);
ac_input_screen.setProgress(Utils.strToInt(Battery.getS7AcInputScreen()) / 25 - 16);
ac_input_screen.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7AcInputScreen((position + 16) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
acMains.addItem(ac_input_screen);
}
if (Battery.hasS7AcChargeScreen()) {
SeekBarView ac_charge_screen = new SeekBarView();
ac_charge_screen.setTitle(getString(R.string.ac_charge_screen));
ac_charge_screen.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_ac_charge_screen", "", getActivity()) + getString(R.string.ma));
ac_charge_screen.setMax(3150);
ac_charge_screen.setMin(400);
ac_charge_screen.setUnit(getString(R.string.ma));
ac_charge_screen.setOffset(25);
ac_charge_screen.setProgress(Utils.strToInt(Battery.getS7AcChargeScreen()) / 25 - 16);
ac_charge_screen.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7AcChargeScreen((position + 16) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
acMains.addItem(ac_charge_screen);
}
if (acMains.size() > 0) {
items.add(acMains);
}
CardView usbCard = new CardView(getActivity());
usbCard.setTitle(getString(R.string.usb_port));
usbCard.setFullSpan(true);
if (Battery.hasS7UsbInput()) {
SeekBarView usb_input = new SeekBarView();
usb_input.setTitle(getString(R.string.usb_input));
usb_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_usb_input", "", getActivity()) + getString(R.string.ma));
usb_input.setMax(1200);
usb_input.setMin(100);
usb_input.setUnit(getString(R.string.ma));
usb_input.setOffset(25);
usb_input.setProgress(Utils.strToInt(Battery.getS7UsbInput()) / 25 - 4);
usb_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7UsbInput((position + 4) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
usbCard.addItem(usb_input);
}
if (Battery.hasS7UsbCharge()) {
SeekBarView usb_charge = new SeekBarView();
usb_charge.setTitle(getString(R.string.usb_charge));
usb_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_usb_charge", "", getActivity()) + getString(R.string.ma));
usb_charge.setMax(1200);
usb_charge.setMin(100);
usb_charge.setUnit(getString(R.string.ma));
usb_charge.setOffset(25);
usb_charge.setProgress(Utils.strToInt(Battery.getS7UsbCharge()) / 25 - 4);
usb_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7UsbCharge((position + 4) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
usbCard.addItem(usb_charge);
}
if (usbCard.size() > 0) {
items.add(usbCard);
}
CardView carCard = new CardView(getActivity());
carCard.setTitle(getString(R.string.car_dock));
carCard.setFullSpan(true);
if (Battery.hasS7CarInput()) {
SeekBarView car_input = new SeekBarView();
car_input.setTitle(getString(R.string.car_input));
car_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_car_input", "", getActivity()) + getString(R.string.ma));
car_input.setMax(2300);
car_input.setMin(800);
car_input.setUnit(getString(R.string.ma));
car_input.setOffset(25);
car_input.setProgress(Utils.strToInt(Battery.getS7CarInput()) / 25 - 32);
car_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7CarInput((position + 32) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
carCard.addItem(car_input);
}
if (Battery.hasS7CarCharge()) {
SeekBarView car_charge = new SeekBarView();
car_charge.setTitle(getString(R.string.car_charge));
car_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_car_charge", "", getActivity()) + getString(R.string.ma));
car_charge.setMax(2300);
car_charge.setMin(800);
car_charge.setUnit(getString(R.string.ma));
car_charge.setOffset(25);
car_charge.setProgress(Utils.strToInt(Battery.getS7CarCharge()) / 25 - 32);
car_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7CarCharge((position + 32) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
carCard.addItem(car_charge);
}
if (carCard.size() > 0) {
items.add(carCard);
}
CardView wcCard = new CardView(getActivity());
wcCard.setTitle(getString(R.string.wireless_power));
wcCard.setFullSpan(true);
if (Battery.hasS7WcInput()) {
SeekBarView wc_input = new SeekBarView();
wc_input.setTitle(getString(R.string.wc_input));
wc_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_wc_input", "", getActivity()) + getString(R.string.ma));
wc_input.setMax(1500);
wc_input.setMin(800);
wc_input.setUnit(getString(R.string.ma));
wc_input.setOffset(25);
wc_input.setProgress(Utils.strToInt(Battery.getS7WcInput()) / 25 - 32);
wc_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7WcInput((position + 32) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
wcCard.addItem(wc_input);
}
if (Battery.hasS7WcCharge()) {
SeekBarView wc_charge = new SeekBarView();
wc_charge.setTitle(getString(R.string.wc_charge));
wc_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_wc_charge", "", getActivity()) + getString(R.string.ma));
wc_charge.setMax(2300);
wc_charge.setMin(800);
wc_charge.setUnit(getString(R.string.ma));
wc_charge.setOffset(25);
wc_charge.setProgress(Utils.strToInt(Battery.getS7WcCharge()) / 25 - 32);
wc_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Battery.setS7WcCharge((position + 32) * 25, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
wcCard.addItem(wc_charge);
}
if (wcCard.size() > 0) {
items.add(wcCard);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class BatteryFragment method forceFastChargeInit.
private void forceFastChargeInit(List<RecyclerViewItem> items) {
SwitchView forceFastCharge = new SwitchView();
forceFastCharge.setTitle(getString(R.string.usb_fast_charge));
forceFastCharge.setSummary(getString(R.string.usb_fast_charge_summary));
forceFastCharge.setChecked(Battery.isForceFastChargeEnabled());
forceFastCharge.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Battery.enableForceFastCharge(isChecked, getActivity());
}
});
items.add(forceFastCharge);
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class BoefflaWakelockFragment method bwCardInit.
private void bwCardInit(CardView card, String title, List<BoefflaWakelock.ListWake> wakelocks) {
card.clearItems();
card.setTitle(title);
for (BoefflaWakelock.ListWake wake : wakelocks) {
final String name = wake.getName();
String wakeup = String.valueOf(wake.getWakeup());
String time = String.valueOf(wake.getTime() / 1000);
time = Utils.sToString(Utils.strToLong(time));
SwitchView sw = new SwitchView();
sw.setTitle(name);
sw.setSummary(getString(R.string.wkl_total_time) + ": " + time + "\n" + getString(R.string.wkl_wakep_count) + ": " + wakeup);
sw.setChecked(!BoefflaWakelock.isWakelockBlocked(name));
sw.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
if (isChecked) {
BoefflaWakelock.setWakelockAllowed(name, getActivity());
} else {
BoefflaWakelock.setWakelockBlocked(name, getActivity());
}
getHandler().postDelayed(new Runnable() {
@Override
public void run() {
bwCardReload();
}
}, 50);
}
});
card.addItem(sw);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class LEDFragment method fadeInit.
private void fadeInit(List<RecyclerViewItem> items) {
if (LED.hasFade()) {
SwitchView fade = new SwitchView();
fade.setTitle(getString(R.string.fade));
fade.setSummary(getString(R.string.fade_summary));
fade.setChecked(LED.isFadeEnabled());
fade.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
LED.enableFade(isChecked, getActivity());
}
});
items.add(fade);
}
CardView fadeCard = new CardView(getActivity());
fadeCard.setTitle(getString(R.string.fade));
if (Sec.hasNotificationRampControl()) {
SwitchView notificationRampControl = new SwitchView();
notificationRampControl.setTitle(getString(R.string.fade_ramp_control));
notificationRampControl.setSummary(getString(R.string.fade_ramp_control_summary));
notificationRampControl.setChecked(Sec.isNotificationRampControlEnabled());
notificationRampControl.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Sec.enableNotificationRampControl(isChecked, getActivity());
}
});
fadeCard.addItem(notificationRampControl);
}
if (Sec.hasNotificationRampUp()) {
SeekBarView notificationRampUp = new SeekBarView();
notificationRampUp.setTitle(getString(R.string.fade_in));
notificationRampUp.setSummary(getString(R.string.fade_in_summary));
notificationRampUp.setUnit(getString(R.string.ms));
notificationRampUp.setMax(1900);
notificationRampUp.setOffset(100);
notificationRampUp.setProgress(Sec.getNotificationRampUp() / 100);
notificationRampUp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Sec.setNotificationRampUp(position * 100, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
fadeCard.addItem(notificationRampUp);
}
if (Sec.hasNotificationRampDown()) {
SeekBarView notificationRampDown = new SeekBarView();
notificationRampDown.setTitle(getString(R.string.fade_out));
notificationRampDown.setSummary(getString(R.string.fade_out_summary));
notificationRampDown.setUnit(getString(R.string.ms));
notificationRampDown.setMax(1900);
notificationRampDown.setOffset(100);
notificationRampDown.setProgress(Sec.getNotificationRampDown() / 100);
notificationRampDown.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Sec.setNotificationRampDown(position * 100, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
fadeCard.addItem(notificationRampDown);
}
if (fadeCard.size() > 0) {
items.add(fadeCard);
}
}
use of com.moro.mtweaks.views.recyclerview.SwitchView in project MTweaks-KernelAdiutorMOD by morogoku.
the class LMKFragment method adaptiveInit.
private void adaptiveInit(List<RecyclerViewItem> items) {
SwitchView adaptive = new SwitchView();
adaptive.setTitle(getString(R.string.lmk_adaptive));
adaptive.setSummary(getString(R.string.lmk_adaptive_summary));
adaptive.setChecked(LMK.isAdaptiveEnabled());
adaptive.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
LMK.enableAdaptive(isChecked, getActivity());
}
});
items.add(adaptive);
}
Aggregations