aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-08-19 13:50:36 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-08-19 13:50:36 +0000
commit54785beede8f1af28f4f05f645251d10ff520928 (patch)
treecc2638eb9ab35385077e551c3ae58dc9ebab1b3c
parentb3eb20862a1524b1ceedad041ac92446b4ffeb30 (diff)
downloadinfinity-for-reddit-54785beede8f1af28f4f05f645251d10ff520928.tar
infinity-for-reddit-54785beede8f1af28f4f05f645251d10ff520928.tar.gz
infinity-for-reddit-54785beede8f1af28f4f05f645251d10ff520928.tar.bz2
infinity-for-reddit-54785beede8f1af28f4f05f645251d10ff520928.tar.lz
infinity-for-reddit-54785beede8f1af28f4f05f645251d10ff520928.tar.xz
infinity-for-reddit-54785beede8f1af28f4f05f645251d10ff520928.tar.zst
infinity-for-reddit-54785beede8f1af28f4f05f645251d10ff520928.zip
Try fixing IllegalArgumentException at androidx.viewpager.widget.ViewPager.onInterceptTouchEvent.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java13
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/customviews/ViewPagerBugFixed.java37
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java1
-rw-r--r--app/src/main/res/layout/activity_subscribed_thing_listing.xml2
-rw-r--r--app/src/main/res/layout/activity_theme_preview.xml2
-rw-r--r--app/src/main/res/layout/activity_view_imgur_media.xml6
-rw-r--r--app/src/main/res/layout/activity_view_reddit_gallery.xml2
10 files changed, 63 insertions, 23 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java
index dbd40c31..e3d232e6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/CustomThemePreviewActivity.java
@@ -1,5 +1,10 @@
package ml.docilealligator.infinityforreddit.activities;
+import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
+import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
+import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
+import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
+
import android.content.SharedPreferences;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
@@ -43,22 +48,18 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.AppBarStateChangeListener;
+import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.customtheme.CustomTheme;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeSettingsItem;
+import ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed;
import ml.docilealligator.infinityforreddit.font.ContentFontStyle;
import ml.docilealligator.infinityforreddit.font.FontStyle;
import ml.docilealligator.infinityforreddit.font.TitleFontStyle;
import ml.docilealligator.infinityforreddit.fragments.ThemePreviewCommentsFragment;
import ml.docilealligator.infinityforreddit.fragments.ThemePreviewPostsFragment;
-import ml.docilealligator.infinityforreddit.Infinity;
-import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
-import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_AUTO_BATTERY;
-import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM;
-import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO;
-import static androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES;
-
public class CustomThemePreviewActivity extends AppCompatActivity {
public static final String EXTRA_CUSTOM_THEME_SETTINGS_ITEMS = "ECTSI";
@@ -66,7 +67,7 @@ public class CustomThemePreviewActivity extends AppCompatActivity {
@BindView(R.id.coordinator_layout_theme_preview_activity)
CoordinatorLayout coordinatorLayout;
@BindView(R.id.view_pager_theme_preview_activity)
- ViewPager viewPager;
+ ViewPagerBugFixed viewPager;
@BindView(R.id.appbar_layout_theme_preview_activity)
AppBarLayout appBarLayout;
@BindView(R.id.collapsing_toolbar_layout_theme_preview_activity)
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
index 7309c15f..0d33b2a8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
@@ -47,6 +47,7 @@ import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.asynctasks.InsertMultireddit;
import ml.docilealligator.infinityforreddit.asynctasks.InsertSubscribedThings;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
+import ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed;
import ml.docilealligator.infinityforreddit.events.GoBackToMainPageEvent;
import ml.docilealligator.infinityforreddit.events.RefreshMultiRedditsEvent;
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
@@ -77,7 +78,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
@BindView(R.id.tab_layout_subscribed_thing_listing_activity)
TabLayout tabLayout;
@BindView(R.id.view_pager_subscribed_thing_listing_activity)
- ViewPager viewPager;
+ ViewPagerBugFixed viewPager;
@BindView(R.id.fab_subscribed_thing_listing_activity)
FloatingActionButton fab;
@Inject
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java
index 57a8be8b..8aab0011 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImgurMediaActivity.java
@@ -36,7 +36,13 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.ImgurMedia;
+import ml.docilealligator.infinityforreddit.Infinity;
+import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback;
+import ml.docilealligator.infinityforreddit.WallpaperSetter;
import ml.docilealligator.infinityforreddit.apis.ImgurAPI;
+import ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed;
import ml.docilealligator.infinityforreddit.font.ContentFontFamily;
import ml.docilealligator.infinityforreddit.font.ContentFontStyle;
import ml.docilealligator.infinityforreddit.font.FontFamily;
@@ -45,14 +51,9 @@ import ml.docilealligator.infinityforreddit.font.TitleFontFamily;
import ml.docilealligator.infinityforreddit.font.TitleFontStyle;
import ml.docilealligator.infinityforreddit.fragments.ViewImgurImageFragment;
import ml.docilealligator.infinityforreddit.fragments.ViewImgurVideoFragment;
-import ml.docilealligator.infinityforreddit.ImgurMedia;
-import ml.docilealligator.infinityforreddit.Infinity;
-import ml.docilealligator.infinityforreddit.R;
-import ml.docilealligator.infinityforreddit.SetAsWallpaperCallback;
import ml.docilealligator.infinityforreddit.utils.APIUtils;
import ml.docilealligator.infinityforreddit.utils.JSONUtils;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
-import ml.docilealligator.infinityforreddit.WallpaperSetter;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
@@ -72,7 +73,7 @@ public class ViewImgurMediaActivity extends AppCompatActivity implements SetAsWa
@BindView(R.id.progress_bar_view_imgur_media_activity)
ProgressBar progressBar;
@BindView(R.id.view_pager_view_imgur_media_activity)
- ViewPager viewPager;
+ ViewPagerBugFixed viewPager;
@BindView(R.id.load_image_error_linear_layout_view_imgur_media_activity)
LinearLayout errorLinearLayout;
private SectionsPagerAdapter sectionsPagerAdapter;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java
index 75e91d33..b5047cc6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewRedditGalleryActivity.java
@@ -28,6 +28,7 @@ import javax.inject.Named;
import butterknife.BindView;
import butterknife.ButterKnife;
+import ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed;
import ml.docilealligator.infinityforreddit.font.ContentFontFamily;
import ml.docilealligator.infinityforreddit.font.ContentFontStyle;
import ml.docilealligator.infinityforreddit.font.FontFamily;
@@ -51,7 +52,7 @@ public class ViewRedditGalleryActivity extends AppCompatActivity implements SetA
@BindView(R.id.hauler_view_view_reddit_gallery_activity)
HaulerView haulerView;
@BindView(R.id.view_pager_view_reddit_gallery_activity)
- ViewPager viewPager;
+ ViewPagerBugFixed viewPager;
private SectionsPagerAdapter sectionsPagerAdapter;
private ArrayList<Post.Gallery> gallery;
private String subredditName;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/ViewPagerBugFixed.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/ViewPagerBugFixed.java
new file mode 100644
index 00000000..78e7b88e
--- /dev/null
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/ViewPagerBugFixed.java
@@ -0,0 +1,37 @@
+package ml.docilealligator.infinityforreddit.customviews;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.viewpager.widget.ViewPager;
+
+public class ViewPagerBugFixed extends ViewPager {
+ public ViewPagerBugFixed(@NonNull Context context) {
+ super(context);
+ }
+
+ public ViewPagerBugFixed(@NonNull Context context, @Nullable AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent ev) {
+ try {
+ return super.onTouchEvent(ev);
+ } catch (IllegalArgumentException ignore) {}
+
+ return false;
+ }
+
+ @Override
+ public boolean onInterceptTouchEvent(MotionEvent ev) {
+ try {
+ return super.onInterceptTouchEvent(ev);
+ } catch (IllegalArgumentException ignore) {}
+
+ return false;
+ }
+}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java
index 94a958a5..d676a933 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRPANBroadcastFragment.java
@@ -6,7 +6,6 @@ import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
-import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
diff --git a/app/src/main/res/layout/activity_subscribed_thing_listing.xml b/app/src/main/res/layout/activity_subscribed_thing_listing.xml
index d1f49996..109d3f74 100644
--- a/app/src/main/res/layout/activity_subscribed_thing_listing.xml
+++ b/app/src/main/res/layout/activity_subscribed_thing_listing.xml
@@ -45,7 +45,7 @@
</com.google.android.material.appbar.AppBarLayout>
- <androidx.viewpager.widget.ViewPager
+ <ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed
android:id="@+id/view_pager_subscribed_thing_listing_activity"
android:layout_width="match_parent"
android:layout_height="match_parent"
diff --git a/app/src/main/res/layout/activity_theme_preview.xml b/app/src/main/res/layout/activity_theme_preview.xml
index 67a75368..f2504287 100644
--- a/app/src/main/res/layout/activity_theme_preview.xml
+++ b/app/src/main/res/layout/activity_theme_preview.xml
@@ -7,7 +7,7 @@
android:id="@+id/coordinator_layout_theme_preview_activity"
tools:context=".activities.CustomThemePreviewActivity">
- <androidx.viewpager.widget.ViewPager
+ <ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed
android:id="@+id/view_pager_theme_preview_activity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/app/src/main/res/layout/activity_view_imgur_media.xml b/app/src/main/res/layout/activity_view_imgur_media.xml
index 0b29fb8b..408ddff4 100644
--- a/app/src/main/res/layout/activity_view_imgur_media.xml
+++ b/app/src/main/res/layout/activity_view_imgur_media.xml
@@ -23,10 +23,10 @@
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
- <androidx.viewpager.widget.ViewPager
+ <ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed
+ android:id="@+id/view_pager_view_imgur_media_activity"
android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:id="@+id/view_pager_view_imgur_media_activity" />
+ android:layout_height="match_parent" />
<LinearLayout
android:id="@+id/load_image_error_linear_layout_view_imgur_media_activity"
diff --git a/app/src/main/res/layout/activity_view_reddit_gallery.xml b/app/src/main/res/layout/activity_view_reddit_gallery.xml
index d0bff7c2..6027fce2 100644
--- a/app/src/main/res/layout/activity_view_reddit_gallery.xml
+++ b/app/src/main/res/layout/activity_view_reddit_gallery.xml
@@ -13,7 +13,7 @@
android:layout_height="match_parent"
android:fillViewport="true">
- <androidx.viewpager.widget.ViewPager
+ <ml.docilealligator.infinityforreddit.customviews.ViewPagerBugFixed
android:id="@+id/view_pager_view_reddit_gallery_activity"
android:layout_width="match_parent"
android:layout_height="match_parent" />