mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
refactor duplicated code
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
48c7ccb4b0
commit
eaab887765
@ -118,42 +118,32 @@ class MainActivity : BaseActivity(), ActionBarProvider {
|
|||||||
if (userUtils.anyUserExists()) {
|
if (userUtils.anyUserExists()) {
|
||||||
setDefaultRootController()
|
setDefaultRootController()
|
||||||
} else {
|
} else {
|
||||||
if (!TextUtils.isEmpty(resources.getString(R.string.weblogin_url))) {
|
launchLoginScreen()
|
||||||
router!!.pushController(
|
|
||||||
RouterTransaction.with(
|
|
||||||
WebViewLoginController(resources.getString(R.string.weblogin_url), false)
|
|
||||||
)
|
|
||||||
.pushChangeHandler(HorizontalChangeHandler())
|
|
||||||
.popChangeHandler(HorizontalChangeHandler())
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
router!!.setRoot(
|
|
||||||
RouterTransaction.with(ServerSelectionController())
|
|
||||||
.pushChangeHandler(HorizontalChangeHandler())
|
|
||||||
.popChangeHandler(HorizontalChangeHandler())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!TextUtils.isEmpty(resources.getString(R.string.weblogin_url))) {
|
launchLoginScreen()
|
||||||
router!!.pushController(
|
|
||||||
RouterTransaction.with(
|
|
||||||
WebViewLoginController(resources.getString(R.string.weblogin_url), false)
|
|
||||||
)
|
|
||||||
.pushChangeHandler(HorizontalChangeHandler())
|
|
||||||
.popChangeHandler(HorizontalChangeHandler())
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
router!!.setRoot(
|
|
||||||
RouterTransaction.with(ServerSelectionController())
|
|
||||||
.pushChangeHandler(HorizontalChangeHandler())
|
|
||||||
.popChangeHandler(HorizontalChangeHandler())
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun launchLoginScreen() {
|
||||||
|
if (!TextUtils.isEmpty(resources.getString(R.string.weblogin_url))) {
|
||||||
|
router!!.pushController(
|
||||||
|
RouterTransaction.with(
|
||||||
|
WebViewLoginController(resources.getString(R.string.weblogin_url), false)
|
||||||
|
)
|
||||||
|
.pushChangeHandler(HorizontalChangeHandler())
|
||||||
|
.popChangeHandler(HorizontalChangeHandler())
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
router!!.setRoot(
|
||||||
|
RouterTransaction.with(ServerSelectionController())
|
||||||
|
.pushChangeHandler(HorizontalChangeHandler())
|
||||||
|
.popChangeHandler(HorizontalChangeHandler())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
Log.d(TAG, "onStart: Activity: " + System.identityHashCode(this).toString())
|
Log.d(TAG, "onStart: Activity: " + System.identityHashCode(this).toString())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user