Code Monkey home page Code Monkey logo

uipresenter's Introduction

UIPresenter

This android library is like a tour guide for your app's Views. It helps to explain to your user, the role of the Views in your Activity or Fragment. It supports minSdk 21 and up.

UIPresenter example 2 screenshot

UIPresenter in action UIPresenter in action UIPresenter in action
UIPresenter gif UIPresenter gif UIPresenter gif

How to get this library in your android app

Step 1. Add the jitpack repository to the repositories { } function, inside your project build.gradle or your settings.gradle like so:

repositories {
    google()
    mavenCentral()
    // Place the jitpack repository inside this, like so:
    maven { url 'https://jitpack.io' }
}

Step 2. Add the dependency in your module build.gradle file, like so:

dependencies {
    implementation "com.github.germainkevinbusiness:UIPresenter:2.0.0"
}

That's it!

Example with a RecyclerView & a menu item

UIPresenter example 2 screenshot A Menu item being presented by the library

Usage

Basic usage is shown below, with more examples in the sample app.

UIPresenter(activity = this).set(
    viewToPresent = binding.recyclerView[2], // using view binding here
    descriptionText = "This is a row inside the RecyclerView with an animal image and name",
    presenterStateChangeListener = { _, _ -> }
)

Only the above three parameters inside the UIPresenter.set() method are required to display a Presenter on your Activity or Fragment's UI. The rest of the parameters in the UIPresenter.set() method are optional, but great for customization!

Here's the output of the above code in light and dark mode:

Light mode UIPresenter example Dark mode UIPresenter example

For more in-depth examples, check out the sample app.

Note

To create your own animation when the presenter is being added to the decorView (called revealAnimation), or when the presenter is being removed from the decorView (called removeAnimation) , you need to implement the PresenterAnimation interface, like so:

class MyCustomAnimation : PresenterAnimation {

    override fun runAnimation(
        coroutineScope: CoroutineScope, // A scope to run your animation in, if you want
        presenter: Presenter, // The Presenter is the View which presents your UI and the View that
        // your custom animation will animate.
        animationDuration: Long, // The duration of the animation in milliseconds
        afterAnim: () -> Unit // When called that means we can safely consider this animation to be done
    ) {
        // write your animation logic here
    }
}

You can apply your own animations to the UIPresenter like so:

UIPresenter(activity = this).set(
    revealAnimation = MyCustomAnimation(), // if it's a reveal animation
    removeAnimation = MyCustomAnimation() // if it's a remove animation
)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

Licenced under the MIT Licence

Copyright (c) 2023 Kevin Germain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

uipresenter's People

Contributors

germainkevinbusiness avatar kevingermainbusiness avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

oyamo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.