Skip to content

Commit

Permalink
CPU Hotplug: Alucard: hide Advanced tunables from norma view
Browse files Browse the repository at this point in the history
Signed-off-by: sunilpaulmathew <sunil.kde@gmail.com>
  • Loading branch information
sunilpaulmathew committed Oct 28, 2018
1 parent 358ee23 commit 84a8563
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.grarak.kerneladiutor.R;
import com.grarak.kerneladiutor.fragments.ApplyOnBootFragment;
import com.grarak.kerneladiutor.fragments.RecyclerViewFragment;
import com.grarak.kerneladiutor.utils.Prefs;
import com.grarak.kerneladiutor.utils.Utils;
import com.grarak.kerneladiutor.utils.kernel.cpu.CPUFreq;
import com.grarak.kerneladiutor.utils.kernel.cpuhotplug.AlucardHotplug;
Expand Down Expand Up @@ -1525,15 +1526,20 @@ public void onStop(SeekBarView seekBarView, int position, String value) {
alucardHotplug.addItem(cpuUpRate);
}

DescriptionView tunables = new DescriptionView();
if (!(Prefs.getBoolean("advanced_tunables", false, getActivity())))
Prefs.saveBoolean("advanced_tunables", false, getActivity());

final SwitchView tunables = new SwitchView();
tunables.setTitle(getString(R.string.adv_hotplug_tunables));
tunables.setSummary(getString(R.string.adv_hotplug_tunables_summary));
tunables.setChecked(Prefs.getBoolean("advanced_tunables", false, getActivity()));

alucardHotplug.addItem(tunables);

for (int i = 0; i < AlucardHotplug.size(); i++) {
for (int i = 0; i < AlucardHotplug.size(); i++) {
if (AlucardHotplug.exists(i)) {

GenericSelectView advancedtunables = new GenericSelectView();
final GenericSelectView advancedtunables = new GenericSelectView();
advancedtunables.setSummary(AlucardHotplug.getName(i));
advancedtunables.setValue(AlucardHotplug.getValue(i));
advancedtunables.setValueRaw(advancedtunables.getValue());
Expand All @@ -1546,9 +1552,31 @@ public void onGenericValueSelected(GenericSelectView genericSelectView, String v
genericSelectView.setValue(value);
}
});
alucardHotplug.addItem(advancedtunables);
class tunablesManager {
public void showadvancedtunables (boolean enable) {
if (enable == true) {
alucardHotplug.addItem(advancedtunables);
} else {
alucardHotplug.removeItem(advancedtunables);
}
}
}
}

final tunablesManager manager = new tunablesManager();
if (Prefs.getBoolean("advanced_tunables", false, getActivity()) == true) {
manager.showadvancedtunables(true);
} else {
manager.showadvancedtunables(false);
}
tunables.addOnSwitchListener(new SwitchView.OnSwitchListener() {
@Override
public void onChanged(SwitchView switchview, boolean isChecked) {
Prefs.saveBoolean("advanced_tunables", isChecked, getActivity());
manager.showadvancedtunables(isChecked);
}
});
}
}

if (alucardHotplug.size() > 0) {
items.add(alucardHotplug);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@
<string name="quad_core_mode">Quad-Core mode</string>
<string name="dual_core_mode">Dual-Core mode</string>
<string name="adv_hotplug_tunables">Advanced Hotplug Tunables</string>
<string name="adv_hotplug_tunables_summary">Warning! This is only for advanced users.\nPlease do not touch unless you\'re an expert.</string>
<string name="adv_hotplug_tunables_summary">Warning! This is only for advanced users. Please do not touch unless you\'re an expert.</string>
<string name="core_control">Core Control</string>
<string name="core_control_summary">Qualcomm\'s hotplugging solution. Sorry you can\'t turn it off. #blameqcom</string>
<string name="hcube">H-Cube</string>
Expand Down

0 comments on commit 84a8563

Please sign in to comment.