Multiple quality improvements - squid:S1213, squid:S1943, squid:S1066 (#342)

pull/345/head
Mohamed Ezzat 8 years ago committed by Bram van de Kerkhof
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,24 +1262,6 @@ public class VerticalViewPagerImpl extends ViewGroup {
private Parcelable adapterState;
private ClassLoader loader;
public SavedState(Parcelable superState) {
super(superState);
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeInt(position);
out.writeParcelable(adapterState, flags);
}
@Override
public String toString() {
return "FragmentPager.SavedState{"
+ Integer.toHexString(System.identityHashCode(this))
+ " position=" + position + "}";
}
public static final Parcelable.Creator<SavedState> CREATOR
= ParcelableCompat.newCreator(new ParcelableCompatCreatorCallbacks<SavedState>() {
@Override
@ -1294,6 +1274,10 @@ public class VerticalViewPagerImpl extends ViewGroup {
}
});
public SavedState(Parcelable superState) {
super(superState);
}
SavedState(Parcel in, ClassLoader loader) {
super(in);
if (loader == null) {
@ -1303,6 +1287,21 @@ public class VerticalViewPagerImpl extends ViewGroup {
adapterState = in.readParcelable(loader);
this.loader = loader;
}
@Override
public void writeToParcel(Parcel out, int flags) {
super.writeToParcel(out, flags);
out.writeInt(position);
out.writeParcelable(adapterState, flags);
}
@Override
public String toString() {
return "FragmentPager.SavedState{"
+ Integer.toHexString(System.identityHashCode(this))
+ " position=" + position + "}";
}
}
@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…
Cancel
Save