Search in sources :

Example 36 with CardView

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

the class WakeFrament method dt2sInit.

private void dt2sInit(List<RecyclerViewItem> items) {
    CardView dt2sCard = new CardView(getActivity());
    dt2sCard.setTitle(getString(R.string.dt2s));
    SelectView dt2s = new SelectView();
    dt2s.setTitle(getString(R.string.dt2s));
    dt2s.setSummary(getString(R.string.dt2s_summary));
    dt2s.setItems(Dt2s.getMenu(getActivity()));
    dt2s.setItem(Dt2s.get());
    dt2s.setOnItemSelected(new SelectView.OnItemSelected() {

        @Override
        public void onItemSelected(SelectView selectView, int position, String item) {
            Dt2s.set(position, getActivity());
        }
    });
    dt2sCard.addItem(dt2s);
    items.add(dt2sCard);
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

Example 37 with CardView

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

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

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

Example 40 with CardView

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

the class CPUFragment method cpuQuietInit.

private void cpuQuietInit(List<RecyclerViewItem> items) {
    List<RecyclerViewItem> views = new ArrayList<>();
    CardView cpuQuietCard = new CardView(getActivity());
    cpuQuietCard.setTitle(getString(R.string.cpu_quiet));
    if (Misc.hasCpuQuietEnable()) {
        SwitchView cpuQuietEnable = new SwitchView();
        cpuQuietEnable.setSummary(getString(R.string.cpu_quiet));
        cpuQuietEnable.setChecked(Misc.isCpuQuietEnabled());
        cpuQuietEnable.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableCpuQuiet(isChecked, getActivity());
            }
        });
        views.add(cpuQuietEnable);
    }
    if (Misc.hasCpuQuietGovernors()) {
        SelectView cpuQuietGovernors = new SelectView();
        cpuQuietGovernors.setSummary(getString(R.string.cpu_quiet_governor));
        cpuQuietGovernors.setItems(Misc.getCpuQuietAvailableGovernors());
        cpuQuietGovernors.setItem(Misc.getCpuQuietCurGovernor());
        cpuQuietGovernors.setOnItemSelected(new SelectView.OnItemSelected() {

            @Override
            public void onItemSelected(SelectView selectView, int position, String item) {
                Misc.setCpuQuietGovernor(item, getActivity());
            }
        });
        views.add(cpuQuietGovernors);
    }
    if (views.size() > 0) {
        DescriptionView descriptionView = new DescriptionView();
        descriptionView.setSummary(getString(R.string.cpu_quiet_summary));
        cpuQuietCard.addItem(descriptionView);
        for (RecyclerViewItem item : views) {
            cpuQuietCard.addItem(item);
        }
        items.add(cpuQuietCard);
    }
}
Also used : SwitchView(com.moro.mtweaks.views.recyclerview.SwitchView) ArrayList(java.util.ArrayList) CardView(com.moro.mtweaks.views.recyclerview.CardView) RecyclerViewItem(com.moro.mtweaks.views.recyclerview.RecyclerViewItem) DescriptionView(com.moro.mtweaks.views.recyclerview.DescriptionView) SelectView(com.moro.mtweaks.views.recyclerview.SelectView)

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