consp1racy / android-support-preference

Android Preferences according to Material design specs
Apache License 2.0
332 stars 49 forks source link

RingonePreference XpRingtonePreferenceDialogFragment doesn't show up with latest appcompat #121

Open dirkam opened 3 years ago

dirkam commented 3 years ago

Hi,

If androidx.appcompat:appcompat is updated to 1.3.0 or 1.3.1 then XpRingtonePreferenceDialogFragment dialog doesn't show up. It shows the backdrop shadow as if the dialog was visible, but the dialog is actually not visible.

Can you please test this on your end? Is there a workaround or fix that could be applied?

Thanks

dirkam commented 3 years ago

This is how I used to show the ringtone picker dialog from code:

XpRingtonePreferenceDialogFragment ringtonePicker = 
    XpRingtonePreferenceDialogFragment.newInstance(ringtonePreference.getKey());
ringtonePicker.setTargetFragment(SettingsFragment.this, 0);
ringtonePicker.show(getFragmentManager(), DIALOG_FRAGMENT_TAG);
dirkam commented 2 years ago

@consp1racy can you please take a look at this?

consp1racy commented 2 years ago

Looks like it's caused by the workaround introduced here https://github.com/consp1racy/android-support-preference/issues/87#issuecomment-370004822.

It appears, removing the workaround in conjunction with updating the Fragment library solves the underlying issue.

dirkam commented 2 years ago

Thanks for the update. Is there a way for us to fix this on our end?

consp1racy commented 2 years ago

Non-trivial. Try pulling in commit c13d5890a6 via jitpack.io and verify this works for you. It uses latest stable releases of AndroidX, except Preference.

Will update to Preference 1.2.0 later.

dirkam commented 2 years ago

Perhaps a noob question, but how can I do that? implementation 'net.xpece.android:support-preference:c13d5890a6' doesn't seem to work Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve net.xpece.android:support-preference:c13d5890a6.

consp1racy commented 2 years ago

Hi, sorry, you can follow the instructions here https://jitpack.io/docs/

dirkam commented 2 years ago

@consp1racy I tried that. I think I'm doing everything right. It seems there is a build failure for this commit.

c13d5890a6 3.x-dev-SNAPSHOT

dirkam commented 2 years ago

@consp1racy I also tried to download the branch and load it as a module but gradle build fails locally as well, so I couldn't verify this fix for the initial issue. I'd appreciate if you could have a look at this. Thanks!

consp1racy commented 2 years ago

It seems I broke publishing to Jitpack when I set up publishing to Maven Central.

The correct coordinates with the fix should be

dependencies {
  implementation("com.github.consp1racy.android-support-preference:support-preference:b8a9625ede")
  implementation("com.github.consp1racy.android-support-preference:support-preference-color:b8a9625ede")
  implementation("com.github.consp1racy.android-support-preference:support-spinner:b8a9625ede")
}
repositories {
  maven("https://jitpack.io")
}
dirkam commented 2 years ago

Thanks. This fixes the initial issue for me. It raises a question though, will this bring #87 issue back?

consp1racy commented 2 years ago

I understand your concern.

The AndroidX team completely replaced the FragmentManager implementation, which shoukd, among other things, fix any ordering issues. I have high hopes it affects this case as well.

The sample app doesn't crash.

I think it may be possible to write a test that triggers the flow a large number of times in an attempt to encounter crash.