Materially inspired widgets and views that expose RxJava bindings.

Related tags

Button Rx.Widgets
Overview

Rx.Widgets

Release License

Materially inspired widgets and views.

Use

ExpandableButtonGroup

Add the widget to your view:

    <io.andref.rx.widgets.ExpandableButtonGroupLayout
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:padding="16dp"
        app:rxw_backgroundTint="@color/colorAccent"
        app:rxw_drawableLess="@drawable/ic_expand_less_black_24dp"
        app:rxw_drawableMore="@drawable/ic_expand_more_black_24dp"
        app:rxw_drawableTint="@android:color/white"
        app:rxw_itemsPerRow="4"
        app:rxw_lessText="@string/less"
        app:rxw_moreText="@string/more"/>

All the available attributes are above and should be self explanatory. Please open an issue if there's one you'd like to see.

Next, give the view some items to display:

    List<ExpandableButtonGroup.Item> items = new ArrayList<>();
    items.add([...])

    final ExpandableButtonGroup expandableButtonGroup = (ExpandableButtonGroup) findViewById(R.id.expandable_button_group);
    expandableButtonGroup.setItems(items);

The view won't do anything until you subscribe to the exposed observables:

        // Subscribe to "less" button clicks.
        expandableButtonGroup.lessItemClicks()
                .subscribe(new Action1<Void>()
                {
                    @Override
                    public void call(Void aVoid)
                    {
                        expandableButtonGroup.showLessItems();
                    }
                });

        // Subscribe to "more" button clicks.
        expandableButtonGroup.moreItemClicks()
                .subscribe(new Action1<Void>()
                {
                    @Override
                    public void call(Void aVoid)
                    {
                        expandableButtonGroup.showMoreItems();
                    }
                });


        // Subscribe to all the other item clicks.
        expandableButtonGroup.itemClicks()
                .subscribe(new Action1<ExpandableButtonGroup.Item>()
                {
                    @Override
                    public void call(ExpandableButtonGroup.Item item)
                    {
                        Toast.makeText(getBaseContext(), item.getText(), Toast.LENGTH_SHORT).show();
                    }
                });

ListViewCard

Add the widget to your view:

    <io.andref.rx.widgets.ListViewCard
        android:id="@+id/list_view_card"
        android:layout_height="wrap_content"
        android:layout_margin="16dp"
        android:layout_width="match_parent"
        app:rxw_avatarAlpha="1"
        app:rxw_avatarTint="@color/colorAccent"
        app:rxw_buttonText="@string/button_to_click"
        app:rxw_denseLayout="true"
        app:rxw_iconAlpha=".27"/>

All the available attributes are above and should be self explanatory. Please open an issue if there's one you'd like to see.

Next, give the view some items to display:

        List<ListViewCard.Item> listViewCardItems = new ArrayList<>();
        listViewCardItems.add([...]);

        mListViewCard = (ListViewCard) findViewById(R.id.list_view_card);
        mListViewCard.setItems(listViewCardItems);

To handle the clicks you must subscribe to the exposed observables:

    listViewCard.itemClicks()
            .subscribe(new Action1<ListViewCard.Item>()
            {
                @Override
                public void call(ListViewCard.Item item)
                {
                    Toast.makeText(getBaseContext(), item.getLine1(), Toast.LENGTH_SHORT).show();
                }
            });


    listViewCard.iconClicks()
            .subscribe(new Action1<ListViewCard.Item>()
            {
                @Override
                public void call(ListViewCard.Item item)
                {
                    Toast.makeText(getBaseContext(), "Icon Clicked", Toast.LENGTH_SHORT).show();
                }
            });

    listViewCard.buttonClicks()
            .subscribe(new Action1<Void>()
            {
                @Override
                public void call(Void aVoid)
                {
                    Toast.makeText(getBaseContext(), "Button Clicked", Toast.LENGTH_SHORT).show();
                }
            });

Fun Fact: Even though this widget is called ListViewCard it does not contain a ListView. So, why call it that? Because we felt it best conveyed what this widget is supposed to do: Display a list of items inside a card.

Friendly Reminder

Don't forget to unsubscribe when you're done observing!

Note

This library is under active development so expect some breaking changes as we ramp up. We'll note these changes in the release notes.

Binaries

Add the JitPack repository to your root build.gradle at the end of repositories:

    allprojects {
        repositories {
            ...
            maven { url "https://jitpack.io" }
        }
   }

And then add this library to your project:

   dependencies {
        compile 'io.andref:Rx.Widgets:1.1.0'
   }

Or if you want a specific revision:

   dependencies {
        compile 'io.andref:Rx.Widgets:5dda428'
   }

License

Copyright 2016 Michael De Soto

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

You might also like...
RxJava binding APIs for Android's UI widgets.

RxBinding RxJava binding APIs for Android UI widgets from the platform and support libraries. Download Platform bindings: implementation 'com.jakewhar

This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS -->
This library provides advance views for lists and stacks. Some of the views are build on top of RecyclerView and others are written in their own. Annotations are compiled by annotation processor to generate bind classes. DOCS --

PlaceHolderView An advance view for lists and stacks Some Implementations Documentation You can find the PlaceHolderView documentation here which has

Okuki is a simple, hierarchical navigation bus and back stack for Android, with optional Rx bindings, and Toothpick DI integration.

Okuki A simple, hierarchical navigation bus and back stack for Android, with optional Rx bindings, and Toothpick integration for automatic dependency-

A custom recycler view with shimmer views to indicate that views are loading.
A custom recycler view with shimmer views to indicate that views are loading.

ShimmerRecyclerView Intro A custom recycler view with shimmer views to indicate that views are loading. The recycler view has a built-in adapter to co

SquircleView is a library which provides you with Squircle views to use for buttons, views, etc.
SquircleView is a library which provides you with Squircle views to use for buttons, views, etc.

SquircleView SquircleView is a library which provides you with Squircle views to use for buttons, views, etc. Screenshots Different kinds of buttons,

SquircleView is a library which provides you with Squircle views to use for buttons, views, etc.
SquircleView is a library which provides you with Squircle views to use for buttons, views, etc.

SquircleView is a library which provides you with Squircle views to use for buttons, views, etc.

Small Kafka Playground to play around with Test Containers, and KotlinX Coroutines bindings while reading Kafka Definite Guide V2

KafkaPlayground Small playground where I'm playing around with Kafka in Kotlin and the Kafka SDK whilst reading the Kafka book Definite Guide from Con

Kafka bindings for Kotlin `suspend`, and Kafka streaming operators for KotlinX Flow.

Module kotlin-kafka Rationale Goals Example This project is still under development, andd started as a playground where I was playing around with Kafk

Kotlin MPP bindings for various clis

kommander Kotlin MPP bindings for various cli tools. The libraries only wrap around the clis and still require them to be natively available on the PA

This little project provides Kotlin bindings for the popular tree-sitter library

kotlintree This little project provides Kotlin bindings for the popular tree-sitter library. Currently it only supports the Kotlin JVM target, but Kot

Java bindings for Skia
Java bindings for Skia

Skija: Java bindings for Skia Skia is an open source 2D graphics library which provides common APIs that work across a variety of hardware and softwar

Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#

Xamarin.Android Xamarin.Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#. Build Status Platform

Bindings to the JNI library on Android for Kotlin/Native

JNI Utils using this library: implementation("io.github.landrynorris:jni-utils:0.0.1-alpha01") This library provides bindings to the JNI library on An

Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.
Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Provides easy means to validate with dependencies.

android-formidable-validation Form validation and feedback library for Android. Provides .setText for more than just TextView and EditText widgets. Pr

Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.
Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.

Android ViewPagerIndicator Paging indicator widgets that are compatible with the ViewPager from the Android Support Library to improve discoverability

A Collection on all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential
A Collection on all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential

ComposeCookBook Declarative UI A Collection of all Jetpack compose UI elements, Layouts, Widgets and Demo screens to see it's potential. Jetpack Compo

Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.
Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.

Android ViewPagerIndicator Paging indicator widgets that are compatible with the ViewPager from the Android Support Library to improve discoverability

Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.
Material Design implementation for Android 4.0+. Shadows, ripples, vectors, fonts, animations, widgets, rounded corners and more.

Carbon Material Design implementation for Android 4.0 and newer. This is not the exact copy of the Lollipop's API and features. It's a custom implemen

A simple calendar with events, customizable widgets and no ads.
A simple calendar with events, customizable widgets and no ads.

Simple Calendar A simple calendar with events and a customizable widget. A simple calendar with optional CalDAV synchronization. You can easily create

Releases(1.1.0)
  • 1.1.0(Nov 19, 2016)

    Additions

    • Adding ListViewCard and related layouts.

    Fixes

    • Replaced our List<Subscription> with a CompositeSubscription. It does essentially the same thing, but means there's one less thing to worry about managing.
    • Moved layout initialization into onCreate() in the example. Originally it was in onResume(). If you don't do this too you'll get duplicated views and potentially crash. A better, longer term fix is forthcoming.

    Breaking Changes

    • All layout attributes have been prefixed with rxw_ to avoid conflicts in consuming projects. So, for example, app:itemsPerRow becomes app:rxw_itemsPerRow.
    • Renamed method setmData() to setData() in ExpandableButtonGroup.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.1(Nov 18, 2016)

    This release tries to make observing and subscribing more efficient.

    Breaking Changes

    • ExpandableButtonGroup now returns a single itemClicks observable. There's no need to have individual subscriptions to each item clicked. Your Action should remain the same.
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Nov 14, 2016)

Owner
Andrefio
Andrefio
Bootstrap style widgets for Android, with Glyph Icons

Android-Bootstrap Android Bootstrap is an Android library which provides custom views styled according to the Twitter Bootstrap Specification. This al

Bearded Hen 7.3k Jan 3, 2023
Sometimes, we need to show a label above an ImageView or any other views. Well, LabelView will be able to help you. It's easy to implement as well!

LabelView Sometimes, we need to show a label above an ImageView or any other views. Well, LabelXXView will be able to help you. It's easy to implement

Jingwei 1.9k Dec 6, 2022
Button for android with animations for transition and error states.

Transition Button Android Preview Expand animation: Shake animation: Installation Gradle dependencies { implementation 'com.royrodriguez:transitionbu

Roy Rodriguez 137 Jan 3, 2023
AwesomeSwitch is a replacement for the standard Switch(View) android offers, and it offers much more customization than the standard switch component.

AwesomeSwitch AwesomeSwitch is a replacement for the standard Switch(View) android offers, and it offers much more customization than the standard swi

Anoop S S 29 Jun 2, 2022
A cute widget of Switch Button for you to create beautiful and friendly UI.

SwitchButton To get a quick preview, you can get Demo apk in Google Play or Directly download. This project provides you a convenient way to use and c

kyleduo 4.6k Dec 31, 2022
comtomize view submit button which you use for submit operation or download operation and so on.

This is library project with a custom view that implements concept of Submit Button (https://dribbble.com/shots/1426764-Submit-Button?list=likes&offse

ZhangLei 129 Feb 5, 2021
Floating Action Button But Moveable And Expandalbe

MeFab todo add the maven bacge here Floating Action Button but MOVEABLE and EXPA

Hussien Fahmy 6 Dec 30, 2022
Primitive OpenGL (ES) based graphics library and engine for Android development.

Parrot Primitive OpenGL (ES) based graphics library and engine for Android development. Parrot makes Android core graphics simpler, giving you the fea

null 1 Dec 30, 2021
➕ An efficient and beaufitul Multi Float action button library based on Twitter implemented in Jetpack Compose 🚀

Multi Float Action Button ➕ An efficient and beaufitul Multi Float action button library based on Twitter implemented in Jetpack Compose ?? Including

Geovani Amaral 8 Oct 15, 2022
RxJava bindings for Android

RxAndroid: Reactive Extensions for Android Android specific bindings for RxJava 3. This module adds the minimum classes to RxJava that make writing re

ReactiveX 19.8k Jan 8, 2023