mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 19:27:25 +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> {
|
public final class ComponentReflectionInjector<T> {
|
||||||
|
|
||||||
|
private static final ConcurrentHashMap<Class<?>, HashMap<Class<?>, Method>> cache = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final Class<T> componentClass;
|
private final Class<T> componentClass;
|
||||||
private final T component;
|
private final T component;
|
||||||
private final HashMap<Class<?>, Method> methods;
|
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) {
|
private static HashMap<Class<?>, Method> getMethods(Class componentClass) {
|
||||||
HashMap<Class<?>, Method> methods = cache.get(componentClass);
|
HashMap<Class<?>, Method> methods = cache.get(componentClass);
|
||||||
if (methods == null) {
|
if (methods == null) {
|
||||||
|
@ -1141,10 +1141,8 @@ public class VerticalViewPagerImpl extends ViewGroup {
|
|||||||
for (int i=0; i<getChildCount(); i++) {
|
for (int i=0; i<getChildCount(); i++) {
|
||||||
View child = getChildAt(i);
|
View child = getChildAt(i);
|
||||||
ii = infoForChild(child);
|
ii = infoForChild(child);
|
||||||
if (ii != null && ii.position == mCurItem) {
|
if (ii != null && ii.position == mCurItem && child.requestFocus(focusDirection)) {
|
||||||
if (child.requestFocus(focusDirection)) {
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1264,10 +1262,32 @@ public class VerticalViewPagerImpl extends ViewGroup {
|
|||||||
private Parcelable adapterState;
|
private Parcelable adapterState;
|
||||||
private ClassLoader loader;
|
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) {
|
public SavedState(Parcelable superState) {
|
||||||
super(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
|
@Override
|
||||||
public void writeToParcel(Parcel out, int flags) {
|
public void writeToParcel(Parcel out, int flags) {
|
||||||
super.writeToParcel(out, flags);
|
super.writeToParcel(out, flags);
|
||||||
@ -1282,27 +1302,6 @@ public class VerticalViewPagerImpl extends ViewGroup {
|
|||||||
+ " position=" + position + "}";
|
+ " 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
|
@Override
|
||||||
@ -1956,11 +1955,9 @@ public class VerticalViewPagerImpl extends ViewGroup {
|
|||||||
if (DEBUG) Log.v(TAG, "Starting unable to drag!");
|
if (DEBUG) Log.v(TAG, "Starting unable to drag!");
|
||||||
mIsUnableToDrag = true;
|
mIsUnableToDrag = true;
|
||||||
}
|
}
|
||||||
if (mIsBeingDragged) {
|
// Scroll to follow the motion event
|
||||||
// Scroll to follow the motion event
|
if (mIsBeingDragged && performDrag(y)) {
|
||||||
if (performDrag(y)) {
|
ViewCompat.postInvalidateOnAnimation(this);
|
||||||
ViewCompat.postInvalidateOnAnimation(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2811,10 +2808,8 @@ public class VerticalViewPagerImpl extends ViewGroup {
|
|||||||
View child = getChildAt(i);
|
View child = getChildAt(i);
|
||||||
if (child.getVisibility() == VISIBLE) {
|
if (child.getVisibility() == VISIBLE) {
|
||||||
ItemInfo ii = infoForChild(child);
|
ItemInfo ii = infoForChild(child);
|
||||||
if (ii != null && ii.position == mCurItem) {
|
if (ii != null && ii.position == mCurItem && child.requestFocus(direction, previouslyFocusedRect)) {
|
||||||
if (child.requestFocus(direction, previouslyFocusedRect)) {
|
return true;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.util;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
@ -15,7 +16,7 @@ public final class DiskUtils {
|
|||||||
String cacheKey;
|
String cacheKey;
|
||||||
try {
|
try {
|
||||||
final MessageDigest mDigest = MessageDigest.getInstance("MD5");
|
final MessageDigest mDigest = MessageDigest.getInstance("MD5");
|
||||||
mDigest.update(key.getBytes());
|
mDigest.update(key.getBytes(StandardCharsets.UTF_8));
|
||||||
cacheKey = bytesToHexString(mDigest.digest());
|
cacheKey = bytesToHexString(mDigest.digest());
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
cacheKey = String.valueOf(key.hashCode());
|
cacheKey = String.valueOf(key.hashCode());
|
||||||
|
Loading…
Reference in New Issue
Block a user