Search in sources :

Example 21 with DescriptionView

use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.

the class HelpFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    for (int id : sHelps.keySet()) {
        DescriptionView descriptionView = new DescriptionView();
        descriptionView.setTitle(getString(id));
        descriptionView.setSummary(getString(sHelps.get(id)));
        items.add(descriptionView);
    }
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView)

Example 22 with DescriptionView

use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.

the class FeaturesFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    for (SupportedDownloads.KernelContent.Feature feature : mFeatures) {
        DescriptionView descriptionView = new DescriptionView();
        if (feature.hasItems()) {
            StringBuilder stringBuilder = new StringBuilder();
            for (String subFeature : feature.getItems()) {
                if (stringBuilder.length() == 0) {
                    stringBuilder.append("\u2022").append(" ").append(subFeature);
                } else {
                    stringBuilder.append("<br>").append("\u2022").append(" ").append(subFeature);
                }
            }
            descriptionView.setTitle(Utils.htmlFrom(feature.getItem()));
            descriptionView.setSummary(Utils.htmlFrom(stringBuilder.toString()));
        } else {
            descriptionView.setSummary(Utils.htmlFrom(feature.getItem()));
        }
        descriptionView.setMovementMethod(LinkMovementMethod.getInstance());
        items.add(descriptionView);
    }
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView)

Example 23 with DescriptionView

use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.

the class CPUFragment method cpuQuietInit.

private void cpuQuietInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> views = new ArrayList<>();
    CardView cpuQuietCard = new CardView(getActivity());
    cpuQuietCard.setTitle(getString(R.string.cpu_quiet));
    if (Misc.hasCpuQuietEnable()) {
        SwitchView cpuQuietEnable = new SwitchView();
        cpuQuietEnable.setSummary(getString(R.string.cpu_quiet));
        cpuQuietEnable.setChecked(Misc.isCpuQuietEnabled());
        cpuQuietEnable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableCpuQuiet(isChecked, getActivity());
            }
        });
        views.add(cpuQuietEnable);
    }
    if (Misc.hasCpuQuietGovernors()) {
        SelectView cpuQuietGovernors = new SelectView();
        cpuQuietGovernors.setSummary(getString(R.string.cpu_quiet_governor));
        cpuQuietGovernors.setItems(Misc.getCpuQuietAvailableGovernors());
        cpuQuietGovernors.setItem(Misc.getCpuQuietCurGovernor());
        cpuQuietGovernors.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                Misc.setCpuQuietGovernor(item, getActivity());
            }
        });
        views.add(cpuQuietGovernors);
    }
    if (views.size() > 0) {
        DescriptionView descriptionView = new DescriptionView();
        descriptionView.setSummary(getString(R.string.cpu_quiet_summary));
        cpuQuietCard.addItem(descriptionView);
        for (RecyclerViewItem item : views) {
            cpuQuietCard.addItem(item);
        }
        items.add(cpuQuietCard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) ArrayList(java.util.ArrayList) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 24 with DescriptionView

use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.

the class EntropyFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    int ps = Entropy.getPoolsize();
    mAvailable = new DescriptionView();
    mAvailable.setTitle(getString(R.string.available));
    mAvailable.setSummary(getAvailableDescription(Entropy.getAvailable(), ps));
    items.add(mAvailable);
    mPoolSize = new DescriptionView();
    mPoolSize.setTitle(getString(R.string.poolsize));
    mPoolSize.setSummary(String.valueOf(ps));
    items.add(mPoolSize);
    SeekBarView read = new SeekBarView();
    read.setTitle(getString(R.string.read));
    read.setMax(4096);
    read.setMin(64);
    read.setOffset(64);
    read.setProgress(Entropy.getRead() / 64 - 1);
    read.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

        @Override
        public void onStop(SeekBarView seekBarView, int position, String value) {
            Entropy.setRead((position + 1) * 64, getActivity());
        }

        @Override
        public void onMove(SeekBarView seekBarView, int position, String value) {
        }
    });
    items.add(read);
    SeekBarView write = new SeekBarView();
    write.setTitle(getString(R.string.write));
    write.setMax(4096);
    write.setMin(64);
    write.setOffset(64);
    write.setProgress(Entropy.getWrite() / 64 - 1);
    write.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

        @Override
        public void onStop(SeekBarView seekBarView, int position, String value) {
            Entropy.setWrite((position + 1) * 64, getActivity());
        }

        @Override
        public void onMove(SeekBarView seekBarView, int position, String value) {
        }
    });
    items.add(write);
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

Example 25 with DescriptionView

use of com.moro.mtweaks.views.recyclerview.DescriptionView in project MTweaks-KernelAdiutorMOD by morogoku.

the class HmpFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    CardView card = new CardView(getActivity());
    card.setTitle(getString(R.string.hmp_long));
    DescriptionView hmp = new DescriptionView();
    hmp.setSummary(getString(R.string.hmp_desc));
    card.addItem(hmp);
    if (Hmp.hasUpThreshold()) {
        mUpThreshold = new SeekBarView();
        mUpThreshold.setTitle(getString(R.string.hmp_up_threshold));
        mUpThreshold.setSummary(getString(R.string.hmp_up_threshold_summary));
        mUpThreshold.setMax(1024);
        mUpThreshold.setMin(1);
        mUpThreshold.setProgress(Utils.strToInt(Hmp.getUpThreshold()) - 1);
        mUpThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Hmp.setUpThreshold((position + 1), getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        card.addItem(mUpThreshold);
    }
    if (Hmp.hasDownThreshold()) {
        mDownThreshold = new SeekBarView();
        mDownThreshold.setTitle(getString(R.string.hmp_down_threshold));
        mDownThreshold.setSummary(getString(R.string.hmp_down_threshold_summary));
        mDownThreshold.setMax(1024);
        mDownThreshold.setMin(1);
        mDownThreshold.setProgress(Utils.strToInt(Hmp.getDownThreshold()) - 1);
        mDownThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Hmp.setDownThreshold((position + 1), getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        card.addItem(mDownThreshold);
    }
    if (card.size() > 0) {
        items.add(card);
    }
    if (Hmp.hasUpThreshold() && Hmp.hasDownThreshold()) {
        TitleView profilesTitle = new TitleView();
        profilesTitle.setText(getString(R.string.profile));
        items.add(profilesTitle);
        for (int id : sProfiles.keySet()) {
            DescriptionView profile = new DescriptionView();
            profile.setTitle(getString(id));
            profile.setSummary(sProfiles.get(id));
            profile.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {

                @Override
                public void onClick(RecyclerViewItem item) {
                    Hmp.setHmpProfile(((DescriptionView) item).getSummary().toString(), getActivity());
                    refreshHmpProfile();
                }
            });
            items.add(profile);
        }
    }
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) CardView(com.moro.mtweaks.views.recyclerview.CardView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

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