Merge pull request #1062 from nextcloud/unreadMessagesPillStyle

Use chip view for pill-style unread messages counter
This commit is contained in:
Marcel Hibbe 2021-03-26 00:14:12 +01:00 коммит произвёл GitHub
Родитель 12154fffdd a2736785c4
Коммит 6253aeecad
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
13 изменённых файлов: 177 добавлений и 134 удалений

Просмотреть файл

@ -246,15 +246,15 @@ dependencies {
implementation "androidx.work:work-rxjava2:$work_version"
androidTestImplementation "androidx.work:work-testing:$work_version"
implementation 'androidx.appcompat:appcompat:1.2.0-beta01'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.core:core-ktx:1.3.0-rc01'
implementation 'androidx.sharetarget:sharetarget:1.0.0-rc01'
implementation 'com.google.android.material:material:1.2.0-alpha06'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta4'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.github.vanniktech:Emoji:0.6.0'
implementation group: 'androidx.emoji', name: 'emoji-bundled', version: '1.0.0'
implementation 'org.michaelevans.colorart:library:0.0.3'
implementation 'com.google.android:flexbox:2.0.0'
implementation 'com.google.android:flexbox:2.0.1'
implementation 'com.gitlab.bitfireAT:dav4jvm:2.1.2'
implementation 'org.conscrypt:conscrypt-android:2.4.0'

Просмотреть файл

@ -23,11 +23,14 @@
package com.nextcloud.talk.newarch.features.conversationsList
import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.graphics.drawable.Drawable
import android.text.TextUtils
import android.text.format.DateUtils
import android.view.View
import android.view.ViewGroup
import androidx.core.content.ContextCompat
import androidx.core.view.isVisible
import coil.api.load
import coil.transform.CircleCropTransformation
@ -73,19 +76,33 @@ open class ConversationPresenter(context: Context, onElementClick: ((Page, Holde
if (conversation.unreadMessages > 0) {
holder.itemView.dialogUnreadBubble!!.visibility = View.VISIBLE
if (conversation.unreadMessages < 100) {
holder.itemView.dialogName.setTypeface(
holder.itemView.dialogName.getTypeface(),
Typeface.BOLD
)
holder.itemView.dialogDate.setTypeface(
holder.itemView.dialogDate.getTypeface(),
Typeface.BOLD
)
holder.itemView.dialogLastMessage.setTypeface(
holder.itemView.dialogLastMessage.getTypeface(),
Typeface.BOLD
)
if (conversation.unreadMessages < 1000) {
holder.itemView.dialogUnreadBubble!!.text = conversation.unreadMessages.toLong()
.toString()
} else {
holder.itemView.dialogUnreadBubble!!.text = context.getString(R.string.nc_99_plus)
holder.itemView.dialogUnreadBubble!!.text = context.getString(R.string.nc_999_plus)
}
if (conversation.unreadMention || conversation.type == Conversation.ConversationType.ONE_TO_ONE_CONVERSATION) {
holder.itemView.dialogUnreadBubble!!.background =
context.getDrawable(R.drawable.bubble_circle_unread_mention)
holder.itemView.dialogUnreadBubble!!.setChipBackgroundColorResource(R.color.colorPrimary)
holder.itemView.dialogUnreadBubble!!.setTextColor(Color.WHITE)
} else {
holder.itemView.dialogUnreadBubble!!.background =
context.getDrawable(R.drawable.bubble_circle_unread)
holder.itemView.dialogUnreadBubble!!.setChipBackgroundColorResource(R.color.conversation_unread_bubble)
holder.itemView.dialogUnreadBubble!!.setTextColor(
ContextCompat.getColor(context, R.color.conversation_unread_bubble_text)
)
}
} else {
holder.itemView.dialogUnreadBubble!!.visibility = View.GONE

Просмотреть файл

@ -3,6 +3,8 @@
~ Nextcloud Talk application
~
~ @author Mario Danic
~ @author Andy Scherzinger
~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
~ Copyright (C) 2017-2018 Mario Danic <mario@lovelyhq.com>
~
~ This program is free software: you can redistribute it and/or modify
@ -17,120 +19,129 @@
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
~
-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/rv_item_view_height"
android:layout_margin="@dimen/double_margin_between_elements"
android:animateLayoutChanges="true">
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:paddingLeft="@dimen/double_margin_between_elements"
android:paddingTop="12dp"
android:paddingRight="@dimen/double_margin_between_elements"
android:paddingBottom="12dp">
<FrameLayout
android:id="@+id/dialogAvatarFrameLayout"
<FrameLayout
android:id="@+id/dialogAvatarFrameLayout"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/double_margin_between_elements">
<ImageView
android:id="@id/dialogAvatar"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/margin_between_elements">
android:contentDescription="@null"
android:scaleType="centerCrop"
tools:src="@tools:sample/avatars[0]" />
<ImageView
android:id="@id/dialogAvatar"
android:layout_width="48dp"
android:layout_height="48dp"
android:scaleType="centerCrop"
tools:src="@tools:sample/avatars[0]"/>
<ImageView
android:id="@+id/passwordProtectedRoomImageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="bottom|end"
android:contentDescription="@string/protected_conversation"
android:src="@drawable/ic_lock_grey600_24px" />
<ImageView
android:id="@+id/passwordProtectedRoomImageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="bottom|end"
android:src="@drawable/ic_lock_grey600_24px" />
<ImageView
android:id="@+id/favoriteConversationImageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="top|end"
android:contentDescription="@string/favorite_conversation"
android:src="@drawable/ic_star_black_24dp"
app:tint="@color/favorite_icon_tint"
app:tintMode="src_in" />
<ImageView
android:id="@+id/favoriteConversationImageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_gravity="top|end"
android:src="@drawable/ic_star_black_24dp"
android:tint="@color/favorite_icon_tint"
android:tintMode="src_in"/>
</FrameLayout>
</FrameLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/dialogName"
android:layout_marginTop="8dp"
android:layout_toEndOf="@id/dialogAvatarFrameLayout">
<androidx.emoji.widget.EmojiTextView
android:id="@id/dialogLastMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toStartOf="@id/dialogUnreadBubble"
android:ellipsize="end"
android:gravity="top"
android:lines="1"
android:singleLine="true"
android:textColor="@color/conversation_last_message"
tools:text="This is the last message\nof an incredibly long two line conversation text" />
<TextView
android:id="@id/dialogUnreadBubble"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:background="@drawable/bubble_circle_unread"
android:gravity="center_vertical"
android:layout_centerInParent="true"
android:lines="1"
android:textAlignment="center"
android:textColor="@color/conversation_unread_bubble"
android:textSize="10sp"
tools:background="@drawable/bubble_circle_unread"
tools:text="99+"
/>
</RelativeLayout>
<TextView
android:id="@id/dialogDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/conversation_date" />
<androidx.emoji.widget.EmojiTextView
android:id="@id/dialogLastMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/dialogName"
android:layout_marginTop="5dp"
android:layout_toStartOf="@+id/dialogUnreadBubble"
android:layout_toEndOf="@id/dialogAvatarFrameLayout"
android:ellipsize="end"
android:gravity="top"
android:lines="1"
android:singleLine="true"
android:textColor="@color/conversation_last_message"
android:textSize="14sp"
tools:text="This is the last message\nof an incredibly long two line conversation text" />
<ProgressBar
android:layout_width="16sp"
android:layout_height="16sp"
android:id="@+id/actionProgressBar"
android:layout_alignBottom="@id/dialogName"
android:layout_marginEnd="8dp"
android:layout_toEndOf="@+id/dialogAvatarFrameLayout"
android:indeterminateTint="@color/colorPrimary"
android:visibility="gone"
/>
<com.google.android.material.chip.Chip
android:id="@+id/dialogUnreadBubble"
style="@style/Widget.MaterialComponents.Chip.Choice"
android:layout_width="wrap_content"
android:layout_height="18dp"
android:layout_below="@+id/dialogName"
android:layout_alignParentEnd="true"
android:layout_marginStart="8dp"
android:layout_marginTop="7dp"
android:gravity="top"
android:lines="1"
android:textAppearance="@style/ChipUnreadMessagesTextAppearance"
android:textColor="@color/conversation_unread_bubble_text"
app:chipBackgroundColor="@color/conversation_unread_bubble"
app:chipEndPadding="-1dp"
app:chipMinTouchTargetSize="0dp"
app:chipStartPadding="-3dp"
app:ensureMinTouchTargetSize="false"
tools:text="99+" />
<androidx.emoji.widget.EmojiTextView
android:id="@id/dialogName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/dialogAvatarFrameLayout"
android:layout_toStartOf="@id/dialogDate"
android:layout_toEndOf="@id/actionProgressBar"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="@color/conversation_item_header"
android:textSize="16sp"
tools:text="Best conversation" />
<TextView
android:id="@id/dialogDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/dialogAvatarFrameLayout"
android:layout_alignParentEnd="true"
android:layout_marginStart="@dimen/margin_between_elements"
android:layout_marginTop="3dp"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/conversation_date"
android:textSize="14sp"
tools:text="@string/nc_date_header_yesterday" />
<ProgressBar
android:id="@+id/actionProgressBar"
android:layout_width="16sp"
android:layout_height="16sp"
android:layout_alignBottom="@id/dialogName"
android:layout_marginTop="3dp"
android:layout_marginEnd="8dp"
android:layout_toEndOf="@+id/dialogAvatarFrameLayout"
android:indeterminateTint="@color/colorPrimary"
android:visibility="gone" />
<androidx.emoji.widget.EmojiTextView
android:id="@id/dialogName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@id/dialogAvatarFrameLayout"
android:layout_marginTop="3dp"
android:layout_toStartOf="@id/dialogDate"
android:layout_toEndOf="@id/actionProgressBar"
android:ellipsize="end"
android:includeFontPadding="false"
android:maxLines="1"
android:textColor="@color/conversation_item_header"
android:textSize="16sp"
tools:text="Best conversation" />
</RelativeLayout>

Просмотреть файл

@ -26,12 +26,12 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.cardview.widget.CardView
<com.google.android.material.card.MaterialCardView
android:id="@+id/searchCardView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginHorizontal="12dp"
android:background="@color/transparent"
android:background="@color/appbar"
app:cardPreventCornerOverlap="true"
android:clipToPadding="true"
android:layout_marginBottom="-4dp"
@ -148,5 +148,5 @@
</FrameLayout>
</RelativeLayout>
</androidx.cardview.widget.CardView>
</com.google.android.material.card.MaterialCardView>
</merge>

Просмотреть файл

@ -29,15 +29,19 @@
<color name="colorPrimaryDark">#006AA3</color>
<color name="colorAccent">#007CC2</color>
<color name="conversation_item_header">#9FBDCC</color>
<!--<color name="conversation_item_header">#CFCFCF</color>-->
<color name="appbar">#1E1E1E</color>
<color name="bg_default">#222222</color>
<color name="bg_alt">#222222</color>
<!-- Name of person or group for the chat conversation -->
<color name="conversation_item_header">#E3E3E3</color>
<color name="conversation_unread_bubble">#373737</color>
<color name="conversation_unread_bubble_text">#D8D8D8</color>
<color name="bg_default">#121212</color>
<color name="bg_alt">#121212</color>
<color name="bg_inverse">@color/grey950</color>
<color name="fg_default">#FFFFFF</color>
<color name="fg_inverse">#222222</color>
<color name="fg_inverse">#121212</color>
<color name="fg_chat_message_sent">@color/fg_default</color>
<!-- Chat window incoming message text & informational -->
@ -46,7 +50,7 @@
<color name="nc_chip_mention_you_background">#0083C9</color>
<color name="nc_chip_mention_others_background">#6F6F6F</color>
<color name="nc_grey">@android:color/holo_purple</color>
<color name="bg_bottom_sheet">#222222</color>
<color name="bg_bottom_sheet">#121212</color>
<color name="bg_selected_participant_clear_icon">#EFEFEF</color>
<color name="bg_message_list_incoming_bubble">#484848</color>
<color name="bg_message_list_outcoming_bubble">#003F62</color>

Просмотреть файл

@ -27,16 +27,20 @@
<color name="colorPrimaryDark">#006AA3</color>
<color name="colorAccent">#007CC2</color>
<color name="appbar">@android:color/white</color>
<color name="fontAppbar">#A5A5A5</color>
<!-- Text color of sent messages -->
<color name="nc_outcoming_text_default">#FFFFFF</color>
<!-- Text color of received messages -->
<color name="nc_incoming_text_default">#37505D</color>
<!-- Name of person or group for the chat conversation -->
<color name="conversation_item_header">#37505D</color>
<color name="conversation_item_header">#333333</color>
<color name="conversation_date">@color/warm_grey_two</color>
<color name="conversation_last_message">@color/warm_grey_four</color>
<color name="conversation_unread_bubble">#FFFFFF</color>
<color name="conversation_unread_bubble">#DBDBDB</color>
<color name="conversation_unread_bubble_text">#222222</color>
<color name="nc_incoming_text_mention_you">#C98879</color>
<color name="nc_incoming_text_mention_others">#37505D</color>

Просмотреть файл

@ -337,7 +337,7 @@
<string name="nc_last_moderator">You need to promote a new moderator before you can leave %1$s.</string>
<!-- Chat -->
<string name="nc_99_plus">99+</string>
<string name="nc_999_plus" translatable="false">999+</string>
<string name="nc_copy_message">Copy</string>
<string name="nc_reply">Reply</string>
@ -355,4 +355,6 @@
<string name="nc_look_and_feel">Appearance &amp; Sounds</string>
<string name="nc_settings_calls_sound">Calls sound</string>
<string name="nc_settings_notifications_sound">Notifications sound</string>
<string name="protected_conversation">protected conversation</string>
<string name="favorite_conversation">favorite conversation</string>
</resources>

Просмотреть файл

@ -51,6 +51,11 @@
<item name="android:textColor">@color/colorAccent</item>
</style>
<style name="ChipUnreadMessagesTextAppearance" parent="TextAppearance.MaterialComponents.Chip">
<item name="android:textSize">14sp</item>
<item name="android:textStyle">bold</item>
</style>
<style name="appActionBarStyle" parent="@style/Widget.MaterialComponents.ActionBar.Solid">
<item name="android:colorPrimary">@color/fg_inverse</item>
<item name="android:textColor">@color/fg_inverse</item>

Просмотреть файл

@ -39,10 +39,10 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.5.0'
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

2
gradle/wrapper/gradle-wrapper.properties поставляемый
Просмотреть файл

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip

Просмотреть файл

@ -11,7 +11,7 @@
ruby scripts/analysis/lint-up.rb $1 $2 $3
lintValue=$?
./gradlew assembleGplayDebug spotbugsGplayDebugReport
./gradlew assembleGplay app:spotbugsGplayReleaseReport
# exit codes:
# 0: count was reduced
@ -24,12 +24,12 @@ if [ $3 = "master" ]; then
echo "New findbugs result for master at: https://www.kaminsky.me/nc-dev/talk-findbugs/master.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/master.html --upload-file app/build/reports/spotbugs/spotbugs.html
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" app/build/reports/spotbugs/spotbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s'/Summary/FindBugs (master)/' | tr "\"" "\'" | tr -d "\r\n")
curl -u $4:$5 -X PUT -d "$summary" https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/findbugs.html
summary=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" app/build/reports/spotbugs/spotbugs.html | head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s'/Summary/SpotBugs (master)/' | tr "\"" "\'" | tr -d "\r\n")
curl -u $4:$5 -X PUT -d "$summary" https://nextcloud.kaminsky.me/remote.php/webdav/talk-findbugs/findbugs-summary-master.html
if [ $lintValue -ne 1 ]; then
echo "New lint result for master at: https://www.kaminsky.me/nc-dev/talk-lint/master.html"
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-droneLogs/master.html --upload-file app/build/reports/lint/lint.html
curl -u $4:$5 -X PUT https://nextcloud.kaminsky.me/remote.php/webdav/talk-lint/master.html --upload-file app/build/reports/lint/lint.html
exit 0
fi
else
@ -56,8 +56,8 @@ else
lintErrorOld=$(grep "[0-9]* error" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
lintWarningOld=$(grep "[0-9]* warning" scripts/analysis/lint-results.txt -o | cut -f1 -d" ")
lintResult="<h1>Lint</h1><table width='500' cellpadding='5' cellspacing='2'><tr class='tablerow0'><td>Type</td><td><a href='https://www.kaminsky.me/nc-dev/talk-lint/master.html'>Master</a></td><td><a href='https://www.kaminsky.me/nc-dev/talk-lint/"$6".html'>PR</a></td></tr><tr class='tablerow1'><td>Warnings</td><td>"$lintWarningOld"</td><td>"$lintWarningNew"</td></tr><tr class='tablerow0'><td>Errors</td><td>"$lintErrorOld"</td><td>"$lintErrorNew"</td></tr></table>"
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" app/build/reports/spotbugs/spotbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/talk-findbugs/$6.html\">FindBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
findbugsResultOld=$(curl 2>/dev/null https://www.kaminsky.me/nc-dev/talk-findbugs/findbugs.html | tr "\"" "\'" | tr -d "\r\n" | sed s'#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/talk-findbugs/master.html">FindBugs</a>#'| tr "\"" "\'" | tr -d "\n")
findbugsResultNew=$(sed -n "/<h1>Summary<\/h1>/,/<h1>Warnings<\/h1>/p" app/build/reports/spotbugs/spotbugs.html |head -n-1 | sed s'/<\/a>//'g | sed s'/<a.*>//'g | sed s"#Summary#<a href=\"https://www.kaminsky.me/nc-dev/talk-findbugs/$6.html\">SpotBugs</a> (new)#" | tr "\"" "\'" | tr -d "\n")
findbugsResultOld=$(curl 2>/dev/null https://www.kaminsky.me/nc-dev/talk-findbugs/findbugs-summary-master.html | tr "\"" "\'" | tr -d "\r\n" | sed s'#FindBugs#<a href=\"https://www.kaminsky.me/nc-dev/talk-findbugs/master.html">FindBugs</a>#'| tr "\"" "\'" | tr -d "\n")
curl -u $1:$2 -X POST https://api.github.com/repos/nextcloud/talk-android/issues/$7/comments -d "{ \"body\" : \"$lintResult $findbugsResultNew $findbugsResultOld \" }"
if [ $lintValue -eq 2 ]; then

Просмотреть файл

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 11 errors and 566 warnings</span>
<span class="mdl-layout-title">Lint Report: 41 errors and 645 warnings</span>

Просмотреть файл

@ -56,7 +56,7 @@ end
# run Lint
puts "running Lint..."
system './gradlew clean assembleGplay app:lint'
system './gradlew clean assembleGplay lint'
# confirm that Lint ran w/out error
result = $?.to_i
@ -178,7 +178,7 @@ previous_git_email = previous_git_email.strip
# update git user name and email for this script
system ("git config --local user.name '" + git_user + "'")
system ("git config --local user.email 'android@nextcloud.com'")
system ("git config --local user.email '.'") # set email blank
system ("git remote rm origin")
system ("git remote add origin https://" + git_user + ":" + git_token + "@github.com/nextcloud/talk-android")