-
Notifications
You must be signed in to change notification settings - Fork 0
/
gradlew.bat
40 lines (35 loc) · 2.7 KB
/
gradlew.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package com.curiousdev.composeplayground.dynamicreceipt.custom
import android.content.Context
import android.graphics.Bitmap
import android.view.View
import android.view.ViewTreeObserver
import android.view.ViewTreeObserver.*
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.compose.ui.platform.ComposeView
import com.curiousdev.composeplayground.R
import com.curiousdev.composeplayground.dynamicreceipt.model.MyPair
import com.curiousdev.composeplayground.dynamicreceipt.model.MyTransaction
import com.curiousdev.composeplayground.dynamicreceipt.screen.ReceiptPage
class ReceiptLayout(ctx: Context,response: MutableList<MyPair>, onBitmapCreated: (bitmap: Bitmap) -> Unit) : LinearLayoutCompat(ctx) {
constructor(ctx: Context) : this(ctx, mutableListOf(),onBitmapCreated = {})
init {
val height = 1000
val width = 600
val view = ComposeView(ctx)
view.visibility = View.GONE
view.layoutParams = LayoutParams(width, height)
this.addView(view)
// view.setContent {
// ReceiptPage(response)
// }
// viewTreeObserver.addOnGlobalLayoutListener(object :
// OnGlobalLayoutListener {
// override fun onGlobalLayout() {
// val graphicUtils = GraphicUtils()
// val bitmap = graphicUtils.createBitmapFromView(view = view, width = width, height = height)
// onBitmapCreated(bitmap)
// viewTreeObserver.removeOnGlobalLayoutListener(this)
// }
// })
}
}