From 2fda3bb0710809e736f17aea92624806fe88ced4 Mon Sep 17 00:00:00 2001
From: Taras Smakula <tarassmakula@gmail.com>
Date: Fri, 27 Oct 2023 17:49:52 +0300
Subject: [PATCH] Update well known design

---
 .../well_known/RoomWellKnownDialogFragment.kt |  5 ++--
 .../org/futo/circles/model/RoomPublicInfo.kt  |  9 ++++----
 .../dialog_fragment_room_well_known.xml       | 23 ++++++++++++++++---
 app/src/main/res/values/strings.xml           |  2 +-
 4 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/app/src/main/java/org/futo/circles/feature/room/well_known/RoomWellKnownDialogFragment.kt b/app/src/main/java/org/futo/circles/feature/room/well_known/RoomWellKnownDialogFragment.kt
index 4559d3e1a..b42111f87 100644
--- a/app/src/main/java/org/futo/circles/feature/room/well_known/RoomWellKnownDialogFragment.kt
+++ b/app/src/main/java/org/futo/circles/feature/room/well_known/RoomWellKnownDialogFragment.kt
@@ -74,8 +74,9 @@ class RoomWellKnownDialogFragment :
     private fun bindRoomData(roomInfo: RoomPublicInfo) {
         with(binding) {
             ivCover.apply {
-                setIsVisible(roomInfo.avatarUrl != null || roomInfo.name != null)
-                loadProfileIcon(roomInfo.avatarUrl, roomInfo.name ?: "")
+                if (roomInfo.avatarUrl != null || roomInfo.name != null)
+                    loadProfileIcon(roomInfo.avatarUrl, roomInfo.name ?: "")
+                else setImageResource(R.drawable.ic_logo)
             }
             tvRoomName.apply {
                 setIsVisible(roomInfo.name != null)
diff --git a/app/src/main/java/org/futo/circles/model/RoomPublicInfo.kt b/app/src/main/java/org/futo/circles/model/RoomPublicInfo.kt
index c0bf84cd4..82952409d 100644
--- a/app/src/main/java/org/futo/circles/model/RoomPublicInfo.kt
+++ b/app/src/main/java/org/futo/circles/model/RoomPublicInfo.kt
@@ -1,6 +1,5 @@
 package org.futo.circles.model
 
-import org.futo.circles.core.mapping.nameOrId
 import org.futo.circles.core.model.ShareUrlTypeArg
 import org.matrix.android.sdk.api.session.room.model.Membership
 import org.matrix.android.sdk.api.session.room.model.RoomSummary
@@ -20,8 +19,8 @@ fun RoomPublicInfo.isProfile() = type == ShareUrlTypeArg.PROFILE
 
 fun RoomSummary.toRoomPublicInfo(urlType: ShareUrlTypeArg) = RoomPublicInfo(
     id = roomId,
-    name = name,
-    avatarUrl = avatarUrl,
+    name = name.takeIf { it.isNotEmpty() },
+    avatarUrl = avatarUrl.takeIf { it.isNotEmpty() },
     topic = topic,
     memberCount = joinedMembersCount ?: 0,
     membership = membership,
@@ -30,8 +29,8 @@ fun RoomSummary.toRoomPublicInfo(urlType: ShareUrlTypeArg) = RoomPublicInfo(
 
 fun PeekResult.Success.toRoomPublicInfo(urlType: ShareUrlTypeArg) = RoomPublicInfo(
     id = roomId,
-    name = name,
-    avatarUrl = avatarUrl,
+    name = name?.takeIf { it.isNotEmpty() },
+    avatarUrl = avatarUrl?.takeIf { it.isNotEmpty() },
     topic = topic,
     memberCount = numJoinedMembers ?: 0,
     membership = Membership.NONE,
diff --git a/app/src/main/res/layout/dialog_fragment_room_well_known.xml b/app/src/main/res/layout/dialog_fragment_room_well_known.xml
index a5d65439d..078ffb64c 100644
--- a/app/src/main/res/layout/dialog_fragment_room_well_known.xml
+++ b/app/src/main/res/layout/dialog_fragment_room_well_known.xml
@@ -32,12 +32,16 @@
         android:id="@+id/ivCover"
         android:layout_width="@dimen/group_icon_size"
         android:layout_height="@dimen/group_icon_size"
-        android:layout_marginTop="16dp"
+        android:layout_marginTop="36dp"
         android:scaleType="centerCrop"
+        app:layout_constraintBottom_toTopOf="@id/tvRoomName"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/toolbarDivider"
-        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.GroupIconRadius" />
+        app:layout_constraintVertical_bias="0"
+        app:layout_constraintVertical_chainStyle="packed"
+        app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.App.GroupIconRadius"
+        tools:src="@drawable/ic_logo" />
 
 
     <ProgressBar
@@ -51,12 +55,13 @@
 
     <TextView
         android:id="@+id/tvRoomName"
-        style="@style/body"
+        style="@style/title2"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginHorizontal="36dp"
         android:layout_marginTop="36dp"
         android:gravity="center"
+        app:layout_constraintBottom_toTopOf="@id/tvRoomId"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/ivCover"
@@ -64,23 +69,28 @@
 
     <TextView
         android:id="@+id/tvRoomId"
+        style="@style/body"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginHorizontal="36dp"
         android:layout_marginTop="8dp"
         android:gravity="center"
+        app:layout_constraintBottom_toTopOf="@id/tvType"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/tvRoomName"
+        app:layout_goneMarginTop="36dp"
         tools:text="Aasdsadasdsaf" />
 
     <TextView
         android:id="@+id/tvType"
+        style="@style/body"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginHorizontal="36dp"
         android:layout_marginTop="8dp"
         android:gravity="center"
+        app:layout_constraintBottom_toTopOf="@id/tvTopic"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/tvRoomId"
@@ -89,12 +99,14 @@
 
     <TextView
         android:id="@+id/tvTopic"
+        style="@style/body"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginHorizontal="36dp"
         android:layout_marginTop="8dp"
         android:gravity="center"
         android:visibility="gone"
+        app:layout_constraintBottom_toTopOf="@id/tvMembersCount"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/tvType"
@@ -103,11 +115,13 @@
 
     <TextView
         android:id="@+id/tvMembersCount"
+        style="@style/body"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginHorizontal="36dp"
         android:layout_marginTop="8dp"
         android:gravity="center"
+        app:layout_constraintBottom_toTopOf="@id/tvMembersip"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/tvTopic"
@@ -115,11 +129,13 @@
 
     <TextView
         android:id="@+id/tvMembersip"
+        style="@style/body"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
         android:layout_marginHorizontal="36dp"
         android:layout_marginTop="8dp"
         android:gravity="center"
+        app:layout_constraintBottom_toTopOf="@id/btnRequest"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/tvMembersCount"
@@ -134,6 +150,7 @@
         android:layout_marginTop="16dp"
         android:text="@string/request_to_join"
         android:visibility="gone"
+        app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@id/tvMembersip"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 2f413c5cb..2d49f60d4 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -76,7 +76,7 @@
     <string name="unfollow">Unfollow</string>
     <string name="requested_to_follow_format">%s requested to follow</string>
     <string name="request_to_join">Request to join</string>
-    <string name="request_to_follow">Requested to follow</string>
+    <string name="request_to_follow">Request to follow</string>
     <string name="select_circles_in_which_you_want_to_follow_this_timeline">Select circles in which you want to follow this timeline</string>
     <string name="accept_invite">Accept invite</string>
     <string name="save_to_device">Save to device</string>
-- 
GitLab