diff --git a/README.md b/README.md index a54da66..af1a11b 100644 --- a/README.md +++ b/README.md @@ -15,19 +15,12 @@ This library makes it easy to implement a [Backdrop](https://material.io/design/ ## Download **JCenter (Recommended):** - -*For support library:* ```groovy dependencies { - implementation 'ru.semper-viventem.backdrop:backdrop:0.1.5' -} -``` -*For Android X:* -```groovy -dependencies { - implementation 'ru.semper-viventem.backdrop:backdrop:0.1.5_x' + implementation 'ru.semper-viventem.backdrop:backdrop:0.1.6' } ``` + **JitPack:** ```groovy repositories { @@ -36,34 +29,41 @@ repositories { } dependencies { - implementation 'com.github.Semper-Viventem:BackdropView:0.1.5' + implementation 'com.github.Semper-Viventem:BackdropView:0.1.6' } ``` ## How to use it? -You need to add a layout Toolbar, back container and foreground container +You need to add front layout and back layout (with toolbar) to CoordinatorLayout. -Add BackdropBehavior to the Foreground View Container: +Add BackdropBehavior to your front layout: **XML** ```xml - - - - + - - - + + + + + + + - + @@ -97,14 +97,16 @@ fun > View.findBehavior(): T = layoutParams.ru val backdropBehavior: BackdropBehavior = foregroundContainer.findBehavior() // find behavior with(backdropBehavior) { - attachBackContainer(R.id.backContainer) // set back container - attachToolbar(R.id.toolbar) // set toolbar + + // Attach your back layout to behavior. + // BackDropBehavior will find the toolbar itself. + attachBackLayout(R.id.backLayout) - // set navigation icons for toolbar + // Set navigation icons for toolbar setClosedIcon(R.drawable.ic_menu) setOpenedIcon(R.drawable.ic_close) - // add listener + // Add listener addOnDropListener(object : BackdropBehavior.OnDropListener { override fun onDrop(dropState: BackdropBehavior.DropState, fromUser: Boolean) { // TODO: handle listener diff --git a/sample/src/main/kotlin/ru/semper_viventem/backdropview/ui/MainActivity.kt b/sample/src/main/kotlin/ru/semper_viventem/backdropview/ui/MainActivity.kt index 604498c..c9adab3 100644 --- a/sample/src/main/kotlin/ru/semper_viventem/backdropview/ui/MainActivity.kt +++ b/sample/src/main/kotlin/ru/semper_viventem/backdropview/ui/MainActivity.kt @@ -21,7 +21,7 @@ class MainActivity : AppCompatActivity() { private const val MENU_TEXT = R.id.menuText private const val MENU_LIST = R.id.menuList - private const val FRAGMENT_CONTAINER = R.id.foregroundContainer + private const val FRAGMENT_CONTAINER = R.id.frontLayout private const val DEFAULT_ITEM = MENU_GALLERY } @@ -32,9 +32,9 @@ class MainActivity : AppCompatActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) - backdropBehavior = foregroundContainer.findBehavior() + backdropBehavior = frontLayout.findBehavior() with(backdropBehavior) { - attachBackLayout(R.id.backContainer) + attachBackLayout(R.id.backLayout) } with(toolbar) { setTitle(R.string.app_name) diff --git a/sample/src/main/res/layout/activity_main.xml b/sample/src/main/res/layout/activity_main.xml index d5b96de..96ba40f 100644 --- a/sample/src/main/res/layout/activity_main.xml +++ b/sample/src/main/res/layout/activity_main.xml @@ -10,7 +10,7 @@ tools:context=".ui.MainActivity"> @@ -34,7 +34,7 @@