Skip to content

Commit

Permalink
Got stuff set up
Browse files Browse the repository at this point in the history
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
  • Loading branch information
rapterjet2004 committed Nov 6, 2024
1 parent d9bcf14 commit 289a2b1
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 42 deletions.
26 changes: 16 additions & 10 deletions app/src/main/java/com/nextcloud/talk/chat/ChatActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3546,23 +3546,29 @@ class ChatActivity :
when (recent.systemMessageType) {
ChatMessage.SystemMessageType.CALL_STARTED -> { // add CallStartedMessage with id -2
if (!callStarted) {
val callStartedChatMessage = ChatMessage()
callStartedChatMessage.jsonMessageId = CALL_STARTED_ID
callStartedChatMessage.actorId = "-2"
val name = if (recent.actorDisplayName.isNullOrEmpty()) "Guest" else recent.actorDisplayName
callStartedChatMessage.actorDisplayName = name
callStartedChatMessage.actorType = recent.actorType
callStartedChatMessage.timestamp = chatMessageList[0].timestamp
callStartedChatMessage.message = null
adapter?.addToStart(callStartedChatMessage, false)
// TODO try to keep UI intact, but come up with a pinning mechanism
// copy this code into message fragment and pass in the recent message
// also delete call started viewholder, callstarted interface and callstarted from the
// message holders somewhere below idk. In addition, impl functions and add animations. Should
// be good

// val callStartedChatMessage = ChatMessage()
// callStartedChatMessage.jsonMessageId = CALL_STARTED_ID
// callStartedChatMessage.actorId = "-2"
// val name = if (recent.actorDisplayName.isNullOrEmpty()) "Guest" else recent.actorDisplayName
// callStartedChatMessage.actorDisplayName = name
// callStartedChatMessage.actorType = recent.actorType
// callStartedChatMessage.timestamp = chatMessageList[0].timestamp
// callStartedChatMessage.message = null
// adapter?.addToStart(callStartedChatMessage, false)
callStarted = true
}
} // remove CallStartedMessage with id -2
ChatMessage.SystemMessageType.CALL_ENDED,
ChatMessage.SystemMessageType.CALL_MISSED,
ChatMessage.SystemMessageType.CALL_TRIED,
ChatMessage.SystemMessageType.CALL_ENDED_EVERYONE -> {
adapter?.deleteById("-2")
// adapter?.deleteById("-2")
callStarted = false
} // remove message of id -2
else -> {}
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/java/com/nextcloud/talk/chat/MessageInputFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -907,6 +907,19 @@ class MessageInputFragment : Fragment() {
binding.fragmentEditView.clearEdit.let {
viewThemeUtils.platform.colorImageView(it, ColorRole.PRIMARY)
}

binding.fragmentCallStarted.callStartedBackground.apply {
viewThemeUtils.talk.themeOutgoingMessageBubble(this, grouped = true, false)
}

binding.fragmentCallStarted.callAuthorChip.apply {
viewThemeUtils.material.colorChipBackground(this)
}

// TODO figure this out
binding.fragmentCallStarted.callStartedCloseBtn.apply {
viewThemeUtils.platform.colorImageView(this, ColorRole.ON_PRIMARY)
}
}

private fun cancelReply() {
Expand Down
11 changes: 10 additions & 1 deletion app/src/main/res/layout/call_started_message.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@
tools:background="@drawable/shape_grouped_outcoming_message"
tools:backgroundTint="@color/colorPrimaryDark">

<ImageView
android:id="@+id/call_started_close_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/close_icon"
android:src="@drawable/ic_keyboard_arrow_down"
android:background="@drawable/bubble_circle"
android:layout_gravity="end"/>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_half_margin"
android:orientation="horizontal"
android:gravity="center">

Expand Down
70 changes: 39 additions & 31 deletions app/src/main/res/layout/fragment_message_input.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">

<include
android:id="@+id/fragment_call_started"
layout="@layout/call_started_message"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginVertical="@dimen/standard_margin"
android:layout_marginHorizontal="@dimen/standard_quarter_margin"/>

<com.google.android.material.textview.MaterialTextView
android:id="@+id/fragment_connection_lost"
android:layout_width="match_parent"
Expand All @@ -24,36 +32,36 @@
android:visibility="gone"
tools:visibility="visible" />

<include
android:id="@+id/fragment_editView"
layout="@layout/edit_message_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp">
</include>
<include
android:id="@+id/fragment_editView"
layout="@layout/edit_message_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="6dp">
</include>

<com.nextcloud.talk.ui.MessageInput
android:id="@+id/fragment_message_input_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:inputType="textLongMessage|textAutoComplete"
android:maxLength="1000"
app:attachmentButtonBackground="@color/transparent"
app:attachmentButtonHeight="48dp"
app:attachmentButtonIcon="@drawable/ic_baseline_attach_file_24"
app:attachmentButtonMargin="0dp"
app:attachmentButtonWidth="48dp"
app:delayTypingStatus="200"
app:inputButtonDefaultBgColor="@color/transparent"
app:inputButtonDefaultBgDisabledColor="@color/transparent"
app:inputButtonDefaultBgPressedColor="@color/transparent"
app:inputButtonDefaultIconColor="@color/colorPrimary"
app:inputButtonHeight="48dp"
app:inputButtonMargin="0dp"
app:inputButtonWidth="48dp"
app:inputHint="@string/nc_hint_enter_a_message"
app:inputTextColor="@color/nc_incoming_text_default"
app:inputTextSize="16sp"
app:showAttachmentButton="true" />
<com.nextcloud.talk.ui.MessageInput
android:id="@+id/fragment_message_input_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:inputType="textLongMessage|textAutoComplete"
android:maxLength="1000"
app:attachmentButtonBackground="@color/transparent"
app:attachmentButtonHeight="48dp"
app:attachmentButtonIcon="@drawable/ic_baseline_attach_file_24"
app:attachmentButtonMargin="0dp"
app:attachmentButtonWidth="48dp"
app:delayTypingStatus="200"
app:inputButtonDefaultBgColor="@color/transparent"
app:inputButtonDefaultBgDisabledColor="@color/transparent"
app:inputButtonDefaultBgPressedColor="@color/transparent"
app:inputButtonDefaultIconColor="@color/colorPrimary"
app:inputButtonHeight="48dp"
app:inputButtonMargin="0dp"
app:inputButtonWidth="48dp"
app:inputHint="@string/nc_hint_enter_a_message"
app:inputTextColor="@color/nc_incoming_text_default"
app:inputTextSize="16sp"
app:showAttachmentButton="true" />
</LinearLayout>

0 comments on commit 289a2b1

Please sign in to comment.