From 130b0ebf98817fd490645fc954d096f7b9803017 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 20 Aug 2017 14:38:50 -0700 Subject: Update back press and changelog --- .../com/pitchedapps/frost/activities/LoginActivity.kt | 18 +++++++++++------- app/src/main/res/xml/frost_changelog.xml | 3 ++- 2 files changed, 13 insertions(+), 8 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> { 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?, 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 diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml index 32227578..edfadce6 100644 --- a/app/src/main/res/xml/frost_changelog.xml +++ b/app/src/main/res/xml/frost_changelog.xml @@ -17,7 +17,8 @@ - + + -- cgit v1.2.3