Loading app/src/main/java/app/fedilab/android/helper/DividerDecoration.java +28 −9 Original line number Diff line number Diff line Loading @@ -39,12 +39,20 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { private final Context _mContext; private final List<Status> statusList; private final float fontScale; private final int indentationMax; private final List<Integer> colorList = Arrays.asList( R.color.decoration_1, R.color.decoration_2, R.color.decoration_3, R.color.decoration_4, R.color.decoration_5 R.color.decoration_5, R.color.decoration_6, R.color.decoration_7, R.color.decoration_8, R.color.decoration_9, R.color.decoration_10, R.color.decoration_11, R.color.decoration_12 ); public DividerDecoration(Context context, List<Status> statuses) { Loading @@ -52,6 +60,7 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { statusList = statuses; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_mContext); fontScale = prefs.getFloat(_mContext.getString(R.string.SET_FONT_SCALE), 1.1f); indentationMax = prefs.getInt(_mContext.getString(R.string.SET_MAX_INDENTATION), 5); } @Override Loading @@ -62,7 +71,7 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { Status status = statusAdapter.getItem(position); int start = (int) Helper.convertDpToPixel( 6 * fontScale * CommentDecorationHelper.getIndentation(status.in_reply_to_id, statusList, colorList.size()), 6 * fontScale * CommentDecorationHelper.getIndentation(status.in_reply_to_id, statusList, indentationMax), _mContext); if (parent.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) { Loading @@ -84,8 +93,8 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { Status status = statusAdapter.getItem(position); int indentation = Math.min( CommentDecorationHelper.getIndentation(status.in_reply_to_id, statusList, colorList.size()), colorList.size()); CommentDecorationHelper.getIndentation(status.in_reply_to_id, statusList, indentationMax), indentationMax); if (indentation > 0) { Paint paint = new Paint(); Loading @@ -100,9 +109,14 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { startPx = c.getWidth() - startPx; float bottomPx = view.getBottom(); paint.setColor(ResourcesCompat.getColor(_mContext.getResources(), colorList.get(j), _mContext.getTheme())); if (j == colorList.size() - 1) { int color; if (j >= colorList.size()) { color = colorList.get(j - colorList.size()); } else { color = colorList.get(j); } paint.setColor(ResourcesCompat.getColor(_mContext.getResources(), color, _mContext.getTheme())); if (j == indentationMax - 1) { paint.setPathEffect(new DashPathEffect( new float[]{Helper.convertDpToPixel(3, _mContext), Helper.convertDpToPixel(3, _mContext)}, 0)); Loading @@ -111,8 +125,13 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { c.drawLine(startPx, view.getTop() - margin, startPx, bottomPx, paint); } paint.setColor(ResourcesCompat.getColor(_mContext.getResources(), colorList.get(indentation - 1), _mContext.getTheme())); int color; if (indentation - 1 >= colorList.size()) { color = colorList.get(indentation - 1 - colorList.size()); } else { color = colorList.get(indentation - 1); } paint.setColor(ResourcesCompat.getColor(_mContext.getResources(), color, _mContext.getTheme())); float startDp = 6 * fontScale * (indentation - 1) + 6 * fontScale; float centerPx = view.getBottom() - view.getHeight() / 2F; Loading app/src/main/res/values/colors.xml +12 −15 Original line number Diff line number Diff line Loading @@ -77,21 +77,18 @@ <color name="dark_icon_theme">#f3f3f3</color> <color name="decoration_1">#7986CB</color> <!-- Red 300 --> <color name="decoration_2">#4DB6AC</color> <!-- Purple 300 --> <color name="decoration_1">#7986CB</color> <!-- Indigo 300 --> <color name="decoration_2">#4DB6AC</color> <!-- Teal 300 --> <color name="decoration_3">#FFD54F</color> <!-- Amber 300 --> <color name="decoration_4">#64B5F6</color> <!-- Blue 300 --> <color name="decoration_5">#9E9E9E</color> <!-- Green 300 --> <!-- Teal 300 --> <!-- Deep Orange 300 --> <!-- Cyan 300 --> <!-- Light Green 300 --> <!-- Deep Purple 300 --> <!-- Orange 300 --> <!-- Light Blue 300 --> <!-- Lime 300 --> <!-- Indigo 300 --> <!-- Gray 500 --> <color name="decoration_5">#DCE775</color> <!-- Lime 300 --> <color name="decoration_6">#E57373</color> <!-- Red 300 --> <color name="decoration_7">#4DD0E1</color> <!-- Cyan 300 --> <color name="decoration_8">#FFF176</color> <!-- Yellow 300 --> <color name="decoration_9">#81C784</color> <!-- Green 300 --> <color name="decoration_10">#A1887F</color> <!-- Brown 300 --> <color name="decoration_11">#AED581</color> <!-- Light Green 300 --> <color name="decoration_12">#FF8A65</color> <!-- Deep Orange 300 --> <color name="decoration_end">#9E9E9E</color> <!-- Gray 300 --> </resources> app/src/main/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -969,6 +969,8 @@ <string name="SET_NOTIF_POLL" translatable="false">SET_NOTIF_POLL</string> <string name="SET_NOTIF_STATUS" translatable="false">SET_NOTIF_STATUS</string> <string name="SET_FONT_SCALE" translatable="false">SET_FONT_SCALE</string> <string name="SET_MAX_INDENTATION" translatable="false">SET_MAX_INDENTATION</string> <string name="SET_FONT_SCALE_INT" translatable="false">SET_FONT_SCALE_INT</string> <string name="SET_FONT_SCALE_ICON" translatable="false">SET_FONT_SCALE_ICON</string> <string name="SET_FONT_SCALE_ICON_INT" translatable="false">SET_FONT_SCALE_ICON_INT</string> Loading Loading @@ -1560,4 +1562,5 @@ <string name="status_history">Message history</string> <string name="edited_message_at">Edited at %1$s</string> <string name="created_message_at">Created at %1$s</string> <string name="max_indentation_thread">Max indentation in threads</string> </resources> app/src/main/res/xml/pref_timelines.xml +9 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,15 @@ app:summary="@string/aggregate_notifications_summary" app:title="@string/aggregate_notifications" /> <androidx.preference.SeekBarPreference android:defaultValue="5" android:max="20" app:iconSpaceReserved="false" app:key="@string/SET_MAX_INDENTATION" app:showSeekBarValue="true" app:singleLineTitle="false" app:title="@string/max_indentation_thread" /> <SwitchPreferenceCompat app:defaultValue="true" app:iconSpaceReserved="false" Loading Loading
app/src/main/java/app/fedilab/android/helper/DividerDecoration.java +28 −9 Original line number Diff line number Diff line Loading @@ -39,12 +39,20 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { private final Context _mContext; private final List<Status> statusList; private final float fontScale; private final int indentationMax; private final List<Integer> colorList = Arrays.asList( R.color.decoration_1, R.color.decoration_2, R.color.decoration_3, R.color.decoration_4, R.color.decoration_5 R.color.decoration_5, R.color.decoration_6, R.color.decoration_7, R.color.decoration_8, R.color.decoration_9, R.color.decoration_10, R.color.decoration_11, R.color.decoration_12 ); public DividerDecoration(Context context, List<Status> statuses) { Loading @@ -52,6 +60,7 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { statusList = statuses; SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(_mContext); fontScale = prefs.getFloat(_mContext.getString(R.string.SET_FONT_SCALE), 1.1f); indentationMax = prefs.getInt(_mContext.getString(R.string.SET_MAX_INDENTATION), 5); } @Override Loading @@ -62,7 +71,7 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { Status status = statusAdapter.getItem(position); int start = (int) Helper.convertDpToPixel( 6 * fontScale * CommentDecorationHelper.getIndentation(status.in_reply_to_id, statusList, colorList.size()), 6 * fontScale * CommentDecorationHelper.getIndentation(status.in_reply_to_id, statusList, indentationMax), _mContext); if (parent.getLayoutDirection() == View.LAYOUT_DIRECTION_LTR) { Loading @@ -84,8 +93,8 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { Status status = statusAdapter.getItem(position); int indentation = Math.min( CommentDecorationHelper.getIndentation(status.in_reply_to_id, statusList, colorList.size()), colorList.size()); CommentDecorationHelper.getIndentation(status.in_reply_to_id, statusList, indentationMax), indentationMax); if (indentation > 0) { Paint paint = new Paint(); Loading @@ -100,9 +109,14 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { startPx = c.getWidth() - startPx; float bottomPx = view.getBottom(); paint.setColor(ResourcesCompat.getColor(_mContext.getResources(), colorList.get(j), _mContext.getTheme())); if (j == colorList.size() - 1) { int color; if (j >= colorList.size()) { color = colorList.get(j - colorList.size()); } else { color = colorList.get(j); } paint.setColor(ResourcesCompat.getColor(_mContext.getResources(), color, _mContext.getTheme())); if (j == indentationMax - 1) { paint.setPathEffect(new DashPathEffect( new float[]{Helper.convertDpToPixel(3, _mContext), Helper.convertDpToPixel(3, _mContext)}, 0)); Loading @@ -111,8 +125,13 @@ public class DividerDecoration extends RecyclerView.ItemDecoration { c.drawLine(startPx, view.getTop() - margin, startPx, bottomPx, paint); } paint.setColor(ResourcesCompat.getColor(_mContext.getResources(), colorList.get(indentation - 1), _mContext.getTheme())); int color; if (indentation - 1 >= colorList.size()) { color = colorList.get(indentation - 1 - colorList.size()); } else { color = colorList.get(indentation - 1); } paint.setColor(ResourcesCompat.getColor(_mContext.getResources(), color, _mContext.getTheme())); float startDp = 6 * fontScale * (indentation - 1) + 6 * fontScale; float centerPx = view.getBottom() - view.getHeight() / 2F; Loading
app/src/main/res/values/colors.xml +12 −15 Original line number Diff line number Diff line Loading @@ -77,21 +77,18 @@ <color name="dark_icon_theme">#f3f3f3</color> <color name="decoration_1">#7986CB</color> <!-- Red 300 --> <color name="decoration_2">#4DB6AC</color> <!-- Purple 300 --> <color name="decoration_1">#7986CB</color> <!-- Indigo 300 --> <color name="decoration_2">#4DB6AC</color> <!-- Teal 300 --> <color name="decoration_3">#FFD54F</color> <!-- Amber 300 --> <color name="decoration_4">#64B5F6</color> <!-- Blue 300 --> <color name="decoration_5">#9E9E9E</color> <!-- Green 300 --> <!-- Teal 300 --> <!-- Deep Orange 300 --> <!-- Cyan 300 --> <!-- Light Green 300 --> <!-- Deep Purple 300 --> <!-- Orange 300 --> <!-- Light Blue 300 --> <!-- Lime 300 --> <!-- Indigo 300 --> <!-- Gray 500 --> <color name="decoration_5">#DCE775</color> <!-- Lime 300 --> <color name="decoration_6">#E57373</color> <!-- Red 300 --> <color name="decoration_7">#4DD0E1</color> <!-- Cyan 300 --> <color name="decoration_8">#FFF176</color> <!-- Yellow 300 --> <color name="decoration_9">#81C784</color> <!-- Green 300 --> <color name="decoration_10">#A1887F</color> <!-- Brown 300 --> <color name="decoration_11">#AED581</color> <!-- Light Green 300 --> <color name="decoration_12">#FF8A65</color> <!-- Deep Orange 300 --> <color name="decoration_end">#9E9E9E</color> <!-- Gray 300 --> </resources>
app/src/main/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -969,6 +969,8 @@ <string name="SET_NOTIF_POLL" translatable="false">SET_NOTIF_POLL</string> <string name="SET_NOTIF_STATUS" translatable="false">SET_NOTIF_STATUS</string> <string name="SET_FONT_SCALE" translatable="false">SET_FONT_SCALE</string> <string name="SET_MAX_INDENTATION" translatable="false">SET_MAX_INDENTATION</string> <string name="SET_FONT_SCALE_INT" translatable="false">SET_FONT_SCALE_INT</string> <string name="SET_FONT_SCALE_ICON" translatable="false">SET_FONT_SCALE_ICON</string> <string name="SET_FONT_SCALE_ICON_INT" translatable="false">SET_FONT_SCALE_ICON_INT</string> Loading Loading @@ -1560,4 +1562,5 @@ <string name="status_history">Message history</string> <string name="edited_message_at">Edited at %1$s</string> <string name="created_message_at">Created at %1$s</string> <string name="max_indentation_thread">Max indentation in threads</string> </resources>
app/src/main/res/xml/pref_timelines.xml +9 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,15 @@ app:summary="@string/aggregate_notifications_summary" app:title="@string/aggregate_notifications" /> <androidx.preference.SeekBarPreference android:defaultValue="5" android:max="20" app:iconSpaceReserved="false" app:key="@string/SET_MAX_INDENTATION" app:showSeekBarValue="true" app:singleLineTitle="false" app:title="@string/max_indentation_thread" /> <SwitchPreferenceCompat app:defaultValue="true" app:iconSpaceReserved="false" Loading