mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 00:01:54 +01:00
Multiple quality improvements - squid:S1213, squid:S1943, squid:S1066 (#342)
This commit is contained in:
parent
1f8126e2af
commit
95cd77e749
@ -40,6 +40,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public final class ComponentReflectionInjector<T> {
|
||||
|
||||
private static final ConcurrentHashMap<Class<?>, HashMap<Class<?>, Method>> cache = new ConcurrentHashMap<>();
|
||||
|
||||
private final Class<T> componentClass;
|
||||
private final T component;
|
||||
private final HashMap<Class<?>, Method> methods;
|
||||
@ -74,8 +76,6 @@ public final class ComponentReflectionInjector<T> {
|
||||
}
|
||||
}
|
||||
|
||||
private static final ConcurrentHashMap<Class<?>, HashMap<Class<?>, Method>> cache = new ConcurrentHashMap<>();
|
||||
|
||||
private static HashMap<Class<?>, Method> getMethods(Class componentClass) {
|
||||
HashMap<Class<?>, Method> methods = cache.get(componentClass);
|
||||
if (methods == null) {
|
||||
|
@ -1141,10 +1141,8 @@ public class VerticalViewPagerImpl extends ViewGroup {
|
||||
for (int i=0; i<getChildCount(); i++) {
|
||||
View child = getChildAt(i);
|
||||
ii = infoForChild(child);
|
||||
if (ii != null && ii.position == mCurItem) {
|
||||
if (child.requestFocus(focusDirection)) {
|
||||
break;
|
||||
}
|
||||
if (ii != null && ii.position == mCurItem && child.requestFocus(focusDirection)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1264,10 +1262,32 @@ public class VerticalViewPagerImpl extends ViewGroup {
|
||||
private Parcelable adapterState;
|
||||
private ClassLoader loader;
|
||||
|
||||
public static final Parcelable.Creator<SavedState> CREATOR
|
||||
= ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks<SavedState>() {
|
||||
@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<SavedState> CREATOR
|
||||
= ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks<SavedState>() {
|
||||
@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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user