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
9cb060ab
Commit
9cb060ab
authored
Jun 05, 2018
by
Lucio Maciel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash on AuthenticationActivity
parent
a6a58c8f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
AuthenticationActivity.kt
...ocket/android/authentication/ui/AuthenticationActivity.kt
+11
-8
Ui.kt
app/src/main/java/chat/rocket/android/util/extensions/Ui.kt
+9
-4
No files found.
app/src/main/java/chat/rocket/android/authentication/ui/AuthenticationActivity.kt
View file @
9cb060ab
...
...
@@ -32,17 +32,25 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
setContentView
(
R
.
layout
.
activity_authentication
)
setTheme
(
R
.
style
.
AuthenticationTheme
)
super
.
onCreate
(
savedInstanceState
)
}
override
fun
onStart
()
{
super
.
onStart
()
val
deepLinkInfo
=
intent
.
getLoginDeepLinkInfo
()
launch
(
UI
+
job
)
{
val
newServer
=
intent
.
getBooleanExtra
(
INTENT_ADD_NEW_SERVER
,
false
)
// if we got authenticateWithDeepLink information, pass true to newServer also
presenter
.
loadCredentials
(
newServer
||
deepLinkInfo
!=
null
)
{
authenticated
->
if
(!
authenticated
)
{
showServerInput
(
savedInstanceState
,
deepLinkInfo
)
showServerInput
(
deepLinkInfo
)
}
}
}
}
override
fun
onStop
()
{
job
.
cancel
()
super
.
onStop
()
}
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
...
...
@@ -53,17 +61,12 @@ class AuthenticationActivity : AppCompatActivity(), HasSupportFragmentInjector {
}
}
override
fun
onDestroy
()
{
job
.
cancel
()
super
.
onDestroy
()
}
override
fun
supportFragmentInjector
():
AndroidInjector
<
Fragment
>
{
return
fragmentDispatchingAndroidInjector
}
fun
showServerInput
(
savedInstanceState
:
Bundle
?,
deepLinkInfo
:
LoginDeepLinkInfo
?)
{
addFragment
(
"ServerFragment"
,
R
.
id
.
fragment_container
)
{
fun
showServerInput
(
deepLinkInfo
:
LoginDeepLinkInfo
?)
{
addFragment
(
"ServerFragment"
,
R
.
id
.
fragment_container
,
allowStateLoss
=
true
)
{
ServerFragment
.
newInstance
(
deepLinkInfo
)
}
}
...
...
app/src/main/java/chat/rocket/android/util/extensions/Ui.kt
View file @
9cb060ab
...
...
@@ -31,11 +31,16 @@ fun View.isVisible(): Boolean {
fun
ViewGroup
.
inflate
(
@LayoutRes
resource
:
Int
,
attachToRoot
:
Boolean
=
false
):
View
=
LayoutInflater
.
from
(
context
).
inflate
(
resource
,
this
,
attachToRoot
)
fun
AppCompatActivity
.
addFragment
(
tag
:
String
,
layoutId
:
Int
,
newInstance
:
()
->
Fragment
)
{
fun
AppCompatActivity
.
addFragment
(
tag
:
String
,
layoutId
:
Int
,
allowStateLoss
:
Boolean
=
false
,
newInstance
:
()
->
Fragment
)
{
val
fragment
=
supportFragmentManager
.
findFragmentByTag
(
tag
)
?:
newInstance
()
supportFragmentManager
.
beginTransaction
()
val
transaction
=
supportFragmentManager
.
beginTransaction
()
.
replace
(
layoutId
,
fragment
,
tag
)
.
commit
()
if
(
allowStateLoss
)
{
transaction
.
commitAllowingStateLoss
()
}
else
{
transaction
.
commit
()
}
}
fun
AppCompatActivity
.
addFragmentBackStack
(
...
...
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