diff options
Diffstat (limited to '')
5 files changed, 28 insertions, 24 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java index cbb15ce6..19fad657 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/CommentsRecyclerViewAdapter.java @@ -148,7 +148,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi private int mCommentIconAndInfoColor; private int mFullyCollapsedCommentBackgroundColor; private int mAwardedCommentBackgroundColor; - private Integer[] verticalBlockColors; + private int[] verticalBlockColors; private Drawable mCommentIcon; @@ -273,7 +273,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi mFullyCollapsedCommentBackgroundColor = customThemeWrapper.getFullyCollapsedCommentBackgroundColor(); mAwardedCommentBackgroundColor = customThemeWrapper.getAwardedCommentBackgroundColor(); - verticalBlockColors = new Integer[] { + verticalBlockColors = new int[] { customThemeWrapper.getCommentVerticalBarColor1(), customThemeWrapper.getCommentVerticalBarColor2(), customThemeWrapper.getCommentVerticalBarColor3(), diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java index f7fb0062..2ac6ba70 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/comment/Comment.java @@ -14,7 +14,7 @@ public class Comment implements Parcelable { public static final int NOT_PLACEHOLDER = 0; public static final int PLACEHOLDER_LOAD_MORE_COMMENTS = 1; public static final int PLACEHOLDER_CONTINUE_THREAD = 2; - public static final Creator<Comment> CREATOR = new Creator<Comment>() { + public static final Creator<Comment> CREATOR = new Creator<>() { @Override public Comment createFromParcel(Parcel in) { return new Comment(in); @@ -139,8 +139,10 @@ public class Comment implements Parcelable { scoreHidden = in.readByte() != 0; isExpanded = in.readByte() != 0; hasExpandedBefore = in.readByte() != 0; - children = in.readArrayList(Comment.class.getClassLoader()); - moreChildrenFullnames = in.readArrayList(Comment.class.getClassLoader()); + children = new ArrayList<>(); + in.readTypedList(children, Comment.CREATOR); + moreChildrenFullnames = new ArrayList<>(); + in.readStringList(moreChildrenFullnames); moreChildrenStartingIndex = in.readInt(); placeholderType = in.readInt(); isLoadingMoreChildren = in.readByte() != 0; @@ -416,8 +418,8 @@ public class Comment implements Parcelable { parcel.writeByte((byte) (scoreHidden ? 1 : 0)); parcel.writeByte((byte) (isExpanded ? 1 : 0)); parcel.writeByte((byte) (hasExpandedBefore ? 1 : 0)); - parcel.writeList(children); - parcel.writeList(moreChildrenFullnames); + parcel.writeTypedList(children); + parcel.writeStringList(moreChildrenFullnames); parcel.writeInt(moreChildrenStartingIndex); parcel.writeInt(placeholderType); parcel.writeByte((byte) (isLoadingMoreChildren ? 1 : 0)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java index 2da995f6..3e2f9d1a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customtheme/CustomThemeWrapper.java @@ -367,37 +367,37 @@ public class CustomThemeWrapper { getDefaultColor("#F0F0F0", "#3C3C3C", "#3C3C3C")); } - public Integer getCommentVerticalBarColor1() { + public int getCommentVerticalBarColor1() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_1, getDefaultColor("#0336FF", "#0336FF", "#0336FF")); } - public Integer getCommentVerticalBarColor2() { + public int getCommentVerticalBarColor2() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_2, getDefaultColor("#EE02BE", "#C300B3", "#C300B3")); } - public Integer getCommentVerticalBarColor3() { + public int getCommentVerticalBarColor3() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_3, getDefaultColor("#02DFEE", "#00B8DA", "#00B8DA")); } - public Integer getCommentVerticalBarColor4() { + public int getCommentVerticalBarColor4() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_4, getDefaultColor("#EED502", "#EDCA00", "#EDCA00")); } - public Integer getCommentVerticalBarColor5() { + public int getCommentVerticalBarColor5() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_5, getDefaultColor("#EE0220", "#EE0219", "#EE0219")); } - public Integer getCommentVerticalBarColor6() { + public int getCommentVerticalBarColor6() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_6, getDefaultColor("#02EE6E", "#00B925", "#00B925")); } - public Integer getCommentVerticalBarColor7() { + public int getCommentVerticalBarColor7() { return getThemeSharedPreferences().getInt(CustomThemeSharedPreferencesUtils.COMMENT_VERTICAL_BAR_COLOR_7, getDefaultColor("#EE4602", "#EE4602", "#EE4602")); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CommentIndentationView.java b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CommentIndentationView.java index 27e1e142..d03d9878 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CommentIndentationView.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CommentIndentationView.java @@ -18,7 +18,7 @@ public class CommentIndentationView extends LinearLayout { private final Paint paint; private int level; - private Integer[] colors; + private int[] colors; private ArrayList<Integer> startXs; private final int spacing; private int pathWidth; @@ -85,7 +85,7 @@ public class CommentIndentationView extends LinearLayout { invalidate(); } - public void setLevelAndColors(int level, Integer[] colors) { + public void setLevelAndColors(int level, int[] colors) { this.colors = colors; this.level = level; if (level > 0) { @@ -106,7 +106,7 @@ public class CommentIndentationView extends LinearLayout { private static class SavedState extends BaseSavedState { ArrayList<Integer> startXs; - Integer[] colors; + int[] colors; SavedState(Parcelable superState) { super(superState); @@ -114,18 +114,19 @@ public class CommentIndentationView extends LinearLayout { private SavedState(Parcel in) { super(in); - startXs = in.readArrayList(SavedState.class.getClassLoader()); - colors = (Integer[]) in.readArray(SavedState.class.getClassLoader()); + startXs = new ArrayList<>(); + in.readList(startXs, Integer.class.getClassLoader()); + colors = in.createIntArray(); } @Override public void writeToParcel(Parcel out, int flags) { super.writeToParcel(out, flags); out.writeList(startXs); - out.writeArray(colors); + out.writeIntArray(colors); } - public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<SavedState>() { + public static final Parcelable.Creator<SavedState> CREATOR = new Parcelable.Creator<>() { public SavedState createFromParcel(Parcel in) { return new SavedState(in); } diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiReddit.java b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiReddit.java index 518ee945..c911f33f 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiReddit.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/multireddit/MultiReddit.java @@ -103,10 +103,11 @@ public class MultiReddit implements Parcelable { over18 = in.readByte() != 0; isSubscriber = in.readByte() != 0; isFavorite = in.readByte() != 0; - subreddits = in.readArrayList(MultiReddit.class.getClassLoader()); + subreddits = new ArrayList<>(); + in.readStringList(subreddits); } - public static final Creator<MultiReddit> CREATOR = new Creator<MultiReddit>() { + public static final Creator<MultiReddit> CREATOR = new Creator<>() { @Override public MultiReddit createFromParcel(Parcel in) { return new MultiReddit(in); @@ -253,6 +254,6 @@ public class MultiReddit implements Parcelable { parcel.writeByte((byte) (over18 ? 1 : 0)); parcel.writeByte((byte) (isSubscriber ? 1 : 0)); parcel.writeByte((byte) (isFavorite ? 1 : 0)); - parcel.writeList(subreddits); + parcel.writeStringList(subreddits); } } |