From 768e75c535623504f972603a89d1ac7d20cd48a0 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Mon, 5 Jun 2017 23:25:31 -0700 Subject: Add fabric properties --- app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt | 6 ++---- app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt | 6 ++++-- app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'app/src/main/kotlin') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt index b9118c60..025b9001 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt @@ -41,7 +41,6 @@ class MainActivity : AppCompatActivity() { val tabs: TabLayout by bindView(R.id.tabs) lateinit var drawer: Drawer lateinit var drawerHeader: AccountHeader - val cookies: ArrayList by lazy { cookies() } var titleDisposable: Disposable? = null var refreshObservable = PublishSubject.create().observeOn(AndroidSchedulers.mainThread()) @@ -108,7 +107,7 @@ class MainActivity : AppCompatActivity() { savedInstance = savedInstanceState translucentStatusBar = false drawerHeader = accountHeader { - cookies.forEach { (id, name) -> + cookies().forEach { (id, name) -> profile(name = name ?: "") { iconUrl = PROFILE_PICTURE_URL(id) identifier = id @@ -144,10 +143,9 @@ class MainActivity : AppCompatActivity() { override fun onOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { R.id.action_settings -> { + launchNewTask(SelectorActivity::class.java, cookies()) // startActivity(Intent(this, LoginActivity::class.java)) // finish() - L.e("Settings") - throw IllegalArgumentException("Test") } R.id.action_changelog -> Changelog.show(this) R.id.action_call -> launchNewTask(LoginActivity::class.java) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt index 84e5592c..11db1a67 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/SelectorActivity.kt @@ -4,8 +4,9 @@ import android.os.Bundle import android.support.v7.app.AppCompatActivity import android.support.v7.widget.RecyclerView import butterknife.ButterKnife -import com.mikepenz.fastadapter.FastAdapter +import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter import com.pitchedapps.frost.utils.bindView +import com.pitchedapps.frost.utils.cookies import com.pitchedapps.frost.views.AccountItem /** @@ -21,6 +22,7 @@ class SelectorActivity : AppCompatActivity() { setContentView(R.layout.activity_selector) ButterKnife.bind(this) recycler.adapter = adapter - adapter.addal + adapter.add(cookies().map { AccountItem(it) }) + adapter.add(AccountItem()) // add account } } \ No newline at end of file diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt index 9d6099c6..5a17fa8f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt @@ -13,6 +13,7 @@ import com.bumptech.glide.request.RequestListener import com.bumptech.glide.request.target.Target import com.mikepenz.fastadapter.items.AbstractItem import com.pitchedapps.frost.R +import com.pitchedapps.frost.dbflow.CookieModel import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL import com.pitchedapps.frost.utils.bindView @@ -21,6 +22,7 @@ import com.pitchedapps.frost.utils.bindView */ class AccountItem(val id: Long, val name: String) : AbstractItem() { constructor() : this(-1L, "") + constructor(cookie: CookieModel) : this(cookie.id, cookie.name ?: "") override fun getType(): Int = R.id.item_account -- cgit v1.2.3