Multiple quality improvements - squid:S1213, squid:S1943, squid:S1066 (#342)
Cette révision appartient à :
Parent
1f8126e2af
révision
95cd77e749
3 fichiers modifiés avec 33 ajouts et 37 suppressions
|
@ -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,15 +1141,13 @@ 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)) {
|
||||
if (ii != null && ii.position == mCurItem && child.requestFocus(focusDirection)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sortChildDrawingOrder() {
|
||||
if (mDrawingOrder != DRAW_ORDER_DEFAULT) {
|
||||
|
@ -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,12 +1955,10 @@ 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)) {
|
||||
if (mIsBeingDragged && performDrag(y)) {
|
||||
ViewCompat.postInvalidateOnAnimation(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2811,13 +2808,11 @@ 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)) {
|
||||
if (ii != null && ii.position == mCurItem && child.requestFocus(direction, previouslyFocusedRect)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
Référencer dans un nouveau ticket