helps easily switch between different layouts without writing much code of View visibility.
Add change-scene to your dependencies block:
compile 'com.github.rajuse.changescene:change-scene:1.1.0'Add a ChangeSceneLayout to your layout just like any other view.
<dev.raju.lib.changescene.ChangeSceneLayout
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--Your Default-Scene-->
</dev.raju.lib.changescene.ChangeSceneLayout>For example:
<dev.raju.lib.changescene.ChangeSceneLayout
android:id="@+id/rootView"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="@android:color/white" />
</dev.raju.lib.changescene.ChangeSceneLayout>To design Default-Scene, there are 3 options:
ChangeSceneLayout is custom RelativeLayout
ChangeSceneConstraintLayout is custom ConstraintLayout
ChangeSceneLinearLayout is custom LinearLayout
-
Change to your custom layout (
custom-scene)
#changeScene(R.layout.custom_scene); -
Change to
progressbar
#showProgressScene(String progMessage) -
Change to
default-scene(i.e. childs ofChangeSceneLayout)
#showContentScene();
- Separates different states with different layouts.
- You can provide custom layout to be switched to.
- Progress-scene support for showing progress bar.
- Boilerplate code related with view visibility/invisibility is gone.
As always any enhancements, PRs and bugs report will be highly appreciated. :-)