Search in sources :

Example 11 with CardView

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

the class ScreenFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    restoreValuesInit(items);
    screenColorInit(items);
    List<RecyclerViewItem> gammas = new ArrayList<>();
    if (Gamma.hasKGamma()) {
        kgammaInit(gammas);
    } else if (Gamma.hasGammaControl()) {
        gammacontrolInit(gammas);
    } else if (Gamma.hasDsiPanel()) {
        dsipanelInit(gammas);
    }
    if (gammas.size() > 0) {
        CardView gamma = new CardView(getActivity());
        gamma.setTitle(getString(R.string.gamma));
        for (RecyclerViewItem item : gammas) {
            gamma.addItem(item);
        }
        items.add(gamma);
    }
    lcdBackLightInit(items);
    backlightDimmerInit(items);
    if (Misc.hasNegativeToggle()) {
        negativeToggleInit(items);
    }
    mdnieGlobalInit(items);
    if (Misc.hasGloveMode()) {
        gloveModeInit(items);
    }
}
Also used : ArrayList(java.util.ArrayList) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem)

Example 12 with CardView

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

the class SpectrumFragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    final int balColor = ContextCompat.getColor(getContext(), R.color.colorBalance);
    final int perColor = ContextCompat.getColor(getContext(), R.color.colorPerformance);
    final int batColor = ContextCompat.getColor(getContext(), R.color.colorBattery);
    final int gamColor = ContextCompat.getColor(getContext(), R.color.colorGaming);
    // CardView Balanced
    final CardView card0 = new CardView(getActivity());
    card0.setTitle(getString(R.string.spec_balanced));
    card0.setExpandable(false);
    final DescriptionView desc0 = new DescriptionView();
    desc0.setSummary(getString(R.string.spec_balanced_summary));
    desc0.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_balanced));
    card0.setOnItemClickListener(new CardView.OnItemClickListener() {

        @Override
        public void onClick(RecyclerViewItem item) {
            cardClick(card0, desc0, 0, balColor);
        }
    });
    card0.addItem(desc0);
    items.add(card0);
    // CardView Performance
    final CardView card1 = new CardView(getActivity());
    card1.setTitle(getString(R.string.spec_performance));
    card1.setExpandable(false);
    final DescriptionView desc1 = new DescriptionView();
    desc1.setSummary(getString(R.string.spec_performance_summary));
    desc1.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_performance));
    card1.setOnItemClickListener(new CardView.OnItemClickListener() {

        @Override
        public void onClick(RecyclerViewItem item) {
            cardClick(card1, desc1, 1, perColor);
        }
    });
    card1.addItem(desc1);
    items.add(card1);
    // CardView Battery
    final CardView card2 = new CardView(getActivity());
    card2.setTitle(getString(R.string.spec_battery));
    card2.setExpandable(false);
    final DescriptionView desc2 = new DescriptionView();
    desc2.setSummary(getString(R.string.spec_battery_summary));
    desc2.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_battery));
    card2.setOnItemClickListener(new CardView.OnItemClickListener() {

        @Override
        public void onClick(RecyclerViewItem item) {
            cardClick(card2, desc2, 2, batColor);
        }
    });
    card2.addItem(desc2);
    items.add(card2);
    // CardView Gaming
    final CardView card3 = new CardView(getActivity());
    card3.setTitle(getString(R.string.spec_gaming));
    card3.setExpandable(false);
    final DescriptionView desc3 = new DescriptionView();
    desc3.setSummary(getString(R.string.spec_gaming_summary));
    desc3.setDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_spectrum_game));
    card3.setOnItemClickListener(new CardView.OnItemClickListener() {

        @Override
        public void onClick(RecyclerViewItem item) {
            cardClick(card3, desc3, 3, gamColor);
        }
    });
    card3.addItem(desc3);
    items.add(card3);
    // Detects the selected profile on launch
    int mProfile = Prefs.getInt("spectrum_profile", 0, getActivity());
    if (mProfile == 0) {
        card0.GrxSetInitSelection(true, balColor);
        desc0.GrxSetInitSelection(true, Color.WHITE);
        oldCard = card0;
        oldDesc = desc0;
    } else if (mProfile == 1) {
        card1.GrxSetInitSelection(true, perColor);
        desc1.GrxSetInitSelection(true, Color.WHITE);
        oldCard = card1;
        oldDesc = desc1;
    } else if (mProfile == 2) {
        card2.GrxSetInitSelection(true, batColor);
        desc2.GrxSetInitSelection(true, Color.WHITE);
        oldCard = card2;
        oldDesc = desc2;
    } else if (mProfile == 3) {
        card3.GrxSetInitSelection(true, gamColor);
        desc3.GrxSetInitSelection(true, Color.WHITE);
        oldCard = card3;
        oldDesc = desc3;
    }
}
Also used : DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem)

Example 13 with CardView

use of com.moro.mtweaks.views.recyclerview.CardView 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 14 with CardView

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

the class CPUVoltageCl0Fragment method addItems.

@Override
protected void addItems(List<RecyclerViewItem> items) {
    mVoltages.clear();
    final List<String> freqs = VoltageCl0.getFreqs();
    final List<String> voltages = VoltageCl0.getVoltages();
    final List<String> voltagesStock = VoltageCl0.getStockVoltages();
    if (freqs != null && voltages != null && voltagesStock != null && freqs.size() == voltages.size()) {
        CardView freqCard = new CardView(getActivity());
        freqCard.setTitle(getString(R.string.cpuCl0_volt_control));
        List<String> progress = new ArrayList<>();
        for (float i = -100000f; i < 31250f; i += 6250) {
            String global = String.valueOf(i / VoltageCl0.getOffset());
            progress.add(global);
        }
        seekbarProfInit(mSeekbarProf, freqs, voltages, voltagesStock, progress);
        freqCard.addItem(mSeekbarProf);
        Boolean enableGlobal = Prefs.getBoolean("CpuCl0_global_volts", true, getActivity());
        SwitchView voltControl = new SwitchView();
        voltControl.setTitle(getString(R.string.cpu_manual_volt));
        voltControl.setSummaryOn(getString(R.string.cpu_manual_volt_summaryOn));
        voltControl.setSummaryOff(getString(R.string.cpu_manual_volt_summaryOff));
        voltControl.setChecked(enableGlobal);
        voltControl.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                if (isChecked) {
                    Prefs.saveBoolean("CpuCl0_global_volts", true, getActivity());
                    Prefs.saveBoolean("CpuCl0_individual_volts", false, getActivity());
                    reload();
                } else {
                    Prefs.saveBoolean("CpuCl0_global_volts", false, getActivity());
                    Prefs.saveBoolean("CpuCl0_individual_volts", true, getActivity());
                    Prefs.saveInt("CpuCl0_seekbarPref_value", 16, getActivity());
                    reload();
                }
            }
        });
        freqCard.addItem(voltControl);
        if (freqCard.size() > 0) {
            items.add(freqCard);
        }
        TitleView tunables = new TitleView();
        tunables.setText(getString(R.string.cpuCl0_volt));
        items.add(tunables);
        for (int i = 0; i < freqs.size(); i++) {
            SeekBarView seekbar = new SeekBarView();
            seekbarInit(seekbar, freqs.get(i), voltages.get(i), voltagesStock.get(i));
            mVoltages.add(seekbar);
        }
    }
    items.addAll(mVoltages);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) ArrayList(java.util.ArrayList) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView)

Example 15 with CardView

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

the class GPUFragment method governorInit.

private void governorInit(List<RecyclerViewItem> items) {
    CardView govCard = new CardView(getActivity());
    govCard.setTitle(getString(R.string.gpu_governor));
    if (GPUFreq.hasGovernor()) {
        SelectView governor = new SelectView();
        governor.setTitle(getString(R.string.gpu_governor));
        governor.setSummary(getString(R.string.gpu_governor_summary));
        governor.setItems(GPUFreq.getAvailableGovernors());
        governor.setItem(GPUFreq.getGovernor());
        governor.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                GPUFreq.setGovernor(item, getActivity());
            }
        });
        govCard.addItem(governor);
    }
    TitleView tunables = new TitleView();
    tunables.setText(getString(R.string.gov_tunables));
    govCard.addItem(tunables);
    if (GPUFreq.hasHighspeedClock()) {
        List<String> freqs = new ArrayList<>();
        List<Integer> list = GPUFreq.getAvailableFreqsSort();
        if (list != null) {
            int value = 0;
            for (int i = 0; i < list.size(); i++) {
                freqs.add(String.valueOf(list.get(i)));
                if (list.get(i) == GPUFreq.getHighspeedClock()) {
                    value = i;
                }
            }
            SeekBarView seekbar = new SeekBarView();
            seekbar.setTitle(getString(R.string.tun_highspeed_clock));
            seekbar.setSummary(getString(R.string.tun_highspeed_clock_summary));
            seekbar.setUnit(getString(R.string.mhz));
            seekbar.setItems(freqs);
            seekbar.setProgress(value);
            seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

                @Override
                public void onStop(SeekBarView seekBarView, int position, String value) {
                    GPUFreq.setHighspeedClock(value, getActivity());
                }

                @Override
                public void onMove(SeekBarView seekBarView, int position, String value) {
                }
            });
            govCard.addItem(seekbar);
        }
    }
    if (GPUFreq.hasHighspeedLoad()) {
        SeekBarView seekbar = new SeekBarView();
        seekbar.setTitle(getString(R.string.tun_highspeed_load));
        seekbar.setSummary(getString(R.string.tun_highspeed_load_summary));
        seekbar.setUnit(getString(R.string.percent));
        seekbar.setMax(100);
        seekbar.setMin(1);
        seekbar.setProgress(GPUFreq.getHighspeedLoad() - 1);
        seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        govCard.addItem(seekbar);
    }
    if (GPUFreq.hasHighspeedDelay()) {
        SeekBarView seekbar = new SeekBarView();
        seekbar.setTitle(getString(R.string.tun_highspeed_delay));
        seekbar.setSummary(getString(R.string.tun_highspeed_delay_summary));
        seekbar.setUnit(getString(R.string.ms));
        seekbar.setMax(5);
        seekbar.setMin(0);
        seekbar.setProgress(GPUFreq.getHighspeedDelay());
        seekbar.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                GPUFreq.setHighspeedDelay(position, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        govCard.addItem(seekbar);
    }
    if (govCard.size() > 0) {
        items.add(govCard);
    }
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) ArrayList(java.util.ArrayList) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView) TitleView(com.moro.mtweaks.views.recyclerview.TitleView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Aggregations

CardView (com.moro.mtweaks.views.recyclerview.CardView)51 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)23 SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)23 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)20 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)13 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)9 ArrayList (java.util.ArrayList)8 TitleView (com.moro.mtweaks.views.recyclerview.TitleView)6 PopupMenu (android.support.v7.widget.PopupMenu)4 MenuItem (android.view.MenuItem)4 GenericSelectView (com.moro.mtweaks.views.recyclerview.GenericSelectView)4 DialogInterface (android.content.DialogInterface)3 Menu (android.view.Menu)3 Intent (android.content.Intent)2 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)2 XYGraphView (com.moro.mtweaks.views.recyclerview.XYGraphView)2 AppWidgetManager (android.appwidget.AppWidgetManager)1 ComponentName (android.content.ComponentName)1 View (android.view.View)1 TextView (android.widget.TextView)1