Karumi / Dexter

Android library that simplifies the process of requesting permissions at runtime.
http://karumi.com
Apache License 2.0
5.23k stars 671 forks source link

SnackbarOnDeniedPermissionListener.Builder.with requires ViewGroup #169

Closed igelgrun closed 7 years ago

igelgrun commented 7 years ago

Expected behaviour

SnackbarOnDeniedPermissionListener.Builder.with(
    findViewById(R.id.some_view), R.string.some_text)

Actual behaviour

SnackbarOnDeniedPermissionListener.Builder.with(
    (ViewGroup) findViewById(R.id.some_view), R.string.some_text)

Steps to reproduce

Try to create SnackbarOnDeniedPermissionListener using static method of builder.

Version of the library

4.1.0

pedrovgs commented 7 years ago

Hi @stefan-nsk I guess this is not a bug xD The snack bar component requires a ViewGroup instance. I'm closing this issue, sorry. If you want to avoid the downcasting you can use a library like butterknife so the casting is performed by the library and if the casting fails your app will crash.

pedrovgs commented 7 years ago

My bad, the library accepts a view and in Snackbar:135 is going to find the view parent. We could change the code to accept View instead of ViewGroup as param. As this is not a major feature we will wait for a collaborator PR 😃 if you don't mind.

igelgrun commented 7 years ago

You are welcome: #171.

pedrovgs commented 7 years ago

uooo thanks!