Search in sources :

Example 1 with CardView

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

the class BatteryFragment method chargeS7Init.

private void chargeS7Init(List<RecyclerViewItem> items) {
    CardView unsCharge = new CardView(getActivity());
    unsCharge.setTitle(getString(R.string.unstable_charge_card));
    unsCharge.setFullSpan(true);
    if (Battery.hasUnstableCharge()) {
        SwitchView uCharge = new SwitchView();
        uCharge.setTitle(getString(R.string.enable_unstable_charge));
        uCharge.setSummary(getString(R.string.enable_unstable_charge_summary));
        uCharge.setChecked(Battery.isUnstableChargeEnabled());
        uCharge.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Battery.enableUnstableCharge(isChecked, getActivity());
            }
        });
        unsCharge.addItem(uCharge);
    }
    if (unsCharge.size() > 0) {
        items.add(unsCharge);
    }
    CardView storeCard = new CardView(getActivity());
    storeCard.setTitle(getString(R.string.store_mode));
    storeCard.setFullSpan(true);
    if (Battery.hasS7StoreMode()) {
        SwitchView sMode = new SwitchView();
        sMode.setTitle(getString(R.string.store_mode));
        sMode.setSummary(getString(R.string.store_mode_summary));
        sMode.setChecked(Battery.isS7StoreModeEnabled());
        sMode.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Battery.enableS7StoreMode(isChecked, getActivity());
            }
        });
        storeCard.addItem(sMode);
        SeekBarView smMax = new SeekBarView();
        smMax.setTitle(getString(R.string.store_mode_max));
        smMax.setSummary(getString(R.string.store_mode_max_summary));
        smMax.setMax(100);
        smMax.setMin(1);
        smMax.setUnit(getString(R.string.percent));
        smMax.setProgress(Utils.strToInt(Battery.getS7StoreModeMax()) - 1);
        smMax.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        storeCard.addItem(smMax);
        SeekBarView smMin = new SeekBarView();
        smMin.setTitle(getString(R.string.store_mode_min));
        smMin.setSummary(getString(R.string.store_mode_min_summary));
        smMin.setMax(100);
        smMin.setMin(1);
        smMin.setUnit(getString(R.string.percent));
        smMin.setProgress(Utils.strToInt(Battery.getS7StoreModeMin()) - 1);
        smMin.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        storeCard.addItem(smMin);
    }
    if (storeCard.size() > 0) {
        items.add(storeCard);
    }
    CardView hvPower = new CardView(getActivity());
    hvPower.setTitle(getString(R.string.hv_power_supply));
    hvPower.setFullSpan(true);
    if (Battery.hasS7HvInput()) {
        SeekBarView hv_input = new SeekBarView();
        hv_input.setTitle(getString(R.string.hv_input));
        hv_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_hv_input", "", getActivity()) + getString(R.string.ma));
        hv_input.setMax(3000);
        hv_input.setMin(400);
        hv_input.setUnit(getString(R.string.ma));
        hv_input.setOffset(25);
        hv_input.setProgress(Utils.strToInt(Battery.getS7HvInput()) / 25 - 16);
        hv_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7HvInput((position + 16) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        hvPower.addItem(hv_input);
    }
    if (Battery.hasS7HvCharge()) {
        SeekBarView hv_charge = new SeekBarView();
        hv_charge.setTitle(getString(R.string.hv_charge));
        hv_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_hv_charge", "", getActivity()) + getString(R.string.ma));
        hv_charge.setMax(3150);
        hv_charge.setMin(1000);
        hv_charge.setUnit(getString(R.string.ma));
        hv_charge.setOffset(25);
        hv_charge.setProgress(Utils.strToInt(Battery.getS7HvCharge()) / 25 - 40);
        hv_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7HvCharge((position + 40) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        hvPower.addItem(hv_charge);
    }
    if (hvPower.size() > 0) {
        items.add(hvPower);
    }
    CardView acMains = new CardView(getActivity());
    acMains.setTitle(getString(R.string.ac_mains));
    acMains.setFullSpan(true);
    if (Battery.hasS7AcInput()) {
        SeekBarView ac_input = new SeekBarView();
        ac_input.setTitle(getString(R.string.ac_input));
        ac_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_ac_input", "", getActivity()) + getString(R.string.ma));
        ac_input.setMax(3150);
        ac_input.setMin(400);
        ac_input.setUnit(getString(R.string.ma));
        ac_input.setOffset(25);
        ac_input.setProgress(Utils.strToInt(Battery.getS7AcInput()) / 25 - 16);
        ac_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7AcInput((position + 16) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        acMains.addItem(ac_input);
    }
    if (Battery.hasS7AcCharge()) {
        SeekBarView ac_charge = new SeekBarView();
        ac_charge.setTitle(getString(R.string.ac_charge));
        ac_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_ac_charge", "", getActivity()) + getString(R.string.ma));
        ac_charge.setMax(3150);
        ac_charge.setMin(400);
        ac_charge.setUnit(getString(R.string.ma));
        ac_charge.setOffset(25);
        ac_charge.setProgress(Utils.strToInt(Battery.getS7AcCharge()) / 25 - 16);
        ac_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7AcCharge((position + 16) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        acMains.addItem(ac_charge);
    }
    if (Battery.hasS7AcInputScreen()) {
        SeekBarView ac_input_screen = new SeekBarView();
        ac_input_screen.setTitle(getString(R.string.ac_input_screen));
        ac_input_screen.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_ac_input_screen", "", getActivity()) + getString(R.string.ma));
        ac_input_screen.setMax(3150);
        ac_input_screen.setMin(400);
        ac_input_screen.setUnit(getString(R.string.ma));
        ac_input_screen.setOffset(25);
        ac_input_screen.setProgress(Utils.strToInt(Battery.getS7AcInputScreen()) / 25 - 16);
        ac_input_screen.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7AcInputScreen((position + 16) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        acMains.addItem(ac_input_screen);
    }
    if (Battery.hasS7AcChargeScreen()) {
        SeekBarView ac_charge_screen = new SeekBarView();
        ac_charge_screen.setTitle(getString(R.string.ac_charge_screen));
        ac_charge_screen.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_ac_charge_screen", "", getActivity()) + getString(R.string.ma));
        ac_charge_screen.setMax(3150);
        ac_charge_screen.setMin(400);
        ac_charge_screen.setUnit(getString(R.string.ma));
        ac_charge_screen.setOffset(25);
        ac_charge_screen.setProgress(Utils.strToInt(Battery.getS7AcChargeScreen()) / 25 - 16);
        ac_charge_screen.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7AcChargeScreen((position + 16) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        acMains.addItem(ac_charge_screen);
    }
    if (acMains.size() > 0) {
        items.add(acMains);
    }
    CardView usbCard = new CardView(getActivity());
    usbCard.setTitle(getString(R.string.usb_port));
    usbCard.setFullSpan(true);
    if (Battery.hasS7UsbInput()) {
        SeekBarView usb_input = new SeekBarView();
        usb_input.setTitle(getString(R.string.usb_input));
        usb_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_usb_input", "", getActivity()) + getString(R.string.ma));
        usb_input.setMax(1200);
        usb_input.setMin(100);
        usb_input.setUnit(getString(R.string.ma));
        usb_input.setOffset(25);
        usb_input.setProgress(Utils.strToInt(Battery.getS7UsbInput()) / 25 - 4);
        usb_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7UsbInput((position + 4) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        usbCard.addItem(usb_input);
    }
    if (Battery.hasS7UsbCharge()) {
        SeekBarView usb_charge = new SeekBarView();
        usb_charge.setTitle(getString(R.string.usb_charge));
        usb_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_usb_charge", "", getActivity()) + getString(R.string.ma));
        usb_charge.setMax(1200);
        usb_charge.setMin(100);
        usb_charge.setUnit(getString(R.string.ma));
        usb_charge.setOffset(25);
        usb_charge.setProgress(Utils.strToInt(Battery.getS7UsbCharge()) / 25 - 4);
        usb_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7UsbCharge((position + 4) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        usbCard.addItem(usb_charge);
    }
    if (usbCard.size() > 0) {
        items.add(usbCard);
    }
    CardView carCard = new CardView(getActivity());
    carCard.setTitle(getString(R.string.car_dock));
    carCard.setFullSpan(true);
    if (Battery.hasS7CarInput()) {
        SeekBarView car_input = new SeekBarView();
        car_input.setTitle(getString(R.string.car_input));
        car_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_car_input", "", getActivity()) + getString(R.string.ma));
        car_input.setMax(2300);
        car_input.setMin(800);
        car_input.setUnit(getString(R.string.ma));
        car_input.setOffset(25);
        car_input.setProgress(Utils.strToInt(Battery.getS7CarInput()) / 25 - 32);
        car_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7CarInput((position + 32) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        carCard.addItem(car_input);
    }
    if (Battery.hasS7CarCharge()) {
        SeekBarView car_charge = new SeekBarView();
        car_charge.setTitle(getString(R.string.car_charge));
        car_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_car_charge", "", getActivity()) + getString(R.string.ma));
        car_charge.setMax(2300);
        car_charge.setMin(800);
        car_charge.setUnit(getString(R.string.ma));
        car_charge.setOffset(25);
        car_charge.setProgress(Utils.strToInt(Battery.getS7CarCharge()) / 25 - 32);
        car_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7CarCharge((position + 32) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        carCard.addItem(car_charge);
    }
    if (carCard.size() > 0) {
        items.add(carCard);
    }
    CardView wcCard = new CardView(getActivity());
    wcCard.setTitle(getString(R.string.wireless_power));
    wcCard.setFullSpan(true);
    if (Battery.hasS7WcInput()) {
        SeekBarView wc_input = new SeekBarView();
        wc_input.setTitle(getString(R.string.wc_input));
        wc_input.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_wc_input", "", getActivity()) + getString(R.string.ma));
        wc_input.setMax(1500);
        wc_input.setMin(800);
        wc_input.setUnit(getString(R.string.ma));
        wc_input.setOffset(25);
        wc_input.setProgress(Utils.strToInt(Battery.getS7WcInput()) / 25 - 32);
        wc_input.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7WcInput((position + 32) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        wcCard.addItem(wc_input);
    }
    if (Battery.hasS7WcCharge()) {
        SeekBarView wc_charge = new SeekBarView();
        wc_charge.setTitle(getString(R.string.wc_charge));
        wc_charge.setSummary(getString(R.string.def) + ": " + Prefs.getString("bat_s7_wc_charge", "", getActivity()) + getString(R.string.ma));
        wc_charge.setMax(2300);
        wc_charge.setMin(800);
        wc_charge.setUnit(getString(R.string.ma));
        wc_charge.setOffset(25);
        wc_charge.setProgress(Utils.strToInt(Battery.getS7WcCharge()) / 25 - 32);
        wc_charge.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Battery.setS7WcCharge((position + 32) * 25, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        wcCard.addItem(wc_charge);
    }
    if (wcCard.size() > 0) {
        items.add(wcCard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

Example 2 with CardView

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

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

the class LEDFragment method fadeInit.

private void fadeInit(List<RecyclerViewItem> items) {
    if (LED.hasFade()) {
        SwitchView fade = new SwitchView();
        fade.setTitle(getString(R.string.fade));
        fade.setSummary(getString(R.string.fade_summary));
        fade.setChecked(LED.isFadeEnabled());
        fade.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                LED.enableFade(isChecked, getActivity());
            }
        });
        items.add(fade);
    }
    CardView fadeCard = new CardView(getActivity());
    fadeCard.setTitle(getString(R.string.fade));
    if (Sec.hasNotificationRampControl()) {
        SwitchView notificationRampControl = new SwitchView();
        notificationRampControl.setTitle(getString(R.string.fade_ramp_control));
        notificationRampControl.setSummary(getString(R.string.fade_ramp_control_summary));
        notificationRampControl.setChecked(Sec.isNotificationRampControlEnabled());
        notificationRampControl.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Sec.enableNotificationRampControl(isChecked, getActivity());
            }
        });
        fadeCard.addItem(notificationRampControl);
    }
    if (Sec.hasNotificationRampUp()) {
        SeekBarView notificationRampUp = new SeekBarView();
        notificationRampUp.setTitle(getString(R.string.fade_in));
        notificationRampUp.setSummary(getString(R.string.fade_in_summary));
        notificationRampUp.setUnit(getString(R.string.ms));
        notificationRampUp.setMax(1900);
        notificationRampUp.setOffset(100);
        notificationRampUp.setProgress(Sec.getNotificationRampUp() / 100);
        notificationRampUp.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Sec.setNotificationRampUp(position * 100, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        fadeCard.addItem(notificationRampUp);
    }
    if (Sec.hasNotificationRampDown()) {
        SeekBarView notificationRampDown = new SeekBarView();
        notificationRampDown.setTitle(getString(R.string.fade_out));
        notificationRampDown.setSummary(getString(R.string.fade_out_summary));
        notificationRampDown.setUnit(getString(R.string.ms));
        notificationRampDown.setMax(1900);
        notificationRampDown.setOffset(100);
        notificationRampDown.setProgress(Sec.getNotificationRampDown() / 100);
        notificationRampDown.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Sec.setNotificationRampDown(position * 100, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        fadeCard.addItem(notificationRampDown);
    }
    if (fadeCard.size() > 0) {
        items.add(fadeCard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

Example 4 with CardView

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

the class LEDFragment method brightnessInit.

private void brightnessInit(List<RecyclerViewItem> items) {
    CardView brightnessCard = new CardView(getActivity());
    brightnessCard.setTitle(getString(R.string.brightness));
    if (Sec.hasHighpowerCurrent()) {
        SeekBarView highpowerCurrent = new SeekBarView();
        highpowerCurrent.setTitle(getString(R.string.bright_light_environment));
        highpowerCurrent.setSummary(getString(R.string.bright_light_environment_summary));
        highpowerCurrent.setUnit(getString(R.string.ma));
        highpowerCurrent.setMax(250);
        highpowerCurrent.setOffset(5);
        highpowerCurrent.setProgress(Sec.getHighpowerCurrent() / 5);
        highpowerCurrent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Sec.setHighpowerCurrent(position * 5, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        brightnessCard.addItem(highpowerCurrent);
    }
    if (Sec.hasLowpowerCurrent()) {
        SeekBarView lowpowerCurrent = new SeekBarView();
        lowpowerCurrent.setTitle(getString(R.string.low_light_environment));
        lowpowerCurrent.setSummary(getString(R.string.low_light_environment_summary));
        lowpowerCurrent.setUnit(getString(R.string.ma));
        lowpowerCurrent.setMax(250);
        lowpowerCurrent.setOffset(5);
        lowpowerCurrent.setProgress(Sec.getLowpowerCurrent() / 5);
        lowpowerCurrent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Sec.setLowpowerCurrent(position * 5, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        brightnessCard.addItem(lowpowerCurrent);
    }
    if (brightnessCard.size() > 0) {
        items.add(brightnessCard);
    }
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) SeekBarView(com.moro.mtweaks.views.recyclerview.SeekBarView)

Example 5 with CardView

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

the class MiscFragment method pwmInit.

private void pwmInit(List<RecyclerViewItem> items) {
    CardView pwmCard = new CardView(getActivity());
    pwmCard.setTitle(getString(R.string.pwm));
    SwitchView enable = new SwitchView();
    enable.setTitle(getString(R.string.pwm));
    enable.setSummary(getString(R.string.pwm_summary));
    enable.setChecked(Pwm.isPwmEnabled());
    enable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

        @Override
        public void onChanged(SwitchView switchView, boolean isChecked) {
            Pwm.enablePwm(isChecked, getActivity());
        }
    });
    pwmCard.addItem(enable);
    items.add(pwmCard);
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView)

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