From aeb5cf0c40a177e6a4ecfbbf0f4e059618311242 Mon Sep 17 00:00:00 2001 From: Scott Jackson Date: Tue, 26 Jul 2016 22:01:03 -0700 Subject: Fix the cast dialog theme not matching --- .../daneren2005/dsub/fragments/NowPlayingFragment.java | 3 ++- .../compat/CustomMediaRouteChooserDialogFragment.java | 15 +++++++++++++++ .../CustomMediaRouteControllerDialogFragment.java | 15 +++++++++++++++ .../dsub/view/compat/CustomMediaRouteDialogFactory.java | 17 +++++++++++++++++ 4 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteChooserDialogFragment.java create mode 100644 app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteControllerDialogFragment.java create mode 100644 app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteDialogFactory.java diff --git a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java index 530c03b6..7c20dc28 100644 --- a/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java +++ b/app/src/main/java/github/daneren2005/dsub/fragments/NowPlayingFragment.java @@ -60,7 +60,6 @@ import github.daneren2005.dsub.activity.SubsonicFragmentActivity; import github.daneren2005.dsub.adapter.SectionAdapter; import github.daneren2005.dsub.audiofx.EqualizerController; import github.daneren2005.dsub.domain.Bookmark; -import github.daneren2005.dsub.domain.MusicDirectory; import github.daneren2005.dsub.domain.PlayerState; import github.daneren2005.dsub.domain.RepeatMode; import github.daneren2005.dsub.domain.ServerInfo; @@ -74,6 +73,7 @@ import github.daneren2005.dsub.service.ServerTooOldException; import github.daneren2005.dsub.util.Constants; import github.daneren2005.dsub.util.SilentBackgroundTask; import github.daneren2005.dsub.adapter.DownloadFileAdapter; +import github.daneren2005.dsub.view.compat.CustomMediaRouteDialogFactory; import github.daneren2005.dsub.view.FadeOutAnimation; import github.daneren2005.dsub.view.FastScroller; import github.daneren2005.dsub.view.UpdateView; @@ -535,6 +535,7 @@ public class NowPlayingFragment extends SubsonicFragment implements OnGestureLis MenuItem mediaRouteItem = menu.findItem(R.id.menu_mediaroute); if(mediaRouteItem != null) { MediaRouteButton mediaRouteButton = (MediaRouteButton) MenuItemCompat.getActionView(mediaRouteItem); + mediaRouteButton.setDialogFactory(new CustomMediaRouteDialogFactory()); mediaRouteButton.setRouteSelector(downloadService.getRemoteSelector()); } } diff --git a/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteChooserDialogFragment.java b/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteChooserDialogFragment.java new file mode 100644 index 00000000..da9b135f --- /dev/null +++ b/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteChooserDialogFragment.java @@ -0,0 +1,15 @@ +package github.daneren2005.dsub.view.compat; + +import android.content.Context; +import android.os.Bundle; +import android.support.v7.app.MediaRouteChooserDialog; +import android.support.v7.app.MediaRouteChooserDialogFragment; + +import github.daneren2005.dsub.util.Util; + +public class CustomMediaRouteChooserDialogFragment extends MediaRouteChooserDialogFragment { + @Override + public MediaRouteChooserDialog onCreateChooserDialog(Context context, Bundle savedInstanceState) { + return new MediaRouteChooserDialog(context, Util.getThemeRes(context)); + } +} diff --git a/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteControllerDialogFragment.java b/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteControllerDialogFragment.java new file mode 100644 index 00000000..7fd54142 --- /dev/null +++ b/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteControllerDialogFragment.java @@ -0,0 +1,15 @@ +package github.daneren2005.dsub.view.compat; + +import android.content.Context; +import android.os.Bundle; +import android.support.v7.app.MediaRouteControllerDialog; +import android.support.v7.app.MediaRouteControllerDialogFragment; + +import github.daneren2005.dsub.util.Util; + +public class CustomMediaRouteControllerDialogFragment extends MediaRouteControllerDialogFragment { + @Override + public MediaRouteControllerDialog onCreateControllerDialog(Context context, Bundle savedInstanceState) { + return new MediaRouteControllerDialog(context, Util.getThemeRes(context)); + } +} diff --git a/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteDialogFactory.java b/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteDialogFactory.java new file mode 100644 index 00000000..8bc890cb --- /dev/null +++ b/app/src/main/java/github/daneren2005/dsub/view/compat/CustomMediaRouteDialogFactory.java @@ -0,0 +1,17 @@ +package github.daneren2005.dsub.view.compat; + +import android.support.v7.app.MediaRouteChooserDialogFragment; +import android.support.v7.app.MediaRouteControllerDialogFragment; +import android.support.v7.app.MediaRouteDialogFactory; + +public class CustomMediaRouteDialogFactory extends MediaRouteDialogFactory { + @Override + public MediaRouteChooserDialogFragment onCreateChooserDialogFragment() { + return new CustomMediaRouteChooserDialogFragment(); + } + + @Override + public MediaRouteControllerDialogFragment onCreateControllerDialogFragment() { + return new CustomMediaRouteControllerDialogFragment(); + } +} -- cgit v1.2.3