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
635b6c56
Commit
635b6c56
authored
Feb 23, 2018
by
Syam Sundar K
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Observables fix in ProfileFragment
parent
4d2c2564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
42 deletions
+15
-42
ProfileFragment.kt
...in/java/chat/rocket/android/profile/ui/ProfileFragment.kt
+15
-42
No files found.
app/src/main/java/chat/rocket/android/profile/ui/ProfileFragment.kt
View file @
635b6c56
...
...
@@ -128,48 +128,21 @@ class ProfileFragment : Fragment(), ProfileView, ActionMode.Callback {
}
private
fun
listenToChanges
()
{
// val list = Arrays.asList(Observable.just(text_name), Observable.just(text_username),Observable.just(text_email), Observable.just(text_avatar_url))
// Observables.combineLatest(
// text_name.asObservable(),
// text_username.asObservable(),
// text_email.asObservable(),
// text_avatar_url.asObservable()
// )
// // combine function
// { text_name, text_username, text_email, text_avatar_url->
// // verify data and return a boolean
// return@combineLatest text_name.toString() != currentName || text_username !=currentUsername || text_email != currentEmail || text_avatar_url != currentAvatar
// }.subscribe({ isValid->
// if (isValid) {
// startActionMode()
// } else {
// finishActionMode()
// }
// })
// listOfObservables.subscribe({ t ->
// if (t.first.toString() != currentName || t.second.toString() != currentUsername) {
// startActionMode()
// } else {
// finishActionMode()
// }
// })
Observables
.
combineLatest
(
text_name
.
asObservable
(),
text_username
.
asObservable
()).
subscribe
({
t
->
if
(
t
.
first
.
toString
()
!=
currentName
||
t
.
second
.
toString
()
!=
currentUsername
)
{
startActionMode
()
}
else
{
finishActionMode
()
}
})
Observables
.
combineLatest
(
text_email
.
asObservable
(),
text_avatar_url
.
asObservable
()).
subscribe
({
t
->
if
(
t
.
first
.
toString
()
!=
currentEmail
||
(
t
.
second
.
toString
()
!=
""
&&
t
.
second
.
toString
()
!=
currentAvatar
)
)
{
startActionMode
()
}
else
{
finishActionMode
()
}
})
Observables
.
combineLatest
(
text_name
.
asObservable
(),
text_username
.
asObservable
(),
text_email
.
asObservable
(),
text_avatar_url
.
asObservable
()
)
{
text_name
,
text_username
,
text_email
,
text_avatar_url
->
return
@combineLatest
(
text_name
.
toString
()
!=
currentName
||
text_username
.
toString
()
!=
currentUsername
||
text_email
.
toString
()
!=
currentEmail
||
(
text_avatar_url
.
toString
()!=
""
&&
text_avatar_url
.
toString
()!=
currentAvatar
))
}.
subscribe
({
isValid
->
if
(
isValid
)
{
startActionMode
()
}
else
{
finishActionMode
()
}
})
}
private
fun
startActionMode
()
{
...
...
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