use of com.moro.mtweaks.views.recyclerview.CardView 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.CardView 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);
}
}
use of com.moro.mtweaks.views.recyclerview.CardView in project MTweaks-KernelAdiutorMOD by morogoku.
the class ScreenFragment method backlightDimmerInit.
private void backlightDimmerInit(List<RecyclerViewItem> items) {
CardView backLightDimmerCard = new CardView(getActivity());
backLightDimmerCard.setTitle(getString(R.string.backlight_dimmer));
if (Misc.hasBackLightDimmerEnable()) {
SwitchView backLightDimmer = new SwitchView();
backLightDimmer.setSummary(getString(R.string.backlight_dimmer));
backLightDimmer.setChecked(Misc.isBackLightDimmerEnabled());
backLightDimmer.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableBackLightDimmer(isChecked, getActivity());
}
});
backLightDimmerCard.addItem(backLightDimmer);
}
if (Misc.hasMinBrightness()) {
SeekBarView minBrightness = new SeekBarView();
minBrightness.setTitle(getString(R.string.min_brightness));
minBrightness.setSummary(getString(R.string.min_brightness_summary));
minBrightness.setMax(Misc.getMaxMinBrightness());
minBrightness.setProgress(Misc.getCurMinBrightness());
minBrightness.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Misc.setMinBrightness(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
backLightDimmerCard.addItem(minBrightness);
}
if (Misc.hasBackLightDimmerThreshold()) {
SeekBarView threshold = new SeekBarView();
threshold.setTitle(getString(R.string.threshold));
threshold.setMax(50);
threshold.setProgress(Misc.getBackLightDimmerThreshold());
threshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Misc.setBackLightDimmerThreshold(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
backLightDimmerCard.addItem(threshold);
}
if (Misc.hasBackLightDimmerOffset()) {
SeekBarView dimmerOffset = new SeekBarView();
dimmerOffset.setTitle(getString(R.string.offset));
dimmerOffset.setMax(50);
dimmerOffset.setProgress(Misc.getBackLightDimmerOffset());
dimmerOffset.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Misc.setBackLightDimmerOffset(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
backLightDimmerCard.addItem(dimmerOffset);
}
if (backLightDimmerCard.size() > 0) {
items.add(backLightDimmerCard);
}
}
use of com.moro.mtweaks.views.recyclerview.CardView in project MTweaks-KernelAdiutorMOD by morogoku.
the class VMFragment method zswapInit.
private void zswapInit(List<RecyclerViewItem> items) {
CardView zswapCard = new CardView(getActivity());
zswapCard.setTitle(getString(R.string.zswap));
if (ZSwap.hasEnable()) {
SwitchView zswap = new SwitchView();
zswap.setTitle(getString(R.string.zswap));
zswap.setSummary(getString(R.string.zswap_summary));
zswap.setChecked(ZSwap.isEnabled());
zswap.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
ZSwap.enable(isChecked, getActivity());
}
});
zswapCard.addItem(zswap);
}
if (ZSwap.hasMaxPoolPercent()) {
if (!Prefs.getBoolean("memory_pool_percent", false, getActivity())) {
SeekBarView maxPoolPercent = new SeekBarView();
maxPoolPercent.setTitle(getString(R.string.memory_pool));
maxPoolPercent.setSummary(getString(R.string.memory_pool_summary));
maxPoolPercent.setUnit("%");
maxPoolPercent.setMax(ZSwap.getStockMaxPoolPercent() / 10);
maxPoolPercent.setProgress(ZSwap.getMaxPoolPercent() / 10);
maxPoolPercent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
ZSwap.setMaxPoolPercent(position * 10, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
zswapCard.addItem(maxPoolPercent);
} else {
SeekBarView maxPoolPercent = new SeekBarView();
maxPoolPercent.setTitle(getString(R.string.memory_pool));
maxPoolPercent.setSummary(getString(R.string.memory_pool_summary));
maxPoolPercent.setUnit("%");
maxPoolPercent.setMax(ZSwap.getStockMaxPoolPercent());
maxPoolPercent.setProgress(ZSwap.getMaxPoolPercent());
maxPoolPercent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
ZSwap.setMaxPoolPercent(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
zswapCard.addItem(maxPoolPercent);
}
}
if (ZSwap.hasMaxCompressionRatio()) {
SeekBarView maxCompressionRatio = new SeekBarView();
maxCompressionRatio.setTitle(getString(R.string.maximum_compression_ratio));
maxCompressionRatio.setSummary(getString(R.string.maximum_compression_ratio_summary));
maxCompressionRatio.setUnit("%");
maxCompressionRatio.setProgress(ZSwap.getMaxCompressionRatio());
maxCompressionRatio.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
ZSwap.setMaxCompressionRatio(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
zswapCard.addItem(maxCompressionRatio);
}
if (zswapCard.size() > 0) {
items.add(zswapCard);
}
}
use of com.moro.mtweaks.views.recyclerview.CardView in project MTweaks-KernelAdiutorMOD by morogoku.
the class VMFragment method memBarsInit.
private void memBarsInit(List<RecyclerViewItem> items) {
CardView card = new CardView(getActivity());
card.setTitle(getString(R.string.memory));
long swap_total = Device.MemInfo.getItemMb("SwapTotal");
long swap_progress = swap_total - Device.MemInfo.getItemMb("SwapFree");
swap = new ProgressBarView();
swap.setTitle("SWAP");
swap.setItems(swap_total, swap_progress);
swap.setUnit(getResources().getString(R.string.mb));
swap.setProgressColor(getResources().getColor(R.color.blue_accent));
card.addItem(swap);
long mem_total = Device.MemInfo.getItemMb("MemTotal");
long mem_progress = mem_total - (Device.MemInfo.getItemMb("Cached") + Device.MemInfo.getItemMb("MemFree"));
mem = new ProgressBarView();
mem.setTitle("RAM");
mem.setItems(mem_total, mem_progress);
mem.setUnit(getResources().getString(R.string.mb));
mem.setProgressColor(getResources().getColor(R.color.orange_accent));
card.addItem(mem);
items.add(card);
}
Aggregations