diff options
Diffstat (limited to 'app')
3 files changed, 8 insertions, 6 deletions
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<CookieModel> by lazy { cookies() } var titleDisposable: Disposable? = null var refreshObservable = PublishSubject.create<Unit>().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<AccountItem, AccountItem.ViewHolder>() { constructor() : this(-1L, "") + constructor(cookie: CookieModel) : this(cookie.id, cookie.name ?: "") override fun getType(): Int = R.id.item_account |