Skip to content

Commit

Permalink
update deps metaapp
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilveirah committed Aug 13, 2024
1 parent 5a5a1b5 commit 69b3c84
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 64 deletions.
8 changes: 4 additions & 4 deletions samples/metaapp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ dependencies {

// kotlin
implementation(Libs.kotlinxCoroutinesCore)
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.21")
implementation("org.jetbrains.kotlin:kotlin-reflect:1.9.24")

implementation(project(":cmplibrary"))

Expand All @@ -112,12 +112,12 @@ dependencies {
implementation(Libs.vectorDrawable)
implementation(Libs.androidxLifLivedata)
implementation(Libs.androidxLifViewModel)
implementation("androidx.fragment:fragment-ktx:1.3.5")
implementation("androidx.core:core-ktx:1.5.0") // ext drawable
implementation("androidx.fragment:fragment-ktx:1.8.2")
implementation("androidx.core:core-ktx:1.13.1") // ext drawable
implementation("io.github.g00fy2:versioncompare:1.4.1")

// TV
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.appcompat:appcompat:1.7.0")
implementation("androidx.leanback:leanback:1.0.0")

// Koin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
package com.sourcepointmeta.metaapp.logger

import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.text.style.* // ktlint-disable
import android.util.Log
import android.widget.TextView
import androidx.annotation.ColorInt
import androidx.core.content.ContextCompat
import com.sourcepoint.cmplibrary.exception.Logger
import com.sourcepointmeta.metaapp.data.localdatasource.LocalDataSource
import com.sourcepointmeta.metaapp.data.localdatasource.MetaLog
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import org.json.JSONObject
import java.util.* // ktlint-disable

@OptIn(DelicateCoroutinesApi::class)
internal class LoggerImpl(
private val propertyName: String,
private val ds: LocalDataSource,
Expand Down Expand Up @@ -265,51 +261,3 @@ internal class LoggerImpl(
}
}
}

fun TextView.setColorOfSubstring(substring: String, color: Int) {
try {
val spannable = android.text.SpannableString(text)
val start = text.indexOf(substring)
spannable.setSpan(
ForegroundColorSpan(ContextCompat.getColor(context, color)),
start,
start + substring.length,
SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE
)
text = spannable
} catch (e: Exception) {
e.printStackTrace()
}
}

fun SpannableStringBuilder.spanText(span: Any): SpannableStringBuilder {
setSpan(span, 0, length, SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE)
return this
}

private fun String.toSpannable() = SpannableStringBuilder(this)

fun String.foregroundColor(@ColorInt color: Int): SpannableStringBuilder {
val span = ForegroundColorSpan(color)
return toSpannable().spanText(span)
}

fun String.backgroundColor(@ColorInt color: Int): SpannableStringBuilder {
val span = BackgroundColorSpan(color)
return toSpannable().spanText(span)
}

fun String.relativeSize(size: Float): SpannableStringBuilder {
val span = RelativeSizeSpan(size)
return toSpannable().spanText(span)
}

fun String.supserscript(): SpannableStringBuilder {
val span = SuperscriptSpan()
return toSpannable().spanText(span)
}

fun String.strike(): SpannableStringBuilder {
val span = StrikethroughSpan()
return toSpannable().spanText(span)
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ fun FullWidthDetailsOverviewRowPresenter.setTransitionListener(
}

fun DetailsOverviewRow.arrayObjectAdapter(vararg pairs: Pair<Long, String>): DetailsOverviewRow {
val arr = ArrayObjectAdapter()
pairs.fold(ArrayObjectAdapter()) { acc, elem -> acc.apply { add(elem) } }
actionsAdapter =
pairs.fold(ArrayObjectAdapter()) { acc, elem -> acc.apply { add(Action(elem.first, elem.second)) } }
Expand Down Expand Up @@ -135,10 +134,10 @@ fun Activity.updatePropertyListAndGoBack() {
fun DemoEventFragmentTv.bounceEventAndSelectFirstElement() {
MainScope().launch {
withContext(Dispatchers.Default) {
channel.send(0)
flow.emit(0)
}
channel
.asFlow()

flow
.debounce(300)
.collect {
setSelectedPosition(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import com.sourcepointmeta.metaapp.ui.component.LogItem
import com.sourcepointmeta.metaapp.ui.eventlogs.LogViewModel
import com.sourcepointmeta.metaapp.ui.eventlogs.composeEmail
import com.sourcepointmeta.metaapp.ui.eventlogs.createFileWithContent
import kotlinx.coroutines.channels.BroadcastChannel
import kotlinx.coroutines.flow.MutableStateFlow
import org.koin.androidx.viewmodel.ext.android.viewModel

class DemoEventFragmentTv : VerticalGridSupportFragment(), OnItemViewClickedListener {
Expand All @@ -33,7 +33,7 @@ class DemoEventFragmentTv : VerticalGridSupportFragment(), OnItemViewClickedList
}
}

val channel = BroadcastChannel<Int>(1)
val flow = MutableStateFlow(1)

var pmListener: ((CampaignType) -> Unit)? = null
var flmListener: (() -> Unit)? = null
Expand Down

0 comments on commit 69b3c84

Please sign in to comment.