use of com.moro.mtweaks.views.recyclerview.SeekBarView in project MTweaks-KernelAdiutorMOD by morogoku.
the class LEDFragment method delayInit.
private void delayInit(List<RecyclerViewItem> items) {
CardView delayCard = new CardView(getActivity());
delayCard.setTitle(getString(R.string.delay));
if (Sec.hasNotificationDelayOn()) {
SeekBarView notificationDelayOn = new SeekBarView();
notificationDelayOn.setTitle(getString(R.string.on));
notificationDelayOn.setUnit(getString(R.string.ms));
notificationDelayOn.setMax(5000);
notificationDelayOn.setOffset(100);
notificationDelayOn.setProgress(Sec.getNotificationDelayOn() / 100);
notificationDelayOn.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Sec.setNotificationDelayOn(position * 100, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
delayCard.addItem(notificationDelayOn);
}
if (Sec.hasNotificationDelayOff()) {
SeekBarView notificationDelayOff = new SeekBarView();
notificationDelayOff.setTitle(getString(R.string.off));
notificationDelayOff.setUnit(getString(R.string.ms));
notificationDelayOff.setMax(5000);
notificationDelayOff.setOffset(100);
notificationDelayOff.setProgress(Sec.getNotificationDelayOff() / 100);
notificationDelayOff.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Sec.setNotificationDelayOff(position * 100, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
delayCard.addItem(notificationDelayOff);
}
if (delayCard.size() > 0) {
items.add(delayCard);
}
}
use of com.moro.mtweaks.views.recyclerview.SeekBarView in project MTweaks-KernelAdiutorMOD by morogoku.
the class LMKFragment method minfreeInit.
private void minfreeInit(List<RecyclerViewItem> items) {
mMinFrees.clear();
List<String> minfrees = LMK.getMinFrees();
String[] descriptions = getResources().getStringArray(R.array.lmk_names);
for (int i = 0; i < minfrees.size(); i++) {
if (i == descriptions.length)
break;
SeekBarView minfree = new SeekBarView();
minfree.setTitle(descriptions[i]);
minfree.setUnit(getString(R.string.mb));
minfree.setMax(1024);
minfree.setProgress(Math.round(Utils.strToInt(minfrees.get(i)) / 256));
final int minfreeposition = i;
minfree.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
List<String> minfrees = LMK.getMinFrees();
StringBuilder values = new StringBuilder();
for (int i = 0; i < minfrees.size(); i++) {
values.append(minfreeposition == i ? position * 256 : minfrees.get(i)).append(",");
}
values.setLength(values.length() - 1);
LMK.setMinFree(values.toString(), getActivity());
refreshMinFree();
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
items.add(minfree);
mMinFrees.add(minfree);
}
}
use of com.moro.mtweaks.views.recyclerview.SeekBarView 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.SeekBarView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method vibrationInit.
private void vibrationInit(List<RecyclerViewItem> items) {
final Vibrator vibrator = (Vibrator) getActivity().getSystemService(Context.VIBRATOR_SERVICE);
final int min = Vibration.getMin();
int max = Vibration.getMax();
final float offset = (max - min) / 100f;
SeekBarView vibration = new SeekBarView();
vibration.setTitle(getString(R.string.vibration_strength));
vibration.setUnit("%");
vibration.setProgress(Math.round((Vibration.get() - min) / offset));
vibration.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Vibration.setVibration(Math.round(position * offset + min), getActivity());
getHandler().postDelayed(new Runnable() {
@Override
public void run() {
if (vibrator != null) {
vibrator.vibrate(300);
}
}
}, 250);
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
items.add(vibration);
}
use of com.moro.mtweaks.views.recyclerview.SeekBarView in project MTweaks-KernelAdiutorMOD by morogoku.
the class ScreenFragment method lcdBackLightInit.
private void lcdBackLightInit(List<RecyclerViewItem> items) {
CardView lcdBackLightCard = new CardView(getActivity());
lcdBackLightCard.setTitle(getString(R.string.lcd_backlight));
if (Misc.hasBrightnessMode()) {
SwitchView brightnessMode = new SwitchView();
brightnessMode.setSummary(getString(R.string.brightness_mode));
brightnessMode.setChecked(Misc.isBrightnessModeEnabled());
brightnessMode.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableBrightnessMode(isChecked, getActivity());
}
});
lcdBackLightCard.addItem(brightnessMode);
}
if (Misc.hasLcdMinBrightness()) {
SeekBarView lcdMinBrightness = new SeekBarView();
lcdMinBrightness.setTitle(getString(R.string.min_brightness));
lcdMinBrightness.setSummary(getString(R.string.min_brightness_summary));
lcdMinBrightness.setMax(114);
lcdMinBrightness.setMin(2);
lcdMinBrightness.setProgress(Misc.getLcdMinBrightness() - 2);
lcdMinBrightness.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Misc.setLcdMinBrightness(position + 2, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
lcdBackLightCard.addItem(lcdMinBrightness);
}
if (Misc.hasLcdMaxBrightness()) {
SeekBarView lcdMaxBrightness = new SeekBarView();
lcdMaxBrightness.setTitle(getString(R.string.max_brightness));
lcdMaxBrightness.setSummary(getString(R.string.max_brightness_summary));
lcdMaxBrightness.setMax(114);
lcdMaxBrightness.setMin(2);
lcdMaxBrightness.setProgress(Misc.getLcdMaxBrightness() - 2);
lcdMaxBrightness.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Misc.setLcdMaxBrightness(position + 2, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
lcdBackLightCard.addItem(lcdMaxBrightness);
}
if (lcdBackLightCard.size() > 0) {
items.add(lcdBackLightCard);
}
}
Aggregations