diff --git a/app/src/main/java/eu/kanade/tachiyomi/injection/ComponentReflectionInjector.java b/app/src/main/java/eu/kanade/tachiyomi/injection/ComponentReflectionInjector.java index 5f2c8ed14..e5934b78e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/injection/ComponentReflectionInjector.java +++ b/app/src/main/java/eu/kanade/tachiyomi/injection/ComponentReflectionInjector.java @@ -40,6 +40,8 @@ import java.util.concurrent.ConcurrentHashMap; */ public final class ComponentReflectionInjector { + private static final ConcurrentHashMap, HashMap, Method>> cache = new ConcurrentHashMap<>(); + private final Class componentClass; private final T component; private final HashMap, Method> methods; @@ -74,8 +76,6 @@ public final class ComponentReflectionInjector { } } - private static final ConcurrentHashMap, HashMap, Method>> cache = new ConcurrentHashMap<>(); - private static HashMap, Method> getMethods(Class componentClass) { HashMap, Method> methods = cache.get(componentClass); if (methods == null) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/vertical/VerticalViewPagerImpl.java b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/vertical/VerticalViewPagerImpl.java index a2ef17fda..60b1d2102 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/vertical/VerticalViewPagerImpl.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/vertical/VerticalViewPagerImpl.java @@ -1141,10 +1141,8 @@ public class VerticalViewPagerImpl extends ViewGroup { for (int i=0; i CREATOR + = ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks() { + @Override + public SavedState createFromParcel(Parcel in, ClassLoader loader) { + return new SavedState(in, loader); + } + @Override + public SavedState[] newArray(int size) { + return new SavedState[size]; + } + }); + public SavedState(Parcelable superState) { super(superState); } + SavedState(Parcel in, ClassLoader loader) { + super(in); + if (loader == null) { + loader = getClass().getClassLoader(); + } + position = in.readInt(); + adapterState = in.readParcelable(loader); + this.loader = loader; + } + @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); @@ -1282,27 +1302,6 @@ public class VerticalViewPagerImpl extends ViewGroup { + " position=" + position + "}"; } - public static final Parcelable.Creator CREATOR - = ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks() { - @Override - public SavedState createFromParcel(Parcel in, ClassLoader loader) { - return new SavedState(in, loader); - } - @Override - public SavedState[] newArray(int size) { - return new SavedState[size]; - } - }); - - SavedState(Parcel in, ClassLoader loader) { - super(in); - if (loader == null) { - loader = getClass().getClassLoader(); - } - position = in.readInt(); - adapterState = in.readParcelable(loader); - this.loader = loader; - } } @Override @@ -1956,11 +1955,9 @@ public class VerticalViewPagerImpl extends ViewGroup { if (DEBUG) Log.v(TAG, "Starting unable to drag!"); mIsUnableToDrag = true; } - if (mIsBeingDragged) { - // Scroll to follow the motion event - if (performDrag(y)) { - ViewCompat.postInvalidateOnAnimation(this); - } + // Scroll to follow the motion event + if (mIsBeingDragged && performDrag(y)) { + ViewCompat.postInvalidateOnAnimation(this); } break; } @@ -2811,10 +2808,8 @@ public class VerticalViewPagerImpl extends ViewGroup { View child = getChildAt(i); if (child.getVisibility() == VISIBLE) { ItemInfo ii = infoForChild(child); - if (ii != null && ii.position == mCurItem) { - if (child.requestFocus(direction, previouslyFocusedRect)) { - return true; - } + if (ii != null && ii.position == mCurItem && child.requestFocus(direction, previouslyFocusedRect)) { + return true; } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/DiskUtils.java b/app/src/main/java/eu/kanade/tachiyomi/util/DiskUtils.java index 53011786b..1b22cacfa 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/DiskUtils.java +++ b/app/src/main/java/eu/kanade/tachiyomi/util/DiskUtils.java @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.util; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; @@ -15,7 +16,7 @@ public final class DiskUtils { String cacheKey; try { final MessageDigest mDigest = MessageDigest.getInstance("MD5"); - mDigest.update(key.getBytes()); + mDigest.update(key.getBytes(StandardCharsets.UTF_8)); cacheKey = bytesToHexString(mDigest.digest()); } catch (NoSuchAlgorithmException e) { cacheKey = String.valueOf(key.hashCode());