com.grarak.kerneladiutor.utils.tools.Buildprop Java Examples

The following examples show how to use com.grarak.kerneladiutor.utils.tools.Buildprop. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BuildpropFragment.java    From KA27 with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    if (searchItem != null) searchItem.collapseActionView();

    removeAllViews();
    buildpropItem = Buildprop.getProps();
    for (int i = 0; i < buildpropItem.size(); i++) {
        PopupCardView.DPopupCard mPropCard = new PopupCardView.DPopupCard(null);
        mPropCard.setDescription((String) buildpropItem.keySet().toArray()[i]);
        mPropCard.setItem((String) buildpropItem.values().toArray()[i]);
        mPropCard.setOnClickListener(BuildpropFragment.this);

        addView(mPropCard);
    }

    try {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                title.setText(getString(R.string.items_found, buildpropItem.size()));
                refreshLayout.setRefreshing(false);
            }
        });
    } catch (NullPointerException ignored) {}
}
 
Example #2
Source File: BuildpropFragment.java    From KernelAdiutor with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onBottomFabClick() {
    super.onBottomFabClick();
    mAddDialog = new Dialog(getActivity()).setItems(getResources().getStringArray(
            R.array.build_prop_add_options),
            (dialog, which) -> {
                switch (which) {
                    case 0:
                        modify(null, null);
                        break;
                    case 1:
                        Buildprop.backup();
                        Utils.toast(getString(R.string.backup_item, Buildprop.BUILD_PROP,
                                Utils.getInternalDataStorage()), getActivity(), Toast.LENGTH_LONG);
                        break;
                }
            }).setOnDismissListener(dialog -> mAddDialog = null);
    mAddDialog.show();
}
 
Example #3
Source File: BuildpropFragment.java    From kernel_adiutor with Apache License 2.0 6 votes vote down vote up
@Override
public void run() {
    if (searchItem != null) MenuItemCompat.collapseActionView(searchItem);

    removeAllViews();
    buildpropItem = Buildprop.getProps();
    for (int i = 0; i < buildpropItem.size(); i++) {
        PopupCardView.DPopupCard mPropCard = new PopupCardView.DPopupCard(null);
        mPropCard.setDescription((String) buildpropItem.keySet().toArray()[i]);
        mPropCard.setItem((String) buildpropItem.values().toArray()[i]);
        mPropCard.setOnClickListener(BuildpropFragment.this);

        addView(mPropCard);
    }

    try {
        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                title.setText(getString(R.string.items_found, buildpropItem.size()));
                refreshLayout.setRefreshing(false);
            }
        });
    } catch (NullPointerException ignored) {
    }
}
 
Example #4
Source File: MainActivity.java    From KA27 with Apache License 2.0 5 votes vote down vote up
/**
 * Add all fragments in a list
 */
private void setList() {
    ITEMS.clear();
    ITEMS.add(new DAdapter.MainHeader());
    ITEMS.add(new DAdapter.Header(getString(R.string.information)));
    ITEMS.add(new DAdapter.Item(getString(R.string.kernel_information), new KernelInformationFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.frequency_table), new FrequencyTableFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.kernel)));

    ITEMS.add(new DAdapter.Item(getString(R.string.cpu), new CPUFragment()));
    if (CPUHotplug.hasCpuHotplug()) ITEMS.add(new DAdapter.Item(getString(R.string.cpu_hotplug), new CPUHotplugFragment()));
    if (CPUVoltage.hasCpuVoltage()) ITEMS.add(new DAdapter.Item(getString(R.string.cpu_voltage), new CPUVoltageFragment()));
    if (Entropy.hasEntropy()) ITEMS.add(new DAdapter.Item(getString(R.string.entropy), new EntropyFragment()));
    if (GPU.hasGpuControl()) ITEMS.add(new DAdapter.Item(getString(R.string.gpu), new GPUFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.io_scheduler), new IOFragment()));
    if (KSM.hasKsm()) ITEMS.add(new DAdapter.Item(getString(R.string.ksm), new KSMFragment()));
    if (LMK.getMinFrees() != null) ITEMS.add(new DAdapter.Item(getString(R.string.low_memory_killer), new LMKFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.misc_controls), new MiscFragment()));
    if (!Utils.isTV(this)) ITEMS.add(new DAdapter.Item(getString(R.string.battery), new BatteryFragment())); //Power and battery
    if (Ram.hasRamControl()) ITEMS.add(new DAdapter.Item(getString(R.string.ram), new RamFragment()));
    if (Screen.hasScreen()) ITEMS.add(new DAdapter.Item(getString(R.string.screen), new ScreenFragment()));
    if (Sound.hasSound()) ITEMS.add(new DAdapter.Item(getString(R.string.sound), new SoundFragment()));
    if (Thermal.hasThermal()) ITEMS.add(new DAdapter.Item(getString(R.string.thermal), new ThermalFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.virtual_memory), new VMFragment()));
    if (Wake.hasWake()) ITEMS.add(new DAdapter.Item(getString(R.string.wake_controls), new WakeFragment()));
    if (WakeLock.hasAnyWakelocks()) ITEMS.add(new DAdapter.Item(getString(R.string.wakelocks), new WakeLockFragment()));

    ITEMS.add(new DAdapter.Header(getString(R.string.tools)));
    if (Backup.hasBackup()) ITEMS.add(new DAdapter.Item(getString(R.string.backup), new BackupFragment()));
    if (Buildprop.hasBuildprop()) ITEMS.add(new DAdapter.Item(getString(R.string.build_prop_editor), new BuildpropFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.initd), new InitdFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.logs), new LogsFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.profile), new ProfileFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.recovery), new RecoveryFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.startup_commands), new StartUpCommandsFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.other)));
    ITEMS.add(new DAdapter.Item(getString(R.string.settings), new SettingsFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.about_us), new AboutusFragment()));
}
 
Example #5
Source File: BuildpropFragment.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
@Override
public void init(Bundle savedInstanceState) {
    super.init(savedInstanceState);
    hand = getHandler();

    buildpropItem = Buildprop.getProps();
    for (int i = 0; i < buildpropItem.size(); i++) {
        PopupCardView.DPopupCard mPropCard = new PopupCardView.DPopupCard(null);
        mPropCard.setDescription((String) buildpropItem.keySet().toArray()[i]);
        mPropCard.setItem((String) buildpropItem.values().toArray()[i]);
        mPropCard.setOnClickListener(this);

        addView(mPropCard);
    }
}
 
Example #6
Source File: BuildpropFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<RecyclerViewItem> doInBackground(BuildpropFragment fragment) {
    if (mRead) {
        fragment.mProps = Buildprop.getProps();
    }
    return super.doInBackground(fragment);
}
 
Example #7
Source File: BuildpropFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
@Override
public void init(Bundle savedInstanceState) {
    super.init(savedInstanceState);
    hand = getHandler();

    buildpropItem = Buildprop.getProps();
    for (int i = 0; i < buildpropItem.size(); i++) {
        PopupCardView.DPopupCard mPropCard = new PopupCardView.DPopupCard(null);
        mPropCard.setDescription((String) buildpropItem.keySet().toArray()[i]);
        mPropCard.setItem((String) buildpropItem.values().toArray()[i]);
        mPropCard.setOnClickListener(this);

        addView(mPropCard);
    }
}
 
Example #8
Source File: BuildpropFragment.java    From KA27 with Apache License 2.0 4 votes vote down vote up
private void overwrite(Context context, String oldKey, String oldValue, String newKey, String newValue) {
    String busybox = context.getFilesDir().getPath() + "/busybox";
    Buildprop.overwrite(oldKey, oldValue, newKey, newValue, busybox);
    hand.postDelayed(refresh, 500);
}
 
Example #9
Source File: BuildpropFragment.java    From KA27 with Apache License 2.0 4 votes vote down vote up
private void delete(Context context, String Key) {
    String busybox = context.getFilesDir().getPath() + "/busybox";
    Buildprop.delete(Key, busybox);
    hand.postDelayed(refresh, 500);
}
 
Example #10
Source File: BuildpropFragment.java    From KA27 with Apache License 2.0 4 votes vote down vote up
private void add(String key, String value) {
    Buildprop.addKey(key, value);
    hand.postDelayed(refresh, 500);
}
 
Example #11
Source File: BuildpropFragment.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
private void add(String key, String value) {
    Buildprop.addKey(key, value);
    hand.postDelayed(refresh, 500);
}
 
Example #12
Source File: BuildpropFragment.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
private void overwrite(String oldKey, String oldValue, String newKey, String newValue) {
    Buildprop.overwrite(oldKey, oldValue, newKey, newValue);
    hand.postDelayed(refresh, 500);
}
 
Example #13
Source File: BuildpropFragment.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
private void delete(String Key) {
    Buildprop.delete(Key);
    hand.postDelayed(refresh, 500);
}
 
Example #14
Source File: MainActivity.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
/**
 * Add all fragments in a list
 */
private void setList() {
    ITEMS.clear();
    ITEMS.add(new DAdapter.MainHeader());
    ITEMS.add(new DAdapter.Header(getString(R.string.information)));
    ITEMS.add(new DAdapter.Item(getString(R.string.kernel_information), new KernelInformationFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.frequency_table), new FrequencyTableFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.kernel)));
    ITEMS.add(new DAdapter.Item(getString(R.string.cpu), new CPUFragment()));
    if (CPUVoltage.hasCpuVoltage())
        ITEMS.add(new DAdapter.Item(getString(R.string.cpu_voltage), new CPUVoltageFragment()));
    if (CPUHotplug.hasCpuHotplug())
        ITEMS.add(new DAdapter.Item(getString(R.string.cpu_hotplug), new CPUHotplugFragment()));
    if (CoreControl.hasMinLittle())
        ITEMS.add(new DAdapter.Item(getString(R.string.corecontrol), new CoreControlFragment()));
    if (Thermal.hasThermal())
        ITEMS.add(new DAdapter.Item(getString(R.string.thermal), new ThermalFragment()));
    if (GPU.hasGpuControl())
        ITEMS.add(new DAdapter.Item(getString(R.string.gpu), new GPUFragment()));
    if (Screen.hasScreen())
        ITEMS.add(new DAdapter.Item(getString(R.string.screen), new ScreenFragment()));
    if (Wake.hasWake())
        ITEMS.add(new DAdapter.Item(getString(R.string.wake_controls), new WakeFragment()));
    if (Sound.hasSound())
        ITEMS.add(new DAdapter.Item(getString(R.string.sound), new SoundFragment()));
    if (!Utils.isTV(this))
        ITEMS.add(new DAdapter.Item(getString(R.string.battery), new BatteryFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.io_scheduler), new IOFragment()));
    if (KSM.hasKsm())
        ITEMS.add(new DAdapter.Item(getString(R.string.ksm), new KSMFragment()));
    if (LMK.getMinFrees() != null)
        ITEMS.add(new DAdapter.Item(getString(R.string.low_memory_killer), new LMKFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.virtual_memory), new VMFragment()));
    if (WakeLock.hasAnyWakelocks()) {
        ITEMS.add(new DAdapter.Item(getString(R.string.wakelocks), new WakeLockFragment()));
    }
    if (Entropy.hasEntropy())
        ITEMS.add(new DAdapter.Item(getString(R.string.entropy), new EntropyFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.misc_controls), new MiscFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.tools)));
    Downloads downloads;
    if ((downloads = new Downloads(this)).isSupported())
        ITEMS.add(new DAdapter.Item(getString(R.string.downloads),
                DownloadsFragment.newInstance(downloads.getLink())));
    if (Backup.hasBackup())
        ITEMS.add(new DAdapter.Item(getString(R.string.backup), new BackupFragment()));
    if (Buildprop.hasBuildprop() && RootUtils.busyboxInstalled())
        ITEMS.add(new DAdapter.Item(getString(R.string.build_prop_editor), new BuildpropFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.profile), new ProfileFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.recovery), new RecoveryFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.initd), new InitdFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.startup_commands), new StartUpCommandsFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.other)));
    ITEMS.add(new DAdapter.Item(getString(R.string.settings), new SettingsFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.faq), new FAQFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.about_us), new AboutusFragment()));
}
 
Example #15
Source File: BuildpropFragment.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void addItems(List<RecyclerViewItem> items) {
    mProps = Buildprop.getProps();
    load(items);
}
 
Example #16
Source File: BuildpropFragment.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
private void add(String key, String value) {
    Buildprop.addKey(key, value);
    reload(true);
}
 
Example #17
Source File: BuildpropFragment.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
private void overwrite(String oldKey, String oldValue, String newKey, String newValue) {
    Buildprop.overwrite(oldKey, oldValue, newKey, newValue);
    reload(true);
}