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

The following examples show how to use com.grarak.kerneladiutor.utils.tools.Backup. 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: BackupFragment.java    From KA27 with Apache License 2.0 6 votes vote down vote up
private void options(final boolean flashing, final RootFile file) {
    final LinkedHashMap < String, Backup.PARTITION > menu = new LinkedHashMap < > ();
    if (Backup.getBootPartition() != null)
        menu.put(getString(R.string.boot), Backup.PARTITION.BOOT);
    if (Backup.getRecoveryPartition() != null)
        menu.put(getString(R.string.recovery), Backup.PARTITION.RECOVERY);

    String[] items = new String[menu.keySet().toArray().length];
    for (int i = 0; i < items.length; i++)
        items[i] = (String) menu.keySet().toArray()[i];
    new AlertDialog.Builder(getActivity(),
        (Utils.DARKTHEME ? R.style.AlertDialogStyleDark : R.style.AlertDialogStyleLight)).setItems(items,
        new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                if (flashing) restoreDialog(file, (Backup.PARTITION) menu.values().toArray()[which], false);
                else backupDialog((Backup.PARTITION) menu.values().toArray()[which]);
            }
        }).show();
}
 
Example #2
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 6 votes vote down vote up
private void backup(final Backup.PARTITION partition) {
    mBackupPartition = partition;
    ViewUtils.dialogEditText(partition == Backup.PARTITION.BOOT ? Device.getKernelVersion(false) : null,
            (dialogInterface, i) -> {
            },
            text -> {
                if (text.isEmpty()) {
                    Utils.toast(R.string.name_empty, getActivity());
                    return;
                }

                if (!text.endsWith(".img")) {
                    text += ".img";
                }
                if (Utils.existFile(Backup.getPath(partition) + "/" + text)) {
                    Utils.toast(getString(R.string.already_exists, text), getActivity());
                    return;
                }

                showDialog(new BackupTask(getActivity(), text, partition));
            }, getActivity())
            .setOnDismissListener(dialogInterface
                    -> mBackupPartition = null).show();
}
 
Example #3
Source File: BackupFragment.java    From kernel_adiutor with Apache License 2.0 6 votes vote down vote up
private void options(final boolean flashing, final RootFile file) {
    final LinkedHashMap<String, Backup.PARTITION> menu = new LinkedHashMap<>();
    if (Backup.getBootPartition() != null)
        menu.put(getString(R.string.boot), Backup.PARTITION.BOOT);
    if (Backup.getRecoveryPartition() != null)
        menu.put(getString(R.string.recovery), Backup.PARTITION.RECOVERY);
    if (Backup.getFotaPartition() != null)
        menu.put(getString(R.string.fota), Backup.PARTITION.FOTA);

    String[] items = new String[menu.keySet().toArray().length];
    for (int i = 0; i < items.length; i++)
        items[i] = (String) menu.keySet().toArray()[i];
    new AlertDialog.Builder(getActivity()).setItems(items,
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    if (flashing)
                        restoreDialog(file, (Backup.PARTITION) menu.values().toArray()[which], false);
                    else backupDialog((Backup.PARTITION) menu.values().toArray()[which]);
                }
            }).show();
}
 
Example #4
Source File: BackupFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
private void create() {
    removeAllViews();

    final long size = viewInit(boot, Backup.PARTITION.BOOT) + viewInit(recovery, Backup.PARTITION.RECOVERY);
    getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            title.setText(getCount() > 0 ? getString(R.string.items_found, getCount()) + " (" +
                size + getString(R.string.mb) + ")" : getString(R.string.no_backups));
        }
    });
}
 
Example #5
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
private LinkedHashMap<String, Backup.PARTITION> getPartitionMenu() {
    LinkedHashMap<String, Backup.PARTITION> partitions = new LinkedHashMap<>();
    if (Backup.getBootPartition() != null) {
        partitions.put(getString(R.string.boot_partition), Backup.PARTITION.BOOT);
    }
    if (Backup.getRecoveryPartition() != null) {
        partitions.put(getString(R.string.recovery_partition), Backup.PARTITION.RECOVERY);
    }
    if (Backup.getFotaPartition() != null) {
        partitions.put(getString(R.string.fota_partition), Backup.PARTITION.FOTA);
    }
    return partitions;
}
 
Example #6
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
private void restore(final Backup.PARTITION partition, final File file, final boolean flashing) {
    mRestoreDialog = ViewUtils.dialogBuilder(getString(R.string.sure_question),
            (dialogInterface, i) -> {
            },
            (dialogInterface, i)
                    -> showDialog(new RestoreTask(getActivity(), flashing, file, partition)),
            dialogInterface -> mRestoreDialog = null, getActivity());
    mRestoreDialog.show();
}
 
Example #7
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
private void showBackupFlashingDialog(final File file) {
    final LinkedHashMap<String, Backup.PARTITION> menu = getPartitionMenu();
    mBackupFlashingDialog = new Dialog(getActivity()).setItems(menu.keySet().toArray(
            new String[menu.size()]),
            (dialogInterface, i) -> {
                Backup.PARTITION partition = menu.values().toArray(new Backup.PARTITION[menu.size()])[i];
                if (file != null) {
                    restore(partition, file, true);
                } else {
                    backup(partition);
                }
            })
            .setOnDismissListener(dialogInterface -> mBackupFlashingDialog = null);
    mBackupFlashingDialog.show();
}
 
Example #8
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
private void itemInit(List<RecyclerViewItem> items, final Backup.PARTITION partition) {
    File file = new File(Backup.getPath(partition));
    if (file.exists()) {
        for (final File image : file.listFiles()) {
            if (image.isFile()) {
                DescriptionView descriptionView = new DescriptionView();
                descriptionView.setTitle(image.getName().replace(".img", ""));
                descriptionView.setSummary((image.length() / 1024L / 1024L) + getString(R.string.mb));
                descriptionView.setOnItemClickListener(item -> {
                    mItemOptionsDialog = new Dialog(getActivity())
                            .setItems(getResources().getStringArray(R.array.backup_item_options),
                                    (dialogInterface, i) -> {
                                        switch (i) {
                                            case 0:
                                                restore(partition, image, false);
                                                break;
                                            case 1:
                                                delete(image);
                                                break;
                                        }
                                    })
                            .setOnDismissListener(dialogInterface -> mItemOptionsDialog = null);
                    mItemOptionsDialog.show();
                });

                items.add(descriptionView);
            }
        }
    }
}
 
Example #9
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void init() {
    super.init();

    if (Backup.getBootPartition() != null) {
        addViewPagerFragment(DescriptionFragment.newInstance(getString(R.string.boot_partition),
                Backup.getBootPartition()));
    }
    if (Backup.getRecoveryPartition() != null) {
        addViewPagerFragment(DescriptionFragment.newInstance(getString(R.string.recovery_partition),
                Backup.getRecoveryPartition()));
    }
    if (Backup.getFotaPartition() != null) {
        addViewPagerFragment(DescriptionFragment.newInstance(getString(R.string.fota_partition),
                Backup.getFotaPartition()));
    }

    if (mOptionsDialog != null) {
        mOptionsDialog.show();
    }
    if (mBackupFlashingDialog != null) {
        mBackupFlashingDialog.show();
    }
    if (mBackupPartition != null) {
        backup(mBackupPartition);
    }
    if (mItemOptionsDialog != null) {
        mItemOptionsDialog.show();
    }
    if (mDeleteDialog != null) {
        mDeleteDialog.show();
    }
    if (mRestoreDialog != null) {
        mRestoreDialog.show();
    }
}
 
Example #10
Source File: BackupFragment.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
private long viewInit(RootFile folder, final Backup.PARTITION partition_type) {
    folder.mkdir();

    long size = 0;
    String text = null;
    if (folder.toString().endsWith("boot")) text = getString(R.string.boot);
    else if (folder.toString().endsWith("recovery")) text = getString(R.string.recovery);
    else if (folder.toString().endsWith("fota")) text = getString(R.string.fota);
    if (text == null) return 0;
    for (final RootFile file : folder.listFiles())
        if (file.getName().endsWith(".img")) {
            CardViewItem.DCardView cardView = new CardViewItem.DCardView();
            cardView.setTitle(file.getName().replace(".img", ""));
            float fileSize = file.length() / 1024;
            size += fileSize;
            cardView.setDescription(text + ", " + fileSize + getString(R.string.mb));
            cardView.setOnDCardListener(new CardViewItem.DCardView.OnDCardListener() {
                @Override
                public void onClick(CardViewItem.DCardView dCardView) {
                    new AlertDialog.Builder(getActivity()).setItems(getResources().getStringArray(R.array.backup_menu),
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    switch (which) {
                                        case 0:
                                            restoreDialog(file, partition_type, true);
                                            break;
                                        case 1:
                                            deleteDialog(file);
                                            break;
                                    }
                                }
                            }).show();
                }
            });

            addView(cardView);
        }
    return size;
}
 
Example #11
Source File: BackupFragment.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
private void create() {
    removeAllViews();

    final long size = viewInit(boot, Backup.PARTITION.BOOT) + viewInit(recovery, Backup.PARTITION.RECOVERY) +
            viewInit(fota, Backup.PARTITION.FOTA);
    getActivity().runOnUiThread(new Runnable() {
        @Override
        public void run() {
            title.setText(getCount() > 0 ? getString(R.string.items_found, getCount()) + " (" +
                    size + getString(R.string.mb) + ")" : getString(R.string.no_backups));
        }
    });
}
 
Example #12
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 #13
Source File: BackupFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
private void restoreDialog(final RootFile file, final Backup.PARTITION partition_type, final boolean restoring) {
    Utils.confirmDialog(null, getString(R.string.overwrite_question, Backup.getPartition(partition_type)), new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            new AsyncTask < Void, Void, Void > () {
                private MaterialDialog progressDialog;

                @Override
                protected void onPreExecute() {
                    super.onPreExecute();
                    progressDialog = new MaterialDialog.Builder(getActivity())
                        .content(restoring ? R.string.restoring : R.string.flashing)
                        .progress(true, 0)
                        .canceledOnTouchOutside(false)
                        .show();
                }

                @Override
                protected Void doInBackground(Void...params) {
                    Backup.restore(file, partition_type);
                    return null;
                }

                @Override
                protected void onPostExecute(Void aVoid) {
                    super.onPostExecute(aVoid);
                    progressDialog.dismiss();
                }
            }.execute();
        }
    }, getActivity());
}
 
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: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
private RestoreTask(Context context, boolean flashing,
                    File file, Backup.PARTITION partition) {
    super(null, context.getString(flashing ? R.string.flashing : R.string.restoring));
    mFile = file;
    mPartition = partition;
}
 
Example #16
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Void doInBackground(BackupFragment fragment) {
    Backup.restore(mFile, mPartition);
    return null;
}
 
Example #17
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
private BackupTask(Context context, String name, Backup.PARTITION partition) {
    super(null, context.getString(R.string.backing_up));
    mName = name;
    mPartition = partition;
}
 
Example #18
Source File: BackupFragment.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Void doInBackground(BackupFragment fragment) {
    Backup.backup(mName, mPartition);
    return null;
}
 
Example #19
Source File: BackupFragment.java    From KA27 with Apache License 2.0 4 votes vote down vote up
private long viewInit(RootFile folder, final Backup.PARTITION partition_type) {
    folder.mkdir();

    long size = 0;
    String text = null;
    if (folder.toString().endsWith("boot")) text = getString(R.string.boot);
    else if (folder.toString().endsWith("recovery")) text = getString(R.string.recovery);
    if (text == null) return 0;
    for (final RootFile file: folder.listFiles())
        if (file.getName().endsWith(".img")) {
            CardViewItem.DCardView cardView = new CardViewItem.DCardView();
            cardView.setTitle(file.getName().replace(".img", ""));
            float fileSize = file.length() / 1024;
            size += fileSize;
            cardView.setDescription(text + ", " + fileSize + getString(R.string.mb));
            cardView.setOnDCardListener(new CardViewItem.DCardView.OnDCardListener() {
                @Override
                public void onClick(CardViewItem.DCardView dCardView) {
                    new AlertDialog.Builder(getActivity(),
                            (Utils.DARKTHEME ? R.style.AlertDialogStyleDark : R.style.AlertDialogStyleLight))
                        .setTitle(file.getName().replace(".img", ""))
                        .setItems(getResources().getStringArray(R.array.backup_menu),
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int which) {
                                    switch (which) {
                                        case 0:
                                            restoreDialog(file, partition_type, true);
                                            break;
                                        case 1:
                                            deleteDialog(file);
                                            break;
                                    }
                                }
                            }).show();
                }
            });

            addView(cardView);
        }
    return size;
}
 
Example #20
Source File: NavigationActivity.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
private void initFragments() {
    mFragments.clear();
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.statistics));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.overall, OverallFragment.class, R.drawable.ic_chart));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.device, DeviceFragment.class, R.drawable.ic_device));
    if (Device.MemInfo.getInstance().getItems().size() > 0) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.memory, MemoryFragment.class, R.drawable.ic_save));
    }
    if (Device.Input.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.inputs, InputsFragment.class, R.drawable.ic_keyboard));
    }
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.kernel));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.cpu, CPUFragment.class, R.drawable.ic_cpu));
    if (Voltage.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.cpu_voltage, CPUVoltageFragment.class, R.drawable.ic_bolt));
    }
    if (Hotplug.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.cpu_hotplug, CPUHotplugFragment.class, R.drawable.ic_switch));
    }
    if (Thermal.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.thermal, ThermalFragment.class, R.drawable.ic_temperature));
    }
    if (GPU.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.gpu, GPUFragment.class, R.drawable.ic_gpu));
    }
    if (Screen.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.screen, ScreenFragment.class, R.drawable.ic_display));
    }
    if (Wake.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.wake, WakeFragment.class, R.drawable.ic_unlock));
    }
    if (Sound.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.sound, SoundFragment.class, R.drawable.ic_music));
    }
    if (Battery.getInstance(this).supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.battery, BatteryFragment.class, R.drawable.ic_battery));
    }
    if (LED.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.led, LEDFragment.class, R.drawable.ic_led));
    }
    if (IO.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.io_scheduler, IOFragment.class, R.drawable.ic_sdcard));
    }
    if (KSM.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.ksm, KSMFragment.class, R.drawable.ic_merge));
    }
    if (LMK.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.lmk, LMKFragment.class, R.drawable.ic_stackoverflow));
    }
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.virtual_memory, VMFragment.class, R.drawable.ic_server));
    if (Entropy.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.entropy, EntropyFragment.class, R.drawable.ic_numbers));
    }
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.misc, MiscFragment.class, R.drawable.ic_clear));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.tools));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.data_sharing, DataSharingFragment.class, R.drawable.ic_database));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.custom_controls, CustomControlsFragment.class, R.drawable.ic_console));

    SupportedDownloads supportedDownloads = new SupportedDownloads(this);
    if (supportedDownloads.getLink() != null) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.downloads, DownloadsFragment.class, R.drawable.ic_download));
    }
    if (Backup.hasBackup()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.backup, BackupFragment.class, R.drawable.ic_restore));
    }
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.build_prop_editor, BuildpropFragment.class, R.drawable.ic_edit));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.profile, ProfileFragment.class, R.drawable.ic_layers));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.recovery, RecoveryFragment.class, R.drawable.ic_security));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.initd, InitdFragment.class, R.drawable.ic_shell));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.on_boot, OnBootFragment.class, R.drawable.ic_start));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.other));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.settings, SettingsFragment.class, R.drawable.ic_settings));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.about, AboutFragment.class, R.drawable.ic_about));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.contributors, ContributorsFragment.class, R.drawable.ic_people));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.help, HelpFragment.class, R.drawable.ic_help));
}