Search in sources :

Example 1 with TitleView

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

the class BoefflaWakelockFragment method boefflaWakelockInit.

private void boefflaWakelockInit(List<RecyclerViewItem> items) {
    mWakeCard.clear();
    TitleView bwbT = new TitleView();
    bwbT.setText(getString(R.string.boeffla_wakelock) + " v" + BoefflaWakelock.getVersion());
    items.add(bwbT);
    DescriptionView bwbD = new DescriptionView();
    bwbD.setSummary(getString(R.string.boeffla_wakelock_summary));
    items.add(bwbD);
    SelectView bwOrder = new SelectView();
    bwOrder.setTitle(getString(R.string.wkl_order));
    bwOrder.setSummary(getString(R.string.wkl_order_summary));
    bwOrder.setItems(Arrays.asList(getResources().getStringArray(R.array.b_wakelocks_oder)));
    bwOrder.setItem(getString(R.string.wkl_time));
    bwOrder.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            BoefflaWakelock.setWakelockOrder(position);
            bwCardReload();
        }
    });
    items.add(bwOrder);
    List<BoefflaWakelock.ListWake> wakelocksB = BoefflaWakelock.getWakelockListBlocked();
    String titleB = getString(R.string.wkl_blocked);
    CardView cardB = new CardView(getActivity());
    bwCardInit(cardB, titleB, wakelocksB);
    mWakeCard.add(cardB);
    List<BoefflaWakelock.ListWake> wakelocksA = BoefflaWakelock.getWakelockListAllowed();
    String titleA = getString(R.string.wkl_allowed);
    CardView cardA = new CardView(getActivity());
    bwCardInit(cardA, titleA, wakelocksA);
    mWakeCard.add(cardA);
    items.addAll(mWakeCard);
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) CardView(com.moro.mtweaks.views.recyclerview.CardView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 2 with TitleView

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

the class LMKFragment method profileInit.

private void profileInit(List<RecyclerViewItem> items) {
    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) {
                LMK.setMinFree(((DescriptionView) item).getSummary().toString(), getActivity());
                refreshMinFree();
            }
        });
        items.add(profile);
    }
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem)

Example 3 with TitleView

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

the class VMFragment method CardVmTunablesInit.

private void CardVmTunablesInit(final CardView card) {
    card.clearItems();
    mVMs.clear();
    mCompleteList = Prefs.getBoolean("vm_show_complete_list", false, getActivity());
    SwitchView sv = new SwitchView();
    sv.setTitle(getString(R.string.vm_tun_switch_title));
    sv.setSummary(getString(R.string.vm_tun_switch_summary));
    sv.setChecked(mCompleteList);
    sv.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            mCompleteList = isChecked;
            Prefs.saveBoolean("vm_show_complete_list", mCompleteList, getActivity());
            getHandler().postDelayed(new Runnable() {

                @Override
                public void run() {
                    CardVmTunablesInit(card);
                }
            }, 250);
        }
    });
    card.addItem(sv);
    TitleView tit = new TitleView();
    if (mCompleteList) {
        tit.setText(getString(R.string.vm_tun_tit_all));
    } else {
        tit.setText(getString(R.string.vm_tun_tit_common));
    }
    card.addItem(tit);
    for (int i = 0; i < VM.size(mCompleteList); i++) {
        GenericSelectView2 vm = new GenericSelectView2();
        vm.setTitle(VM.getName(i, mCompleteList));
        vm.setValue(VM.getValue(i, mCompleteList));
        vm.setValueRaw(vm.getValue());
        vm.setInputType(InputType.TYPE_CLASS_NUMBER);
        final int position = i;
        vm.setOnGenericValueListener(new GenericSelectView2.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView2 genericSelectView, String value) {
                VM.setValue(value, position, getActivity(), mCompleteList);
                genericSelectView.setValue(value);
                refreshVMs();
            }
        });
        card.addItem(vm);
        mVMs.add(vm);
    }
}
Also used : GenericSelectView2(com.moro.mtweaks.views.recyclerview.GenericSelectView2) SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView)

Example 4 with TitleView

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

the class CPUHotplugFragment method makoHotplugInit.

private void makoHotplugInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> makoHotplug = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(R.string.mako_hotplug));
    if (MakoHotplug.hasMakoHotplugEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.mako_hotplug));
        enable.setSummary(getString(R.string.mako_hotplug_summary));
        enable.setChecked(MakoHotplug.isMakoHotplugEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                MakoHotplug.enableMakoHotplug(isChecked, getActivity());
            }
        });
        makoHotplug.add(enable);
        mEnableViews.add(enable);
    }
    if (MakoHotplug.hasMakoHotplugCoresOnTouch()) {
        SeekBarView coresOnTouch = new SeekBarView();
        coresOnTouch.setTitle(getString(R.string.cpus_on_touch));
        coresOnTouch.setSummary(getString(R.string.cpus_on_touch_summary));
        coresOnTouch.setMax(CPUFreq.getCpuCount());
        coresOnTouch.setMin(1);
        coresOnTouch.setProgress(MakoHotplug.getMakoHotplugCoresOnTouch() - 1);
        coresOnTouch.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugCoresOnTouch(position + 1, getActivity());
            }
        });
        makoHotplug.add(coresOnTouch);
    }
    if (MakoHotplug.hasMakoHotplugCpuFreqUnplugLimit() && CPUFreq.getFreqs() != null) {
        SelectView cpufreqUnplugLimit = new SelectView();
        cpufreqUnplugLimit.setSummary(getString(R.string.cpu_freq_unplug_limit));
        cpufreqUnplugLimit.setItems(CPUFreq.getAdjustedFreq(getActivity()));
        cpufreqUnplugLimit.setItem((MakoHotplug.getMakoHotplugCpuFreqUnplugLimit() / 1000) + getString(R.string.mhz));
        cpufreqUnplugLimit.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                MakoHotplug.setMakoHotplugCpuFreqUnplugLimit(CPUFreq.getFreqs().get(position), getActivity());
            }
        });
        makoHotplug.add(cpufreqUnplugLimit);
    }
    if (MakoHotplug.hasMakoHotplugFirstLevel()) {
        SeekBarView firstLevel = new SeekBarView();
        firstLevel.setTitle(getString(R.string.first_level));
        firstLevel.setSummary(getString(R.string.first_level_summary));
        firstLevel.setUnit("%");
        firstLevel.setProgress(MakoHotplug.getMakoHotplugFirstLevel());
        firstLevel.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugFirstLevel(position, getActivity());
            }
        });
        makoHotplug.add(firstLevel);
    }
    if (MakoHotplug.hasMakoHotplugHighLoadCounter()) {
        SeekBarView highLoadCounter = new SeekBarView();
        highLoadCounter.setTitle(getString(R.string.high_load_counter));
        highLoadCounter.setProgress(MakoHotplug.getMakoHotplugHighLoadCounter());
        highLoadCounter.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugHighLoadCounter(position, getActivity());
            }
        });
        makoHotplug.add(highLoadCounter);
    }
    if (MakoHotplug.hasMakoHotplugLoadThreshold()) {
        SeekBarView loadThreshold = new SeekBarView();
        loadThreshold.setTitle(getString(R.string.load_threshold));
        loadThreshold.setSummary(getString(R.string.load_threshold_summary));
        loadThreshold.setUnit("%");
        loadThreshold.setProgress(MakoHotplug.getMakoHotplugLoadThreshold());
        loadThreshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugLoadThreshold(position, getActivity());
            }
        });
        makoHotplug.add(loadThreshold);
    }
    if (MakoHotplug.hasMakoHotplugMaxLoadCounter()) {
        SeekBarView maxLoadCounter = new SeekBarView();
        maxLoadCounter.setTitle(getString(R.string.max_load_counter));
        maxLoadCounter.setProgress(MakoHotplug.getMakoHotplugMaxLoadCounter());
        maxLoadCounter.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugMaxLoadCounter(position, getActivity());
            }
        });
        makoHotplug.add(maxLoadCounter);
    }
    if (MakoHotplug.hasMakoHotplugMinTimeCpuOnline()) {
        SeekBarView minTimeCpuOnline = new SeekBarView();
        minTimeCpuOnline.setTitle(getString(R.string.min_time_cpu_online));
        minTimeCpuOnline.setProgress(MakoHotplug.getMakoHotplugMinTimeCpuOnline());
        minTimeCpuOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugMinTimeCpuOnline(position, getActivity());
            }
        });
        makoHotplug.add(minTimeCpuOnline);
    }
    if (MakoHotplug.hasMakoHotplugMinCoresOnline()) {
        SeekBarView minCoresOnline = new SeekBarView();
        minCoresOnline.setTitle(getString(R.string.min_cpu_online));
        minCoresOnline.setSummary(getString(R.string.min_cpu_online_summary));
        minCoresOnline.setMax(CPUFreq.getCpuCount());
        minCoresOnline.setMin(1);
        minCoresOnline.setProgress(MakoHotplug.getMakoHotplugMinCoresOnline() - 1);
        minCoresOnline.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugMinCoresOnline(position + 1, getActivity());
            }
        });
        makoHotplug.add(minCoresOnline);
    }
    if (MakoHotplug.hasMakoHotplugTimer()) {
        SeekBarView timer = new SeekBarView();
        timer.setTitle(getString(R.string.timer));
        timer.setProgress(MakoHotplug.getMakoHotplugTimer());
        timer.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                MakoHotplug.setMakoHotplugTimer(position, getActivity());
            }
        });
        makoHotplug.add(timer);
    }
    if (MakoHotplug.hasMakoHotplugSuspendFreq() && CPUFreq.getFreqs() != null) {
        SelectView suspendFreq = new SelectView();
        suspendFreq.setTitle(getString(R.string.cpu_max_screen_off_freq));
        suspendFreq.setSummary(getString(R.string.cpu_max_screen_off_freq_summary));
        suspendFreq.setItems(CPUFreq.getAdjustedFreq(getActivity()));
        suspendFreq.setItem((MakoHotplug.getMakoHotplugSuspendFreq() / 1000) + getString(R.string.mhz));
        suspendFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                MakoHotplug.setMakoHotplugSuspendFreq(CPUFreq.getFreqs().get(position), getActivity());
            }
        });
        makoHotplug.add(suspendFreq);
    }
    if (makoHotplug.size() > 0) {
        items.add(title);
        items.addAll(makoHotplug);
    }
}
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) TitleView(com.moro.mtweaks.views.recyclerview.TitleView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 5 with TitleView

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

the class CPUHotplugFragment method autoSmpInit.

private void autoSmpInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> autoSmp = new ArrayList<>();
    TitleView title = new TitleView();
    title.setText(getString(R.string.autosmp));
    if (AutoSmp.hasAutoSmpEnable()) {
        SwitchView enable = new SwitchView();
        enable.setTitle(getString(R.string.autosmp));
        enable.setSummary(getString(R.string.autosmp_summary));
        enable.setChecked(AutoSmp.isAutoSmpEnabled());
        enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                AutoSmp.enableAutoSmp(isChecked, getActivity());
            }
        });
        autoSmp.add(enable);
        mEnableViews.add(enable);
    }
    if (AutoSmp.hasAutoSmpCpufreqDown()) {
        SeekBarView cpuFreqDown = new SeekBarView();
        cpuFreqDown.setTitle(getString(R.string.downrate_limits));
        cpuFreqDown.setUnit("%");
        cpuFreqDown.setProgress(AutoSmp.getAutoSmpCpufreqDown());
        cpuFreqDown.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpCpufreqDown(position, getActivity());
            }
        });
        autoSmp.add(cpuFreqDown);
    }
    if (AutoSmp.hasAutoSmpCpufreqUp()) {
        SeekBarView cpuFreqUp = new SeekBarView();
        cpuFreqUp.setTitle(getString(R.string.uprate_limits));
        cpuFreqUp.setUnit("%");
        cpuFreqUp.setProgress(AutoSmp.getAutoSmpCpufreqUp());
        cpuFreqUp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpCpufreqUp(position, getActivity());
            }
        });
        autoSmp.add(cpuFreqUp);
    }
    if (AutoSmp.hasAutoSmpCycleDown()) {
        SeekBarView cycleDown = new SeekBarView();
        cycleDown.setTitle(getString(R.string.cycle_down));
        cycleDown.setSummary(getString(R.string.cycle_down_summary));
        cycleDown.setMax(CPUFreq.getCpuCount());
        cycleDown.setProgress(AutoSmp.getAutoSmpCycleDown());
        cycleDown.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpCycleDown(position, getActivity());
            }
        });
        autoSmp.add(cycleDown);
    }
    if (AutoSmp.hasAutoSmpCycleUp()) {
        SeekBarView cycleUp = new SeekBarView();
        cycleUp.setTitle(getString(R.string.cycle_up));
        cycleUp.setSummary(getString(R.string.cycle_up_summary));
        cycleUp.setMax(CPUFreq.getCpuCount());
        cycleUp.setProgress(AutoSmp.getAutoSmpCycleUp());
        cycleUp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpCycleUp(position, getActivity());
            }
        });
        autoSmp.add(cycleUp);
    }
    if (AutoSmp.hasAutoSmpDelay()) {
        SeekBarView delay = new SeekBarView();
        delay.setTitle(getString(R.string.delay));
        delay.setSummary(getString(R.string.delay_summary));
        delay.setUnit(getString(R.string.ms));
        delay.setMax(500);
        delay.setProgress(AutoSmp.getAutoSmpDelay());
        delay.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpDelay(position, getActivity());
            }
        });
        autoSmp.add(delay);
    }
    if (AutoSmp.hasAutoSmpMaxCpus()) {
        SeekBarView maxCpus = new SeekBarView();
        maxCpus.setTitle(getString(R.string.max_cpu_online));
        maxCpus.setSummary(getString(R.string.max_cpu_online_summary));
        maxCpus.setMax(CPUFreq.getCpuCount());
        maxCpus.setMin(1);
        maxCpus.setProgress(AutoSmp.getAutoSmpMaxCpus() - 1);
        maxCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpMaxCpus(position + 1, getActivity());
            }
        });
        autoSmp.add(maxCpus);
    }
    if (AutoSmp.hasAutoSmpMinCpus()) {
        SeekBarView minCpus = new SeekBarView();
        minCpus.setTitle(getString(R.string.min_cpu_online));
        minCpus.setSummary(getString(R.string.min_cpu_online_summary));
        minCpus.setMax(CPUFreq.getCpuCount());
        minCpus.setMin(1);
        minCpus.setProgress(AutoSmp.getAutoSmpMinCpus() - 1);
        minCpus.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                AutoSmp.setAutoSmpMinCpus(position + 1, getActivity());
            }
        });
        autoSmp.add(minCpus);
    }
    if (AutoSmp.hasAutoSmpScroffSingleCore()) {
        SwitchView scroffSingleCore = new SwitchView();
        scroffSingleCore.setTitle(getString(R.string.screen_off_single_cpu));
        scroffSingleCore.setSummary(getString(R.string.screen_off_single_cpu_summary));
        scroffSingleCore.setChecked(AutoSmp.isAutoSmpScroffSingleCoreEnabled());
        scroffSingleCore.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                AutoSmp.enableAutoSmpScroffSingleCoreActive(isChecked, getActivity());
            }
        });
        autoSmp.add(scroffSingleCore);
    }
    if (autoSmp.size() > 0) {
        items.add(title);
        items.addAll(autoSmp);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) ArrayList(java.util.ArrayList) TitleView(com.moro.mtweaks.views.recyclerview.TitleView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

Aggregations

TitleView (com.moro.mtweaks.views.recyclerview.TitleView)25 ArrayList (java.util.ArrayList)19 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)18 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)18 SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)16 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)7 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)7 CardView (com.moro.mtweaks.views.recyclerview.CardView)6 DialogInterface (android.content.DialogInterface)1 Controls (com.moro.mtweaks.database.tools.customcontrols.Controls)1 Profiles (com.moro.mtweaks.database.tools.profiles.Profiles)1 Device (com.moro.mtweaks.utils.Device)1 Wakelocks (com.moro.mtweaks.utils.kernel.misc.Wakelocks)1 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)1 ImageView (com.moro.mtweaks.views.recyclerview.ImageView)1 HashMap (java.util.HashMap)1