This project is an approach to create a template for Backdrop UI design on Android. Backdrop means that the toolbar moves into the background and the navigation drawer is no longer the main source for navigation. Instead the card stack element holds the navigation steps and can reveal additional options or configurations in the backdrop element.
Available through jitpack: https://jitpack.io/#Str3l0k/Backdrop_Android
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency:
dependencies {
implementation 'com.github.Str3l0k:Backdrop_Android:Tag'
}
The app module shows a basic how-to-use it for now as demonstration. It is intended as One-Activity-Application with Fragments for all other means. Basically use the Activity as base class.
To build an application based on backdrop, the first step is to implement an Activity which inherits from the Activity provided in the library. It is itself an modified AppCompatActivity. The second step is to create a base card fragment which will be used as main entry point.
So the basic configuration for an working app is one activity and one Fragment.
MainActivity
class MainActivity : Activity() {
override val baseCardFragment: MainCardBackdropFragment = BaseFragment()
}
BaseFragment
class BaseFragment : MainCardBackdropFragment() {
override val menuButtonState: BackdropToolbarMainButtonState
get() = BackdropToolbarMainButtonState.MENU
override val toolbarItem: BackdropToolbarItem = BackdropToolbarItem(title = "Backdrop",
subtitle = "Demonstration",
primaryAction = R.drawable.ic_add,
moreActionEnabled = true)
override fun onCreateContentView(inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?): View? {
return inflater.inflate(R.layout.base_card, container, false)
}
override fun onContentViewCreated(view: View?, savedInstanceState: Bundle?) {
// configure content view here
}
}
The main fragment is returned as property in the Activity and currently the only thing that is required to be implemented when using the Activity class. The fragment needs a ToolbarItem which configures the toolbar titles and action items. Instead of using the onCreateView and onViewCreated from the Android Fragment class use the onCreateContentView and onContentViewCreated from the backdrop Fragment to inflate and configure the desired layout.
See issues for now.
Apache 2.0