Search in sources :

Example 11 with SwitchView

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

the class ScreenFragment method screenColorInit.

private void screenColorInit(List<RecyclerViewItem> items) {
    if (Calibration.hasColors()) {
        CardView screenColor = new CardView(getActivity());
        screenColor.setTitle(getString(R.string.screen_color));
        List<String> colors = Calibration.getColors();
        final List<String> limits = Calibration.getLimits();
        mColors = new SeekBarView[colors.size()];
        for (int i = 0; i < colors.size(); i++) {
            mColors[i] = new SeekBarView();
            mColors[i].setTitle(getResources().getStringArray(R.array.colors)[i]);
            mColors[i].setItems(limits);
            mColors[i].setProgress(limits.indexOf(colors.get(i)));
            mColors[i].setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

                @Override
                public void onMove(SeekBarView seekBarView, int position, String value) {
                    if (mMinColor != null && position < mMinColor.getProgress()) {
                        mMinColor.setProgress(position);
                    }
                }

                @Override
                public void onStop(SeekBarView seekBarView, int position, String value) {
                    if (mMinColor != null) {
                        int current = Utils.strToInt(Calibration.getLimits().get(position));
                        if (Calibration.getMinColor() > current) {
                            Calibration.setMinColor(current, getActivity());
                        }
                    }
                    int r = mColors[0].getProgress();
                    int g = mColors[1].getProgress();
                    int b = mColors[2].getProgress();
                    Calibration.setColors(limits.get(r) + " " + limits.get(g) + " " + limits.get(b), getActivity());
                }
            });
            screenColor.addItem(mColors[i]);
        }
        items.add(screenColor);
        if (Calibration.hasMinColor()) {
            mMinColor = new SeekBarView();
            mMinColor.setTitle(getString(R.string.min_rgb));
            mMinColor.setItems(Calibration.getLimits());
            mMinColor.setProgress(Calibration.getLimits().indexOf(String.valueOf(Calibration.getMinColor())));
            mMinColor.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

                @Override
                public void onStop(SeekBarView seekBarView, int position, String value) {
                    Calibration.setMinColor(Utils.strToInt(value), getActivity());
                    StringBuilder colors = new StringBuilder();
                    for (String color : Calibration.getColors()) {
                        if (Utils.strToInt(value) > Utils.strToInt(color)) {
                            colors.append(value).append(" ");
                        } else {
                            colors.append(color).append(" ");
                        }
                    }
                    colors.setLength(colors.length() - 1);
                    Calibration.setColors(colors.toString(), getActivity());
                }

                @Override
                public void onMove(SeekBarView seekBarView, int position, String value) {
                    for (SeekBarView color : mColors) {
                        if (position > color.getProgress()) {
                            color.setProgress(position);
                        }
                    }
                }
            });
            items.add(mMinColor);
        }
    }
    if (Calibration.hasInvertScreen()) {
        SwitchView invertScreen = new SwitchView();
        invertScreen.setSummary(getString(R.string.invert_screen));
        invertScreen.setChecked(Calibration.isInvertScreenEnabled());
        invertScreen.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Calibration.enableInvertScreen(isChecked, getActivity());
            }
        });
        items.add(invertScreen);
    }
    if (Calibration.hasSaturationIntensity()) {
        int saturation = Calibration.getSaturationIntensity();
        final SeekBarView saturationIntensity = new SeekBarView();
        saturationIntensity.setTitle(getString(R.string.saturation_intensity));
        saturationIntensity.setMax(158);
        saturationIntensity.setProgress(saturation == 128 ? 30 : saturation - 225);
        saturationIntensity.setEnabled(saturation != 128);
        saturationIntensity.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Calibration.setSaturationIntensity(position + 225, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        items.add(saturationIntensity);
        SwitchView grayscaleMode = new SwitchView();
        grayscaleMode.setSummary(getString(R.string.grayscale_mode));
        grayscaleMode.setChecked(saturation == 128);
        grayscaleMode.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                saturationIntensity.setEnabled(!isChecked);
                Calibration.enableGrayscaleMode(isChecked, getActivity());
                if (!isChecked) {
                    saturationIntensity.setProgress(30);
                }
            }
        });
        items.add(grayscaleMode);
    }
    if (Calibration.hasScreenHue()) {
        SeekBarView screenHue = new SeekBarView();
        screenHue.setTitle(getString(R.string.screen_hue));
        screenHue.setSummary(getString(R.string.screen_hue_summary));
        screenHue.setMax(1536);
        screenHue.setProgress(Calibration.getScreenHue());
        screenHue.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        items.add(screenHue);
    }
    if (Calibration.hasScreenValue()) {
        SeekBarView screenValue = new SeekBarView();
        screenValue.setTitle(getString(R.string.screen_value));
        screenValue.setMax(255);
        screenValue.setProgress(Calibration.getScreenValue() - 128);
        screenValue.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Calibration.setScreenValue(position + 128, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        items.add(screenValue);
    }
    if (Calibration.hasScreenContrast()) {
        SeekBarView screenContrast = new SeekBarView();
        screenContrast.setTitle(getString(R.string.screen_contrast));
        screenContrast.setMax(255);
        screenContrast.setProgress(Calibration.getScreenContrast() - 128);
        screenContrast.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Calibration.setScreenContrast(position + 128, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        items.add(screenContrast);
    }
    if (Calibration.hasScreenHBM()) {
        SwitchView screenHBM = new SwitchView();
        screenHBM.setSummary(getString(R.string.high_brightness_mode));
        screenHBM.setChecked(Calibration.isScreenHBMEnabled());
        screenHBM.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Calibration.enableScreenHBM(isChecked, getActivity());
            }
        });
        items.add(screenHBM);
    }
    if (Calibration.hasSRGB()) {
        SwitchView sRGB = new SwitchView();
        sRGB.setSummary(getString(R.string.srgb));
        sRGB.setChecked(Calibration.isSRGBEnabled());
        sRGB.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Calibration.enableSRGB(isChecked, getActivity());
            }
        });
        items.add(sRGB);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

Example 12 with SwitchView

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

the class ScreenFragment method mdnieGlobalInit.

private void mdnieGlobalInit(List<RecyclerViewItem> items) {
    CardView mdnieCard = new CardView(getActivity());
    mdnieCard.setTitle(getString(R.string.mdnie_global_controls));
    if (Misc.hasRegisterHook()) {
        SwitchView registerHook = new SwitchView();
        registerHook.setTitle(getString(R.string.register_hook));
        registerHook.setSummary(getString(R.string.register_hook_summary));
        registerHook.setChecked(Misc.isRegisterHookEnabled());
        registerHook.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableRegisterHook(isChecked, getActivity());
            }
        });
        mdnieCard.addItem(registerHook);
    }
    if (Misc.hasMasterSequence()) {
        SwitchView masterSequence = new SwitchView();
        masterSequence.setTitle(getString(R.string.master_sequence));
        masterSequence.setSummary(getString(R.string.master_sequence_summary));
        masterSequence.setChecked(Misc.isMasterSequenceEnable());
        masterSequence.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableMasterSequence(isChecked, getActivity());
            }
        });
        mdnieCard.addItem(masterSequence);
    }
    if (mdnieCard.size() > 0) {
        items.add(mdnieCard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView)

Example 13 with SwitchView

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

the class SoundFragment method highPerfModeEnableInit.

private void highPerfModeEnableInit(List<RecyclerViewItem> items) {
    SwitchView highPerfMode = new SwitchView();
    highPerfMode.setSummary(getString(R.string.headset_highperf_mode));
    highPerfMode.setChecked(Sound.isHighPerfModeEnabled());
    highPerfMode.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Sound.enableHighPerfMode(isChecked, getActivity());
        }
    });
    items.add(highPerfMode);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView)

Example 14 with SwitchView

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

the class SoundFragment method lockOutputGainInit.

private void lockOutputGainInit(List<RecyclerViewItem> items) {
    SwitchView lockOutputGain = new SwitchView();
    lockOutputGain.setTitle(getString(R.string.lock_output_gain));
    lockOutputGain.setSummary(getString(R.string.lock_output_gain_summary));
    lockOutputGain.setChecked(Sound.isLockOutputGainEnabled());
    lockOutputGain.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Sound.enableLockOutputGain(isChecked, getActivity());
        }
    });
    items.add(lockOutputGain);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView)

Example 15 with SwitchView

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

the class ThermalFragment method thermaldInit.

private void thermaldInit(List<RecyclerViewItem> items) {
    SwitchView thermald = new SwitchView();
    thermald.setTitle(getString(R.string.thermald));
    thermald.setSummary(getString(R.string.thermald_summary));
    thermald.setChecked(Thermald.isThermaldEnabled());
    thermald.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Thermald.enableThermald(isChecked, getActivity());
        }
    });
    items.add(thermald);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView)

Aggregations

SwitchView (com.moro.mtweaks.views.recyclerview.SwitchView)64 SeekBarView (com.moro.mtweaks.views.recyclerview.SeekBarView)31 CardView (com.moro.mtweaks.views.recyclerview.CardView)23 ArrayList (java.util.ArrayList)19 TitleView (com.moro.mtweaks.views.recyclerview.TitleView)16 RecyclerViewItem (com.moro.mtweaks.views.recyclerview.RecyclerViewItem)15 SelectView (com.moro.mtweaks.views.recyclerview.SelectView)14 DescriptionView (com.moro.mtweaks.views.recyclerview.DescriptionView)4 GenericSelectView2 (com.moro.mtweaks.views.recyclerview.GenericSelectView2)3 GenericSelectView (com.moro.mtweaks.views.recyclerview.GenericSelectView)2 Intent (android.content.Intent)1 Controls (com.moro.mtweaks.database.tools.customcontrols.Controls)1 BoefflaWakelock (com.moro.mtweaks.utils.kernel.boefflawakelock.BoefflaWakelock)1 Wakelocks (com.moro.mtweaks.utils.kernel.misc.Wakelocks)1 CustomControlException (com.moro.mtweaks.utils.tools.customcontrols.CustomControlException)1 XYGraphView (com.moro.mtweaks.views.recyclerview.XYGraphView)1 ErrorView (com.moro.mtweaks.views.recyclerview.customcontrols.ErrorView)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1