Search in sources :

Example 1 with GammaProfiles

use of com.moro.mtweaks.utils.kernel.screen.GammaProfiles in project MTweaks-KernelAdiutorMOD by morogoku.

the class ScreenFragment method kgammaInit.

private void kgammaInit(List<RecyclerViewItem> items) {
    if (mKGammaBlue == null) {
        mKGammaBlue = new GenericSelectView();
        mKGammaBlue.setSummary(getString(R.string.blue));
        mKGammaBlue.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setKGammaBlue(value, getActivity());
                kgammaInit(null);
            }
        });
    }
    String blue = Gamma.getKGammaBlue();
    mKGammaBlue.setValue(blue);
    mKGammaBlue.setValueRaw(blue);
    if (items != null) {
        items.add(mKGammaBlue);
    }
    if (mKGammaGreen == null) {
        mKGammaGreen = new GenericSelectView();
        mKGammaGreen.setSummary(getString(R.string.green));
        mKGammaGreen.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setKGammaGreen(value, getActivity());
                kgammaInit(null);
            }
        });
    }
    String green = Gamma.getKGammaGreen();
    mKGammaGreen.setValue(green);
    mKGammaGreen.setValueRaw(green);
    if (items != null) {
        items.add(mKGammaGreen);
    }
    if (mKGammaRed == null) {
        mKGammaRed = new GenericSelectView();
        mKGammaRed.setSummary(getString(R.string.red));
        mKGammaRed.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setKGammaRed(value, getActivity());
                kgammaInit(null);
            }
        });
    }
    String red = Gamma.getKGammaRed();
    mKGammaRed.setValue(red);
    mKGammaRed.setValueRaw(red);
    if (items != null) {
        items.add(mKGammaRed);
    }
    if (items != null) {
        List<String> profileList = new ArrayList<>();
        final GammaProfiles.KGammaProfiles gammaProfiles = Gamma.getKGammaProfiles(getActivity());
        for (int i = 0; i < gammaProfiles.length(); i++) {
            profileList.add(gammaProfiles.getName(i));
        }
        DropDownView profiles = new DropDownView();
        profiles.setTitle(getString(R.string.profile));
        profiles.setSummary(getString(R.string.gamma_profiles_summary));
        profiles.setItems(profileList);
        profiles.setSelection(Prefs.getInt("kgamma_profile", -1, getActivity()));
        profiles.setOnDropDownListener(new DropDownView.OnDropDownListener() {

            @Override
            public void onSelect(DropDownView dropDownView, int position, String value) {
                Gamma.setKGammaProfile(position, gammaProfiles, getActivity());
                kgammaInit(null);
                Prefs.saveInt("kgamma_profile", position, getActivity());
            }
        });
        items.add(profiles);
    }
}
Also used : GammaProfiles(com.moro.mtweaks.utils.kernel.screen.GammaProfiles) ArrayList(java.util.ArrayList) DropDownView(com.moro.mtweaks.views.recyclerview.DropDownView) GenericSelectView(com.moro.mtweaks.views.recyclerview.GenericSelectView)

Example 2 with GammaProfiles

use of com.moro.mtweaks.utils.kernel.screen.GammaProfiles in project MTweaks-KernelAdiutorMOD by morogoku.

the class ScreenFragment method dsipanelInit.

private void dsipanelInit(List<RecyclerViewItem> items) {
    if (mDsiPanelBlueNegative == null) {
        mDsiPanelBlueNegative = new GenericSelectView();
        mDsiPanelBlueNegative.setSummary(getString(R.string.blue_negative));
        mDsiPanelBlueNegative.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setBlueNegative(value, getActivity());
            }
        });
    }
    String blueNegative = Gamma.getBlueNegative();
    mDsiPanelBlueNegative.setValue(blueNegative);
    mDsiPanelBlueNegative.setValueRaw(blueNegative);
    if (items != null) {
        items.add(mDsiPanelBlueNegative);
    }
    if (mDsiPanelBluePositive == null) {
        mDsiPanelBluePositive = new GenericSelectView();
        mDsiPanelBluePositive.setSummary(getString(R.string.blue_positive));
        mDsiPanelBluePositive.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setBluePositive(value, getActivity());
            }
        });
    }
    String bluePositive = Gamma.getBluePositive();
    mDsiPanelBluePositive.setValue(bluePositive);
    mDsiPanelBluePositive.setValueRaw(bluePositive);
    if (items != null) {
        items.add(mDsiPanelBluePositive);
    }
    if (mDsiPanelGreenNegative == null) {
        mDsiPanelGreenNegative = new GenericSelectView();
        mDsiPanelGreenNegative.setSummary(getString(R.string.green_negative));
        mDsiPanelGreenNegative.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGreenNegative(value, getActivity());
            }
        });
    }
    String greenNegative = Gamma.getGreenNegative();
    mDsiPanelGreenNegative.setValue(greenNegative);
    mDsiPanelGreenNegative.setValueRaw(greenNegative);
    if (items != null) {
        items.add(mDsiPanelGreenNegative);
    }
    if (mDsiPanelGreenPositive == null) {
        mDsiPanelGreenPositive = new GenericSelectView();
        mDsiPanelGreenPositive.setSummary(getString(R.string.green_positive));
        mDsiPanelGreenPositive.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGreenPositive(value, getActivity());
            }
        });
    }
    String greenPositive = Gamma.getGreenPositive();
    mDsiPanelGreenPositive.setValue(greenPositive);
    mDsiPanelGreenPositive.setValueRaw(greenPositive);
    if (items != null) {
        items.add(mDsiPanelGreenPositive);
    }
    if (mDsiPanelRedNegative == null) {
        mDsiPanelRedNegative = new GenericSelectView();
        mDsiPanelRedNegative.setSummary(getString(R.string.red_negative));
        mDsiPanelRedNegative.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setRedNegative(value, getActivity());
            }
        });
    }
    String redNegative = Gamma.getRedNegative();
    mDsiPanelRedNegative.setValue(redNegative);
    mDsiPanelRedNegative.setValueRaw(redNegative);
    if (items != null) {
        items.add(mDsiPanelRedNegative);
    }
    if (mDsiPanelRedPositive == null) {
        mDsiPanelRedPositive = new GenericSelectView();
        mDsiPanelRedPositive.setSummary(getString(R.string.red_positive));
        mDsiPanelRedPositive.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setRedPositive(value, getActivity());
            }
        });
    }
    String redPositive = Gamma.getRedPositive();
    mDsiPanelRedPositive.setValue(redPositive);
    mDsiPanelRedPositive.setValueRaw(redPositive);
    if (items != null) {
        items.add(mDsiPanelRedPositive);
    }
    if (mDsiPanelWhitePoint == null) {
        mDsiPanelWhitePoint = new GenericSelectView();
        mDsiPanelWhitePoint.setSummary(getString(R.string.white_point));
        mDsiPanelWhitePoint.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setWhitePoint(value, getActivity());
            }
        });
    }
    String whitePoint = Gamma.getWhitePoint();
    mDsiPanelWhitePoint.setValue(whitePoint);
    mDsiPanelWhitePoint.setValueRaw(whitePoint);
    if (items != null) {
        items.add(mDsiPanelWhitePoint);
    }
    if (items != null) {
        List<String> profileList = new ArrayList<>();
        final GammaProfiles.DsiPanelProfiles gammaProfiles = Gamma.getDsiPanelProfiles(getActivity());
        for (int i = 0; i < gammaProfiles.length(); i++) {
            profileList.add(gammaProfiles.getName(i));
        }
        DropDownView profiles = new DropDownView();
        profiles.setTitle(getString(R.string.profile));
        profiles.setSummary(getString(R.string.gamma_profiles_summary));
        profiles.setItems(profileList);
        profiles.setSelection(Prefs.getInt("dsi_panel_profile", -1, getActivity()));
        profiles.setOnDropDownListener(new DropDownView.OnDropDownListener() {

            @Override
            public void onSelect(DropDownView dropDownView, int position, String value) {
                Gamma.setDsiPanelProfile(position, gammaProfiles, getActivity());
                dsipanelInit(null);
                Prefs.saveInt("dsi_panel_profile", position, getActivity());
            }
        });
        items.add(profiles);
    }
}
Also used : GammaProfiles(com.moro.mtweaks.utils.kernel.screen.GammaProfiles) ArrayList(java.util.ArrayList) DropDownView(com.moro.mtweaks.views.recyclerview.DropDownView) GenericSelectView(com.moro.mtweaks.views.recyclerview.GenericSelectView)

Example 3 with GammaProfiles

use of com.moro.mtweaks.utils.kernel.screen.GammaProfiles in project MTweaks-KernelAdiutorMOD by morogoku.

the class ScreenFragment method gammacontrolInit.

private void gammacontrolInit(List<RecyclerViewItem> items) {
    if (mGammaControlRedGreys == null) {
        mGammaControlRedGreys = new GenericSelectView();
        mGammaControlRedGreys.setSummary(getString(R.string.red_greys));
        mGammaControlRedGreys.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setRedGreys(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String redGreys = Gamma.getRedGreys();
    mGammaControlRedGreys.setValue(redGreys);
    mGammaControlRedGreys.setValueRaw(redGreys);
    if (items != null) {
        items.add(mGammaControlRedGreys);
    }
    if (mGammaControlRedMids == null) {
        mGammaControlRedMids = new GenericSelectView();
        mGammaControlRedMids.setSummary(getString(R.string.red_mids));
        mGammaControlRedMids.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setRedMids(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String redMids = Gamma.getRedMids();
    mGammaControlRedMids.setValue(redMids);
    mGammaControlRedMids.setValueRaw(redMids);
    if (items != null) {
        items.add(mGammaControlRedMids);
    }
    if (mGammaControlRedBlacks == null) {
        mGammaControlRedBlacks = new GenericSelectView();
        mGammaControlRedBlacks.setSummary(getString(R.string.red_blacks));
        mGammaControlRedBlacks.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setRedBlacks(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String redBlacks = Gamma.getRedBlacks();
    mGammaControlRedBlacks.setValue(redBlacks);
    mGammaControlRedBlacks.setValueRaw(redBlacks);
    if (items != null) {
        items.add(mGammaControlRedBlacks);
    }
    if (mGammaControlRedWhites == null) {
        mGammaControlRedWhites = new GenericSelectView();
        mGammaControlRedWhites.setSummary(getString(R.string.red_whites));
        mGammaControlRedWhites.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setRedWhites(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String redWhites = Gamma.getRedWhites();
    mGammaControlRedWhites.setValue(redWhites);
    mGammaControlRedWhites.setValueRaw(redWhites);
    if (items != null) {
        items.add(mGammaControlRedWhites);
    }
    if (mGammaControlGreenGreys == null) {
        mGammaControlGreenGreys = new GenericSelectView();
        mGammaControlGreenGreys.setSummary(getString(R.string.green_greys));
        mGammaControlGreenGreys.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGreenGreys(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String greenGreys = Gamma.getGreenGreys();
    mGammaControlGreenGreys.setValue(greenGreys);
    mGammaControlGreenGreys.setValueRaw(greenGreys);
    if (items != null) {
        items.add(mGammaControlGreenGreys);
    }
    if (mGammaControlGreenMids == null) {
        mGammaControlGreenMids = new GenericSelectView();
        mGammaControlGreenMids.setSummary(getString(R.string.green_mids));
        mGammaControlGreenMids.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGreenMids(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String greenMids = Gamma.getGreenMids();
    mGammaControlGreenMids.setValue(greenMids);
    mGammaControlGreenMids.setValueRaw(greenMids);
    if (items != null) {
        items.add(mGammaControlGreenMids);
    }
    if (mGammaControlGreenBlacks == null) {
        mGammaControlGreenBlacks = new GenericSelectView();
        mGammaControlGreenBlacks.setSummary(getString(R.string.green_blacks));
        mGammaControlGreenBlacks.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGreenBlacks(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String greenBlacks = Gamma.getGreenBlacks();
    mGammaControlGreenBlacks.setValue(greenBlacks);
    mGammaControlGreenBlacks.setValueRaw(greenBlacks);
    if (items != null) {
        items.add(mGammaControlGreenBlacks);
    }
    if (mGammaControlGreenWhites == null) {
        mGammaControlGreenWhites = new GenericSelectView();
        mGammaControlGreenWhites.setSummary(getString(R.string.green_whites));
        mGammaControlGreenWhites.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGreenWhites(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String greenWhites = Gamma.getGreenWhites();
    mGammaControlGreenWhites.setValue(greenWhites);
    mGammaControlGreenWhites.setValueRaw(greenWhites);
    if (items != null) {
        items.add(mGammaControlGreenWhites);
    }
    if (mGammaControlBlueGreys == null) {
        mGammaControlBlueGreys = new GenericSelectView();
        mGammaControlBlueGreys.setSummary(getString(R.string.blue_greys));
        mGammaControlBlueGreys.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setBlueGreys(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String blueGreys = Gamma.getBlueGreys();
    mGammaControlBlueGreys.setValue(blueGreys);
    mGammaControlBlueGreys.setValueRaw(blueGreys);
    if (items != null) {
        items.add(mGammaControlBlueGreys);
    }
    if (mGammaControlBlueMids == null) {
        mGammaControlBlueMids = new GenericSelectView();
        mGammaControlBlueMids.setSummary(getString(R.string.blue_mids));
        mGammaControlBlueMids.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setBlueMids(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String blueMids = Gamma.getBlueMids();
    mGammaControlBlueMids.setValue(blueMids);
    mGammaControlBlueMids.setValueRaw(blueMids);
    if (items != null) {
        items.add(mGammaControlBlueMids);
    }
    if (mGammaControlBlueBlacks == null) {
        mGammaControlBlueBlacks = new GenericSelectView();
        mGammaControlBlueBlacks.setSummary(getString(R.string.blue_blacks));
        mGammaControlBlueBlacks.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setBlueBlacks(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String blueBlacks = Gamma.getBlueBlacks();
    mGammaControlBlueBlacks.setValue(blueBlacks);
    mGammaControlBlueBlacks.setValueRaw(blueBlacks);
    if (items != null) {
        items.add(mGammaControlBlueBlacks);
    }
    if (mGammaControlBlueWhites == null) {
        mGammaControlBlueWhites = new GenericSelectView();
        mGammaControlBlueWhites.setSummary(getString(R.string.blue_whites));
        mGammaControlBlueWhites.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setBlueWhites(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String blueWhites = Gamma.getBlueWhites();
    mGammaControlBlueWhites.setValue(blueWhites);
    mGammaControlBlueWhites.setValueRaw(blueWhites);
    if (items != null) {
        items.add(mGammaControlBlueWhites);
    }
    if (mGammaControlContrast == null) {
        mGammaControlContrast = new GenericSelectView();
        mGammaControlContrast.setSummary(getString(R.string.contrast));
        mGammaControlContrast.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGammaContrast(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String contrast = Gamma.getGammaContrast();
    mGammaControlContrast.setValue(contrast);
    mGammaControlContrast.setValueRaw(contrast);
    if (items != null) {
        items.add(mGammaControlContrast);
    }
    if (mGammaControlBrightness == null) {
        mGammaControlBrightness = new GenericSelectView();
        mGammaControlBrightness.setSummary(getString(R.string.brightness));
        mGammaControlBrightness.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGammaBrightness(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String brightness = Gamma.getGammaBrightness();
    mGammaControlBrightness.setValue(brightness);
    mGammaControlBrightness.setValueRaw(brightness);
    if (items != null) {
        items.add(mGammaControlBrightness);
    }
    if (mGammaControlSaturation == null) {
        mGammaControlSaturation = new GenericSelectView();
        mGammaControlSaturation.setSummary(getString(R.string.saturation_intensity));
        mGammaControlSaturation.setOnGenericValueListener(new GenericSelectView.OnGenericValueListener() {

            @Override
            public void onGenericValueSelected(GenericSelectView genericSelectView, String value) {
                Gamma.setGammaSaturation(value, getActivity());
                gammacontrolInit(null);
            }
        });
    }
    String saturation = Gamma.getGammaSaturation();
    mGammaControlSaturation.setValue(saturation);
    mGammaControlSaturation.setValueRaw(saturation);
    if (items != null) {
        items.add(mGammaControlSaturation);
    }
    if (items != null) {
        List<String> profileList = new ArrayList<>();
        final GammaProfiles.GammaControlProfiles gammaProfiles = Gamma.getGammaControlProfiles(getActivity());
        for (int i = 0; i < gammaProfiles.length(); i++) {
            profileList.add(gammaProfiles.getName(i));
        }
        DropDownView profiles = new DropDownView();
        profiles.setTitle(getString(R.string.profile));
        profiles.setSummary(getString(R.string.gamma_profiles_summary));
        profiles.setItems(profileList);
        profiles.setSelection(Prefs.getInt("gamma_control_profile", -1, getActivity()));
        profiles.setOnDropDownListener(new DropDownView.OnDropDownListener() {

            @Override
            public void onSelect(DropDownView dropDownView, int position, String value) {
                Gamma.setGammaControlProfile(position, gammaProfiles, getActivity());
                gammacontrolInit(null);
                Prefs.saveInt("gamma_control_profile", position, getActivity());
            }
        });
        items.add(profiles);
    }
}
Also used : GammaProfiles(com.moro.mtweaks.utils.kernel.screen.GammaProfiles) ArrayList(java.util.ArrayList) DropDownView(com.moro.mtweaks.views.recyclerview.DropDownView) GenericSelectView(com.moro.mtweaks.views.recyclerview.GenericSelectView)

Aggregations

GammaProfiles (com.moro.mtweaks.utils.kernel.screen.GammaProfiles)3 DropDownView (com.moro.mtweaks.views.recyclerview.DropDownView)3 GenericSelectView (com.moro.mtweaks.views.recyclerview.GenericSelectView)3 ArrayList (java.util.ArrayList)3