Loading packages/MediaComponents/src/com/android/media/update/ApiHelper.java +18 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,13 @@ package com.android.media.update; import android.content.Context; import android.content.res.Resources; import android.content.res.Resources.Theme; import android.content.res.XmlResourceParser; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; public class ApiHelper { private static ApiHelper sInstance; Loading Loading @@ -46,4 +51,17 @@ public class ApiHelper { public static Resources.Theme getLibTheme() { return sInstance.mLibTheme; } public static LayoutInflater getLayoutInflater(Context context) { LayoutInflater layoutInflater = LayoutInflater.from(context).cloneInContext( new ContextThemeWrapper(context, getLibTheme())); // TODO: call layoutInflater.setFactory2() return layoutInflater; } public static View inflateLibLayout(Context context, int libResId) { try (XmlResourceParser parser = getLibResources().getLayout(libResId)) { return getLayoutInflater(context).inflate(parser, null); } } } packages/MediaComponents/src/com/android/widget/MediaControlView2Impl.java +1 −4 Original line number Diff line number Diff line Loading @@ -348,11 +348,8 @@ public class MediaControlView2Impl implements MediaControlView2Provider { * @hide This doesn't work as advertised */ protected View makeControllerView() { View root = LayoutInflater.from(mInstance.getContext()).inflate( R.layout.media_controller, null); View root = ApiHelper.inflateLibLayout(mInstance.getContext(), R.layout.media_controller); initControllerView(root); return root; } Loading Loading
packages/MediaComponents/src/com/android/media/update/ApiHelper.java +18 −0 Original line number Diff line number Diff line Loading @@ -16,8 +16,13 @@ package com.android.media.update; import android.content.Context; import android.content.res.Resources; import android.content.res.Resources.Theme; import android.content.res.XmlResourceParser; import android.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; public class ApiHelper { private static ApiHelper sInstance; Loading Loading @@ -46,4 +51,17 @@ public class ApiHelper { public static Resources.Theme getLibTheme() { return sInstance.mLibTheme; } public static LayoutInflater getLayoutInflater(Context context) { LayoutInflater layoutInflater = LayoutInflater.from(context).cloneInContext( new ContextThemeWrapper(context, getLibTheme())); // TODO: call layoutInflater.setFactory2() return layoutInflater; } public static View inflateLibLayout(Context context, int libResId) { try (XmlResourceParser parser = getLibResources().getLayout(libResId)) { return getLayoutInflater(context).inflate(parser, null); } } }
packages/MediaComponents/src/com/android/widget/MediaControlView2Impl.java +1 −4 Original line number Diff line number Diff line Loading @@ -348,11 +348,8 @@ public class MediaControlView2Impl implements MediaControlView2Provider { * @hide This doesn't work as advertised */ protected View makeControllerView() { View root = LayoutInflater.from(mInstance.getContext()).inflate( R.layout.media_controller, null); View root = ApiHelper.inflateLibLayout(mInstance.getContext(), R.layout.media_controller); initControllerView(root); return root; } Loading