Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-client-android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-client-android
Commits
dcf11935
Commit
dcf11935
authored
3 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
home: handle empty conversation list
Change-Id: I7b5eb1266c1208509726590bf753dfeddca03f84
parent
02e8b5e9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ring-android/app/src/main/java/cx/ring/client/HomeActivity.kt
+14
-29
14 additions, 29 deletions
...-android/app/src/main/java/cx/ring/client/HomeActivity.kt
with
14 additions
and
29 deletions
ring-android/app/src/main/java/cx/ring/client/HomeActivity.kt
+
14
−
29
View file @
dcf11935
...
...
@@ -317,12 +317,7 @@ class HomeActivity : AppCompatActivity(), NavigationBarView.OnItemSelectedListen
mBinding
!!
.
spinnerToolbar
.
setSelection
(
0
)
}
}
?:
run
{
AccountSpinnerAdapter
(
this
@HomeActivity
,
ArrayList
(
accounts
),
mDisposable
,
mAccountService
).
apply
{
AccountSpinnerAdapter
(
this
@HomeActivity
,
ArrayList
(
accounts
),
mDisposable
,
mAccountService
).
apply
{
mAccountAdapter
=
this
setNotifyOnChange
(
false
)
mBinding
?.
spinnerToolbar
?.
adapter
=
this
...
...
@@ -350,21 +345,18 @@ class HomeActivity : AppCompatActivity(), NavigationBarView.OnItemSelectedListen
.
debounce
(
10
,
TimeUnit
.
SECONDS
)
.
observeOn
(
Schedulers
.
computation
())
.
switchMapSingle
{
conversations
->
Single
.
zip
(
conversations
.
mapTo
(
ArrayList
(
conversations
.
size
))
{
c
->
mContactService
.
getLoadedConversation
(
c
)
if
(
conversations
.
isEmpty
())
Single
.
just
(
emptyArray
<
Any
>())
else
Single
.
zip
(
conversations
.
mapTo
(
ArrayList
(
conversations
.
size
))
{
c
->
mContactService
.
getLoadedConversation
(
c
)
.
observeOn
(
Schedulers
.
computation
())
.
map
{
vm
->
Pair
(
vm
,
BitmapUtils
.
drawableToBitmap
(
AvatarDrawable
.
Builder
()
.
withViewModel
(
vm
)
.
withCircleCrop
(
true
)
.
build
(
this
),
targetSize
)
)
.
map
{
vm
->
Pair
(
vm
,
BitmapUtils
.
drawableToBitmap
(
AvatarDrawable
.
Builder
()
.
withViewModel
(
vm
)
.
withCircleCrop
(
true
)
.
build
(
this
),
targetSize
))
}
})
{
obs
->
obs
}
})
{
obs
->
obs
}
}
.
subscribe
({
conversations
->
setShareShortcuts
(
conversations
)
})
{
e
->
Log
.
e
(
TAG
,
"Error generating conversation shortcuts"
,
e
)
})
...
...
@@ -809,7 +801,7 @@ class HomeActivity : AppCompatActivity(), NavigationBarView.OnItemSelectedListen
val
switchButton
:
SwitchButton
get
()
=
mBinding
!!
.
accountSwitch
private
fun
setShareShortcuts
(
conversations
:
Array
<
*
>)
{
private
fun
setShareShortcuts
(
conversations
:
Array
<
Any
>)
{
var
maxCount
=
ShortcutManagerCompat
.
getMaxShortcutCountPerActivity
(
this
)
if
(
maxCount
==
0
)
maxCount
=
4
...
...
@@ -840,15 +832,8 @@ class HomeActivity : AppCompatActivity(), NavigationBarView.OnItemSelectedListen
.
setLongLived
(
true
)
.
setIcon
(
icon
)
.
setCategories
(
setOf
(
CONVERSATIONS_CATEGORY
))
.
setIntent
(
Intent
(
Intent
.
ACTION_SEND
,
android
.
net
.
Uri
.
EMPTY
,
this
,
HomeActivity
::
class
.
java
)
.
putExtras
(
path
.
toBundle
())
)
.
setIntent
(
Intent
(
Intent
.
ACTION_SEND
,
android
.
net
.
Uri
.
EMPTY
,
this
,
HomeActivity
::
class
.
java
)
.
putExtras
(
path
.
toBundle
()))
.
build
()
shortcutInfoList
.
add
(
shortcutInfo
)
if
(
shortcutInfoList
.
size
==
maxCount
)
break
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment