From e93e51d03cbd0313542aefcf513013ea22b8846f Mon Sep 17 00:00:00 2001 From: Maxime NATUREL Date: Wed, 6 Apr 2022 17:50:52 +0200 Subject: [PATCH] Adding new message item --- .../item/MessageLiveLocationStartItem.kt | 69 ++++++++++++++++++ .../res/drawable-hdpi/bg_no_location_map.webp | Bin 0 -> 952 bytes .../res/drawable-mdpi/bg_no_location_map.webp | Bin 0 -> 638 bytes .../drawable-xhdpi/bg_no_location_map.webp | Bin 0 -> 1228 bytes .../drawable-xxhdpi/bg_no_location_map.webp | Bin 0 -> 1846 bytes .../drawable-xxxhdpi/bg_no_location_map.webp | Bin 0 -> 2706 bytes ...meline_event_live_location_start_stub.xml} | 39 +++++----- ...em_timeline_event_view_stubs_container.xml | 5 ++ 8 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageLiveLocationStartItem.kt create mode 100644 vector/src/main/res/drawable-hdpi/bg_no_location_map.webp create mode 100644 vector/src/main/res/drawable-mdpi/bg_no_location_map.webp create mode 100644 vector/src/main/res/drawable-xhdpi/bg_no_location_map.webp create mode 100644 vector/src/main/res/drawable-xxhdpi/bg_no_location_map.webp create mode 100644 vector/src/main/res/drawable-xxxhdpi/bg_no_location_map.webp rename vector/src/main/res/layout/{item_timeline_event_live_location_started.xml => item_timeline_event_live_location_start_stub.xml} (71%) diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageLiveLocationStartItem.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageLiveLocationStartItem.kt new file mode 100644 index 0000000000..eadfea2c33 --- /dev/null +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/timeline/item/MessageLiveLocationStartItem.kt @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.features.home.room.detail.timeline.item + +import android.widget.ImageView +import androidx.core.view.updateLayoutParams +import com.airbnb.epoxy.EpoxyAttribute +import com.airbnb.epoxy.EpoxyModelClass +import com.bumptech.glide.load.resource.bitmap.RoundedCorners +import im.vector.app.R +import im.vector.app.core.glide.GlideApp +import im.vector.app.core.utils.DimensionConverter +import im.vector.app.features.home.room.detail.timeline.style.TimelineMessageLayout +import im.vector.app.features.home.room.detail.timeline.style.granularRoundedCorners + +@EpoxyModelClass(layout = R.layout.item_timeline_event_base) +abstract class MessageLiveLocationStartItem : AbsMessageItem() { + + @EpoxyAttribute + var mapWidth: Int = 0 + + @EpoxyAttribute + var mapHeight: Int = 0 + + override fun bind(holder: Holder) { + super.bind(holder) + renderSendState(holder.view, null) + + val messageLayout = attributes.informationData.messageLayout + val dimensionConverter = DimensionConverter(holder.view.resources) + val imageCornerTransformation = if (messageLayout is TimelineMessageLayout.Bubble) { + messageLayout.cornersRadius.granularRoundedCorners() + } else { + RoundedCorners(dimensionConverter.dpToPx(8)) + } + holder.noLocationMapImageView.updateLayoutParams { + width = mapWidth + height = mapHeight + } + GlideApp.with(holder.noLocationMapImageView) + .load(R.drawable.bg_no_location_map) + .transform(imageCornerTransformation) + .into(holder.noLocationMapImageView) + } + + override fun getViewStubId() = STUB_ID + + class Holder : AbsMessageItem.Holder(STUB_ID) { + val noLocationMapImageView by bind(R.id.locationLiveStartMap) + } + + companion object { + private const val STUB_ID = R.id.messageContentLiveLocationStartStub + } +} diff --git a/vector/src/main/res/drawable-hdpi/bg_no_location_map.webp b/vector/src/main/res/drawable-hdpi/bg_no_location_map.webp new file mode 100644 index 0000000000000000000000000000000000000000..23a45700f0a59f6caa118e5b7d6a7216c579b3d8 GIT binary patch literal 952 zcmV;p14sN)Nk&Gn0{{S5MM6+kP&il$0000G0002i005By06|PpNNoTB00D3t+qP0Y zZXG-dv5K77YvR3>@7{^KYY8X35itRRWW9L)k-RNZNrF7}$5VME^#_oTw$eYQO=?@?uCCO8OG&Tt`!T76ZYEKLQmMX^XeeG{BbKXM` zU0Dx`z3I>xjzi(s?ed(T4x(b{3PBTe`D!*~Ze%{>4iXxwFSN`gdF)VHwFeA zU#g0l;7sN#B_p;Kk#xum1m9zhl@-{eT{bDCL=(b=c z^CPYnA}k*wLxxS;+_hBrNdCYUR7Jl!M5YafybdB!A_ufOi~AKrLrOInZZNTK6l> zbRZOPLTU38^#wDr(Tz`|c>r=P6UXWB{c6zauhz5tC}k-MJfjD;Qlk@G4Xl=T$u%T1 zWQn=nq-U!l_{1c|%R$YqL?BT2@Su4M8%%jj-Yw|p1`o?hCOQkhc1|xE-vSTDS!_@g zk+}uk?PCxCe6-9D5dJ=(&DvzTDXZN3vNHw5Ak^@0B;-Z}q3-Icj5)=+e1UqoTLCG& zM8kx4mY|Saq|zJ-)lE5|Y(wMF$MmoDw49-M@mW6+8U>l8X?<^F952pGoeI(? zeX{lq8{RLy_vULcdxzkxV(OA2?A+i2k4_3U2^wGcdDw^9YPx9HPOj|7{#FQ<)aF|H a^N4~<>s>Kk5d!ip0u+Q_%Gn-15C8!42g6|i literal 0 HcmV?d00001 diff --git a/vector/src/main/res/drawable-mdpi/bg_no_location_map.webp b/vector/src/main/res/drawable-mdpi/bg_no_location_map.webp new file mode 100644 index 0000000000000000000000000000000000000000..a6130fba782478a78b422e1e36548230d98f400a GIT binary patch literal 638 zcmV-^0)hQfNk&F?0ssJ4MM6+kP&il$0000G0001v003bC06|PpNJ0Pr00CeWNs^*b zvta$0R52_)#{s=IA|?R*R*;He^56neGPnV0xddW7NX%0GSN&K0r#X=r`%H|+1yTeD zZny#!-_-zCP&gnC0ssKe5dfV5DvtnS06qxnZh@5;E;mwLsR3jPQkp}llNFKR{$w>2RiRK9G9DRy-YEQv zNOaR3t3m!1d^zOxiGag-R>@C0GVzG1!d|%8Pzw<6j9h z7O5t`?^(bH|13XF<#R%znSSR7eHAuPayYS>vbqQO$4pKKXWS|% zJlgCQTOJxcZR~_`urFmQLM2*Kzx8F2KCakTRXlS*TAAcRWsB|=6dr0RksGxo4tnoj zl8xUH%lg(b(!bk-O7EBP80~V;K}L1%;n<`i;}`w1(!cXQ-XX}m(V_-&n!)km{dvM$ z+zr5i`yPMlWI3^Dk~!qkvN!^!u(el+fT)hsxI+OHpN}B5%mEFvG=gc)-zF6TC(y3_ zlu&uMDyguwLsJGz(F&nEFE+pWs)hX#fykYr9_h!wCatz}%50 zqAS)UMOJ%fc$+n#LQ`@n*^8mlBzi5DOU{`^eylJltAkF$E9=hXaaL< zBgjy)QE1+MWPtj}O2+(@Mk-woI~-J|mw$-`^~pK}G;dD~ooYi4_f&C#*Xo|0b*8l7I!d8JVzr@?0^PRAf7Szl)6Rtv}2#0!M`N_4g@7j#S0?$YX9?^)AJ zx&6X9fB;1o_RAQ1wHzV)J&ty_Ic#wXaXt&hnJjGB&9>l z`l}Z=C~LLY-azwjs%Pct{-kt5R?pz5Qn*NZ9K598$3>svZ^Q3HyI6d_fJj@b`B9&b znq8<j;jraXP9+34GY@|#jUqZo7OM(D*) z?oLTmctLRt=(8VybR_~ko1K`XP$SJOra6wm-~61cE=z!isED0RgCD8kK7PFSMA6_> z(1;L$?WH^1Uf@D6Bm9qP7To|={IGkbtjq7&h%Z3eEq3Aw@}E<7TL}Un zJci)YetXH|5ncBB?hcw1o*4XMB3iWOY=;+p9WYdpi}v535oA!Z8MCpB8E7$E?tuLx zlnQr56I7^dFxqLne6me{-t(o?hLCRzq=^A{$Tp~`p|Fs~$8H0g{l-G;M;{ar6&w9Kf4q$8ewess4!EuIZ^*AI3mL7)J)H&gBa literal 0 HcmV?d00001 diff --git a/vector/src/main/res/drawable-xxhdpi/bg_no_location_map.webp b/vector/src/main/res/drawable-xxhdpi/bg_no_location_map.webp new file mode 100644 index 0000000000000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GtD%;EZ@^nEf@CskWuZ+hoTBIa#$yZW3#Nqr~Kr} zTTs2Fp<#lR;^fjveJBMr#{t6yl&PYQ$0Jv zXJJTNQS)bTL-CzNw{`jFbCk`(_G-EN1F8y*M#aURmUF?cqJ9FNzm4N-;Vnd7`i$pk z^@faV(BpbGO+;E~?U{km%z28Vf$91?E8gb_W2gRf0gHZh)2@A2*WRoZCQh2M*fy&( z&>rt)M!mDnbFkd7>38hOz2VPe`FQ1n2i|*$ZJ*m3-ZJO_zNz(f_VS{ literal 0 HcmV?d00001 diff --git a/vector/src/main/res/drawable-xxxhdpi/bg_no_location_map.webp b/vector/src/main/res/drawable-xxxhdpi/bg_no_location_map.webp new file mode 100644 index 0000000000000000000000000000000000000000..8b110d33fe17e3323d75c6dda9eb29ee4f0bc8e3 GIT binary patch literal 2706 zcmb_a_gj-o8vR1=LWpz--3v%jL=Y*`q)H1d2m+C+^dg{C(LiXSDk=m75=!6_1Vvpy zdM^e=kzPYHUV?-sW##JL-9KP|nCF=@=bd-XIqz5-U%i^l0s!^~x|Vj9Y7RfQ0O!x8 zNdqK;039<+qvM|l6t^(`3Qw}jS^2c+wy5+@vB{JP{k)U0rAFIChe}YEuJ0bMCy2;TbRsr$5Vy20|5-<5PtVfUj>ZZlqh+{cUYrb&_s>t%@_+YWn^e~hxM>T9@ z>}>Ad(~YPJ*2LC84g;v`#-9(r(;Oe0AHa^kW5_O=ecFTTM;syFVDwAw6is7`Vkc8n zkb+dl>*R2MF3jfyWER6O{1`lcLY>`N)!nsXpC0@LPbyCsBV|VU6agQ_S!>wJ?@9%! z)`?J7&+R0o1f7bE@_$Y{UZZ=2L-u(_t3-{l7TXDld3e>~f1Z5|esBKPKGK(a+gAB@ z=1WDMa;^uL;2IXc`wDlbgDia7V8g=Ncupo{73NHZ%+@c(F}ZVwMm@6g6w&^$OLXi$ zDU-!Qzxkw{o5VCrT|k|CM=m57cWDG<5f%3|D(n69N-#0*jN9xj#TGj7ZgbRPZoUB9FOi#KvH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0fZv&S0&)oIm*F~>x!|$q55Y+^R8IEGKEbsMv)OlR};={;|l>qJ8m%UrS zARgjANvEp_MqRVuzC+5|_&&W=YU8GiF_7~*uZ3vEURx?qL${h|E#%a9u;bWK#wCR) zcI@e=Blq=L>*zQlEEC?ff2ptox};8D`j^651%$LBhc*@S(G%^VC=E24Z$xW5Td~jL zMhLXXQrh&C%b7xh*YignnW?7aP!9eDKawafySNYWq^UtlplRB9VIu=#V#E>GxLLAy zB+b;+o%6ZeX)ubTe@?YX7pVT(=Aq*}Yr#|D%a7_TDH)F2qE8UlzC8(A=vE3e36CG8 zP3K`0`<5`|u0c#TVY+qC_H$3Q@3BRFaP3R=uHF#_zSwsJ#cP#tBmslTM(%aX_#~CL z4B2|whUE#e>bS5p)p`ztEVdqY!a+&`RU(F#jt)_pygS>Q9X%?%TEplg&8+MNCJyGI zqh6B3)|HK~g+KO~xtGADbiywp7nD}BT6ky@I`Z}(OMp8kZyR0ocwS@MS(a5eg_I-m zzC))EqKdQgET`m`?>9XF*{ak=Q?tXJ*R!e8MplF&tD>D#SpFP#)OZetK6u`VnZlil zpT@RLTu>Md_uC8K9P@^Mfv*h^2NP9R>w@`7S}VQ+<6Zl9izS6Bn6PKE^lhpmXK?qT z(s9ZLGBlV*=wf>E>G3ruYvEiB)1B@Le3wiXK5>*7$-))uoL_WBpo>?3Aegh=o(_iN|-(c-I1)b$d@pXKa<5h - + app:layout_constraintBottom_toBottomOf="@id/locationLiveStartMap" + app:layout_constraintEnd_toEndOf="@id/locationLiveStartMap" + app:layout_constraintStart_toStartOf="@id/locationLiveStartMap" /> + app:layout_constraintBottom_toBottomOf="@id/locationLiveStartBannerBackground" + app:layout_constraintStart_toEndOf="@id/locationLiveStartIcon" + app:layout_constraintTop_toTopOf="@id/locationLiveStartBannerBackground" /> + app:layout_constraintBottom_toTopOf="@id/locationLiveStartBannerBackground" + app:layout_constraintEnd_toEndOf="@id/locationLiveStartMap" + app:layout_constraintStart_toStartOf="@id/locationLiveStartMap" + app:layout_constraintTop_toTopOf="@id/locationLiveStartMap" /> diff --git a/vector/src/main/res/layout/item_timeline_event_view_stubs_container.xml b/vector/src/main/res/layout/item_timeline_event_view_stubs_container.xml index fce01ea074..355d5fa7fe 100644 --- a/vector/src/main/res/layout/item_timeline_event_view_stubs_container.xml +++ b/vector/src/main/res/layout/item_timeline_event_view_stubs_container.xml @@ -59,6 +59,11 @@ android:layout_height="wrap_content" android:layout="@layout/item_timeline_event_location_stub" /> +