use of com.moro.mtweaks.views.recyclerview.TitleView in project MTweaks-KernelAdiutorMOD by morogoku.
the class GPUFragment method governorInit.
private void governorInit(List<RecyclerViewItem> items) {
CardView govCard = new CardView(getActivity());
govCard.setTitle(getString(R.string.gpu_governor));
if (GPUFreq.hasGovernor()) {
SelectView governor = new SelectView();
governor.setTitle(getString(R.string.gpu_governor));
governor.setSummary(getString(R.string.gpu_governor_summary));
governor.setItems(GPUFreq.getAvailableGovernors());
governor.setItem(GPUFreq.getGovernor());
governor.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
GPUFreq.setGovernor(item, getActivity());
}
});
govCard.addItem(governor);
}
TitleView tunables = new TitleView();
tunables.setText(getString(R.string.gov_tunables));
govCard.addItem(tunables);
if (GPUFreq.hasHighspeedClock()) {
List<String> freqs = new ArrayList<>();
List<Integer> list = GPUFreq.getAvailableFreqsSort();
if (list != null) {
int value = 0;
for (int i = 0; i < list.size(); i++) {
freqs.add(String.valueOf(list.get(i)));
if (list.get(i) == GPUFreq.getHighspeedClock()) {
value = i;
}
}
SeekBarView seekbar = new SeekBarView();
seekbar.setTitle(getString(R.string.tun_highspeed_clock));
seekbar.setSummary(getString(R.string.tun_highspeed_clock_summary));
seekbar.setUnit(getString(R.string.mhz));
seekbar.setItems(freqs);
seekbar.setProgress(value);
seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
GPUFreq.setHighspeedClock(value, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
govCard.addItem(seekbar);
}
}
if (GPUFreq.hasHighspeedLoad()) {
SeekBarView seekbar = new SeekBarView();
seekbar.setTitle(getString(R.string.tun_highspeed_load));
seekbar.setSummary(getString(R.string.tun_highspeed_load_summary));
seekbar.setUnit(getString(R.string.percent));
seekbar.setMax(100);
seekbar.setMin(1);
seekbar.setProgress(GPUFreq.getHighspeedLoad() - 1);
seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
GPUFreq.setHighspeedLoad((position + 1), getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
govCard.addItem(seekbar);
}
if (GPUFreq.hasHighspeedDelay()) {
SeekBarView seekbar = new SeekBarView();
seekbar.setTitle(getString(R.string.tun_highspeed_delay));
seekbar.setSummary(getString(R.string.tun_highspeed_delay_summary));
seekbar.setUnit(getString(R.string.ms));
seekbar.setMax(5);
seekbar.setMin(0);
seekbar.setProgress(GPUFreq.getHighspeedDelay());
seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
GPUFreq.setHighspeedDelay(position, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
govCard.addItem(seekbar);
}
if (govCard.size() > 0) {
items.add(govCard);
}
}
use of com.moro.mtweaks.views.recyclerview.TitleView in project MTweaks-KernelAdiutorMOD by morogoku.
the class DonationFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
TitleView title = new TitleView();
title.setText(getString(R.string.donation_title));
items.add(title);
DescriptionView desc = new DescriptionView();
desc.setDrawable(getResources().getDrawable(R.drawable.logo));
desc.setSummary(getString(R.string.donation_summary));
desc.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
Utils.launchUrl("https://www.paypal.me/morogoku", getActivity());
}
});
items.add(desc);
String leng = Locale.getDefault().getLanguage();
ImageView img = new ImageView();
if (leng.contains("es")) {
img.setDrawable(getResources().getDrawable(R.drawable.ic_donar_paypal));
} else {
img.setDrawable(getResources().getDrawable(R.drawable.ic_donate_paypal));
}
img.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
Utils.launchUrl("https://www.paypal.me/morogoku", getActivity());
}
});
items.add(img);
}
use of com.moro.mtweaks.views.recyclerview.TitleView in project MTweaks-KernelAdiutorMOD by morogoku.
the class InputsFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
List<Device.Input.Item> inputs = Device.Input.getItems();
for (Device.Input.Item input : inputs) {
String name;
if ((name = input.getName()) != null) {
String[][] list = { { getString(R.string.bus), input.getBus() }, { getString(R.string.vendor), input.getVendor() }, { getString(R.string.product), input.getProduct() }, { getString(R.string.version), input.getVersion() }, { getString(R.string.sysfs), input.getSysfs() }, { getString(R.string.handlers), input.getHandlers() } };
List<RecyclerViewItem> inputItems = new ArrayList<>();
for (String[] inputsList : list) {
if (inputsList[1] != null) {
DescriptionView inputView = new DescriptionView();
inputView.setTitle(inputsList[0]);
inputView.setSummary(inputsList[1]);
inputItems.add(inputView);
}
}
if (inputItems.size() > 0) {
TitleView inputTile = new TitleView();
inputTile.setText(name);
items.add(inputTile);
items.addAll(inputItems);
}
}
}
}
use of com.moro.mtweaks.views.recyclerview.TitleView in project MTweaks-KernelAdiutorMOD by morogoku.
the class OnBootFragment method load.
private void load(List<RecyclerViewItem> items) {
List<RecyclerViewItem> applyOnBoot = new ArrayList<>();
TitleView applyOnBootTitle = new TitleView();
applyOnBootTitle.setText(getString(R.string.apply_on_boot));
List<Settings.SettingsItem> settings = mSettings.getAllSettings();
HashMap<String, Boolean> applyOnBootEnabled = new HashMap<>();
List<ApplyOnBootItem> applyOnBootItems = new ArrayList<>();
for (int i = 0; i < settings.size(); i++) {
if (!applyOnBootEnabled.containsKey(settings.get(i).getCategory())) {
applyOnBootEnabled.put(settings.get(i).getCategory(), Prefs.getBoolean(settings.get(i).getCategory(), false, getActivity()));
}
if (applyOnBootEnabled.get(settings.get(i).getCategory())) {
applyOnBootItems.add(new ApplyOnBootItem(settings.get(i).getSetting(), settings.get(i).getCategory(), i));
}
}
for (int i = 0; i < applyOnBootItems.size(); i++) {
final ApplyOnBootItem applyOnBootItem = applyOnBootItems.get(i);
DescriptionView applyOnBootView = new DescriptionView();
applyOnBootView.setSummary((i + 1) + ". " + applyOnBootItem.mCategory.replace("_onboot", "") + ": " + applyOnBootItem.mCommand);
applyOnBootView.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
mDeleteDialog = ViewUtils.dialogBuilder(getString(R.string.delete_question, applyOnBootItem.mCommand), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
mSettings.delete(applyOnBootItem.mPosition);
mSettings.commit();
reload();
}
}, new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
mDeleteDialog = null;
}
}, getActivity());
mDeleteDialog.show();
}
});
applyOnBoot.add(applyOnBootView);
}
if (applyOnBoot.size() > 0) {
items.add(applyOnBootTitle);
items.addAll(applyOnBoot);
}
List<RecyclerViewItem> customControls = new ArrayList<>();
TitleView customControlTitle = new TitleView();
customControlTitle.setText(getString(R.string.custom_controls));
for (final Controls.ControlItem controlItem : mControls.getAllControls()) {
if (controlItem.isOnBootEnabled() && controlItem.getArguments() != null) {
DescriptionView controlView = new DescriptionView();
controlView.setTitle(controlItem.getTitle());
controlView.setSummary(getString(R.string.arguments, controlItem.getArguments()));
controlView.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
mDeleteDialog = ViewUtils.dialogBuilder(getString(R.string.disable_question, controlItem.getTitle()), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
controlItem.enableOnBoot(false);
mControls.commit();
reload();
}
}, new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
mDeleteDialog = null;
}
}, getActivity());
mDeleteDialog.show();
}
});
customControls.add(controlView);
}
}
if (customControls.size() > 0) {
items.add(customControlTitle);
items.addAll(customControls);
}
List<RecyclerViewItem> profiles = new ArrayList<>();
TitleView profileTitle = new TitleView();
profileTitle.setText(getString(R.string.profile));
for (final Profiles.ProfileItem profileItem : mProfiles.getAllProfiles()) {
if (profileItem.isOnBootEnabled()) {
DescriptionView profileView = new DescriptionView();
profileView.setSummary(profileItem.getName());
profileView.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
mDeleteDialog = ViewUtils.dialogBuilder(getString(R.string.disable_question, profileItem.getName()), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
profileItem.enableOnBoot(false);
mProfiles.commit();
reload();
}
}, new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
mDeleteDialog = null;
}
}, getActivity());
mDeleteDialog.show();
}
});
profiles.add(profileView);
}
}
if (profiles.size() > 0) {
items.add(profileTitle);
items.addAll(profiles);
}
if (Prefs.getBoolean("initd_onboot", false, getActivity())) {
TitleView initdTitle = new TitleView();
initdTitle.setText(getString(R.string.initd));
items.add(initdTitle);
DescriptionView emulateInitd = new DescriptionView();
emulateInitd.setSummary(getString(R.string.emulate_initd));
emulateInitd.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
mDeleteDialog = ViewUtils.dialogBuilder(getString(R.string.disable_question, getString(R.string.emulate_initd)), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
}
}, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
Prefs.saveBoolean("initd_onboot", false, getActivity());
reload();
}
}, new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialogInterface) {
mDeleteDialog = null;
}
}, getActivity());
mDeleteDialog.show();
}
});
items.add(emulateInitd);
}
}
use of com.moro.mtweaks.views.recyclerview.TitleView 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);
}
}
Aggregations