use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class BoefflaWakelockFragment method boefflaWakelockInit.
private void boefflaWakelockInit(List<RecyclerViewItem> items) {
mWakeCard.clear();
TitleView bwbT = new TitleView();
bwbT.setText(getString(R.string.boeffla_wakelock) + " v" + BoefflaWakelock.getVersion());
items.add(bwbT);
DescriptionView bwbD = new DescriptionView();
bwbD.setSummary(getString(R.string.boeffla_wakelock_summary));
items.add(bwbD);
SelectView bwOrder = new SelectView();
bwOrder.setTitle(getString(R.string.wkl_order));
bwOrder.setSummary(getString(R.string.wkl_order_summary));
bwOrder.setItems(Arrays.asList(getResources().getStringArray(R.array.b_wakelocks_oder)));
bwOrder.setItem(getString(R.string.wkl_time));
bwOrder.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
BoefflaWakelock.setWakelockOrder(position);
bwCardReload();
}
});
items.add(bwOrder);
List<BoefflaWakelock.ListWake> wakelocksB = BoefflaWakelock.getWakelockListBlocked();
String titleB = getString(R.string.wkl_blocked);
CardView cardB = new CardView(getActivity());
bwCardInit(cardB, titleB, wakelocksB);
mWakeCard.add(cardB);
List<BoefflaWakelock.ListWake> wakelocksA = BoefflaWakelock.getWakelockListAllowed();
String titleA = getString(R.string.wkl_allowed);
CardView cardA = new CardView(getActivity());
bwCardInit(cardA, titleA, wakelocksA);
mWakeCard.add(cardA);
items.addAll(mWakeCard);
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class LMKFragment method profileInit.
private void profileInit(List<RecyclerViewItem> items) {
TitleView profilesTitle = new TitleView();
profilesTitle.setText(getString(R.string.profile));
items.add(profilesTitle);
for (int id : sProfiles.keySet()) {
DescriptionView profile = new DescriptionView();
profile.setTitle(getString(id));
profile.setSummary(sProfiles.get(id));
profile.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
LMK.setMinFree(((DescriptionView) item).getSummary().toString(), getActivity());
refreshMinFree();
}
});
items.add(profile);
}
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class MiscFragment method networkInit.
private void networkInit(List<RecyclerViewItem> items) {
CardView networkCard = new CardView(getActivity());
networkCard.setTitle(getString(R.string.network));
try {
SelectView tcp = new SelectView();
tcp.setTitle(getString(R.string.tcp));
tcp.setSummary(getString(R.string.tcp_summary));
tcp.setItems(Misc.getTcpAvailableCongestions());
tcp.setItem(Misc.getTcpCongestion());
tcp.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
Misc.setTcpCongestion(item, getActivity());
}
});
networkCard.addItem(tcp);
} catch (Exception ignored) {
}
GenericSelectView hostname = new GenericSelectView();
hostname.setSummary(getString(R.string.hostname));
hostname.setValue(Misc.getHostname());
hostname.setValueRaw(hostname.getValue());
hostname.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {
@Override
public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
Misc.setHostname(value, getActivity());
}
});
networkCard.addItem(hostname);
if (Misc.hasWireguard()) {
DescriptionView wireguard = new DescriptionView();
wireguard.setTitle(getString(R.string.wireguard_title));
wireguard.setSummary(getString(R.string.version) + ": " + Misc.getWireguard());
networkCard.addItem(wireguard);
}
items.add(networkCard);
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class PathReaderFragment method load.
private void load(List<RecyclerViewItem> items) {
if (mPath == null)
return;
String path = mPath;
if (path.contains("%d")) {
path = Utils.strFormat(mPath, mMin);
}
RootFile files = new RootFile(path);
for (final RootFile file : files.listFiles()) {
final String name = file.getName();
final String value = file.readFile();
if (value != null && !value.isEmpty() && !value.contains("\n")) {
DescriptionView descriptionView = new DescriptionView();
descriptionView.setTitle(name);
descriptionView.setSummary(value);
descriptionView.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
List<Integer> freqs = CPUFreq.getFreqs(mMin);
int freq = Utils.strToInt(value);
if (freqs != null && freq != 0 && freqs.contains(freq)) {
String[] values = new String[freqs.size()];
for (int i = 0; i < values.length; i++) {
values[i] = String.valueOf(freqs.get(i));
}
showArrayDialog(value, values, mPath + "/" + name, name);
} else {
showEditTextDialog(value, name);
}
}
});
items.add(descriptionView);
}
}
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class SpectrumFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
final int balColor = ContextCompat.getColor(getContext(), R.color.colorBalance);
final int perColor = ContextCompat.getColor(getContext(), R.color.colorPerformance);
final int batColor = ContextCompat.getColor(getContext(), R.color.colorBattery);
final int gamColor = ContextCompat.getColor(getContext(), R.color.colorGaming);
// CardView Balanced
final CardView card0 = new CardView(getActivity());
card0.setTitle(getString(R.string.spec_balanced));
card0.setExpandable(false);
final DescriptionView desc0 = new DescriptionView();
desc0.setSummary(getString(R.string.spec_balanced_summary));
desc0.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_balanced));
card0.setOnItemClickListener(new CardView.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
cardClick(card0, desc0, 0, balColor);
}
});
card0.addItem(desc0);
items.add(card0);
// CardView Performance
final CardView card1 = new CardView(getActivity());
card1.setTitle(getString(R.string.spec_performance));
card1.setExpandable(false);
final DescriptionView desc1 = new DescriptionView();
desc1.setSummary(getString(R.string.spec_performance_summary));
desc1.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_performance));
card1.setOnItemClickListener(new CardView.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
cardClick(card1, desc1, 1, perColor);
}
});
card1.addItem(desc1);
items.add(card1);
// CardView Battery
final CardView card2 = new CardView(getActivity());
card2.setTitle(getString(R.string.spec_battery));
card2.setExpandable(false);
final DescriptionView desc2 = new DescriptionView();
desc2.setSummary(getString(R.string.spec_battery_summary));
desc2.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_battery));
card2.setOnItemClickListener(new CardView.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
cardClick(card2, desc2, 2, batColor);
}
});
card2.addItem(desc2);
items.add(card2);
// CardView Gaming
final CardView card3 = new CardView(getActivity());
card3.setTitle(getString(R.string.spec_gaming));
card3.setExpandable(false);
final DescriptionView desc3 = new DescriptionView();
desc3.setSummary(getString(R.string.spec_gaming_summary));
desc3.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_game));
card3.setOnItemClickListener(new CardView.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
cardClick(card3, desc3, 3, gamColor);
}
});
card3.addItem(desc3);
items.add(card3);
// Detects the selected profile on launch
int mProfile = Prefs.getInt("spectrum_profile", 0, getActivity());
if (mProfile == 0) {
card0.GrxSetInitSelection(true, balColor);
desc0.GrxSetInitSelection(true, Color.WHITE);
oldCard = card0;
oldDesc = desc0;
} else if (mProfile == 1) {
card1.GrxSetInitSelection(true, perColor);
desc1.GrxSetInitSelection(true, Color.WHITE);
oldCard = card1;
oldDesc = desc1;
} else if (mProfile == 2) {
card2.GrxSetInitSelection(true, batColor);
desc2.GrxSetInitSelection(true, Color.WHITE);
oldCard = card2;
oldDesc = desc2;
} else if (mProfile == 3) {
card3.GrxSetInitSelection(true, gamColor);
desc3.GrxSetInitSelection(true, Color.WHITE);
oldCard = card3;
oldDesc = desc3;
}
}
Aggregations