diff options
author | Alex Ning <chineseperson5@gmail.com> | 2021-05-14 16:21:31 +0000 |
---|---|---|
committer | Alex Ning <chineseperson5@gmail.com> | 2021-05-14 16:21:31 +0000 |
commit | b9a2a1adead1f741d43d79f35cda44330c391580 (patch) | |
tree | e1445829fe285e9f537aff803a1d9eb90f7239c0 /app | |
parent | b21eb89271d5818721e56b8198ddcddcc9875a61 (diff) | |
download | infinity-for-reddit-b9a2a1adead1f741d43d79f35cda44330c391580.tar infinity-for-reddit-b9a2a1adead1f741d43d79f35cda44330c391580.tar.gz infinity-for-reddit-b9a2a1adead1f741d43d79f35cda44330c391580.tar.bz2 infinity-for-reddit-b9a2a1adead1f741d43d79f35cda44330c391580.tar.lz infinity-for-reddit-b9a2a1adead1f741d43d79f35cda44330c391580.tar.xz infinity-for-reddit-b9a2a1adead1f741d43d79f35cda44330c391580.tar.zst infinity-for-reddit-b9a2a1adead1f741d43d79f35cda44330c391580.zip |
Change the style of single comment level indicator.
Diffstat (limited to 'app')
-rw-r--r-- | app/build.gradle | 12 | ||||
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CommentIndentationView.java | 9 |
2 files changed, 12 insertions, 9 deletions
diff --git a/app/build.gradle b/app/build.gradle index d0ed492a..8541e228 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -43,22 +43,22 @@ android { dependencies { /** AndroidX **/ implementation 'androidx.appcompat:appcompat:1.2.0' - implementation 'androidx.biometric:biometric:1.2.0-alpha01' + implementation 'androidx.biometric:biometric:1.2.0-alpha03' implementation 'androidx.browser:browser:1.3.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.4' implementation 'androidx.legacy:legacy-support-v4:1.0.0' - def lifecycleVersion = "2.2.0" + def lifecycleVersion = "2.3.1" implementation "androidx.lifecycle:lifecycle-livedata:$lifecycleVersion" implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycleVersion" annotationProcessor "androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion" - implementation 'androidx.paging:paging-runtime:2.1.2' + implementation 'androidx.paging:paging-runtime:3.0.0' implementation 'androidx.preference:preference:1.1.1' - def roomVersion = "2.2.6" + def roomVersion = "2.3.0" implementation "androidx.room:room-runtime:$roomVersion" annotationProcessor "androidx.room:room-compiler:$roomVersion" - implementation 'androidx.work:work-runtime:2.4.0' - implementation 'com.google.android.material:material:1.3.0-rc01' + implementation 'androidx.work:work-runtime:2.5.0' + implementation 'com.google.android.material:material:1.4.0-beta01' implementation "androidx.viewpager2:viewpager2:1.1.0-alpha01" /** ExoPlayer **/ 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 bcb5248e..27e1e142 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CommentIndentationView.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/customviews/CommentIndentationView.java @@ -21,7 +21,7 @@ public class CommentIndentationView extends LinearLayout { private Integer[] colors; private ArrayList<Integer> startXs; private final int spacing; - private final int pathWidth; + private int pathWidth; private boolean showOnlyOneDivider = false; public CommentIndentationView(Context context, @Nullable AttributeSet attrs) { @@ -53,7 +53,7 @@ public class CommentIndentationView extends LinearLayout { if (showOnlyOneDivider) { if (startXs.size() > 0) { paint.setColor(colors[(startXs.size() - 1) % 7]); - canvas.drawLine(startXs.get(startXs.size() - 1), 0, startXs.get(startXs.size() - 1), getHeight(), paint); + canvas.drawLine(level * pathWidth, 0, level * pathWidth, getHeight(), paint); } } else { for (int i = 0; i < startXs.size(); i++) { @@ -89,7 +89,7 @@ public class CommentIndentationView extends LinearLayout { this.colors = colors; this.level = level; if (level > 0) { - int indentationSpacing = level * spacing + pathWidth; + int indentationSpacing = showOnlyOneDivider ? pathWidth * level : level * spacing + pathWidth; setPaddingRelative(indentationSpacing, 0, pathWidth, 0); } else { setPaddingRelative(0, 0, 0, 0); @@ -99,6 +99,9 @@ public class CommentIndentationView extends LinearLayout { public void setShowOnlyOneDivider(boolean showOnlyOneDivider) { this.showOnlyOneDivider = showOnlyOneDivider; + if (showOnlyOneDivider) { + pathWidth = (int) Utils.convertDpToPixel(4, getContext()); + } } private static class SavedState extends BaseSavedState { |