use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class HelpFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
for (int id : sHelps.keySet()) {
DescriptionView descriptionView = new DescriptionView();
descriptionView.setTitle(getString(id));
descriptionView.setSummary(getString(sHelps.get(id)));
items.add(descriptionView);
}
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class FeaturesFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
for (SupportedDownloads.KernelContent.Feature feature : mFeatures) {
DescriptionView descriptionView = new DescriptionView();
if (feature.hasItems()) {
StringBuilder stringBuilder = new StringBuilder();
for (String subFeature : feature.getItems()) {
if (stringBuilder.length() == 0) {
stringBuilder.append("\u2022").append(" ").append(subFeature);
} else {
stringBuilder.append("<br>").append("\u2022").append(" ").append(subFeature);
}
}
descriptionView.setTitle(Utils.htmlFrom(feature.getItem()));
descriptionView.setSummary(Utils.htmlFrom(stringBuilder.toString()));
} else {
descriptionView.setSummary(Utils.htmlFrom(feature.getItem()));
}
descriptionView.setMovementMethod(LinkMovementMethod.getInstance());
items.add(descriptionView);
}
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUFragment method cpuQuietInit.
private void cpuQuietInit(List<RecyclerViewItem> items) {
List<RecyclerViewItem> views = new ArrayList<>();
CardView cpuQuietCard = new CardView(getActivity());
cpuQuietCard.setTitle(getString(R.string.cpu_quiet));
if (Misc.hasCpuQuietEnable()) {
SwitchView cpuQuietEnable = new SwitchView();
cpuQuietEnable.setSummary(getString(R.string.cpu_quiet));
cpuQuietEnable.setChecked(Misc.isCpuQuietEnabled());
cpuQuietEnable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
Misc.enableCpuQuiet(isChecked, getActivity());
}
});
views.add(cpuQuietEnable);
}
if (Misc.hasCpuQuietGovernors()) {
SelectView cpuQuietGovernors = new SelectView();
cpuQuietGovernors.setSummary(getString(R.string.cpu_quiet_governor));
cpuQuietGovernors.setItems(Misc.getCpuQuietAvailableGovernors());
cpuQuietGovernors.setItem(Misc.getCpuQuietCurGovernor());
cpuQuietGovernors.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
Misc.setCpuQuietGovernor(item, getActivity());
}
});
views.add(cpuQuietGovernors);
}
if (views.size() > 0) {
DescriptionView descriptionView = new DescriptionView();
descriptionView.setSummary(getString(R.string.cpu_quiet_summary));
cpuQuietCard.addItem(descriptionView);
for (RecyclerViewItem item : views) {
cpuQuietCard.addItem(item);
}
items.add(cpuQuietCard);
}
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class EntropyFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
int ps = Entropy.getPoolsize();
mAvailable = new DescriptionView();
mAvailable.setTitle(getString(R.string.available));
mAvailable.setSummary(getAvailableDescription(Entropy.getAvailable(), ps));
items.add(mAvailable);
mPoolSize = new DescriptionView();
mPoolSize.setTitle(getString(R.string.poolsize));
mPoolSize.setSummary(String.valueOf(ps));
items.add(mPoolSize);
SeekBarView read = new SeekBarView();
read.setTitle(getString(R.string.read));
read.setMax(4096);
read.setMin(64);
read.setOffset(64);
read.setProgress(Entropy.getRead() / 64 - 1);
read.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Entropy.setRead((position + 1) * 64, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
items.add(read);
SeekBarView write = new SeekBarView();
write.setTitle(getString(R.string.write));
write.setMax(4096);
write.setMin(64);
write.setOffset(64);
write.setProgress(Entropy.getWrite() / 64 - 1);
write.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Entropy.setWrite((position + 1) * 64, getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
items.add(write);
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class HmpFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
CardView card = new CardView(getActivity());
card.setTitle(getString(R.string.hmp_long));
DescriptionView hmp = new DescriptionView();
hmp.setSummary(getString(R.string.hmp_desc));
card.addItem(hmp);
if (Hmp.hasUpThreshold()) {
mUpThreshold = new SeekBarView();
mUpThreshold.setTitle(getString(R.string.hmp_up_threshold));
mUpThreshold.setSummary(getString(R.string.hmp_up_threshold_summary));
mUpThreshold.setMax(1024);
mUpThreshold.setMin(1);
mUpThreshold.setProgress(Utils.strToInt(Hmp.getUpThreshold()) - 1);
mUpThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Hmp.setUpThreshold((position + 1), getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
card.addItem(mUpThreshold);
}
if (Hmp.hasDownThreshold()) {
mDownThreshold = new SeekBarView();
mDownThreshold.setTitle(getString(R.string.hmp_down_threshold));
mDownThreshold.setSummary(getString(R.string.hmp_down_threshold_summary));
mDownThreshold.setMax(1024);
mDownThreshold.setMin(1);
mDownThreshold.setProgress(Utils.strToInt(Hmp.getDownThreshold()) - 1);
mDownThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
Hmp.setDownThreshold((position + 1), getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
card.addItem(mDownThreshold);
}
if (card.size() > 0) {
items.add(card);
}
if (Hmp.hasUpThreshold() && Hmp.hasDownThreshold()) {
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) {
Hmp.setHmpProfile(((DescriptionView) item).getSummary().toString(), getActivity());
refreshHmpProfile();
}
});
items.add(profile);
}
}
}
Aggregations