use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUFragment method freqInit.
private void freqInit(List<RecyclerViewItem> items) {
CardView bigCard = new CardView(getActivity());
if (CPUFreq.isBigLITTLE()) {
bigCard.setTitle(getString(R.string.cluster_big));
}
mCPUUsageBig = new XYGraphView();
mCPUUsageBig.setTitle(getString(R.string.cpu_usage));
bigCard.addItem(mCPUUsageBig);
final List<Integer> bigCores = CPUFreq.getBigCpuRange();
mCoresBig.clear();
for (final int core : bigCores) {
SwitchView coreSwitch = new SwitchView();
coreSwitch.setSummary(getString(R.string.core, core + 1));
mCoresBig.put(core, coreSwitch);
bigCard.addItem(coreSwitch);
}
mCPUMaxBig = new SelectView();
mCPUMaxBig.setTitle(getString(R.string.cpu_max_freq));
mCPUMaxBig.setSummary(getString(R.string.cpu_max_freq_summary));
mCPUMaxBig.setItems(CPUFreq.getAdjustedFreq(getActivity()));
mCPUMaxBig.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUFreq.setMaxFreq(CPUFreq.getFreqs().get(position), bigCores.get(0), bigCores.get(bigCores.size() - 1), getActivity());
}
});
bigCard.addItem(mCPUMaxBig);
mCPUMinBig = new SelectView();
mCPUMinBig.setTitle(getString(R.string.cpu_min_freq));
mCPUMinBig.setSummary(getString(R.string.cpu_min_freq_summary));
mCPUMinBig.setItems(CPUFreq.getAdjustedFreq(getActivity()));
mCPUMinBig.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUFreq.setMinFreq(CPUFreq.getFreqs().get(position), bigCores.get(0), bigCores.get(bigCores.size() - 1), getActivity());
}
});
bigCard.addItem(mCPUMinBig);
if (CPUFreq.hasMaxScreenOffFreq()) {
mCPUMaxScreenOffBig = new SelectView();
mCPUMaxScreenOffBig.setTitle(getString(R.string.cpu_max_screen_off_freq));
mCPUMaxScreenOffBig.setSummary(getString(R.string.cpu_max_screen_off_freq_summary));
mCPUMaxScreenOffBig.setItems(CPUFreq.getAdjustedFreq(getActivity()));
mCPUMaxScreenOffBig.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUFreq.setMaxScreenOffFreq(CPUFreq.getFreqs().get(position), bigCores.get(0), bigCores.get(bigCores.size() - 1), getActivity());
}
});
bigCard.addItem(mCPUMaxScreenOffBig);
}
mCPUGovernorBig = new SelectView();
mCPUGovernorBig.setTitle(getString(R.string.cpu_governor));
mCPUGovernorBig.setSummary(getString(R.string.cpu_governor_summary));
mCPUGovernorBig.setItems(CPUFreq.getGovernors());
mCPUGovernorBig.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUFreq.setGovernor(item, bigCores.get(0), bigCores.get(bigCores.size() - 1), getActivity());
}
});
bigCard.addItem(mCPUGovernorBig);
DescriptionView governorTunablesBig = new DescriptionView();
governorTunablesBig.setTitle(getString(R.string.cpu_governor_tunables));
governorTunablesBig.setSummary(getString(R.string.governor_tunables_summary));
governorTunablesBig.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
showGovernorTunables(bigCores.get(0), bigCores.get(bigCores.size() - 1));
}
});
bigCard.addItem(governorTunablesBig);
items.add(bigCard);
if (CPUFreq.isBigLITTLE()) {
CardView LITTLECard = new CardView(getActivity());
LITTLECard.setTitle(getString(R.string.cluster_little));
mCPUUsageLITTLE = new XYGraphView();
mCPUUsageLITTLE.setTitle(getString(R.string.cpu_usage));
LITTLECard.addItem(mCPUUsageLITTLE);
final List<Integer> LITTLECores = CPUFreq.getLITTLECpuRange();
mCoresLITTLE.clear();
for (final int core : LITTLECores) {
SwitchView coreSwitch = new SwitchView();
coreSwitch.setSummary(getString(R.string.core, core + 1));
mCoresLITTLE.put(core, coreSwitch);
LITTLECard.addItem(coreSwitch);
}
mCPUMaxLITTLE = new SelectView();
mCPUMaxLITTLE.setTitle(getString(R.string.cpu_max_freq));
mCPUMaxLITTLE.setSummary(getString(R.string.cpu_max_freq_summary));
mCPUMaxLITTLE.setItems(CPUFreq.getAdjustedFreq(CPUFreq.getLITTLECpu(), getActivity()));
mCPUMaxLITTLE.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUFreq.setMaxFreq(CPUFreq.getFreqs(CPUFreq.getLITTLECpu()).get(position), LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1), getActivity());
}
});
LITTLECard.addItem(mCPUMaxLITTLE);
mCPUMinLITTLE = new SelectView();
mCPUMinLITTLE.setTitle(getString(R.string.cpu_min_freq));
mCPUMinLITTLE.setSummary(getString(R.string.cpu_min_freq_summary));
mCPUMinLITTLE.setItems(CPUFreq.getAdjustedFreq(CPUFreq.getLITTLECpu(), getActivity()));
mCPUMinLITTLE.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUFreq.setMinFreq(CPUFreq.getFreqs(CPUFreq.getLITTLECpu()).get(position), LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1), getActivity());
}
});
LITTLECard.addItem(mCPUMinLITTLE);
if (CPUFreq.hasMaxScreenOffFreq(CPUFreq.getLITTLECpu())) {
mCPUMaxScreenOffLITTLE = new SelectView();
mCPUMaxScreenOffLITTLE.setTitle(getString(R.string.cpu_max_screen_off_freq));
mCPUMaxScreenOffLITTLE.setSummary(getString(R.string.cpu_max_screen_off_freq_summary));
mCPUMaxScreenOffLITTLE.setItems(CPUFreq.getAdjustedFreq(CPUFreq.getLITTLECpu(), getActivity()));
mCPUMaxScreenOffLITTLE.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUFreq.setMaxScreenOffFreq(CPUFreq.getFreqs(CPUFreq.getLITTLECpu()).get(position), LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1), getActivity());
}
});
LITTLECard.addItem(mCPUMaxScreenOffLITTLE);
}
mCPUGovernorLITTLE = new SelectView();
mCPUGovernorLITTLE.setTitle(getString(R.string.cpu_governor));
mCPUGovernorLITTLE.setSummary(getString(R.string.cpu_governor_summary));
mCPUGovernorLITTLE.setItems(CPUFreq.getGovernors());
mCPUGovernorLITTLE.setOnItemSelected(new SelectView.OnItemSelected() {
@Override
public void onItemSelected(SelectView selectView, int position, String item) {
CPUFreq.setGovernor(item, LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1), getActivity());
}
});
LITTLECard.addItem(mCPUGovernorLITTLE);
DescriptionView governorTunablesLITTLE = new DescriptionView();
governorTunablesLITTLE.setTitle(getString(R.string.cpu_governor_tunables));
governorTunablesLITTLE.setSummary(getString(R.string.governor_tunables_summary));
governorTunablesLITTLE.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
showGovernorTunables(LITTLECores.get(0), LITTLECores.get(LITTLECores.size() - 1));
}
});
LITTLECard.addItem(governorTunablesLITTLE);
items.add(LITTLECard);
}
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class CPUHotplugFragment method coreCtlInit.
private void coreCtlInit(List<RecyclerViewItem> items) {
List<RecyclerViewItem> coreCtl = new ArrayList<>();
TitleView title = new TitleView();
title.setText(getString(CoreCtl.hasEnable() ? R.string.hcube : R.string.core_control));
if (CoreCtl.hasMinCpus(CPUFreq.getBigCpu())) {
SeekBarView minCpus = new SeekBarView();
minCpus.setTitle(getString(R.string.min_cpus_big));
minCpus.setSummary(getString(R.string.min_cpus_big_summary));
minCpus.setMax(CPUFreq.getBigCpuRange().size());
minCpus.setProgress(CoreCtl.getMinCpus(CPUFreq.getBigCpu()));
minCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
CoreCtl.setMinCpus(position, CPUFreq.getBigCpu(), getActivity());
}
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
});
coreCtl.add(minCpus);
}
if (CoreCtl.hasBusyDownThreshold()) {
SeekBarView busyDownThreshold = new SeekBarView();
busyDownThreshold.setTitle(getString(R.string.busy_down_threshold));
busyDownThreshold.setSummary(getString(R.string.busy_down_threshold_summary));
busyDownThreshold.setProgress(CoreCtl.getBusyDownThreshold());
busyDownThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
CoreCtl.setBusyDownThreshold(position, getActivity());
}
});
coreCtl.add(busyDownThreshold);
}
if (CoreCtl.hasBusyUpThreshold()) {
SeekBarView busyUpThreshold = new SeekBarView();
busyUpThreshold.setTitle(getString(R.string.busy_up_threshold));
busyUpThreshold.setSummary(getString(R.string.busy_up_threshold_summary));
busyUpThreshold.setProgress(CoreCtl.getBusyUpThreshold());
busyUpThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
CoreCtl.setBusyUpThreshold(position, getActivity());
}
});
coreCtl.add(busyUpThreshold);
}
if (CoreCtl.hasOfflineDelayMs()) {
SeekBarView offlineDelayMs = new SeekBarView();
offlineDelayMs.setTitle(getString(R.string.offline_delay));
offlineDelayMs.setSummary(getString(R.string.offline_delay_summary));
offlineDelayMs.setUnit(getString(R.string.ms));
offlineDelayMs.setMax(5000);
offlineDelayMs.setOffset(100);
offlineDelayMs.setProgress(CoreCtl.getOfflineDelayMs() / 100);
offlineDelayMs.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
CoreCtl.setOfflineDelayMs(position * 100, getActivity());
}
});
coreCtl.add(offlineDelayMs);
}
if (CoreCtl.hasOnlineDelayMs()) {
SeekBarView onlineDelayMs = new SeekBarView();
onlineDelayMs.setTitle(getString(R.string.online_delay));
onlineDelayMs.setSummary(getString(R.string.online_delay_summary));
onlineDelayMs.setUnit(getString(R.string.ms));
onlineDelayMs.setMax(5000);
onlineDelayMs.setOffset(100);
onlineDelayMs.setProgress(CoreCtl.getOnlineDelayMs() / 100);
onlineDelayMs.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {
@Override
public void onMove(SeekBarView seekBarView, int position, String value) {
}
@Override
public void onStop(SeekBarView seekBarView, int position, String value) {
CoreCtl.setOnlineDelayMs(position * 100, getActivity());
}
});
coreCtl.add(onlineDelayMs);
}
if (coreCtl.size() > 0) {
items.add(title);
if (CoreCtl.hasEnable()) {
SwitchView enable = new SwitchView();
enable.setTitle(getString(R.string.hcube));
enable.setSummary(getString(R.string.hcube_summary));
enable.setChecked(CoreCtl.isEnabled());
enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchView, boolean isChecked) {
CoreCtl.enable(isChecked, getActivity());
}
});
items.add(enable);
mEnableViews.add(enable);
} else {
DescriptionView description = new DescriptionView();
description.setTitle(getString(R.string.core_control));
description.setSummary(getString(R.string.core_control_summary));
items.add(description);
}
items.addAll(coreCtl);
}
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class AboutFragment method librariesInit.
private void librariesInit(List<RecyclerViewItem> items) {
CardView about = new CardView(getActivity());
about.setTitle(getString(R.string.app_version));
DescriptionView app = new DescriptionView();
app.setTitle(getString(R.string.app_name));
app.setSummary("v" + BuildConfig.VERSION_NAME);
about.addItem(app);
items.add(about);
CardView cardView = new CardView(getActivity());
cardView.setTitle(getString(R.string.libraries_used));
for (final String lib : sLibraries.keySet()) {
DescriptionView descriptionView = new DescriptionView();
descriptionView.setTitle(lib.split(",")[1]);
descriptionView.setSummary(lib.split(",")[0]);
descriptionView.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
@Override
public void onClick(RecyclerViewItem item) {
Utils.launchUrl(sLibraries.get(lib), getActivity());
}
});
cardView.addItem(descriptionView);
}
items.add(cardView);
}
use of com.moro.mtweaks.views.recyclerview.DescriptionView 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.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.
the class DeviceFragment method addItems.
@Override
protected void addItems(List<RecyclerViewItem> items) {
String[][] deviceInfos = { { getString(R.string.android_version), Device.getVersion() }, { getString(R.string.android_api_level), String.valueOf(Device.getSDK()) }, { getString(R.string.android_codename), Device.getCodename() }, { getString(R.string.fingerprint), Device.getFingerprint() }, { getString(R.string.build_display_id), Device.getBuildDisplayId() }, { getString(R.string.baseband), Device.getBaseBand() }, { getString(R.string.bootloader), Device.getBootloader() }, { getString(R.string.rom), Device.ROMInfo.getVersion() }, { getString(R.string.trustzone), Device.TrustZone.getVersion() }, { getString(R.string.asv), Device.getAsv() } };
String[][] boardInfos = { { getString(R.string.hardware), Device.getHardware() }, { getString(R.string.architecture), Device.getArchitecture() }, { getString(R.string.kernel), Device.getKernelVersion(true) } };
CardView deviceCard = new CardView(getActivity());
String vendor = Device.getVendor();
vendor = vendor.substring(0, 1).toUpperCase() + vendor.substring(1);
deviceCard.setTitle(vendor + " " + Device.getModel());
CardView boardCard = new CardView(getActivity());
boardCard.setTitle(Device.getBoard().toUpperCase());
for (String[] deviceInfo : deviceInfos) {
if (deviceInfo[1] != null && deviceInfo[1].isEmpty()) {
continue;
}
DescriptionView info = new DescriptionView();
info.setTitle(deviceInfo[0]);
info.setSummary(deviceInfo[1]);
deviceCard.addItem(info);
}
for (String[] boardInfo : boardInfos) {
if (boardInfo[1] != null && boardInfo[1].isEmpty()) {
continue;
}
DescriptionView info = new DescriptionView();
info.setTitle(boardInfo[0]);
info.setSummary(boardInfo[1]);
boardCard.addItem(info);
}
items.add(deviceCard);
items.add(boardCard);
}
Aggregations