MultiStateView


Source link: https://github.com/Kennyc1012/MultiStateView

MultiStateView

Android View that displays different content based on its state.
Based off of MeetMe/MultiStateView

The four different states the view can be in are:

  • Content
  • Empty
  • Error
  • Loading

Using MultiStateView

MultiStateView can be used the same as any other view by adding it as a layout file via XML

<com.kennyc.view.MultiStateView xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/multiStateView"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  app:msv_errorView="@layout/error_view"
  app:msv_emptyView="@layout/empty_view"
  app:msv_loadingView="@layout/loading_view"
  app:msv_viewState="loading">

<ListView

android:id="@+id/list"

android:layout_width="match_parent"

android:layout_height="match_parent"

tools:listitem="@android:layout/simple_list_item_1" />  </com.kennyc.view.MultiStateView>

The attributes to set for MultiStateView are

<attr name="msv_loadingView" format="reference" /> <attr name="msv_emptyView" format="reference" /> <attr name="msv_errorView" format="reference" /> <attr name="msv_viewState" format="enum"> <attr name="msv_animateViewChanges" format="boolean" />

msv_loadingView is the view to be used for the LOADING ViewState
msv_emptyView is the view to be used for the EMPTY ViewSate
msv_errorView is the view to be used for the ERROR ViewState
msv_viewState is the ViewState for the MultiStateView
The CONTENT ViewState is determined by whatever is inside of the tags via XML. NOTE** a Content view must be set for the view to function, this is by design.

To switch the state of MultiStateView, simply call

public void setViewState(@ViewState int state)

You can also get the View for the accompanying ViewState by calling

public View getView(@ViewState int state)

#Including in your project To include MultiStateView in your project, make the following changes to your build.gradle file

Add repository

repositories {

  maven {
 url 'https://jitpack.io' 
}
 
}

Add dependency

dependencies {

  compile 'com.github.Kennyc1012:MultiStateView:1.3.2' 
}

#Contribution Pull requests are welcomed and encouraged. If you experience any bugs, please file an issue

License

Copyright 2015 Kenny Campagna  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. 

Resources

Android Library for auto-formatting money on EditText.

Restito is a tool which is inspired by mockito and functionally is diametrically opposite to the Rest Assured.

Restito provides a DSL to:

  • Mimic rest server behavior
  • Record HTTP calls to the server
  • Perform verification against happened calls

Testing and validation of REST services in Java is harder than in dynamic languages such as Ruby and Groovy. REST Assured brings the simplicity of using these languages into the Java domain.

A powerful, customizable and extensible ViewPager indicator framework.

Simple to use customizable Android Tooltips library based on PopupWindow. This Tooltips does not require any custom layout. It works as PopupWindow.

It's a cool animation which can be used on splash screen or somewhere else.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes