From cb1d7801a7595313e954a7e7fa1da586080ff88c Mon Sep 17 00:00:00 2001 From: malinajirka Date: Fri, 14 Sep 2018 11:17:30 +0200 Subject: [PATCH] Fix ContextImpl cannot be cast to WordPress --- .../java/org/wordpress/android/ui/media/MediaGridAdapter.java | 2 +- .../org/wordpress/android/ui/uploads/MediaUploadHandler.java | 2 +- .../org/wordpress/android/ui/uploads/PostUploadHandler.java | 2 +- .../main/java/org/wordpress/android/util/WPWebViewClient.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java index 45584f9a5208..7b38fa4464df 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/media/MediaGridAdapter.java @@ -87,7 +87,7 @@ public interface MediaGridAdapterCallback { public MediaGridAdapter(@NonNull Context context, @NonNull SiteModel site, @NonNull MediaBrowserType browserType) { super(); - ((WordPress) WordPress.getContext()).component().inject(this); + ((WordPress) WordPress.getContext().getApplicationContext()).component().inject(this); setHasStableIds(true); mContext = context; diff --git a/WordPress/src/main/java/org/wordpress/android/ui/uploads/MediaUploadHandler.java b/WordPress/src/main/java/org/wordpress/android/ui/uploads/MediaUploadHandler.java index 5574a39165bd..859f437d8ef6 100755 --- a/WordPress/src/main/java/org/wordpress/android/ui/uploads/MediaUploadHandler.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/uploads/MediaUploadHandler.java @@ -41,7 +41,7 @@ public class MediaUploadHandler implements UploadHandler, VideoOptim @Inject SiteStore mSiteStore; MediaUploadHandler() { - ((WordPress) WordPress.getContext()).component().inject(this); + ((WordPress) WordPress.getContext().getApplicationContext()).component().inject(this); AppLog.i(T.MEDIA, "MediaUploadHandler > Created"); mDispatcher.register(this); EventBus.getDefault().register(this); diff --git a/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java b/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java index e58e86fcbf49..f6ad82608563 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/uploads/PostUploadHandler.java @@ -74,7 +74,7 @@ public class PostUploadHandler implements UploadHandler { @Inject MediaStore mMediaStore; PostUploadHandler(PostUploadNotifier postUploadNotifier) { - ((WordPress) WordPress.getContext()).component().inject(this); + ((WordPress) WordPress.getContext().getApplicationContext()).component().inject(this); AppLog.i(T.POSTS, "PostUploadHandler > Created"); mDispatcher.register(this); mPostUploadNotifier = postUploadNotifier; diff --git a/WordPress/src/main/java/org/wordpress/android/util/WPWebViewClient.java b/WordPress/src/main/java/org/wordpress/android/util/WPWebViewClient.java index 2995b486ba57..45bdb492d7a4 100644 --- a/WordPress/src/main/java/org/wordpress/android/util/WPWebViewClient.java +++ b/WordPress/src/main/java/org/wordpress/android/util/WPWebViewClient.java @@ -42,7 +42,7 @@ public WPWebViewClient(SiteModel site, String token) { public WPWebViewClient(SiteModel site, String token, List urls) { super(urls); - ((WordPress) WordPress.getContext()).component().inject(this); + ((WordPress) WordPress.getContext().getApplicationContext()).component().inject(this); mSite = site; mToken = token; }