From c8ce57128d229ed399522dce3dada9fc6c4c709b Mon Sep 17 00:00:00 2001 From: Aman9das Date: Mon, 27 Sep 2021 19:43:13 +0530 Subject: [PATCH] change the date_bubble, and make the ui buttons material --- art/ic_send_cancel_away.svg | 77 ++++++++---- art/ic_send_cancel_dnd.svg | 77 ++++++++---- art/ic_send_cancel_offline.svg | 77 ++++++++---- art/ic_send_cancel_online.svg | 77 ++++++++---- art/ic_send_location_away.svg | 77 ++++++++---- art/ic_send_location_dnd.svg | 81 +++++++++---- art/ic_send_location_offline.svg | 78 ++++++++---- art/ic_send_location_online.svg | 78 ++++++++---- art/ic_send_photo_away.svg | 86 +++++++++---- art/ic_send_photo_dnd.svg | 86 +++++++++---- art/ic_send_photo_offline.svg | 86 +++++++++---- art/ic_send_photo_online.svg | 86 +++++++++---- art/ic_send_picture_away.svg | 79 ++++++++---- art/ic_send_picture_dnd.svg | 78 ++++++++---- art/ic_send_picture_offline.svg | 78 ++++++++---- art/ic_send_picture_online.svg | 78 ++++++++---- art/ic_send_text_away.svg | 94 ++++++++++----- art/ic_send_text_dnd.svg | 94 ++++++++++----- art/ic_send_text_offline.svg | 95 ++++++++++----- art/ic_send_text_online.svg | 94 ++++++++++----- art/ic_send_video_away.svg | 84 +++++++++---- art/ic_send_video_dnd.svg | 83 +++++++++---- art/ic_send_video_offline.svg | 83 +++++++++---- art/ic_send_video_online.svg | 83 +++++++++---- art/ic_send_voice_away.svg | 80 +++++++++---- art/ic_send_voice_dnd.svg | 80 +++++++++---- art/ic_send_voice_offline.svg | 80 +++++++++---- art/ic_send_voice_online.svg | 80 +++++++++---- .../ui/adapter/MessageAdapter.java | 113 ++++++++++-------- src/main/res/drawable/date_bubble.xml | 4 +- src/main/res/drawable/date_bubble_dark.xml | 4 +- src/main/res/layout/message_date_bubble.xml | 4 +- 32 files changed, 1672 insertions(+), 762 deletions(-) diff --git a/art/ic_send_cancel_away.svg b/art/ic_send_cancel_away.svg index fa803779c..12289aca5 100644 --- a/art/ic_send_cancel_away.svg +++ b/art/ic_send_cancel_away.svg @@ -1,26 +1,55 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_cancel_dnd.svg b/art/ic_send_cancel_dnd.svg index 9501f7441..ef87d5adc 100644 --- a/art/ic_send_cancel_dnd.svg +++ b/art/ic_send_cancel_dnd.svg @@ -1,26 +1,55 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_cancel_offline.svg b/art/ic_send_cancel_offline.svg index 9d37a350f..5c8cfa133 100644 --- a/art/ic_send_cancel_offline.svg +++ b/art/ic_send_cancel_offline.svg @@ -1,26 +1,55 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_cancel_online.svg b/art/ic_send_cancel_online.svg index 53ac9c8b1..098cc7b1c 100644 --- a/art/ic_send_cancel_online.svg +++ b/art/ic_send_cancel_online.svg @@ -1,26 +1,55 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_location_away.svg b/art/ic_send_location_away.svg index 8a171774e..3285da08f 100644 --- a/art/ic_send_location_away.svg +++ b/art/ic_send_location_away.svg @@ -1,26 +1,55 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_location_dnd.svg b/art/ic_send_location_dnd.svg index 6fc835bc7..5d3618411 100644 --- a/art/ic_send_location_dnd.svg +++ b/art/ic_send_location_dnd.svg @@ -1,26 +1,61 @@ - - - - - image/svg+xml - - - - - - + + + + + image/svg+xml + + + + + + + + d="m 12,2 c -4.2,0 -8,3.22 -8,8.2 0,3.18 2.45,6.92 7.34,11.23 0.38,0.33 0.95,0.33 1.33,0 C 17.55,17.12 20,13.38 20,10.2 20,5.22 16.2,2 12,2 Z m 0,10 c -1.1,0 -2,-0.9 -2,-2 0,-1.1 0.9,-2 2,-2 1.1,0 2,0.9 2,2 0,1.1 -0.9,2 -2,2 z" + id="path840" + style="fill:#f44336;fill-opacity:0.627451" /> + diff --git a/art/ic_send_location_offline.svg b/art/ic_send_location_offline.svg index e957a15b2..d468288c3 100644 --- a/art/ic_send_location_offline.svg +++ b/art/ic_send_location_offline.svg @@ -1,26 +1,56 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_location_online.svg b/art/ic_send_location_online.svg index d82369d69..886bc9b14 100644 --- a/art/ic_send_location_online.svg +++ b/art/ic_send_location_online.svg @@ -1,26 +1,56 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_photo_away.svg b/art/ic_send_photo_away.svg index 9c605e7cf..d4683155b 100644 --- a/art/ic_send_photo_away.svg +++ b/art/ic_send_photo_away.svg @@ -1,27 +1,65 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + + + d="m 32.474577,44.372881 h -6.34 l -2.48,-2.700001 c -0.74,-0.82 -1.82,-1.3 -2.94,-1.3 h -8.480001 c -1.12,0 -2.2,0.48 -2.9599997,1.3 l -2.4600001,2.700001 h -6.340001 c -2.2000001,0 -4.0000001,1.8 -4.0000001,4 v 24.000001 c 0,2.2 1.8,4 4.0000001,4 H 32.474577 c 2.2,0 4,-1.8 4,-4 V 48.372881 c 0,-2.2 -1.8,-4 -4,-4 z m -16,26.000001 c -5.520001,0 -10.0000008,-4.48 -10.0000008,-10 0,-5.52 4.4799998,-10 10.0000008,-10 5.52,0 10,4.48 10,10 0,5.52 -4.48,10 -10,10 z" + id="path827" + style="fill:#ff9800;fill-opacity:0.627451;stroke-width:2" /> + diff --git a/art/ic_send_photo_dnd.svg b/art/ic_send_photo_dnd.svg index 6e5562cd9..96a0986a9 100644 --- a/art/ic_send_photo_dnd.svg +++ b/art/ic_send_photo_dnd.svg @@ -1,27 +1,65 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + + + d="m 37.5,9.3749993 h -5.94375 l -2.325,-2.53125 C 28.5375,6.0749993 27.525,5.6249993 26.475,5.6249993 h -7.95 c -1.05,0 -2.0625,0.45 -2.775,1.21875 l -2.30625,2.53125 H 7.4999992 c -2.0625,0 -3.75,1.6875007 -3.75,3.7500007 v 22.5 c 0,2.0625 1.6875,3.75 3.75,3.75 H 37.5 c 2.0625,0 3.75,-1.6875 3.75,-3.75 v -22.5 c 0,-2.0625 -1.6875,-3.7500007 -3.75,-3.7500007 z M 22.5,33.75 c -5.175,0 -9.375,-4.2 -9.375,-9.375 0,-5.175 4.2,-9.375 9.375,-9.375 5.175,0 9.375,4.2 9.375,9.375 0,5.175 -4.2,9.375 -9.375,9.375 z" + id="path827" + style="fill:#f44336;fill-opacity:0.627451;stroke-width:1.875" /> + diff --git a/art/ic_send_photo_offline.svg b/art/ic_send_photo_offline.svg index fcbab71e4..0a6cd45df 100644 --- a/art/ic_send_photo_offline.svg +++ b/art/ic_send_photo_offline.svg @@ -1,27 +1,65 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + + + d="M 6.8474583,37.661016 H 0.50745805 L -1.972542,34.961015 c -0.74,-0.82 -1.8200001,-1.3 -2.9400001,-1.3 h -8.4799999 c -1.12,0 -2.2,0.48 -2.96,1.3 l -2.460001,2.700001 h -6.340001 c -2.2,0 -4,1.8 -4,4 v 24.000001 c 0,2.2 1.8,4 4,4 H 6.8474583 c 2.2,0 3.9999997,-1.8 3.9999997,-4 V 41.661016 c 0,-2.2 -1.7999997,-4 -3.9999997,-4 z M -9.1525423,63.661017 c -5.5199997,0 -10.0000007,-4.48 -10.0000007,-10 0,-5.52 4.480001,-10 10.0000007,-10 5.5200002,0 10.00000036,4.48 10.00000036,10 0,5.52 -4.48000016,10 -10.00000036,10 z" + id="path827" + style="fill:#000000;fill-opacity:0.627451;stroke-width:2" /> + diff --git a/art/ic_send_photo_online.svg b/art/ic_send_photo_online.svg index 3c4ccceae..095635ff9 100644 --- a/art/ic_send_photo_online.svg +++ b/art/ic_send_photo_online.svg @@ -1,27 +1,65 @@ - - - - - image/svg+xml - - - - - - - + + + + + image/svg+xml + + + + + + + + + d="M 3.7966113,2.677966 H -2.543389 l -2.48,-2.700001 c -0.74,-0.82 -1.8200001,-1.3 -2.9400001,-1.3 h -8.4799999 c -1.12,0 -2.2,0.48 -2.96,1.3 l -2.460001,2.700001 h -6.340001 c -2.2,0 -4,1.8 -4,4 v 24.000001 c 0,2.2 1.8,4 4,4 H 3.7966113 c 2.2,0 3.9999997,-1.8 3.9999997,-4 V 6.677966 c 0,-2.2 -1.7999997,-4 -3.9999997,-4 z M -12.203389,28.677967 c -5.52,0 -10.000001,-4.48 -10.000001,-10 0,-5.52 4.480001,-10 10.000001,-10 5.5199999,0 10.0000001,4.48 10.0000001,10 0,5.52 -4.4800002,10 -10.0000001,10 z" + id="path827" + style="fill:#259b24;fill-opacity:0.627451;stroke-width:2" /> + diff --git a/art/ic_send_picture_away.svg b/art/ic_send_picture_away.svg index 5a2bfaf28..ec3b2c503 100644 --- a/art/ic_send_picture_away.svg +++ b/art/ic_send_picture_away.svg @@ -1,27 +1,56 @@ - - - - - image/svg+xml - - - - - - - - + + + + + image/svg+xml + + + + + + + + diff --git a/art/ic_send_picture_dnd.svg b/art/ic_send_picture_dnd.svg index 2666b76ee..3f288bab7 100644 --- a/art/ic_send_picture_dnd.svg +++ b/art/ic_send_picture_dnd.svg @@ -1,27 +1,55 @@ - - - - - image/svg+xml - - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_picture_offline.svg b/art/ic_send_picture_offline.svg index cb77ee998..d6c95ba3b 100644 --- a/art/ic_send_picture_offline.svg +++ b/art/ic_send_picture_offline.svg @@ -1,27 +1,55 @@ - - - - - image/svg+xml - - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_picture_online.svg b/art/ic_send_picture_online.svg index ab8109c7f..24c47d413 100644 --- a/art/ic_send_picture_online.svg +++ b/art/ic_send_picture_online.svg @@ -1,27 +1,55 @@ - - - - - image/svg+xml - - - - - - - - + + + + + image/svg+xml + + + + + + + diff --git a/art/ic_send_text_away.svg b/art/ic_send_text_away.svg index f6b02b4f9..2dabef70f 100644 --- a/art/ic_send_text_away.svg +++ b/art/ic_send_text_away.svg @@ -1,33 +1,65 @@ - + + - - - - - image/svg+xml - - - - - - - - - - + + + + + image/svg+xml + + + + + + + + + + diff --git a/art/ic_send_text_dnd.svg b/art/ic_send_text_dnd.svg index 0ebb40f41..adb70eaf6 100644 --- a/art/ic_send_text_dnd.svg +++ b/art/ic_send_text_dnd.svg @@ -1,33 +1,65 @@ - + + - - - - - image/svg+xml - - - - - - - - - - + + + + + image/svg+xml + + + + + + + + + + diff --git a/art/ic_send_text_offline.svg b/art/ic_send_text_offline.svg index 25ffc5f61..7ae4d95ea 100644 --- a/art/ic_send_text_offline.svg +++ b/art/ic_send_text_offline.svg @@ -1,34 +1,65 @@ - + + - - - - - image/svg+xml - - - - - - - - - - + + + + + image/svg+xml + + + + + + + + + + diff --git a/art/ic_send_text_online.svg b/art/ic_send_text_online.svg index aec29e306..c8ba198dc 100644 --- a/art/ic_send_text_online.svg +++ b/art/ic_send_text_online.svg @@ -1,33 +1,65 @@ - + + - - - - - image/svg+xml - - - - - - - - - - + + + + + image/svg+xml + + + + + + + + + + diff --git a/art/ic_send_video_away.svg b/art/ic_send_video_away.svg index c98417a27..3ecca89ca 100644 --- a/art/ic_send_video_away.svg +++ b/art/ic_send_video_away.svg @@ -1,28 +1,62 @@ - - - - - image/svg+xml - - - - - - - - + + + + + image/svg+xml + + + + + + + + + d="M 17,10.5 V 7 C 17,6.45 16.55,6 16,6 H 4 C 3.45,6 3,6.45 3,7 v 10 c 0,0.55 0.45,1 1,1 h 12 c 0.55,0 1,-0.45 1,-1 v -3.5 l 2.29,2.29 C 19.92,16.42 21,15.97 21,15.08 V 8.91 C 21,8.02 19.92,7.57 19.29,8.2 Z" + id="path3489" + style="fill:#ff9800;fill-opacity:0.627451" /> + diff --git a/art/ic_send_video_dnd.svg b/art/ic_send_video_dnd.svg index cbf7d5775..bb7ee18aa 100644 --- a/art/ic_send_video_dnd.svg +++ b/art/ic_send_video_dnd.svg @@ -1,28 +1,61 @@ - - - - - image/svg+xml - - - - - - - - + + + + + image/svg+xml + + + + + + + + d="M 17,10.5 V 7 C 17,6.45 16.55,6 16,6 H 4 C 3.45,6 3,6.45 3,7 v 10 c 0,0.55 0.45,1 1,1 h 12 c 0.55,0 1,-0.45 1,-1 v -3.5 l 2.29,2.29 C 19.92,16.42 21,15.97 21,15.08 V 8.91 C 21,8.02 19.92,7.57 19.29,8.2 Z" + id="path3489" + style="fill:#f44336;fill-opacity:0.627451" /> + diff --git a/art/ic_send_video_offline.svg b/art/ic_send_video_offline.svg index 0426a7233..b1ac0df97 100644 --- a/art/ic_send_video_offline.svg +++ b/art/ic_send_video_offline.svg @@ -1,28 +1,61 @@ - - - - - image/svg+xml - - - - - - - - + + + + + image/svg+xml + + + + + + + + d="M 17,10.5 V 7 C 17,6.45 16.55,6 16,6 H 4 C 3.45,6 3,6.45 3,7 v 10 c 0,0.55 0.45,1 1,1 h 12 c 0.55,0 1,-0.45 1,-1 v -3.5 l 2.29,2.29 C 19.92,16.42 21,15.97 21,15.08 V 8.91 C 21,8.02 19.92,7.57 19.29,8.2 Z" + id="path3489" + style="fill:#000000;fill-opacity:0.627451" /> + diff --git a/art/ic_send_video_online.svg b/art/ic_send_video_online.svg index 021da4eb5..4c9e1a3e7 100644 --- a/art/ic_send_video_online.svg +++ b/art/ic_send_video_online.svg @@ -1,28 +1,61 @@ - - - - - image/svg+xml - - - - - - - - + + + + + image/svg+xml + + + + + + + + d="M 17,10.5 V 7 C 17,6.45 16.55,6 16,6 H 4 C 3.45,6 3,6.45 3,7 v 10 c 0,0.55 0.45,1 1,1 h 12 c 0.55,0 1,-0.45 1,-1 v -3.5 l 2.29,2.29 C 19.92,16.42 21,15.97 21,15.08 V 8.91 C 21,8.02 19.92,7.57 19.29,8.2 Z" + id="path3489" + style="fill:#259b24;fill-opacity:0.627451" /> + diff --git a/art/ic_send_voice_away.svg b/art/ic_send_voice_away.svg index f1c303984..a778acd07 100644 --- a/art/ic_send_voice_away.svg +++ b/art/ic_send_voice_away.svg @@ -1,26 +1,60 @@ - - - - - image/svg+xml - - - - - - + + + + + image/svg+xml + + + + + + + + d="m 12,14 c 1.66,0 3,-1.34 3,-3 V 5 C 15,3.34 13.66,2 12,2 10.34,2 9,3.34 9,5 v 6 c 0,1.66 1.34,3 3,3 z m 5.91,-3 c -0.49,0 -0.9,0.36 -0.98,0.85 C 16.52,14.2 14.47,16 12,16 9.53,16 7.48,14.2 7.07,11.85 6.99,11.36 6.58,11 6.09,11 c -0.61,0 -1.09,0.54 -1,1.14 0.49,3 2.89,5.35 5.91,5.78 V 20 c 0,0.55 0.45,1 1,1 0.55,0 1,-0.45 1,-1 v -2.08 c 3.02,-0.43 5.42,-2.78 5.91,-5.78 0.1,-0.6 -0.39,-1.14 -1,-1.14 z" + id="path4555" + style="fill:#ff9800;fill-opacity:0.627451" /> + diff --git a/art/ic_send_voice_dnd.svg b/art/ic_send_voice_dnd.svg index fdd21b126..c4ea8d5bb 100644 --- a/art/ic_send_voice_dnd.svg +++ b/art/ic_send_voice_dnd.svg @@ -1,26 +1,60 @@ - - - - - image/svg+xml - - - - - - + + + + + image/svg+xml + + + + + + + + d="m 12,14 c 1.66,0 3,-1.34 3,-3 V 5 C 15,3.34 13.66,2 12,2 10.34,2 9,3.34 9,5 v 6 c 0,1.66 1.34,3 3,3 z m 5.91,-3 c -0.49,0 -0.9,0.36 -0.98,0.85 C 16.52,14.2 14.47,16 12,16 9.53,16 7.48,14.2 7.07,11.85 6.99,11.36 6.58,11 6.09,11 c -0.61,0 -1.09,0.54 -1,1.14 0.49,3 2.89,5.35 5.91,5.78 V 20 c 0,0.55 0.45,1 1,1 0.55,0 1,-0.45 1,-1 v -2.08 c 3.02,-0.43 5.42,-2.78 5.91,-5.78 0.1,-0.6 -0.39,-1.14 -1,-1.14 z" + id="path4555" + style="fill:#f44336;fill-opacity:0.627451" /> + diff --git a/art/ic_send_voice_offline.svg b/art/ic_send_voice_offline.svg index 41edd5b65..924904122 100644 --- a/art/ic_send_voice_offline.svg +++ b/art/ic_send_voice_offline.svg @@ -1,26 +1,60 @@ - - - - - image/svg+xml - - - - - - + + + + + image/svg+xml + + + + + + + + d="m 12,14 c 1.66,0 3,-1.34 3,-3 V 5 C 15,3.34 13.66,2 12,2 10.34,2 9,3.34 9,5 v 6 c 0,1.66 1.34,3 3,3 z m 5.91,-3 c -0.49,0 -0.9,0.36 -0.98,0.85 C 16.52,14.2 14.47,16 12,16 9.53,16 7.48,14.2 7.07,11.85 6.99,11.36 6.58,11 6.09,11 c -0.61,0 -1.09,0.54 -1,1.14 0.49,3 2.89,5.35 5.91,5.78 V 20 c 0,0.55 0.45,1 1,1 0.55,0 1,-0.45 1,-1 v -2.08 c 3.02,-0.43 5.42,-2.78 5.91,-5.78 0.1,-0.6 -0.39,-1.14 -1,-1.14 z" + id="path4555" + style="fill:#000000;fill-opacity:0.627451" /> + diff --git a/art/ic_send_voice_online.svg b/art/ic_send_voice_online.svg index e73c6697b..43d8f9c18 100644 --- a/art/ic_send_voice_online.svg +++ b/art/ic_send_voice_online.svg @@ -1,26 +1,60 @@ - - - - - image/svg+xml - - - - - - + + + + + image/svg+xml + + + + + + + + d="m 12,14 c 1.66,0 3,-1.34 3,-3 V 5 C 15,3.34 13.66,2 12,2 10.34,2 9,3.34 9,5 v 6 c 0,1.66 1.34,3 3,3 z m 5.91,-3 c -0.49,0 -0.9,0.36 -0.98,0.85 C 16.52,14.2 14.47,16 12,16 9.53,16 7.48,14.2 7.07,11.85 6.99,11.36 6.58,11 6.09,11 c -0.61,0 -1.09,0.54 -1,1.14 0.49,3 2.89,5.35 5.91,5.78 V 20 c 0,0.55 0.45,1 1,1 0.55,0 1,-0.45 1,-1 v -2.08 c 3.02,-0.43 5.42,-2.78 5.91,-5.78 0.1,-0.6 -0.39,-1.14 -1,-1.14 z" + id="path4555" + style="fill:#259b24;fill-opacity:0.627451" /> + diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 0b15f063c..794c35ed1 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -1,5 +1,17 @@ package eu.siacs.conversations.ui.adapter; +import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; +import static eu.siacs.conversations.entities.Message.DELETED_MESSAGE_BODY; +import static eu.siacs.conversations.entities.Message.DELETED_MESSAGE_BODY_OLD; +import static eu.siacs.conversations.persistance.FileBackend.formatTime; +import static eu.siacs.conversations.persistance.FileBackend.safeLongToInt; +import static eu.siacs.conversations.ui.SettingsActivity.PLAY_GIF_INSIDE; +import static eu.siacs.conversations.ui.SettingsActivity.SHOW_LINKS_INSIDE; +import static eu.siacs.conversations.ui.SettingsActivity.SHOW_MAPS_INSIDE; +import static eu.siacs.conversations.ui.util.MyLinkify.removeTrackingParameter; +import static eu.siacs.conversations.ui.util.MyLinkify.removeTrailingBracket; +import static eu.siacs.conversations.ui.util.MyLinkify.replaceYoutube; + import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; @@ -70,6 +82,7 @@ import eu.siacs.conversations.ui.text.DividerSpan; import eu.siacs.conversations.ui.text.QuoteSpan; import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.MyLinkify; +import eu.siacs.conversations.ui.util.QuoteHelper; import eu.siacs.conversations.ui.util.StyledAttributes; import eu.siacs.conversations.ui.util.ViewUtil; import eu.siacs.conversations.ui.widget.ClickableMovementMethod; @@ -89,18 +102,6 @@ import eu.siacs.conversations.xmpp.mam.MamReference; import me.drakeet.support.toast.ToastCompat; import pl.droidsonroids.gif.GifImageView; -import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT; -import static eu.siacs.conversations.entities.Message.DELETED_MESSAGE_BODY; -import static eu.siacs.conversations.entities.Message.DELETED_MESSAGE_BODY_OLD; -import static eu.siacs.conversations.persistance.FileBackend.formatTime; -import static eu.siacs.conversations.persistance.FileBackend.safeLongToInt; -import static eu.siacs.conversations.ui.SettingsActivity.PLAY_GIF_INSIDE; -import static eu.siacs.conversations.ui.SettingsActivity.SHOW_LINKS_INSIDE; -import static eu.siacs.conversations.ui.SettingsActivity.SHOW_MAPS_INSIDE; -import static eu.siacs.conversations.ui.util.MyLinkify.removeTrackingParameter; -import static eu.siacs.conversations.ui.util.MyLinkify.removeTrailingBracket; -import static eu.siacs.conversations.ui.util.MyLinkify.replaceYoutube; - public class MessageAdapter extends ArrayAdapter { public static final String DATE_SEPARATOR_BODY = "DATE_SEPARATOR"; @@ -510,48 +511,53 @@ public class MessageAdapter extends ArrayAdapter { */ private boolean handleTextQuotes(SpannableStringBuilder body, boolean darkBackground) { boolean startsWithQuote = false; - char previous = '\n'; - int lineStart = -1; - int lineTextStart = -1; - int quoteStart = -1; - for (int i = 0; i <= body.length(); i++) { - char current = body.length() > i ? body.charAt(i) : '\n'; - if (lineStart == -1) { - if (previous == '\n') { - if ((current == '>' && UIHelper.isPositionFollowedByQuoteableCharacter(body, i)) - || current == '\u00bb' && !UIHelper.isPositionFollowedByQuote(body, i)) { - // Line start with quote - lineStart = i; - if (quoteStart == -1) quoteStart = i; - if (i == 0) startsWithQuote = true; - } else if (quoteStart >= 0) { - // Line start without quote, apply spans there - applyQuoteSpan(body, quoteStart, i - 1, darkBackground); - quoteStart = -1; + int quoteDepth = 1; + while (QuoteHelper.bodyContainsQuoteStart(body) && quoteDepth <= Config.QUOTE_MAX_DEPTH) { + char previous = '\n'; + int lineStart = -1; + int lineTextStart = -1; + int quoteStart = -1; + for (int i = 0; i <= body.length(); i++) { + char current = body.length() > i ? body.charAt(i) : '\n'; + if (lineStart == -1) { + if (previous == '\n') { + if ( + QuoteHelper.isPositionQuoteStart(body, i) + ) { + // Line start with quote + lineStart = i; + if (quoteStart == -1) quoteStart = i; + if (i == 0) startsWithQuote = true; + } else if (quoteStart >= 0) { + // Line start without quote, apply spans there + applyQuoteSpan(body, quoteStart, i - 1, darkBackground); + quoteStart = -1; + } + } + } else { + // Remove extra spaces between > and first character in the line + // > character will be removed too + if (current != ' ' && lineTextStart == -1) { + lineTextStart = i; + } + if (current == '\n') { + body.delete(lineStart, lineTextStart); + i -= lineTextStart - lineStart; + if (i == lineStart) { + // Avoid empty lines because span over empty line can be hidden + body.insert(i++, " "); + } + lineStart = -1; + lineTextStart = -1; } } - } else { - // Remove extra spaces between > and first character in the line - // > character will be removed too - if (current != ' ' && lineTextStart == -1) { - lineTextStart = i; - } - if (current == '\n') { - body.delete(lineStart, lineTextStart); - i -= lineTextStart - lineStart; - if (i == lineStart) { - // Avoid empty lines because span over empty line can be hidden - body.insert(i++, " "); - } - lineStart = -1; - lineTextStart = -1; - } + previous = current; } - previous = current; - } - if (quoteStart >= 0) { - // Apply spans to finishing open quote - applyQuoteSpan(body, quoteStart, body.length(), darkBackground); + if (quoteStart >= 0) { + // Apply spans to finishing open quote + applyQuoteSpan(body, quoteStart, body.length(), darkBackground); + } + quoteDepth++; } return startsWithQuote; } @@ -785,9 +791,10 @@ public class MessageAdapter extends ArrayAdapter { } else { scaledH = (int) (100 / ((double) 100 / target)); } - LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(WRAP_CONTENT, scaledH); + LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT); layoutParams.setMargins(0, (int) (metrics.density * 4), 0, (int) (metrics.density * 4)); viewHolder.richlinkview.setLayoutParams(layoutParams); + viewHolder.richlinkview.setMinimumHeight(scaledH); final String weburl; if (link.startsWith("http://") || link.startsWith("https://")) { weburl = removeTrailingBracket(link); @@ -1152,6 +1159,7 @@ public class MessageAdapter extends ArrayAdapter { viewHolder.status_message.setText(DateUtils.formatDateTime(activity, message.getTimeSent(), DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_SHOW_YEAR)); } viewHolder.message_box.setBackgroundResource(darkBackground ? R.drawable.date_bubble_dark : R.drawable.date_bubble); + activity.setBubbleColor(viewHolder.message_box, StyledAttributes.getColor(activity, R.attr.colorAccent), -1); return view; } else if (type == RTP_SESSION) { final boolean isDarkTheme = activity.isDarkTheme(); @@ -1175,6 +1183,7 @@ public class MessageAdapter extends ArrayAdapter { viewHolder.indicatorReceived.setImageResource(RtpSessionStatus.getDrawable(received, rtpSessionStatus.successful, isDarkTheme)); viewHolder.indicatorReceived.setAlpha(isDarkTheme ? 0.7f : 0.57f); viewHolder.message_box.setBackgroundResource(darkBackground ? R.drawable.date_bubble_dark : R.drawable.date_bubble); + activity.setBubbleColor(viewHolder.message_box, StyledAttributes.getColor(activity, R.attr.colorAccent), -1); return view; } else if (type == STATUS) { if ("LOAD_MORE".equals(message.getBody())) { diff --git a/src/main/res/drawable/date_bubble.xml b/src/main/res/drawable/date_bubble.xml index 6d9e2462e..d7fd0b2b8 100644 --- a/src/main/res/drawable/date_bubble.xml +++ b/src/main/res/drawable/date_bubble.xml @@ -7,8 +7,8 @@ android:bottomLeftRadius="5dp" /> \ No newline at end of file diff --git a/src/main/res/drawable/date_bubble_dark.xml b/src/main/res/drawable/date_bubble_dark.xml index 3859b4d83..ee72dfef8 100644 --- a/src/main/res/drawable/date_bubble_dark.xml +++ b/src/main/res/drawable/date_bubble_dark.xml @@ -7,8 +7,8 @@ android:bottomLeftRadius="5dp" /> \ No newline at end of file diff --git a/src/main/res/layout/message_date_bubble.xml b/src/main/res/layout/message_date_bubble.xml index 19183e0c7..79db7586c 100644 --- a/src/main/res/layout/message_date_bubble.xml +++ b/src/main/res/layout/message_date_bubble.xml @@ -24,8 +24,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="01.01.2017" - android:textAppearance="@style/TextAppearance.Conversations.Body1.Secondary" - android:textStyle="italic" /> + android:textAppearance="@style/TextAppearance.Conversations.Title" + android:textStyle="bold" /> \ No newline at end of file