Search in sources :

Example 26 with CardView

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

the class LEDFragment method delayInit.

private void delayInit(List<RecyclerViewItem> items) {
    CardView delayCard = new CardView(getActivity());
    delayCard.setTitle(getString(R.string.delay));
    if (Sec.hasNotificationDelayOn()) {
        SeekBarView notificationDelayOn = new SeekBarView();
        notificationDelayOn.setTitle(getString(R.string.on));
        notificationDelayOn.setUnit(getString(R.string.ms));
        notificationDelayOn.setMax(5000);
        notificationDelayOn.setOffset(100);
        notificationDelayOn.setProgress(Sec.getNotificationDelayOn() / 100);
        notificationDelayOn.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        delayCard.addItem(notificationDelayOn);
    }
    if (Sec.hasNotificationDelayOff()) {
        SeekBarView notificationDelayOff = new SeekBarView();
        notificationDelayOff.setTitle(getString(R.string.off));
        notificationDelayOff.setUnit(getString(R.string.ms));
        notificationDelayOff.setMax(5000);
        notificationDelayOff.setOffset(100);
        notificationDelayOff.setProgress(Sec.getNotificationDelayOff() / 100);
        notificationDelayOff.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 27 with CardView

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

the class ScreenFragment method lcdBackLightInit.

private void lcdBackLightInit(List<RecyclerViewItem> items) {
    CardView lcdBackLightCard = new CardView(getActivity());
    lcdBackLightCard.setTitle(getString(R.string.lcd_backlight));
    if (Misc.hasBrightnessMode()) {
        SwitchView brightnessMode = new SwitchView();
        brightnessMode.setSummary(getString(R.string.brightness_mode));
        brightnessMode.setChecked(Misc.isBrightnessModeEnabled());
        brightnessMode.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableBrightnessMode(isChecked, getActivity());
            }
        });
        lcdBackLightCard.addItem(brightnessMode);
    }
    if (Misc.hasLcdMinBrightness()) {
        SeekBarView lcdMinBrightness = new SeekBarView();
        lcdMinBrightness.setTitle(getString(R.string.min_brightness));
        lcdMinBrightness.setSummary(getString(R.string.min_brightness_summary));
        lcdMinBrightness.setMax(114);
        lcdMinBrightness.setMin(2);
        lcdMinBrightness.setProgress(Misc.getLcdMinBrightness() - 2);
        lcdMinBrightness.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Misc.setLcdMinBrightness(position + 2, getActivity());
            }

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        lcdBackLightCard.addItem(lcdMinBrightness);
    }
    if (Misc.hasLcdMaxBrightness()) {
        SeekBarView lcdMaxBrightness = new SeekBarView();
        lcdMaxBrightness.setTitle(getString(R.string.max_brightness));
        lcdMaxBrightness.setSummary(getString(R.string.max_brightness_summary));
        lcdMaxBrightness.setMax(114);
        lcdMaxBrightness.setMin(2);
        lcdMaxBrightness.setProgress(Misc.getLcdMaxBrightness() - 2);
        lcdMaxBrightness.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

            @Override
            public void onStop(SeekBarView seekBarView, int position, String value) {
                Misc.setLcdMaxBrightness(position + 2, getActivity());
            }

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

Example 28 with CardView

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

the class ScreenFragment method backlightDimmerInit.

private void backlightDimmerInit(List<RecyclerViewItem> items) {
    CardView backLightDimmerCard = new CardView(getActivity());
    backLightDimmerCard.setTitle(getString(R.string.backlight_dimmer));
    if (Misc.hasBackLightDimmerEnable()) {
        SwitchView backLightDimmer = new SwitchView();
        backLightDimmer.setSummary(getString(R.string.backlight_dimmer));
        backLightDimmer.setChecked(Misc.isBackLightDimmerEnabled());
        backLightDimmer.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                Misc.enableBackLightDimmer(isChecked, getActivity());
            }
        });
        backLightDimmerCard.addItem(backLightDimmer);
    }
    if (Misc.hasMinBrightness()) {
        SeekBarView minBrightness = new SeekBarView();
        minBrightness.setTitle(getString(R.string.min_brightness));
        minBrightness.setSummary(getString(R.string.min_brightness_summary));
        minBrightness.setMax(Misc.getMaxMinBrightness());
        minBrightness.setProgress(Misc.getCurMinBrightness());
        minBrightness.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        backLightDimmerCard.addItem(minBrightness);
    }
    if (Misc.hasBackLightDimmerThreshold()) {
        SeekBarView threshold = new SeekBarView();
        threshold.setTitle(getString(R.string.threshold));
        threshold.setMax(50);
        threshold.setProgress(Misc.getBackLightDimmerThreshold());
        threshold.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

            @Override
            public void onMove(SeekBarView seekBarView, int position, String value) {
            }
        });
        backLightDimmerCard.addItem(threshold);
    }
    if (Misc.hasBackLightDimmerOffset()) {
        SeekBarView dimmerOffset = new SeekBarView();
        dimmerOffset.setTitle(getString(R.string.offset));
        dimmerOffset.setMax(50);
        dimmerOffset.setProgress(Misc.getBackLightDimmerOffset());
        dimmerOffset.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 29 with CardView

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

the class VMFragment method zswapInit.

private void zswapInit(List<RecyclerViewItem> items) {
    CardView zswapCard = new CardView(getActivity());
    zswapCard.setTitle(getString(R.string.zswap));
    if (ZSwap.hasEnable()) {
        SwitchView zswap = new SwitchView();
        zswap.setTitle(getString(R.string.zswap));
        zswap.setSummary(getString(R.string.zswap_summary));
        zswap.setChecked(ZSwap.isEnabled());
        zswap.addOnSwitchListener(new SwitchView.OnSwitchListener() {

            @Override
            public void onChanged(SwitchView switchView, boolean isChecked) {
                ZSwap.enable(isChecked, getActivity());
            }
        });
        zswapCard.addItem(zswap);
    }
    if (ZSwap.hasMaxPoolPercent()) {
        if (!Prefs.getBoolean("memory_pool_percent", false, getActivity())) {
            SeekBarView maxPoolPercent = new SeekBarView();
            maxPoolPercent.setTitle(getString(R.string.memory_pool));
            maxPoolPercent.setSummary(getString(R.string.memory_pool_summary));
            maxPoolPercent.setUnit("%");
            maxPoolPercent.setMax(ZSwap.getStockMaxPoolPercent() / 10);
            maxPoolPercent.setProgress(ZSwap.getMaxPoolPercent() / 10);
            maxPoolPercent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

                @Override
                public void onMove(SeekBarView seekBarView, int position, String value) {
                }
            });
            zswapCard.addItem(maxPoolPercent);
        } else {
            SeekBarView maxPoolPercent = new SeekBarView();
            maxPoolPercent.setTitle(getString(R.string.memory_pool));
            maxPoolPercent.setSummary(getString(R.string.memory_pool_summary));
            maxPoolPercent.setUnit("%");
            maxPoolPercent.setMax(ZSwap.getStockMaxPoolPercent());
            maxPoolPercent.setProgress(ZSwap.getMaxPoolPercent());
            maxPoolPercent.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

                @Override
                public void onMove(SeekBarView seekBarView, int position, String value) {
                }
            });
            zswapCard.addItem(maxPoolPercent);
        }
    }
    if (ZSwap.hasMaxCompressionRatio()) {
        SeekBarView maxCompressionRatio = new SeekBarView();
        maxCompressionRatio.setTitle(getString(R.string.maximum_compression_ratio));
        maxCompressionRatio.setSummary(getString(R.string.maximum_compression_ratio_summary));
        maxCompressionRatio.setUnit("%");
        maxCompressionRatio.setProgress(ZSwap.getMaxCompressionRatio());
        maxCompressionRatio.setOnSeekBarListener(new SeekBarView.OnSeekBarListener() {

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

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

Example 30 with CardView

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

the class VMFragment method memBarsInit.

private void memBarsInit(List<RecyclerViewItem> items) {
    CardView card = new CardView(getActivity());
    card.setTitle(getString(R.string.memory));
    long swap_total = Device.MemInfo.getItemMb("SwapTotal");
    long swap_progress = swap_total - Device.MemInfo.getItemMb("SwapFree");
    swap = new ProgressBarView();
    swap.setTitle("SWAP");
    swap.setItems(swap_total, swap_progress);
    swap.setUnit(getResources().getString(R.string.mb));
    swap.setProgressColor(getResources().getColor(R.color.blue_accent));
    card.addItem(swap);
    long mem_total = Device.MemInfo.getItemMb("MemTotal");
    long mem_progress = mem_total - (Device.MemInfo.getItemMb("Cached") + Device.MemInfo.getItemMb("MemFree"));
    mem = new ProgressBarView();
    mem.setTitle("RAM");
    mem.setItems(mem_total, mem_progress);
    mem.setUnit(getResources().getString(R.string.mb));
    mem.setProgressColor(getResources().getColor(R.color.orange_accent));
    card.addItem(mem);
    items.add(card);
}
Also used : CardView(com.moro.mtweaks.views.recyclerview.CardView) ProgressBarView(com.moro.mtweaks.views.recyclerview.ProgressBarView)

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