Code Monkey home page Code Monkey logo

viewbindingpropertydelegate's Introduction

Publish to Bintray Download

ViewBindingPropertyDelegate

Make work with Android View Binding simpler

Add library to a project

allprojects {
  repositories {
    jcenter()
  }
}

dependencies {
    implementation 'co.sampingan.android:viewbinding-propertydelegate:1.0.0'}

Samples

class ProfileFragment : Fragment(R.layout.profile) {

    private val viewBinding: ProfileBinding by viewBinding()
}
class ProfileActivity : AppCompatActivity(R.layout.profile) {

    private val viewBinding: ProfileBinding by viewBinding(R.id.container)
}
class ProfileDialogFragment : DialogFragment() {

    private val viewBinding: ProfileBinding by dialogViewBinding(R.id.container)

    // Creating via default way will work too for that case
    // private val viewBinding: ProfileBinding by viewBinding()

    override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
        return AlertDialog.Builder(requireContext())
            .setView(R.layout.profile)
            .create()
    }
}
class ProfileDialogFragment : DialogFragment() {

    private val viewBinding: ProfileBinding by dialogViewBinding(R.id.container)

    override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
        return inflater.inflate(R.layout.profile, container, false)
    }
}

viewbindingpropertydelegate's People

Contributors

kirich1409 avatar mochadwi avatar dekan avatar

Watchers

James Cloos avatar  avatar

viewbindingpropertydelegate's Issues

Setup Bintray

Error in Hilt doesn't support default value declaration

I tried to implement this library and ended with this build error.

error: [Hilt] public class BaseActivity extends androidx.appcompat.app.AppCompatActivity { ^ The base class, 'com.sampingan.agentapp.utils.base.BaseActivity', of the @AndroidEntryPoint, 'com.sampingan.agentapp.utils.base.DeepLinkActivity', contains a constructor with default parameters. This is currently not supported by the Gradle plugin. Either specify the base class as described at https://dagger.dev/hilt/gradle-setup#why-use-the-plugin or remove the default value declaration.

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.