Search in sources :

Example 6 with DescriptionView

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);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) XYGraphView(com.moro.mtweaks.views.recyclerview.XYGraphView) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 7 with DescriptionView

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);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) ArrayList(java.util.ArrayList) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView)

Example 8 with DescriptionView

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);
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem)

Example 9 with DescriptionView

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);
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView) ImageView(com.moro.mtweaks.views.recyclerview.ImageView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem)

Example 10 with DescriptionView

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);
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) CardView(com.moro.mtweaks.views.recyclerview.CardView)

Aggregations

DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)26 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)16 CardView (com.moro.mtweaks.views.recyclerview.CardView)12 TitleView (com.moro.mtweaks.views.recyclerview.TitleView)7 ArrayList (java.util.ArrayList)6 DialogInterface (android.content.DialogInterface)5 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)5 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)4 SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)4 PopupMenu (android.support.v7.widget.PopupMenu)3 MenuItem (android.view.MenuItem)3 Intent (android.content.Intent)2 Menu (android.view.Menu)2 Profiles (com.moro.mtweaks.database.tools.profiles.Profiles)2 RootFile (com.moro.mtweaks.utils.root.RootFile)2 Dialog (com.moro.mtweaks.views.dialog.Dialog)2 File (java.io.File)2 Activity (android.app.Activity)1 ProgressDialog (android.app.ProgressDialog)1 AppWidgetManager (android.appwidget.AppWidgetManager)1