aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt19
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/StartActivity.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/WebOverlayActivity.kt3
3 files changed, 11 insertions, 19 deletions
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