Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
AloqaIM-Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
AloqaIM-Android
Commits
33f99bec
Commit
33f99bec
authored
Nov 23, 2018
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Open user details screen when tapping on username or avatar image when inside a chat
parent
8d79f2db
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
505 additions
and
29 deletions
+505
-29
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+10
-0
AuthenticationActivity.kt
...ocket/android/authentication/ui/AuthenticationActivity.kt
+0
-2
MessageViewHolder.kt
...chat/rocket/android/chatroom/adapter/MessageViewHolder.kt
+16
-0
ChatRoomNavigator.kt
...rocket/android/chatroom/presentation/ChatRoomNavigator.kt
+1
-1
ChatRoomFragment.kt
.../java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
+4
-7
Menu.kt
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
+3
-3
ActivityBuilder.kt
...java/chat/rocket/android/dagger/module/ActivityBuilder.kt
+17
-10
PasswordFragment.kt
...t/rocket/android/settings/password/ui/PasswordFragment.kt
+5
-5
UserDetailsModule.kt
...a/chat/rocket/android/userdetails/di/UserDetailsModule.kt
+32
-0
UserDetailsPresenter.kt
.../android/userdetails/presentation/UserDetailsPresenter.kt
+139
-0
UserDetailsView.kt
...ocket/android/userdetails/presentation/UserDetailsView.kt
+8
-0
UserDetailsActivity.kt
...chat/rocket/android/userdetails/ui/UserDetailsActivity.kt
+116
-0
ic_message_24dp.xml
app/src/main/res/drawable/ic_message_24dp.xml
+10
-0
activity_password.xml
app/src/main/res/layout/activity_password.xml
+3
-1
activity_user_details.xml
app/src/main/res/layout/activity_user_details.xml
+141
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
33f99bec
...
...
@@ -93,6 +93,16 @@
android:name=
".settings.password.ui.PasswordActivity"
android:theme=
"@style/AppTheme"
/>
<activity
android:name=
".userdetails.ui.UserDetailsActivity"
android:theme=
"@style/AppTheme"
android:windowSoftInputMode=
"stateAlwaysHidden"
>
<meta-data
android:name=
"android.support.PARENT_ACTIVITY"
android:value=
".chatroom.ui.ChatRoomActivity"
/>
</activity>
<receiver
android:name=
".push.DirectReplyReceiver"
android:enabled=
"true"
...
...
app/src/main/java/chat/rocket/android/authentication/ui/AuthenticationActivity.kt
View file @
33f99bec
...
...
@@ -19,7 +19,6 @@ import dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.support.HasSupportFragmentInjector
import
kotlinx.android.synthetic.main.app_bar.*
import
kotlinx.coroutines.experimental.Job
import
javax.inject.Inject
class
AuthenticationActivity
:
AppCompatActivity
(),
HasSupportFragmentInjector
{
...
...
@@ -27,7 +26,6 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
lateinit
var
fragmentDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Fragment
>
@Inject
lateinit
var
presenter
:
AuthenticationPresenter
val
job
=
Job
()
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
...
...
app/src/main/java/chat/rocket/android/chatroom/adapter/MessageViewHolder.kt
View file @
33f99bec
package
chat.rocket.android.chatroom.adapter
import
android.content.Context
import
android.graphics.Color
import
android.graphics.drawable.Drawable
import
android.text.Spannable
...
...
@@ -10,6 +11,7 @@ import androidx.core.view.isVisible
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.uimodel.MessageUiModel
import
chat.rocket.android.emoji.EmojiReactionListener
import
chat.rocket.android.userdetails.ui.userDetailsIntent
import
chat.rocket.core.model.isSystemMessage
import
com.bumptech.glide.load.resource.gif.GifDrawable
import
kotlinx.android.synthetic.main.avatar.view.*
...
...
@@ -70,9 +72,23 @@ class MessageViewHolder(
)
read_receipt_view
.
isVisible
=
true
}
val
senderId
=
data
.
message
.
sender
?.
id
text_sender
.
setOnClickListener
{
toUserDetails
(
context
,
senderId
)
}
image_avatar
.
setOnClickListener
{
toUserDetails
(
context
,
senderId
)
}
}
}
private
fun
toUserDetails
(
context
:
Context
,
userId
:
String
?)
{
userId
?.
let
{
context
.
startActivity
(
context
.
userDetailsIntent
(
it
))
}
}
override
fun
unscheduleDrawable
(
who
:
Drawable
?,
what
:
Runnable
?)
{
with
(
itemView
)
{
text_content
.
removeCallbacks
(
what
)
...
...
app/src/main/java/chat/rocket/android/chatroom/presentation/ChatRoomNavigator.kt
View file @
33f99bec
...
...
@@ -66,4 +66,4 @@ class ChatRoomNavigator(internal val activity: ChatRoomActivity) {
activity
.
startActivity
(
activity
.
messageInformationIntent
(
messageId
=
messageId
))
activity
.
overridePendingTransition
(
R
.
anim
.
open_enter
,
R
.
anim
.
open_exit
)
}
}
\ No newline at end of file
}
app/src/main/java/chat/rocket/android/chatroom/ui/ChatRoomFragment.kt
View file @
33f99bec
...
...
@@ -68,17 +68,17 @@ import chat.rocket.android.helper.ImageHelper
import
chat.rocket.android.helper.KeyboardHelper
import
chat.rocket.android.helper.MessageParser
import
chat.rocket.android.util.extension.asObservable
import
chat.rocket.android.util.extension.createImageFile
import
chat.rocket.android.util.extensions.circularRevealOrUnreveal
import
chat.rocket.android.util.extensions.fadeIn
import
chat.rocket.android.util.extensions.fadeOut
import
chat.rocket.android.util.extensions.getBitmpap
import
chat.rocket.android.util.extensions.hideKeyboard
import
chat.rocket.android.util.extensions.inflate
import
chat.rocket.android.util.extensions.rotateBy
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.android.util.extensions.textContent
import
chat.rocket.android.util.extensions.ui
import
chat.rocket.android.util.extension.createImageFile
import
chat.rocket.android.util.extensions.getBitmpap
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.core.internal.realtime.socket.model.State
...
...
@@ -86,19 +86,16 @@ import dagger.android.support.AndroidSupportInjection
import
io.reactivex.Observable
import
io.reactivex.disposables.CompositeDisposable
import
io.reactivex.disposables.Disposable
import
kotlinx.android.synthetic.main.emoji_image_row_item.*
import
kotlinx.android.synthetic.main.emoji_image_row_item.view.*
import
kotlinx.android.synthetic.main.emoji_row_item.*
import
kotlinx.android.synthetic.main.emoji_row_item.view.*
import
kotlinx.android.synthetic.main.fragment_chat_room.*
import
kotlinx.android.synthetic.main.message_attachment_options.*
import
kotlinx.android.synthetic.main.message_composer.*
import
kotlinx.android.synthetic.main.message_list.*
import
kotlinx.android.synthetic.main.reaction_praises_list_item.view.*
import
timber.log.Timber
import
java.io.File
import
java.io.IOException
import
kotlinx.android.synthetic.main.reaction_praises_list_item.*
import
kotlinx.android.synthetic.main.reaction_praises_list_item.view.*
import
java.util.concurrent.TimeUnit
import
java.util.concurrent.atomic.AtomicInteger
import
javax.inject.Inject
...
...
@@ -144,7 +141,7 @@ private const val BUNDLE_CHAT_ROOM_IS_CREATOR = "chat_room_is_creator"
private
const
val
BUNDLE_CHAT_ROOM_IS_FAVORITE
=
"chat_room_is_favorite"
private
const
val
BUNDLE_CHAT_ROOM_MESSAGE
=
"chat_room_message"
internal
const
val
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
=
1
internal
const
val
MENU_ACTION_FAVORITE_UNFAVO
U
RITE_CHAT
=
1
internal
const
val
MENU_ACTION_SHOW_DETAILS
=
2
class
ChatRoomFragment
:
Fragment
(),
ChatRoomView
,
EmojiKeyboardListener
,
EmojiReactionListener
,
...
...
app/src/main/java/chat/rocket/android/chatroom/ui/Menu.kt
View file @
33f99bec
...
...
@@ -17,7 +17,7 @@ internal fun ChatRoomFragment.setupMenu(menu: Menu) {
internal
fun
ChatRoomFragment
.
setOnMenuItemClickListener
(
item
:
MenuItem
)
{
when
(
item
.
itemId
)
{
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
->
presenter
.
toggleFavoriteChatRoom
(
MENU_ACTION_FAVORITE_UNFAVO
U
RITE_CHAT
->
presenter
.
toggleFavoriteChatRoom
(
chatRoomId
,
isFavorite
)
...
...
@@ -87,7 +87,7 @@ private fun ChatRoomFragment.setupFavoriteMenuItem(menu: Menu) {
if
(
isFavorite
)
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
,
MENU_ACTION_FAVORITE_UNFAVO
U
RITE_CHAT
,
Menu
.
NONE
,
R
.
string
.
title_unfavorite_chat
).
setIcon
(
R
.
drawable
.
ic_star_yellow_24dp
)
...
...
@@ -95,7 +95,7 @@ private fun ChatRoomFragment.setupFavoriteMenuItem(menu: Menu) {
}
else
{
menu
.
add
(
Menu
.
NONE
,
MENU_ACTION_FAVORITE_UNFAVORITE_CHAT
,
MENU_ACTION_FAVORITE_UNFAVO
U
RITE_CHAT
,
Menu
.
NONE
,
R
.
string
.
title_favorite_chat
).
setIcon
(
R
.
drawable
.
ic_star_border_white_24dp
)
...
...
app/src/main/java/chat/rocket/android/dagger/module/ActivityBuilder.kt
View file @
33f99bec
...
...
@@ -38,6 +38,8 @@ import chat.rocket.android.server.ui.ChangeServerActivity
import
chat.rocket.android.settings.di.SettingsFragmentProvider
import
chat.rocket.android.settings.password.di.PasswordFragmentProvider
import
chat.rocket.android.settings.password.ui.PasswordActivity
import
chat.rocket.android.userdetails.di.UserDetailsModule
import
chat.rocket.android.userdetails.ui.UserDetailsActivity
import
chat.rocket.android.webview.adminpanel.di.AdminPanelWebViewFragmentProvider
import
dagger.Module
import
dagger.android.ContributesAndroidInjector
...
...
@@ -46,16 +48,16 @@ import dagger.android.ContributesAndroidInjector
abstract
class
ActivityBuilder
{
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
AuthenticationModule
::
class
,
OnBoardingFragmentProvider
::
class
,
ServerFragmentProvider
::
class
,
LoginOptionsFragmentProvider
::
class
,
LoginFragmentProvider
::
class
,
RegisterUsernameFragmentProvider
::
class
,
ResetPasswordFragmentProvider
::
class
,
SignupFragmentProvider
::
class
,
TwoFAFragmentProvider
::
class
]
modules
=
[
AuthenticationModule
::
class
,
OnBoardingFragmentProvider
::
class
,
ServerFragmentProvider
::
class
,
LoginOptionsFragmentProvider
::
class
,
LoginFragmentProvider
::
class
,
RegisterUsernameFragmentProvider
::
class
,
ResetPasswordFragmentProvider
::
class
,
SignupFragmentProvider
::
class
,
TwoFAFragmentProvider
::
class
]
)
abstract
fun
bindAuthenticationActivity
():
AuthenticationActivity
...
...
@@ -108,6 +110,11 @@ abstract class ActivityBuilder {
@ContributesAndroidInjector
(
modules
=
[
MessageInfoFragmentProvider
::
class
])
abstract
fun
bindMessageInfoActiviy
():
MessageInfoActivity
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
DrawModule
::
class
])
abstract
fun
bindDrawingActivity
():
DrawingActivity
@PerActivity
@ContributesAndroidInjector
(
modules
=
[
UserDetailsModule
::
class
])
abstract
fun
bindUserDetailsActivity
():
UserDetailsActivity
}
app/src/main/java/chat/rocket/android/settings/password/ui/PasswordFragment.kt
View file @
33f99bec
...
...
@@ -35,10 +35,6 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
private
var
actionMode
:
ActionMode
?
=
null
private
val
disposables
=
CompositeDisposable
()
companion
object
{
fun
newInstance
()
=
PasswordFragment
()
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidSupportInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -143,4 +139,8 @@ class PasswordFragment : Fragment(), PasswordView, ActionMode.Callback {
actionMode
=
(
activity
as
PasswordActivity
).
startSupportActionMode
(
this
)
}
}
}
\ No newline at end of file
companion
object
{
fun
newInstance
()
=
PasswordFragment
()
}
}
app/src/main/java/chat/rocket/android/userdetails/di/UserDetailsModule.kt
0 → 100644
View file @
33f99bec
package
chat.rocket.android.userdetails.di
import
androidx.lifecycle.LifecycleOwner
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.dagger.scope.PerActivity
import
chat.rocket.android.userdetails.presentation.UserDetailsView
import
chat.rocket.android.userdetails.ui.UserDetailsActivity
import
dagger.Module
import
dagger.Provides
import
kotlinx.coroutines.experimental.Job
@Module
class
UserDetailsModule
{
@Provides
@PerActivity
fun
provideJob
()
=
Job
()
@Provides
@PerActivity
fun
provideUserDetailsView
(
activity
:
UserDetailsActivity
):
UserDetailsView
=
activity
@Provides
@PerActivity
fun
provideLifecycleOwner
(
activity
:
UserDetailsActivity
):
LifecycleOwner
=
activity
@Provides
@PerActivity
fun
provideCancelStrategy
(
owner
:
LifecycleOwner
,
jobs
:
Job
):
CancelStrategy
{
return
CancelStrategy
(
owner
,
jobs
)
}
}
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsPresenter.kt
0 → 100644
View file @
33f99bec
package
chat.rocket.android.userdetails.presentation
import
chat.rocket.android.core.lifecycle.CancelStrategy
import
chat.rocket.android.db.DatabaseManager
import
chat.rocket.android.server.domain.GetConnectingServerInteractor
import
chat.rocket.android.server.infraestructure.ConnectionManagerFactory
import
chat.rocket.android.util.extension.launchUI
import
chat.rocket.android.util.extensions.avatarUrl
import
chat.rocket.android.util.retryIO
import
chat.rocket.common.model.RoomType
import
chat.rocket.common.model.SimpleUser
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.core.internal.rest.spotlight
import
chat.rocket.core.model.ChatRoom
import
kotlinx.coroutines.experimental.CommonPool
import
kotlinx.coroutines.experimental.withContext
import
timber.log.Timber
import
javax.inject.Inject
class
UserDetailsPresenter
@Inject
constructor
(
private
val
view
:
UserDetailsView
,
private
val
dbManager
:
DatabaseManager
,
private
val
strategy
:
CancelStrategy
,
serverInteractor
:
GetConnectingServerInteractor
,
factory
:
ConnectionManagerFactory
)
{
private
var
currentServer
=
serverInteractor
.
get
()
!!
private
val
manager
=
factory
.
create
(
currentServer
)
private
val
client
=
manager
.
client
fun
loadUserDetails
(
userId
:
String
)
{
launchUI
(
strategy
)
{
try
{
val
user
=
withContext
(
CommonPool
)
{
dbManager
.
userDao
().
getUser
(
id
=
userId
)
}
user
?.
let
{
u
->
val
localDMs
=
chatRoomByName
(
name
=
u
.
name
)
val
avatarUrl
=
u
.
username
?.
let
{
currentServer
.
avatarUrl
(
avatar
=
it
)
}
val
chatRoom
:
ChatRoom
?
=
if
(
localDMs
.
isEmpty
())
{
val
query
=
u
.
username
!!
val
result
=
retryIO
(
"spotlight($query)"
)
{
client
.
spotlight
(
query
=
query
)
}
val
userMatch
=
result
.
users
.
firstOrNull
()
if
(
userMatch
!=
null
)
{
with
(
userMatch
)
{
ChatRoom
(
id
=
id
,
type
=
roomTypeOf
(
RoomType
.
DIRECT_MESSAGE
),
name
=
u
.
username
?:
u
.
name
.
orEmpty
(),
fullName
=
u
.
name
,
favorite
=
false
,
open
=
false
,
alert
=
false
,
status
=
status
,
client
=
client
,
broadcast
=
false
,
archived
=
false
,
default
=
false
,
description
=
null
,
groupMentions
=
null
,
userMentions
=
null
,
lastMessage
=
null
,
lastSeen
=
null
,
topic
=
null
,
announcement
=
null
,
roles
=
null
,
unread
=
0
,
readonly
=
false
,
muted
=
null
,
subscriptionId
=
""
,
timestamp
=
null
,
updatedAt
=
null
,
user
=
SimpleUser
(
id
,
username
)
)
}
}
else
null
}
else
localDMs
.
firstOrNull
()
view
.
showUserDetails
(
avatarUrl
=
avatarUrl
,
username
=
u
.
username
,
name
=
u
.
name
,
utcOffset
=
u
.
utcOffset
,
status
=
u
.
status
,
chatRoom
=
chatRoom
)
}
}
catch
(
ex
:
Exception
)
{
Timber
.
e
(
ex
)
}
}
}
private
suspend
fun
chatRoomByName
(
name
:
String
?
=
null
):
List
<
ChatRoom
>
=
withContext
(
CommonPool
)
{
return
@withContext
dbManager
.
chatRoomDao
().
getAllSync
().
filter
{
if
(
name
==
null
)
{
return
@filter
true
}
it
.
chatRoom
.
name
==
name
||
it
.
chatRoom
.
fullname
==
name
}.
map
{
with
(
it
.
chatRoom
)
{
ChatRoom
(
id
=
id
,
subscriptionId
=
subscriptionId
,
type
=
roomTypeOf
(
type
),
unread
=
unread
,
broadcast
=
broadcast
?:
false
,
alert
=
alert
,
fullName
=
fullname
,
name
=
name
?:
""
,
favorite
=
favorite
?:
false
,
default
=
isDefault
?:
false
,
readonly
=
readonly
,
open
=
open
,
lastMessage
=
null
,
archived
=
false
,
status
=
null
,
user
=
null
,
userMentions
=
userMentions
,
client
=
client
,
announcement
=
null
,
description
=
null
,
groupMentions
=
groupMentions
,
roles
=
null
,
topic
=
null
,
lastSeen
=
this
.
lastSeen
,
timestamp
=
timestamp
,
updatedAt
=
updatedAt
)
}
}
}
}
app/src/main/java/chat/rocket/android/userdetails/presentation/UserDetailsView.kt
0 → 100644
View file @
33f99bec
package
chat.rocket.android.userdetails.presentation
import
chat.rocket.core.model.ChatRoom
interface
UserDetailsView
{
fun
showUserDetails
(
avatarUrl
:
String
?,
username
:
String
?,
name
:
String
?,
utcOffset
:
Float
?,
status
:
String
,
chatRoom
:
ChatRoom
?)
}
app/src/main/java/chat/rocket/android/userdetails/ui/UserDetailsActivity.kt
0 → 100644
View file @
33f99bec
package
chat.rocket.android.userdetails.ui
import
android.content.Context
import
android.content.Intent
import
android.os.Bundle
import
androidx.appcompat.app.AppCompatActivity
import
androidx.fragment.app.Fragment
import
chat.rocket.android.R
import
chat.rocket.android.chatroom.ui.chatRoomIntent
import
chat.rocket.android.emoji.internal.GlideApp
import
chat.rocket.android.userdetails.presentation.UserDetailsPresenter
import
chat.rocket.android.userdetails.presentation.UserDetailsView
import
chat.rocket.android.util.extension.orFalse
import
chat.rocket.android.util.extensions.showToast
import
chat.rocket.common.model.roomTypeOf
import
chat.rocket.core.model.ChatRoom
import
com.bumptech.glide.load.resource.bitmap.RoundedCorners
import
com.bumptech.glide.request.RequestOptions
import
dagger.android.AndroidInjection
import
dagger.android.AndroidInjector
import
dagger.android.DispatchingAndroidInjector
import
dagger.android.support.HasSupportFragmentInjector
import
kotlinx.android.synthetic.main.activity_user_details.*
import
org.threeten.bp.OffsetDateTime
import
org.threeten.bp.ZoneId
import
org.threeten.bp.ZoneOffset
import
org.threeten.bp.ZonedDateTime
import
org.threeten.bp.format.DateTimeFormatter
import
javax.inject.Inject
import
kotlin.math.roundToLong
fun
Context
.
userDetailsIntent
(
userId
:
String
):
Intent
{
return
Intent
(
this
,
UserDetailsActivity
::
class
.
java
).
apply
{
putExtra
(
EXTRA_USER_ID
,
userId
)
}
}
const
val
EXTRA_USER_ID
=
"EXTRA_USER_ID"
class
UserDetailsActivity
:
AppCompatActivity
(),
UserDetailsView
,
HasSupportFragmentInjector
{
@Inject
lateinit
var
fragmentDispatchingAndroidInjector
:
DispatchingAndroidInjector
<
Fragment
>
@Inject
lateinit
var
presenter
:
UserDetailsPresenter
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
AndroidInjection
.
inject
(
this
)
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_user_details
)
setupToolbar
()
val
userId
=
intent
.
getStringExtra
(
EXTRA_USER_ID
)
presenter
.
loadUserDetails
(
userId
=
userId
)
}
override
fun
supportFragmentInjector
():
AndroidInjector
<
Fragment
>
=
fragmentDispatchingAndroidInjector
private
fun
setupToolbar
()
{
setSupportActionBar
(
toolbar
)
supportActionBar
?.
setDisplayShowTitleEnabled
(
false
)
toolbar
.
setNavigationOnClickListener
{
finish
()
}
}
override
fun
showUserDetails
(
avatarUrl
:
String
?,
username
:
String
?,
name
:
String
?,
utcOffset
:
Float
?,
status
:
String
,
chatRoom
:
ChatRoom
?
)
{
text_view_name
.
text
=
name
text_view_username
.
text
=
username
text_view_status
.
text
=
status
.
capitalize
()
GlideApp
.
with
(
this
)
.
load
(
avatarUrl
)
.
centerCrop
()
.
apply
(
RequestOptions
().
transform
(
RoundedCorners
(
25
)))
.
into
(
image_view_avatar
)
utcOffset
?.
let
{
val
offsetLong
=
it
.
roundToLong
()
val
offset
=
if
(
it
>
0
)
"+$offsetLong"
else
offsetLong
.
toString
()
val
formatter
=
DateTimeFormatter
.
ofPattern
(
"'(GMT$offset)' hh:mm a"
)
val
zoneId
=
ZoneId
.
systemDefault
()
val
timeNow
=
OffsetDateTime
.
now
(
ZoneOffset
.
UTC
).
plusHours
(
offsetLong
).
toLocalDateTime
()
text_view_tz
.
text
=
formatter
.
format
(
ZonedDateTime
.
of
(
timeNow
,
zoneId
))
}
text_view_message
.
setOnClickListener
{
toDirectMessage
(
chatRoom
=
chatRoom
)
}
image_view_message
.
setOnClickListener
{
toDirectMessage
(
chatRoom
=
chatRoom
)
}
}
private
fun
toDirectMessage
(
chatRoom
:
ChatRoom
?)
{
chatRoom
?.
let
{
c
->
startActivity
(
chatRoomIntent
(
chatRoomId
=
c
.
id
,
chatRoomName
=
c
.
name
,
chatRoomType
=
c
.
type
.
toString
(),
isReadOnly
=
c
.
readonly
.
orFalse
(),
chatRoomLastSeen
=
c
.
lastSeen
?:
0
,
isSubscribed
=
c
.
open
,
isCreator
=
false
,
isFavorite
=
c
.
favorite
)
)
}
}
}
app/src/main/res/drawable/ic_message_24dp.xml
0 → 100644
View file @
33f99bec
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"20"
android:viewportHeight=
"20"
>
<path
android:fillColor=
"#1d74f5"
android:fillType=
"evenOdd"
android:pathData=
"M10.11,16.546h-0.183c-4.329,0 -7.47,-2.753 -7.47,-6.546 0,-3.61 2.942,-6.547 6.56,-6.547 3.616,0 6.56,2.937 6.56,6.547 0,0.59 -0.276,1.18 -0.567,1.803 -0.1,0.218 -0.2,0.433 -0.278,0.618 -0.756,1.626 0.731,2.41 1.364,2.743 0.098,0.051 0.224,0.117 0.326,0.178 -0.416,0.478 -1.814,1.22 -6.312,1.204m6.666,-2.667c-0.895,-0.473 -0.852,-0.567 -0.71,-0.875 0.081,-0.193 0.172,-0.389 0.264,-0.587 0.33,-0.705 0.703,-1.505 0.703,-2.417 0,-4.412 -3.597,-8 -8.017,-8S1,5.588 1,10c0,4.635 3.755,8 8.927,8h0.382c2.857,0 6.632,-0.256 7.565,-2.237 0.493,-1.046 -0.58,-1.612 -1.098,-1.884"
/>
</vector>
app/src/main/res/layout/activity_password.xml
View file @
33f99bec
...
...
@@ -6,11 +6,13 @@
android:orientation=
"vertical"
android:theme=
"@style/AppTheme"
tools:context=
".settings.password.ui.PasswordActivity"
>
<include
android:id=
"@+id/layout_app_bar"
layout=
"@layout/app_bar_password"
/>
<FrameLayout
android:id=
"@+id/fragment_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</LinearLayout>
\ No newline at end of file
</LinearLayout>
app/src/main/res/layout/activity_user_details.xml
0 → 100644
View file @
33f99bec
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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=
"match_parent"
android:background=
"@android:color/white"
>
<com.google.android.material.appbar.AppBarLayout
android:id=
"@+id/appBarLayout"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:background=
"@android:color/white"
app:elevation=
"0dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
>
<androidx.appcompat.widget.Toolbar
android:id=
"@+id/toolbar"
android:layout_width=
"match_parent"
android:layout_height=
"?attr/actionBarSize"
app:elevation=
"0dp"
app:layout_scrollFlags=
"scroll|enterAlways"
app:navigationIcon=
"?android:attr/homeAsUpIndicator"
app:popupTheme=
"@style/ThemeOverlay.AppCompat.Light"
/>
</com.google.android.material.appbar.AppBarLayout>
<ImageView
android:id=
"@+id/image_view_avatar"
android:layout_width=
"90dp"
android:layout_height=
"90dp"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"32dp"
android:layout_marginEnd=
"16dp"
app:layout_constraintBottom_toBottomOf=
"@+id/appBarLayout"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/appBarLayout"
tools:srcCompat=
"@tools:sample/avatars[6]"
/>
<ImageView
android:id=
"@+id/image_view_message"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:layout_marginTop=
"24dp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_view_username"
app:srcCompat=
"@drawable/ic_message_24dp"
/>
<TextView
android:id=
"@+id/text_view_message"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Message"
android:textSize=
"18sp"
android:textColor=
"#1d74f5"
app:layout_constraintEnd_toEndOf=
"@+id/image_view_message"
app:layout_constraintStart_toStartOf=
"@+id/image_view_message"
app:layout_constraintTop_toBottomOf=
"@+id/image_view_message"
/>
<TextView
android:id=
"@+id/text_view_name"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"8dp"
android:layout_marginEnd=
"16dp"
android:fontFamily=
"sans-serif-medium"
android:textColor=
"@android:color/black"
android:textSize=
"18sp"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/image_view_avatar"
tools:text=
"Karem Flusser"
/>
<TextView
android:id=
"@+id/text_view_username"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginEnd=
"16dp"
android:textColor=
"@color/darkGray"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_view_name"
tools:text=
"karem.flusser"
/>
<TextView
android:id=
"@+id/textView3"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"24dp"
android:text=
"Status"
android:textColor=
"@color/darkGray"
android:textSize=
"14sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_view_message"
/>
<TextView
android:id=
"@+id/text_view_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:textColor=
"@android:color/black"
android:textSize=
"16sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView3"
tools:text=
"Online"
/>
<TextView
android:id=
"@+id/textView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"16dp"
android:text=
"Timezone"
android:textColor=
"@color/darkGray"
android:textSize=
"14sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/text_view_status"
/>
<TextView
android:id=
"@+id/text_view_tz"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:textColor=
"@android:color/black"
android:textSize=
"16sp"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/textView"
tools:text=
"(UTC-2) 11:08 AM"
/>
<androidx.constraintlayout.widget.Group
android:id=
"@+id/group_message"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
app:constraint_referenced_ids=
"text_view_message,image_view_message"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment