Search in sources :

Example 46 with CardView

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

the class GPUFragment method voltageInit.

private void voltageInit(List<RecyclerViewItem> items) {
    List<Integer> freqs = GPUFreq.getAvailableFreqs();
    List<String> voltages = GPUFreq.getVoltages();
    List<String> voltagesStock = GPUFreq.getStockVoltages();
    if (freqs != null && voltages != null && voltagesStock != null && freqs.size() == voltages.size()) {
        CardView voltCard = new CardView(getActivity());
        voltCard.setTitle(getString(R.string.gpu_voltage));
        List<String> progress = new ArrayList<>();
        for (float i = -100000f; i < 31250f; i += 6250) {
            String global = String.valueOf(i / GPUFreq.getVoltageOffset());
            progress.add(global);
        }
        seekbarProfInit(mSeekbarProf, freqs, voltages, voltagesStock, progress);
        voltCard.addItem(mSeekbarProf);
        Boolean enableGlobal = Prefs.getBoolean("gpu_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("gpu_global_volts", true, getActivity());
                    Prefs.saveBoolean("gpu_individual_volts", false, getActivity());
                    reload();
                } else {
                    Prefs.saveBoolean("gpu_global_volts", false, getActivity());
                    Prefs.saveBoolean("gpu_individual_volts", true, getActivity());
                    Prefs.saveInt("gpu_seekbarPref_value", 16, getActivity());
                    reload();
                }
            }
        });
        voltCard.addItem(voltControl);
        if (voltCard.size() > 0) {
            items.add(voltCard);
        }
        TitleView tunables = new TitleView();
        tunables.setText(getString(R.string.cpuCl1_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 47 with CardView

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

the class GPUFragment method adrenoboostInit.

private void adrenoboostInit(List<RecyclerViewItem> items) {
    CardView abCard = new CardView(getActivity());
    abCard.setTitle(getString(R.string.gpu_adreno_boost_title));
    SelectView aB = new SelectView();
    aB.setTitle(getString(R.string.gpu_adreno_boost_title));
    aB.setSummary(getString(R.string.gpu_adreno_boost_summary));
    aB.setItems(Arrays.asList(getResources().getStringArray(R.array.gpu_adreno_boost)));
    aB.setItem(AdrenoBoost.getAdrenoBoost(getActivity()));
    aB.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            AdrenoBoost.setAdrenoBoost(position, getActivity());
        }
    });
    abCard.addItem(aB);
    if (abCard.size() > 0) {
        items.add(abCard);
    }
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 48 with CardView

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

the class GPUFragment method freqInit.

private void freqInit(List<RecyclerViewItem> items) {
    CardView freqCard = new CardView(getActivity());
    freqCard.setTitle(getString(R.string.frequencies));
    if (GPUFreq.hasCurFreq() && GPUFreq.getAvailableFreqs() != null) {
        mCurFreq = new XYGraphView();
        mCurFreq.setTitle(getString(R.string.gpu_freq));
        freqCard.addItem(mCurFreq);
    }
    if (GPUFreq.hasMaxFreq() && GPUFreq.getAvailableFreqs() != null) {
        SelectView maxFreq = new SelectView();
        maxFreq.setTitle(getString(R.string.gpu_max_freq));
        maxFreq.setSummary(getString(R.string.gpu_max_freq_summary));
        maxFreq.setItems(GPUFreq.getAdjustedFreqs(getActivity()));
        maxFreq.setItem((GPUFreq.getMaxFreq() / GPUFreq.getMaxFreqOffset()) + getString(R.string.mhz));
        maxFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                GPUFreq.setMaxFreq(GPUFreq.getAvailableFreqs().get(position), getActivity());
            }
        });
        freqCard.addItem(maxFreq);
    }
    if (GPUFreq.hasMinFreq() && GPUFreq.getAvailableFreqs() != null) {
        SelectView minFreq = new SelectView();
        minFreq.setTitle(getString(R.string.gpu_min_freq));
        minFreq.setSummary(getString(R.string.gpu_min_freq_summary));
        minFreq.setItems(GPUFreq.getAdjustedFreqs(getActivity()));
        minFreq.setItem((GPUFreq.getMinFreq() / GPUFreq.getMinFreqOffset()) + getString(R.string.mhz));
        minFreq.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                GPUFreq.setMinFreq(GPUFreq.getAvailableFreqs().get(position), getActivity());
            }
        });
        freqCard.addItem(minFreq);
    }
    if (freqCard.size() > 0) {
        items.add(freqCard);
    }
}
Also used : XYGraphView(com.moro.mtweaks.views.recyclerview.XYGraphView) CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 49 with CardView

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

the class GPUFragment method powerPolicyInit.

private void powerPolicyInit(List<RecyclerViewItem> items) {
    CardView powCard = new CardView(getActivity());
    powCard.setTitle(getString(R.string.gpu_power_policy_card));
    SelectView powPol = new SelectView();
    powPol.setTitle(getString(R.string.gpu_power_policy));
    powPol.setSummary(getString(R.string.gpu_power_policy_summary));
    powPol.setItems(GPUFreq.getPowerPolicies());
    powPol.setItem(GPUFreq.getPowerPolicy());
    powPol.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            GPUFreq.setPowerPolicy(item, getActivity());
        }
    });
    powCard.addItem(powPol);
    if (powCard.size() > 0) {
        items.add(powCard);
    }
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 50 with CardView

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

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