Compare commits
1 Commits
dev
...
feat/test_
| Author | SHA1 | Date | |
|---|---|---|---|
| 72303637d8 |
@ -386,6 +386,15 @@ dependencies {
|
||||
implementation "com.j256.ormlite:ormlite-android:${ormlite}"
|
||||
implementation "com.j256.ormlite:ormlite-core:${ormlite}"
|
||||
|
||||
implementation("io.coil-kt:coil:2.6.0") {
|
||||
exclude group: "androidx.core"
|
||||
exclude group: "androidx.lifecycle"
|
||||
}
|
||||
implementation("io.coil-kt:coil-svg:2.6.0") {
|
||||
exclude group: "androidx.core"
|
||||
exclude group: "androidx.lifecycle"
|
||||
}
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"
|
||||
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
|
||||
@ -208,20 +208,7 @@ object XapkInstaller : XApkUnZipCallback, XApkUnZipOutputFactory {
|
||||
intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, df.uri)
|
||||
}
|
||||
|
||||
tempLauncher =
|
||||
activity.registerActivityResultLauncher(ActivityResultContracts.OpenDocumentTree()) { uri ->
|
||||
if (uri != null) {
|
||||
activity.contentResolver.takePersistableUriPermission(
|
||||
uri,
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_GRANT_WRITE_URI_PERMISSION
|
||||
)
|
||||
|
||||
useDocStyleToUnzip = true
|
||||
unzipAction.invoke()
|
||||
}
|
||||
|
||||
tempLauncher?.unregister()
|
||||
}
|
||||
tempLauncher = null
|
||||
|
||||
tempLauncher?.launch(obbUri)
|
||||
},
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.gh.gamecenter.wrapper
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Paint
|
||||
import android.graphics.PorterDuff
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
@ -14,6 +17,11 @@ import androidx.core.text.color
|
||||
import androidx.core.view.doOnNextLayout
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import coil.Coil
|
||||
import coil.decode.SvgDecoder
|
||||
import coil.load
|
||||
import coil.request.ImageRequest
|
||||
import coil.transform.Transformation
|
||||
import com.ethanhua.skeleton.Skeleton
|
||||
import com.ethanhua.skeleton.SkeletonScreen
|
||||
import com.gh.common.iinterface.ISuperiorChain
|
||||
@ -39,6 +47,7 @@ import com.gh.gamecenter.entity.BottomTab
|
||||
import com.gh.gamecenter.login.entity.UserInfoEntity
|
||||
import com.halo.assistant.HaloApp
|
||||
import com.lightgame.listeners.OnBackPressedListener
|
||||
import com.lightgame.utils.Utils
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
class MainWrapperFragment : BaseBottomTabFragment<PieceBottomTabBinding>(), OnBackPressedListener, ISuperiorChain, IBusiness {
|
||||
@ -158,6 +167,15 @@ class MainWrapperFragment : BaseBottomTabFragment<PieceBottomTabBinding>(), OnBa
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val request = ImageRequest.Builder(requireContext())
|
||||
.data("https://www.svgrepo.com/show/43967/colours-samples.svg") // Provide the SVG resource ID
|
||||
.decoderFactory(SvgDecoder.Factory())
|
||||
.transformations(SvgColorTintTransformation(requireContext().getColor(com.gh.gamecenter.common.R.color.primary_theme)))
|
||||
.target(mBinding.svgIv)
|
||||
.build()
|
||||
|
||||
Coil.imageLoader(requireContext()).enqueue(request)
|
||||
|
||||
mViewModel?.tabSelectedLiveData?.observe(viewLifecycleOwner) {
|
||||
val selectedTab = it.getContentWithHandled()
|
||||
if (selectedTab is MainSelectedEvent.SelectedTab && selectedTab.bottomTabIndex != -1) {
|
||||
@ -443,3 +461,19 @@ class MainWrapperFragment : BaseBottomTabFragment<PieceBottomTabBinding>(), OnBa
|
||||
|
||||
override fun getBusinessId(): Pair<String, String> = (mCurrentFragment as? IBusiness)?.getBusinessId() ?: Pair("", "")
|
||||
}
|
||||
|
||||
class SvgColorTintTransformation(
|
||||
private val tintColor: Int
|
||||
) : Transformation {
|
||||
|
||||
override val cacheKey: String = "${javaClass.name}-$tintColor"
|
||||
|
||||
override suspend fun transform(input: Bitmap, size: coil.size.Size): Bitmap {
|
||||
val bitmap = input.copy(Bitmap.Config.ARGB_8888, true) // Create a mutable copy
|
||||
val canvas = Canvas(bitmap)
|
||||
val paint = Paint()
|
||||
paint.colorFilter = android.graphics.PorterDuffColorFilter(tintColor, PorterDuff.Mode.SRC_IN)
|
||||
canvas.drawBitmap(input, 0f, 0f, paint)
|
||||
return bitmap
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<com.gh.gamecenter.common.view.MaterializedConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<com.gh.gamecenter.common.view.MaterializedConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
@ -109,8 +110,8 @@
|
||||
android:id="@+id/installApiContentTv"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="您未授予已安装列表权限,可能导致无法安装及更新等异常情况,建议开启权限!"
|
||||
android:textSize="@dimen/secondary_size"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@ -152,4 +153,9 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/svgIv"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp" />
|
||||
|
||||
</com.gh.gamecenter.common.view.MaterializedConstraintLayout>
|
||||
Reference in New Issue
Block a user