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
dd508b7a
Commit
dd508b7a
authored
Sep 01, 2017
by
Leonardo Aramaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleaned up code and change the asset url from where to fetch the logo
for the server button
parent
d21901cb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
11 deletions
+18
-11
MainActivity.java
.../main/java/chat/rocket/android/activity/MainActivity.java
+3
-3
MainPresenter.java
...main/java/chat/rocket/android/activity/MainPresenter.java
+15
-8
No files found.
app/src/main/java/chat/rocket/android/activity/MainActivity.java
View file @
dd508b7a
...
@@ -11,7 +11,6 @@ import android.view.View;
...
@@ -11,7 +11,6 @@ import android.view.View;
import
android.widget.Button
;
import
android.widget.Button
;
import
android.widget.LinearLayout
;
import
android.widget.LinearLayout
;
import
com.facebook.drawee.backends.pipeline.Fresco
;
import
com.facebook.drawee.view.SimpleDraweeView
;
import
com.facebook.drawee.view.SimpleDraweeView
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,6 +26,7 @@ import chat.rocket.android.helper.KeyboardHelper;
...
@@ -27,6 +26,7 @@ import chat.rocket.android.helper.KeyboardHelper;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.service.ConnectivityManager
;
import
chat.rocket.android.widget.RoomToolbar
;
import
chat.rocket.android.widget.RoomToolbar
;
import
chat.rocket.android.widget.helper.AvatarHelper
;
import
chat.rocket.android.widget.helper.AvatarHelper
;
import
chat.rocket.android.widget.helper.FrescoHelper
;
import
chat.rocket.core.interactors.CanCreateRoomInteractor
;
import
chat.rocket.core.interactors.CanCreateRoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.interactors.SessionInteractor
;
import
chat.rocket.core.interactors.SessionInteractor
;
...
@@ -271,8 +271,8 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
...
@@ -271,8 +271,8 @@ public class MainActivity extends AbstractAuthedActivity implements MainContract
Drawable
drawable
=
AvatarHelper
.
INSTANCE
.
getTextDrawable
(
server
.
first
,
this
);
Drawable
drawable
=
AvatarHelper
.
INSTANCE
.
getTextDrawable
(
server
.
first
,
this
);
serverButton
.
getHierarchy
().
setPlaceholderImage
(
drawable
);
FrescoHelper
.
INSTANCE
.
loadImage
(
serverButton
,
server
.
second
,
drawable
);
serverButton
.
setController
(
Fresco
.
newDraweeControllerBuilder
().
setUri
(
server
.
second
).
setAutoPlayAnimations
(
true
).
build
());
serverListContainer
.
addView
(
serverButton
,
serverCount
-
1
);
serverListContainer
.
addView
(
serverButton
,
serverCount
-
1
);
serverListContainer
.
requestLayout
();
serverListContainer
.
requestLayout
();
}
}
...
...
app/src/main/java/chat/rocket/android/activity/MainPresenter.java
View file @
dd508b7a
...
@@ -4,9 +4,11 @@ import android.support.annotation.NonNull;
...
@@ -4,9 +4,11 @@ import android.support.annotation.NonNull;
import
com.hadisatrio.optional.Optional
;
import
com.hadisatrio.optional.Optional
;
import
org.j
etbrains.annotations.NotNull
;
import
org.j
son.JSONException
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.util.List
;
import
chat.rocket.android.BackgroundLooper
;
import
chat.rocket.android.BackgroundLooper
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.RocketChatCache
;
import
chat.rocket.android.api.MethodCallHelper
;
import
chat.rocket.android.api.MethodCallHelper
;
...
@@ -20,6 +22,7 @@ import chat.rocket.core.PublicSettingsConstants;
...
@@ -20,6 +22,7 @@ import chat.rocket.core.PublicSettingsConstants;
import
chat.rocket.core.interactors.CanCreateRoomInteractor
;
import
chat.rocket.core.interactors.CanCreateRoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.interactors.RoomInteractor
;
import
chat.rocket.core.interactors.SessionInteractor
;
import
chat.rocket.core.interactors.SessionInteractor
;
import
chat.rocket.core.models.PublicSetting
;
import
chat.rocket.core.models.Session
;
import
chat.rocket.core.models.Session
;
import
chat.rocket.core.models.User
;
import
chat.rocket.core.models.User
;
import
chat.rocket.core.repositories.PublicSettingRepository
;
import
chat.rocket.core.repositories.PublicSettingRepository
;
...
@@ -64,15 +67,11 @@ public class MainPresenter extends BasePresenter<MainContract.View>
...
@@ -64,15 +67,11 @@ public class MainPresenter extends BasePresenter<MainContract.View>
}
}
@Override
@Override
public
void
loadSignedInServers
(
@No
t
Null
String
hostname
)
{
public
void
loadSignedInServers
(
@No
n
Null
String
hostname
)
{
final
Disposable
disposable
=
publicSettingRepository
.
getById
(
PublicSettingsConstants
.
Assets
.
TILE_144
)
final
Disposable
disposable
=
publicSettingRepository
.
getById
(
PublicSettingsConstants
.
Assets
.
LOGO
)
.
filter
(
Optional:
:
isPresent
)
.
filter
(
Optional:
:
isPresent
)
.
map
(
Optional:
:
get
)
.
map
(
Optional:
:
get
)
.
map
(
publicSetting
->
{
.
map
(
setting
->
getServerList
(
hostname
,
setting
))
JSONObject
jsonObject
=
new
JSONObject
(
publicSetting
.
getValue
());
rocketChatCache
.
addHostname
(
hostname
,
jsonObject
.
optString
(
"defaultUrl"
));
return
rocketChatCache
.
getServerList
();
})
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
subscribeOn
(
AndroidSchedulers
.
from
(
BackgroundLooper
.
get
()))
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
.
subscribe
(
...
@@ -134,6 +133,14 @@ public class MainPresenter extends BasePresenter<MainContract.View>
...
@@ -134,6 +133,14 @@ public class MainPresenter extends BasePresenter<MainContract.View>
addSubscription
(
subscription
);
addSubscription
(
subscription
);
}
}
private
List
<
Pair
<
String
,
String
>>
getServerList
(
String
hostname
,
PublicSetting
publicSetting
)
throws
JSONException
{
JSONObject
jsonObject
=
new
JSONObject
(
publicSetting
.
getValue
());
String
logoUrl
=
(
jsonObject
.
has
(
"url"
))
?
jsonObject
.
optString
(
"url"
)
:
jsonObject
.
optString
(
"defaultUrl"
);
rocketChatCache
.
addHostname
(
hostname
,
logoUrl
);
return
rocketChatCache
.
getServerList
();
}
private
void
openRoom
()
{
private
void
openRoom
()
{
String
hostname
=
rocketChatCache
.
getSelectedServerHostname
();
String
hostname
=
rocketChatCache
.
getSelectedServerHostname
();
String
roomId
=
rocketChatCache
.
getSelectedRoomId
();
String
roomId
=
rocketChatCache
.
getSelectedRoomId
();
...
...
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