Skip to content

Commit

Permalink
add transitionName
Browse files Browse the repository at this point in the history
  • Loading branch information
hoanganhtuan95ptit committed Mar 3, 2023
1 parent ca8cf36 commit f8a618a
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 26 deletions.
Binary file modified .gradle/7.2/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.2/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/7.2/fileHashes/resourceHashesCache.bin
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/outputFiles.bin
Binary file not shown.
7 changes: 7 additions & 0 deletions adapter/src/main/java/com/one/adapter/ViewItemAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ abstract class ViewItemAdapter<out VI : ViewItemCloneable, out VB : ViewBinding>

var adapter: BaseAsyncAdapter<*, *>? = null

val className: String by lazy {

this.javaClass.name
}


open fun getViewItemClass(): Class<ViewItemCloneable> {
return findGenericClassBySuperClass(ViewItemCloneable::class.java)!!.java
Expand Down Expand Up @@ -49,6 +54,8 @@ abstract class ViewItemAdapter<out VI : ViewItemCloneable, out VB : ViewBinding>

fun bindView(binding: @UnsafeVariance VB, viewType: Int, position: Int, item: @UnsafeVariance VI) {

binding.root.transitionName = "$className-$position"

binding.root.setOnClickListener { view ->
getViewItem(position)?.let { onItemClick.invoke(view, it) }
}
Expand Down
51 changes: 25 additions & 26 deletions app/src/main/java/com/tuanha/app/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import com.one.coreapp.utils.extentions.setImage
import com.one.detect.data.usecase.DetectUseCase
import com.one.detect.entities.DetectOption
import com.one.translate.data.usecase.TranslateUseCase
import com.one.word.ui.WordDetailFragment
import com.tuanha.app.utils.DrawTextTransformation
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand All @@ -35,31 +34,31 @@ class MainActivity : AppCompatActivity() {
lifecycleScope.launch(Dispatchers.IO) {
Log.d("tuanha", "onCreate: detectUseCase start")

val path = "https://lh3.googleusercontent.com/jLlhxWVvGod_soN5aWDOZCDekFWkKnudzouQdU_f9jukkjFkbUYSZrKg_Nwf3kdy9QVuf4IlKMJti6jm73UjyWGEbyOdhh7IeJDOi5yIA907c0r_n8uqNeiTTbjtcv6Y8ar-sPUuLheCYCQOta0uaUD8C_MvyTmThnQvxeimGG0RqtIGfhOQ7IdTNK7lAkKcLeqJN-2xgEhh3OSlnhx40py7WRZgdb0UUhfRbjnfTYDM8rM_m-xhY_FjBHmj7Fzz8_W54CR3OKcAkknqhH-PKFLlAOD34GfmwrvCHFq458t7cdvThXT0YEm3O1v7o_sURG2HlVBg_c0IMZheM56sg9VM4UG36EgVfpcve2qylMzJAGcut-lYE4vouOU95LYlhnB9RrXN_MWeqVQ7NXni2-J877zQXXQCM5qWW8vkeW2uLUOGSvzWgk0FJKo0yT0FvSsWDdvhkrMGfr2Rta9v4CpZVKWNyThlDpSi_GvtE_wtnmw1LcX8JSHGPoJZOkKwDts6_PHgvolcR6EanC2ToFBhdr2aAcc5yQ5AP67vDhS4hihPoOn3PrzbkJBO_l5wDW6gl4UvIjHmAIsHmzxwNwMAWQGyyQgDVzFYC2htnhbg8cc0JHI6wQhR_zmUyoMMpTWGcSA0YUgRtYV7RuHH36g7vaCvAk_NJIuJ7BrCGmWERTWBrzF1EdmqzWT-1GBvMQDzNDDXUe-nefBghSQ15ebDaiDu2WyTzqcMmOAo_l0P-NeMDOPVpxlUNM7K2EM4Am0Fs5PLa11KTIWaoc_4rdCs5rzpHCgVWmX7pEhkCEE5Tb8G-asXHmErEzQSKlTLwl5AAxKf54VqLpEacOAIt2TmSE3SazcASf-DxFIjlAtL22s-jY3Aw4LWKuK8_77XGJh-GEx0n0rhdEzBHnV0zv5bIKXGKBVQWX6QW1pY-2u54bWG_k8MQ2HFEek2cuw9DHnYQWz8AtB4shMDUNDk2mgn3EBJ9BdtTlFg_3UhJC6VSNd-fD0dNyMDafDCi1c9o23HUVNaFqsJTit15bmKnthsYLLpOJl16JjdT7gslUy-dE0f9fsm6s20DvEQVdCj86WzYrh_8T25tT5J58LcVdpFckayN8MeTKn6GgPPs0rPZsVoJ-r_TK8jJE41H-r5iSaweA=w786-h220-no?authuser=1"


val sizeMax = 3000


detectUseCase.execute(DetectUseCase.Param(path = path, "en", "en", DetectOption.TEXT_TRANSLATE, sizeMax)).let { state ->

state.doSuccess { list ->

lifecycleScope.launch(Dispatchers.Main) {

findViewById<ImageView>(R.id.image).setImage(path, FitCenter(), DrawTextTransformation(sizeMax, list))
}

list.forEach {
Log.d("tuanha", "onCreate: detectUseCase languageCode:${it.languageCode} text:${it.text}")
}
}

state.doFailed {

Log.d("tuanha", "onCreate: detectUseCase", it)
}
}
// val path = "https://www.apkonline.net/imagescropped/viewinhindiicon128.jpgplus.webp"
//
//
// val sizeMax = 1500
//
//
// detectUseCase.execute(DetectUseCase.Param(path = path, "en", "en", DetectOption.TEXT_TRANSLATE, sizeMax)).let { state ->
//
// state.doSuccess { list ->
//
// lifecycleScope.launch(Dispatchers.Main) {
//
// findViewById<ImageView>(R.id.image).setImage(path, FitCenter(), DrawTextTransformation(sizeMax, list))
// }
//
// list.forEach {
// Log.d("tuanha", "onCreate: detectUseCase languageCode:${it.languageCode} text:${it.text}")
// }
// }
//
// state.doFailed {
//
// Log.d("tuanha", "onCreate: detectUseCase", it)
// }
// }
}

lifecycleScope.launch(Dispatchers.IO) {
Expand Down

0 comments on commit f8a618a

Please sign in to comment.