mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-10 04:52:38 +01:00
Inject tab items
This commit is contained in:
parent
8b233b2629
commit
7a2026fb3f
@ -85,7 +85,7 @@ class TabCustomizerActivity : BaseActivity() {
|
|||||||
val remaining = FbItem.values().filter { it.name[0] != '_' }.toMutableList()
|
val remaining = FbItem.values().filter { it.name[0] != '_' }.toMutableList()
|
||||||
remaining.removeAll(tabs)
|
remaining.removeAll(tabs)
|
||||||
tabs.addAll(remaining)
|
tabs.addAll(remaining)
|
||||||
adapter.set(tabs.map(::TabIItem))
|
adapter.set(tabs.map { TabIItem(it, themeProvider) })
|
||||||
|
|
||||||
bindSwapper(adapter, tabRecycler)
|
bindSwapper(adapter, tabRecycler)
|
||||||
|
|
||||||
|
@ -49,7 +49,6 @@ import kotlinx.coroutines.SupervisorJob
|
|||||||
import kotlinx.coroutines.channels.ReceiveChannel
|
import kotlinx.coroutines.channels.ReceiveChannel
|
||||||
import kotlinx.coroutines.isActive
|
import kotlinx.coroutines.isActive
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.koin.android.ext.android.inject
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.coroutines.CoroutineContext
|
import kotlin.coroutines.CoroutineContext
|
||||||
|
|
||||||
@ -90,11 +89,17 @@ abstract class BaseFragment :
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var mainContract: MainActivityContract
|
protected lateinit var mainContract: MainActivityContract
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected lateinit var fbCookie: FbCookie
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected lateinit var prefs: Prefs
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected lateinit var themeProvider: ThemeProvider
|
||||||
|
|
||||||
protected val fbCookie: FbCookie by inject()
|
|
||||||
protected val prefs: Prefs by inject()
|
|
||||||
protected val themeProvider: ThemeProvider by inject()
|
|
||||||
open lateinit var job: Job
|
open lateinit var job: Job
|
||||||
override val coroutineContext: CoroutineContext
|
override val coroutineContext: CoroutineContext
|
||||||
get() = ContextHelper.dispatcher + job
|
get() = ContextHelper.dispatcher + job
|
||||||
|
@ -30,24 +30,23 @@ import com.mikepenz.fastadapter.drag.IDraggable
|
|||||||
import com.pitchedapps.frost.R
|
import com.pitchedapps.frost.R
|
||||||
import com.pitchedapps.frost.facebook.FbItem
|
import com.pitchedapps.frost.facebook.FbItem
|
||||||
import com.pitchedapps.frost.injectors.ThemeProvider
|
import com.pitchedapps.frost.injectors.ThemeProvider
|
||||||
import org.koin.core.component.KoinComponent
|
|
||||||
import org.koin.core.component.inject
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Allan Wang on 26/11/17.
|
* Created by Allan Wang on 26/11/17.
|
||||||
*/
|
*/
|
||||||
class TabIItem(val item: FbItem) :
|
class TabIItem(val item: FbItem, private val themeProvider: ThemeProvider) :
|
||||||
KauIItem<TabIItem.ViewHolder>(
|
KauIItem<TabIItem.ViewHolder>(
|
||||||
R.layout.iitem_tab_preview,
|
R.layout.iitem_tab_preview,
|
||||||
{ ViewHolder(it) }
|
{ ViewHolder(it, themeProvider) }
|
||||||
),
|
),
|
||||||
IDraggable {
|
IDraggable {
|
||||||
|
|
||||||
override val isDraggable: Boolean = true
|
override val isDraggable: Boolean = true
|
||||||
|
|
||||||
class ViewHolder(itemView: View) : FastAdapter.ViewHolder<TabIItem>(itemView), KoinComponent {
|
class ViewHolder(
|
||||||
|
itemView: View,
|
||||||
private val themeProvider: ThemeProvider by inject()
|
private val themeProvider: ThemeProvider
|
||||||
|
) : FastAdapter.ViewHolder<TabIItem>(itemView) {
|
||||||
|
|
||||||
val image: ImageView by bindView(R.id.image)
|
val image: ImageView by bindView(R.id.image)
|
||||||
val text: TextView by bindView(R.id.text)
|
val text: TextView by bindView(R.id.text)
|
||||||
|
@ -21,17 +21,20 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import com.pitchedapps.frost.prefs.Prefs
|
import com.pitchedapps.frost.prefs.Prefs
|
||||||
import com.pitchedapps.frost.utils.L
|
import com.pitchedapps.frost.utils.L
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import org.koin.core.component.KoinComponent
|
import org.koin.core.component.KoinComponent
|
||||||
import org.koin.core.component.inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Allan Wang on 2017-05-31.
|
* Created by Allan Wang on 2017-05-31.
|
||||||
*
|
*
|
||||||
* Receiver that is triggered whenever the app updates so it can bind the notifications again
|
* Receiver that is triggered whenever the app updates so it can bind the notifications again
|
||||||
*/
|
*/
|
||||||
|
@AndroidEntryPoint
|
||||||
class UpdateReceiver : BroadcastReceiver(), KoinComponent {
|
class UpdateReceiver : BroadcastReceiver(), KoinComponent {
|
||||||
|
|
||||||
private val prefs: Prefs by inject()
|
@Inject
|
||||||
|
lateinit var prefs: Prefs
|
||||||
|
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
if (intent.action != Intent.ACTION_MY_PACKAGE_REPLACED) return
|
if (intent.action != Intent.ACTION_MY_PACKAGE_REPLACED) return
|
||||||
|
@ -48,12 +48,14 @@ import com.pitchedapps.frost.injectors.ThemeProvider
|
|||||||
import com.pitchedapps.frost.prefs.Prefs
|
import com.pitchedapps.frost.prefs.Prefs
|
||||||
import com.pitchedapps.frost.utils.L
|
import com.pitchedapps.frost.utils.L
|
||||||
import com.pitchedapps.frost.utils.frostDownload
|
import com.pitchedapps.frost.utils.frostDownload
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import org.koin.core.component.KoinComponent
|
import org.koin.core.component.KoinComponent
|
||||||
import org.koin.core.component.inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Allan Wang on 2017-10-13.
|
* Created by Allan Wang on 2017-10-13.
|
||||||
*/
|
*/
|
||||||
|
@AndroidEntryPoint
|
||||||
class FrostVideoViewer @JvmOverloads constructor(
|
class FrostVideoViewer @JvmOverloads constructor(
|
||||||
context: Context,
|
context: Context,
|
||||||
attrs: AttributeSet? = null,
|
attrs: AttributeSet? = null,
|
||||||
@ -88,9 +90,14 @@ class FrostVideoViewer @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val prefs: Prefs by inject()
|
@Inject
|
||||||
private val themeProvider: ThemeProvider by inject()
|
lateinit var prefs: Prefs
|
||||||
private val cookieDao: CookieDao by inject()
|
|
||||||
|
@Inject
|
||||||
|
lateinit var themeProvider: ThemeProvider
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
lateinit var cookieDao: CookieDao
|
||||||
|
|
||||||
private val binding: ViewVideoBinding =
|
private val binding: ViewVideoBinding =
|
||||||
ViewVideoBinding.inflate(LayoutInflater.from(context), this, true)
|
ViewVideoBinding.inflate(LayoutInflater.from(context), this, true)
|
||||||
|
Loading…
Reference in New Issue
Block a user