From be608fd90bcd64a1786ebf1a341da0db72b65e5a Mon Sep 17 00:00:00 2001 From: 18401019693 Date: Tue, 21 Mar 2023 17:42:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=B4=E6=92=AD=E9=97=B4?= =?UTF-8?q?=E8=81=8A=E5=A4=A9=E5=AD=97=E4=BD=93=E8=83=8C=E6=99=AF=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.gradle | 6 +-- live/src/main/assets/chat_message_bg.png | Bin 0 -> 540 bytes .../yunbao/live/adapter/LiveChatAdapter.java | 34 +++++++------ .../presenter/LiveEnterRoomAnimPresenter.java | 6 +-- .../yunbao/live/utils/LoadDian9TuUtil.java | 47 ++++++++++++++---- live/src/main/res/layout/item_live_chat.xml | 3 +- 6 files changed, 64 insertions(+), 32 deletions(-) create mode 100644 live/src/main/assets/chat_message_bg.png diff --git a/config.gradle b/config.gradle index 6a165cac5..59ac79f7b 100644 --- a/config.gradle +++ b/config.gradle @@ -4,14 +4,14 @@ ext { buildToolsVersion: "29.0.2", minSdkVersion : 21, targetSdkVersion : 31, - versionCode : 413, + versionCode : 414, versionName : "6.4.9" ] manifestPlaceholders = [ //正式、 -// serverHost : "https://napi.yaoulive.com", + serverHost : "https://napi.yaoulive.com", //测试 - serverHost : "https://ceshi.yaoulive.com", +// serverHost : "https://ceshi.yaoulive.com", //腾讯地图 txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", diff --git a/live/src/main/assets/chat_message_bg.png b/live/src/main/assets/chat_message_bg.png new file mode 100644 index 0000000000000000000000000000000000000000..3f1095d71b8a44219fff2c066968b35b60238126 GIT binary patch literal 540 zcmeAS@N?(olHy`uVBq!ia0vp^SAaN~gAGVN7Sy{6q(brvLXsJnm^guK7?1-plz>

_ly?}{HBmGvHT&DeB=U3KmpxTTY{@$&l(ep1h6X1qHm`{UtbzU^RB(TD^lclJG> zSN@8rUFp|5p*$njHgx~$v;VoWB4fjzKRerVC(Qh6*{KE7u71x--FN28kza;ttB#)F zUEdyWGh;FT)xxhE@*jTeIP3TKndAMo-_7RirHRu5-s(NRCv#<{rBi79a*k83EN|xc z2#Od?THp|%pdlav!W>*6%);8l1j3GtK->tFZU8HRD1#|MQr5VD0ZADalbUX_Z8cO| z@hY=x!Mn49tA3fg29!VJ2>p9&dxBxo)Z?^riKFS$d8oc)Gl$lZdyl=Kj z?0o3`H9g|}lB7KK%jdJK(>`8gl($&9Zq?Nf2dXz`mP?k0+e)#6Lr&(2sN6?IHR-#$ P${@a{tDnm{r-UW|zxk

BITMAP_CACHE=new ArrayList<>();//.9图Bitmap缓存 + private static final List BITMAP_CACHE = new ArrayList<>();//.9图Bitmap缓存 - public static void loadDian9Tu(Context context, View imageView, String imgUrl, int position) { + public void loadDian9Tu(Context context, View imageView, String imgUrl, int position) { if (context == null) { return; } @@ -43,8 +47,8 @@ public class LoadDian9TuUtil { @Override public void onResourceReady(@NonNull File resource, @Nullable Transition transition) { try { - FileInputStream is=new FileInputStream(resource); - Bitmap bitmap=BitmapFactory.decodeStream(is); + FileInputStream is = new FileInputStream(resource); + Bitmap bitmap = BitmapFactory.decodeStream(is); BITMAP_CACHE.add(bitmap); setNinePathImage(context, imageView, bitmap, position); is.close(); @@ -60,7 +64,32 @@ public class LoadDian9TuUtil { }); } - public static void setNinePathImage(Context context, View imageView, Bitmap bitmap, int position) { + public void loadDian9TuAssets(Context context, View imageView, int position) { + Bitmap bitmap = getImageFromAssetsFile(context, "chat_message_bg.png"); + BITMAP_CACHE.add(bitmap); + setNinePathImage(context, imageView, bitmap, position); + } + + /** + * 从Assets中读取图片 + * + * @param fileName + * @return + */ + private Bitmap getImageFromAssetsFile(Context context, String fileName) { + Bitmap image = null; + AssetManager am = context.getResources().getAssets(); + try { + InputStream is = am.open(fileName); + image = BitmapFactory.decodeStream(is); + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + return image; + } + + public void setNinePathImage(Context context, View imageView, Bitmap bitmap, int position) { if (bitmap == null) return; byte[] chunk = bitmap.getNinePatchChunk(); @@ -71,11 +100,11 @@ public class LoadDian9TuUtil { } /** - * @see LiveActivity#onDestroy() 结束时,释放掉.9图缓存 + * @see LiveActivity# 结束时,释放掉.9图缓存 */ - public static void clearBitmap(){ + public static void clearBitmap() { for (Bitmap bitmap : BITMAP_CACHE) { - if(bitmap!=null) { + if (bitmap != null) { bitmap.recycle(); } } diff --git a/live/src/main/res/layout/item_live_chat.xml b/live/src/main/res/layout/item_live_chat.xml index 05c39f36f..0bc47a2be 100644 --- a/live/src/main/res/layout/item_live_chat.xml +++ b/live/src/main/res/layout/item_live_chat.xml @@ -5,7 +5,6 @@ android:id="@+id/bg" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="6dp" android:orientation="vertical">