aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2017-08-20 14:38:50 -0700
committerAllan Wang <me@allanwang.ca>2017-08-20 14:38:50 -0700
commit130b0ebf98817fd490645fc954d096f7b9803017 (patch)
tree5d0cb2976f84b29235229d53301842809bc886ab /app/src/main/kotlin
parent93b179c7f86bd4c7bd0cd75754eb393cfcaf967c (diff)
downloadfrost-130b0ebf98817fd490645fc954d096f7b9803017.tar.gz
frost-130b0ebf98817fd490645fc954d096f7b9803017.tar.bz2
frost-130b0ebf98817fd490645fc954d096f7b9803017.zip
Update back press and changelogv1.4.11
Diffstat (limited to 'app/src/main/kotlin')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt18
1 files changed, 11 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
index 99f95469..9b5fdb0f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/LoginActivity.kt
@@ -62,8 +62,7 @@ class LoginActivity : BaseActivity() {
setSupportActionBar(toolbar)
setTitle(R.string.kau_login)
setFrostColors(toolbar)
- web.loadLogin({ refresh = it != 100 }) {
- cookie ->
+ web.loadLogin({ refresh = it != 100 }) { cookie ->
L.d("Login found")
FbCookie.save(cookie.id)
web.fadeOut(onFinish = {
@@ -78,8 +77,7 @@ class LoginActivity : BaseActivity() {
refresh = true
Observable.zip(SingleToObservable(profileObservable), SingleToObservable(usernameObservable),
BiFunction<Boolean, String, Pair<Boolean, String>> { foundImage, name -> Pair(foundImage, name) })
- .observeOn(AndroidSchedulers.mainThread()).subscribe {
- (foundImage, name) ->
+ .observeOn(AndroidSchedulers.mainThread()).subscribe { (foundImage, name) ->
refresh = false
if (!foundImage) {
L.e("Could not get profile photo; Invalid userId?")
@@ -92,8 +90,7 @@ class LoginActivity : BaseActivity() {
* The user may have logged into an account that is already in the database
* We will let the db handle duplicates and load it now after the new account has been saved
*/
- loadFbCookiesAsync {
- cookies ->
+ loadFbCookiesAsync { cookies ->
Handler().postDelayed({
launchNewTask(if (Showcase.intro) IntroActivity::class.java else MainActivity::class.java,
ArrayList(cookies), clearStack = true)
@@ -113,7 +110,7 @@ class LoginActivity : BaseActivity() {
}
override fun onLoadFailed(e: GlideException?, model: Any?, target: Target<Drawable>?, isFirstResource: Boolean): Boolean {
- e.logFrostAnswers( "Profile loading exception")
+ e.logFrostAnswers("Profile loading exception")
profileObservable.onSuccess(false)
return false
}
@@ -123,4 +120,11 @@ class LoginActivity : BaseActivity() {
fun loadUsername(cookie: CookieModel) {
cookie.fetchUsername { usernameObservable.onSuccess(it) }
}
+
+ override fun onBackPressed() {
+ if (web.canGoBack())
+ web.goBack()
+ else
+ super.onBackPressed()
+ }
} \ No newline at end of file