Search in sources :

Example 46 with SwitchView

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

the class WakeFrament method powerKeySuspendInit.

private void powerKeySuspendInit(List<RecyclerViewItem> items) {
    SwitchView powerKeySuspend = new SwitchView();
    powerKeySuspend.setTitle(getString(R.string.power_key_suspend));
    powerKeySuspend.setSummary(getString(R.string.power_key_suspend_summary));
    powerKeySuspend.setChecked(Misc.isPowerKeySuspendEnabled());
    powerKeySuspend.addOnSwitchListener(new SwitchView.OnSwitchListener() {

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

Example 47 with SwitchView

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

the class WakeFrament method pocketInit.

private void pocketInit(List<RecyclerViewItem> items) {
    SwitchView pocket = new SwitchView();
    pocket.setTitle(getString(R.string.pocket_mode));
    pocket.setSummary(getString(R.string.pocket_mode_summary));
    pocket.setChecked(Misc.isPocketEnabled());
    pocket.addOnSwitchListener(new SwitchView.OnSwitchListener() {

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

Example 48 with SwitchView

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

the class WakeFrament method s2wInit.

private void s2wInit(List<RecyclerViewItem> items) {
    CardView s2wCard = new CardView(getActivity());
    s2wCard.setTitle(getString(R.string.s2w));
    if (S2w.supported()) {
        SelectView s2w = new SelectView();
        s2w.setTitle(getString(R.string.s2w));
        s2w.setSummary(getString(R.string.s2w_summary));
        s2w.setItems(S2w.getMenu(getActivity()));
        s2w.setItem(S2w.get());
        s2w.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                S2w.set(position, getActivity());
            }
        });
        s2wCard.addItem(s2w);
    }
    if (S2w.hasLenient()) {
        SwitchView lenient = new SwitchView();
        lenient.setTitle(getString(R.string.lenient));
        lenient.setSummary(getString(R.string.lenient_summary));
        lenient.setChecked(S2w.isLenientEnabled());
        lenient.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                S2w.enableLenient(isChecked, getActivity());
            }
        });
        s2wCard.addItem(lenient);
    }
    if (s2wCard.size() > 0) {
        items.add(s2wCard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 49 with SwitchView

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

the class WakelockFragment method wakelocksInit.

private void wakelocksInit(List<RecyclerViewItem> items) {
    CardView wake = new CardView(getActivity());
    wake.setTitle(getString(R.string.wkl_control));
    if (Wakelock.hasSensorHub()) {
        SwitchView sh = new SwitchView();
        sh.setTitle(getString(R.string.wkl_sensorhub));
        sh.setSummary(getString(R.string.wkl_sensorhub_summary));
        sh.setChecked(Wakelock.isSensorHubEnabled());
        sh.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Wakelock.enableSensorHub(isChecked, getActivity());
            }
        });
        wake.addItem(sh);
    }
    if (Wakelock.hasSSP()) {
        SwitchView ssp = new SwitchView();
        ssp.setTitle(getString(R.string.wkl_ssp));
        ssp.setSummary(getString(R.string.wkl_ssp_summary));
        ssp.setChecked(Wakelock.isSSPEnabled());
        ssp.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Wakelock.enableSSP(isChecked, getActivity());
            }
        });
        wake.addItem(ssp);
    }
    if (Wakelock.hasGPS()) {
        SwitchView gps = new SwitchView();
        gps.setTitle(getString(R.string.wkl_gps));
        gps.setSummary(getString(R.string.wkl_gps_summary));
        gps.setChecked(Wakelock.isGPSEnabled());
        gps.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Wakelock.enableGPS(isChecked, getActivity());
            }
        });
        wake.addItem(gps);
    }
    if (Wakelock.hasWireless()) {
        SwitchView wifi = new SwitchView();
        wifi.setTitle(getString(R.string.wkl_wireless));
        wifi.setSummary(getString(R.string.wkl_wireless_summary));
        wifi.setChecked(Wakelock.isWirelessEnabled());
        wifi.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Wakelock.enableWireless(isChecked, getActivity());
            }
        });
        wake.addItem(wifi);
    }
    if (Wakelock.hasBluetooth()) {
        SwitchView bt = new SwitchView();
        bt.setTitle(getString(R.string.wkl_bluetooth));
        bt.setSummary(getString(R.string.wkl_bluetooth_summary));
        bt.setChecked(Wakelock.isBluetoothEnabled());
        bt.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Wakelock.enableBluetooth(isChecked, getActivity());
            }
        });
        wake.addItem(bt);
    }
    if (Wakelock.hasBattery()) {
        SeekBarView bat = new SeekBarView();
        bat.setTitle(getString(R.string.wkl_battery));
        bat.setSummary(getString(R.string.wkl_battery_summary));
        bat.setMax(15);
        bat.setMin(1);
        bat.setProgress(Utils.strToInt(Wakelock.getBattery()) - 1);
        bat.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        wake.addItem(bat);
    }
    if (Wakelock.hasNFC()) {
        SeekBarView nfc = new SeekBarView();
        nfc.setTitle(getString(R.string.wkl_nfc));
        nfc.setSummary(getString(R.string.wkl_nfc_summary));
        nfc.setMax(3);
        nfc.setMin(1);
        nfc.setProgress(Utils.strToInt(Wakelock.getNFC()) - 1);
        nfc.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 50 with SwitchView

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

the class BatteryFragment method chargeRateInit.

private void chargeRateInit(List<RecyclerViewItem> items) {
    CardView chargeRateCard = new CardView(getActivity());
    chargeRateCard.setTitle(getString(R.string.charge_rate));
    if (Battery.hasChargeRateEnable()) {
        SwitchView chargeRate = new SwitchView();
        chargeRate.setSummary(getString(R.string.charge_rate));
        chargeRate.setChecked(Battery.isChargeRateEnabled());
        chargeRate.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Battery.enableChargeRate(isChecked, getActivity());
            }
        });
        chargeRateCard.addItem(chargeRate);
    }
    if (Battery.hasChargingCurrent()) {
        SeekBarView chargingCurrent = new SeekBarView();
        chargingCurrent.setTitle(getString(R.string.charging_current));
        chargingCurrent.setSummary(getString(R.string.charging_current_summary));
        chargingCurrent.setUnit(getString(R.string.ma));
        chargingCurrent.setMax(1500);
        chargingCurrent.setMin(100);
        chargingCurrent.setOffset(10);
        chargingCurrent.setProgress(Battery.getChargingCurrent() / 10 - 10);
        chargingCurrent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

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