From e5a43ed02a8b8a6ae53fc0d3dbfb31e7a2374324 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sat, 3 Jun 2017 14:09:01 -0700 Subject: revert sorting cookie list --- .../main/kotlin/com/pitchedapps/frost/MainActivity.kt | 19 +++++++------------ .../kotlin/com/pitchedapps/frost/StartActivity.kt | 8 +------- .../com/pitchedapps/frost/WebOverlayActivity.kt | 3 +++ 3 files changed, 11 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt index 536deab9..920a5572 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt @@ -19,7 +19,6 @@ import co.zsmb.materialdrawerkt.draweritems.badgeable.primaryItem import co.zsmb.materialdrawerkt.draweritems.profile.profile import com.mikepenz.materialdrawer.AccountHeader import com.mikepenz.materialdrawer.Drawer -import com.pitchedapps.frost.dbflow.CookieModel import com.pitchedapps.frost.dbflow.loadFbTabs import com.pitchedapps.frost.dbflow.saveAsync import com.pitchedapps.frost.events.FbAccountEvent @@ -66,8 +65,8 @@ class MainActivity : AppCompatActivity() { } } }) - setupTabs() setupDrawer(savedInstanceState) + setupTabs() fab.setOnClickListener { view -> Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show() @@ -86,23 +85,19 @@ class MainActivity : AppCompatActivity() { savedInstance = savedInstanceState translucentStatusBar = false drawerHeader = accountHeader { - cookies.forEach { - profile(name = it.name ?: "") { - iconUrl = PROFILE_PICTURE_URL(it.id) + cookies.forEach { (id, name) -> + profile(name = name ?: "") { + iconUrl = PROFILE_PICTURE_URL(id) + identifier = id } } onProfileChanged { _, profile, current -> - if (current) WebOverlayActivity.newInstance(this@MainActivity, FbTab.PROFILE) + if (current) launchWebOverlay(FbTab.PROFILE.url) else switchUser(profile.name.text) false } } -// profile("a") { -// -// } -// if (Prefs.userId != Prefs.userIdDefault) { -// profile("a") -// } + drawerHeader.setActiveProfile(Prefs.userId) primaryItem(FbTab.ACTIVITY_LOG) primaryItem(FbTab.PHOTOS) primaryItem(FbTab.GROUPS) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt index a10372d4..ad123360 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt @@ -19,13 +19,7 @@ class StartActivity : AppCompatActivity() { loadFbCookiesAsync { cookies -> L.d("Cookies loaded ${System.currentTimeMillis()} $cookies") - val sorted = ArrayList(cookies) - val current = cookies.filter { it.id == Prefs.userId } - if (current.isNotEmpty()) { - sorted.remove(current[0]) - sorted.add(0, current[0]) - } - launchNewTask(MainActivity::class.java, sorted) + launchNewTask(MainActivity::class.java, ArrayList(cookies)) } } } \ No newline at end of file diff --git a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt index b7062ead..c81c6dea 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt @@ -42,4 +42,7 @@ class WebOverlayActivity : AppCompatActivity() { SwipeBackHelper.onDestroy(this) } + override fun onBackPressed() { + if (!frostWeb.onBackPressed()) super.onBackPressed() + } } \ No newline at end of file -- cgit v1.2.3