Commit fc066f04 authored by wanglei's avatar wanglei

...

parent edafd42c
......@@ -3,18 +3,17 @@ package com.base.scanqrclear.bean
import com.base.scanqrclear.bean.FunctionUIBean.Companion.KEY_FOOD
data class OpenFoodBean(
val image_front_url: String,
val product_name: String,
val ingredients_text: String,//成分
val product_quantity: Int,//500
val product_quantity_unit: String,//ml
val nutriscore_grade: String,// a 等级
val image_front_url: String?,
val product_name: String?,
val ingredients_text: String?,//成分
val product_quantity: Int?,//500
val product_quantity_unit: String?,//ml
val nutriscore_grade: String?,// a 等级
val nova_groups: String? = null,
val nova_groups_tags: Array<String>,
val nova_groups_tags: Array<String>?,
) : ScanBean(KEY_FOOD) {
var qrString: String = ""
val dataSource: String = ""
var dataSource: String = ""
}
\ No newline at end of file
package com.base.scanqrclear.qr
import android.annotation.SuppressLint
import android.graphics.Bitmap
import android.graphics.Color
import android.text.SpannableStringBuilder
import android.text.Spanned
......@@ -38,7 +39,9 @@ import com.base.scanqrclear.utils.BarUtils
import com.base.scanqrclear.utils.BitmapUtils.saveBitmapToFile
import com.base.scanqrclear.utils.KotlinExt.toFormatTime6
import com.base.scanqrclear.utils.LogEx
import com.base.scanqrclear.utils.OpenFoodDialog.showOpenFoodDialog
import com.base.scanqrclear.utils.QRCodeUtils.generateEAN13Barcode
import com.base.scanqrclear.utils.QRCodeUtils.generateEAN8Barcode
import com.base.scanqrclear.utils.QRCodeUtils.generateQRCode
import com.bumptech.glide.Glide
import com.google.gson.Gson
......@@ -72,9 +75,10 @@ class QrResultsActivity : BaseActivity<ActivityQrResultsBinding>(ActivityQrResul
binding.flAd.visibility = View.VISIBLE
binding.flAd2.visibility = View.INVISIBLE
Glide.with(this).load((bean as OpenFoodBean).image_front_url).into(binding.ivFood)
binding.tvIngredients.text = (bean as OpenFoodBean).ingredients_text
binding.tvFoodName.text = (bean as OpenFoodBean).product_name
qrTitle = "Barcode:"
createNormalContent()
generateEAN()
}
......@@ -189,7 +193,13 @@ class QrResultsActivity : BaseActivity<ActivityQrResultsBinding>(ActivityQrResul
private fun generateEAN() {
Thread {
val bitmap = generateEAN13Barcode(qrString, 555, 555)
var bitmap: Bitmap? = null
if (qrString.length == 12 || qrString.length == 13) {
bitmap = generateEAN13Barcode(qrString, 555, 555)
}
if (qrString.length == 8) {
bitmap = generateEAN8Barcode(qrString, 555, 555)
}
runOnUiThread {
binding.ivQr.setImageBitmap(bitmap)
val file = File(cacheDir, System.currentTimeMillis().toString() + ".jpg")
......@@ -252,6 +262,9 @@ class QrResultsActivity : BaseActivity<ActivityQrResultsBinding>(ActivityQrResul
binding.flBack.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
binding.tvSeeMore.setOnClickListener {
showOpenFoodDialog(bean as OpenFoodBean)
}
}
override fun configSystemBar() {
......
......@@ -168,11 +168,10 @@ class ScanFragment : BaseFragment<FragmentScanBinding>(FragmentScanBinding::infl
if (isNumeric(qrCodeValue)) {
activity.lifecycleScope.launch(Dispatchers.IO) {
bean = getOpenFood(qrCodeValue)
bean?.qrString = qrCodeValue
}
}
val jump = {
if (bean?.qrString?.isNotEmpty() == true) {
if (bean != null) {
jumpQrResultsActivity(activity, qrCodeValue, KEY_FOOD, bean)
} else {
jumpProductCodeActivity(activity, qrCodeValue)
......@@ -448,12 +447,11 @@ class ScanFragment : BaseFragment<FragmentScanBinding>(FragmentScanBinding::infl
activity.lifecycleScope.launch(Dispatchers.IO) {
LogEx.logDebug(TAG, "$bean")
bean = getOpenFood(qrCodeValue)
bean?.qrString = qrCodeValue
}
}
val jump = {
if (bean?.qrString?.isNotEmpty() == true) {
if (bean != null) {
jumpQrResultsActivity(activity, qrCodeValue, KEY_FOOD, bean)
} else {
jumpTextCodeActivity(activity, qrCodeValue)
......
package com.base.scanqrclear.utils
import android.annotation.SuppressLint
import android.app.Activity
import android.app.AlertDialog
import android.view.Gravity
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.base.scanqrclear.R
import com.base.scanqrclear.bean.OpenFoodBean
import com.base.scanqrclear.databinding.DialogOpenFoodBinding
object OpenFoodDialog {
@SuppressLint("SetTextI18n")
fun Activity.showOpenFoodDialog(openFoodBean: OpenFoodBean) {
val dialog = AlertDialog.Builder(this).create()
val binding = DialogOpenFoodBinding.inflate(LayoutInflater.from(this))
dialog.setView(binding.root)
dialog.setCanceledOnTouchOutside(true)
dialog.show()
val params = dialog.window?.attributes
params?.width = ConstraintLayout.LayoutParams.MATCH_PARENT
// params?.height = resources.getDimensionPixelOffset(R.dimen.dp_400)
params?.gravity = Gravity.BOTTOM
// params?.y = 50
dialog.window?.attributes = params
dialog.window?.setBackgroundDrawableResource(android.R.color.transparent)
binding.ivClose.setOnClickListener {
dialog.dismiss()
}
binding.tvName.text = openFoodBean.product_name
var grade = "NA"
var gradeDesc = "NA"
if (
openFoodBean.nutriscore_grade?.contains("A") == true ||
openFoodBean.nutriscore_grade?.contains("a") == true
) {
grade = "A"
gradeDesc = "Very good nutritional quality"
}
if (
openFoodBean.nutriscore_grade?.contains("B") == true ||
openFoodBean.nutriscore_grade?.contains("b") == true
) {
grade = "B"
gradeDesc = "Good nutritional quality"
}
if (
openFoodBean.nutriscore_grade?.contains("C") == true ||
openFoodBean.nutriscore_grade?.contains("c") == true
) {
grade = "C"
gradeDesc = "Average nutritional quality"
}
if (
openFoodBean.nutriscore_grade?.contains("D") == true ||
openFoodBean.nutriscore_grade?.contains("d") == true
) {
grade = "D"
gradeDesc = "Poor nutritional quality"
}
if (
openFoodBean.nutriscore_grade?.contains("E") == true ||
openFoodBean.nutriscore_grade?.contains("e") == true
) {
grade = "E"
gradeDesc = "Bad nutritional quality"
}
binding.tvGrade.text = "Nutr.comp:$grade"
binding.tvGradeDesc.text = gradeDesc
var novaImage = R.drawable.nova_group_1
if (openFoodBean.nova_groups == "1") {
novaImage = R.drawable.nova_group_1
}
if (openFoodBean.nova_groups == "2") {
novaImage = R.drawable.nova_group_2
}
if (openFoodBean.nova_groups == "3") {
novaImage = R.drawable.nova_group_3
}
if (openFoodBean.nova_groups == "3") {
novaImage = R.drawable.nova_group_4
}
binding.ivNova.setImageResource(novaImage)
binding.tvNova.text = openFoodBean.nova_groups_tags?.first() ?: "NA"
binding.tvIngredients.text = openFoodBean.ingredients_text ?: "NA"
if (openFoodBean.product_quantity == null || openFoodBean.product_quantity_unit == null) {
binding.tvContent.text = "NA"
} else {
binding.tvContent.text = "${openFoodBean.product_quantity}${openFoodBean.product_quantity_unit}"
}
binding.tvDataSource.text = openFoodBean.dataSource
}
}
\ No newline at end of file
......@@ -16,9 +16,10 @@ object OpenFoodFactsUtils {
fun getOpenFood(qrCode: String): OpenFoodBean? {
try {
val url = "https://world.openfoodfacts.org/api/v3/product/$qrCode.json"
val client = OkHttpClient()
val request = Request.Builder()
.url("https://world.openfoodfacts.org/api/v3/product/$qrCode.json")
.url(url)
.get()
.addHeader("User-Agent", "okhttp/4.10.0")
.addHeader("Accept-Encoding", "gzip")
......@@ -42,6 +43,8 @@ object OpenFoodFactsUtils {
val jsonObject = JSONObject(body)
val productJson = jsonObject.getJSONObject("product").toString()
val bean = Gson().fromJson(productJson, OpenFoodBean::class.java)
bean.qrString = qrCode
bean.dataSource = url
return bean
} catch (e: Exception) {
......
......@@ -10,6 +10,7 @@ import com.google.zxing.EncodeHintType
import com.google.zxing.WriterException
import com.google.zxing.common.BitMatrix
import com.google.zxing.oned.EAN13Writer
import com.google.zxing.oned.EAN8Writer
import com.google.zxing.qrcode.QRCodeWriter
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import kotlin.math.atan2
......@@ -124,6 +125,38 @@ object QRCodeUtils {
return null
}
fun generateEAN8Barcode(content: String, width: Int, height: Int): Bitmap? {
// 创建 EAN-8 条形码生成器
val writer = EAN8Writer()
val hints = HashMap<EncodeHintType, Any>()
hints[EncodeHintType.CHARACTER_SET] = "UTF-8"
try {
// 生成 BitMatrix
val bitMatrix: BitMatrix = writer.encode(content, BarcodeFormat.EAN_8, width, height, hints)
val bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888)
bitmap.setHasAlpha(true)
val canvas = Canvas(bitmap)
val paint = Paint()
paint.color = Color.BLACK
paint.style = Paint.Style.FILL
// 遍历 BitMatrix 并绘制条形码
for (x in 0 until width) {
for (y in 0 until height) {
if (bitMatrix[x, y]) {
canvas.drawRect(x.toFloat(), y.toFloat(), (x + 1).toFloat(), (y + 1).toFloat(), paint)
}
}
}
return bitmap
} catch (e: WriterException) {
e.printStackTrace()
}
return null
}
fun getPairKeyValue(keyValue: String): Pair<String, String> {
val split = keyValue.split(":")
var key = ""
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#F0F1F5" />
<corners
android:topLeftRadius="20dp"
android:topRightRadius="20dp" />
</shape>
\ No newline at end of file
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68dp"
android:height="130dp"
android:viewportWidth="68"
android:viewportHeight="130">
<path
android:pathData="M0,36h68v90L0,126Z"
android:strokeWidth="1.21955"
android:fillColor="#0a0"
android:fillType="nonZero"/>
<path
android:pathData="M4.87,19.55L4.87,29.5L0.85,29.5l0,-17.39l3.13,0L12.09,22.32L12.09,12.11l4.02,0l0,17.39l-3.23,0zM27.07,29.64q-1.93,0 -3.53,-0.76 -1.59,-0.76 -2.72,-1.98 -1.13,-1.25 -1.76,-2.84 -0.61,-1.59 -0.61,-3.28 0,-1.71 0.64,-3.31 0.66,-1.59 1.81,-2.79 1.18,-1.22 2.77,-1.93 1.59,-0.73 3.48,-0.73 1.93,0 3.53,0.76 1.59,0.76 2.72,2.01 1.13,1.25 1.74,2.84 0.61,1.59 0.61,3.23 0,1.71 -0.66,3.31 -0.64,1.59 -1.79,2.82 -1.15,1.2 -2.74,1.93 -1.59,0.73 -3.48,0.73zM22.54,20.83q0,1 0.29,1.96 0.29,0.93 0.86,1.67 0.59,0.73 1.44,1.18 0.86,0.44 1.96,0.44 1.15,0 2.01,-0.47 0.86,-0.47 1.42,-1.2 0.56,-0.76 0.83,-1.69 0.29,-0.96 0.29,-1.93 0,-1 -0.29,-1.93 -0.29,-0.96 -0.88,-1.67 -0.59,-0.73 -1.44,-1.15 -0.83,-0.44 -1.93,-0.44 -1.15,0 -2.01,0.47 -0.83,0.44 -1.42,1.18 -0.56,0.73 -0.86,1.69 -0.27,0.93 -0.27,1.91zM39.96,12.11 L44.05,24.45l4.04,-12.34l4.24,0l-6.59,17.39l-3.38,0l-6.66,-17.39ZM57.19,12.11l3.62,0l6.34,17.39l-4.11,0l-1.35,-3.89l-5.41,0l-1.32,3.89l-4.11,0ZM61.03,22.84 L59,16.69 56.92,22.84Z"
android:strokeLineJoin="miter"
android:strokeWidth="22.331"
android:fillColor="#7d7d7d"
android:strokeColor="#00000000"
android:strokeLineCap="butt"/>
<path
android:pathData="M42.88,108.06l-11.44,0L31.44,76.75l0.11,-5.15 0.19,-5.63q-2.85,2.85 -3.96,3.74l-6.22,5 -5.52,-6.89 17.44,-13.88l9.4,0z"
android:strokeWidth="1.9"
android:fillColor="#fff"
android:strokeColor="#00000000"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68dp"
android:height="130dp"
android:viewportWidth="68"
android:viewportHeight="130">
<path
android:pathData="M0,36l68,0l0,90L0,126Z"
android:strokeWidth="1.22"
android:fillColor="#fc0"
android:fillType="nonZero"/>
<path
android:pathData="M4.87,19.55L4.87,29.5L0.85,29.5l0,-17.39l3.13,0L12.09,22.32L12.09,12.11l4.02,0l0,17.39l-3.23,0zM27.07,29.64q-1.93,0 -3.53,-0.76 -1.59,-0.76 -2.72,-1.98 -1.13,-1.25 -1.76,-2.84 -0.61,-1.59 -0.61,-3.28 0,-1.71 0.64,-3.31 0.66,-1.59 1.81,-2.79 1.18,-1.22 2.77,-1.93 1.59,-0.73 3.48,-0.73 1.93,0 3.53,0.76 1.59,0.76 2.72,2.01 1.13,1.25 1.74,2.84 0.61,1.59 0.61,3.23 0,1.71 -0.66,3.31 -0.64,1.59 -1.79,2.82 -1.15,1.2 -2.74,1.93 -1.59,0.73 -3.48,0.73zM22.54,20.83q0,1 0.29,1.96 0.29,0.93 0.86,1.67 0.59,0.73 1.44,1.18 0.86,0.44 1.96,0.44 1.15,0 2.01,-0.47 0.86,-0.47 1.42,-1.2 0.56,-0.76 0.83,-1.69 0.29,-0.96 0.29,-1.93 0,-1 -0.29,-1.93 -0.29,-0.96 -0.88,-1.67 -0.59,-0.73 -1.44,-1.15 -0.83,-0.44 -1.93,-0.44 -1.15,0 -2.01,0.47 -0.83,0.44 -1.42,1.18 -0.56,0.73 -0.86,1.69 -0.27,0.93 -0.27,1.91zM39.96,12.11 L44.05,24.45l4.04,-12.34l4.24,0l-6.59,17.39l-3.38,0l-6.66,-17.39ZM57.19,12.11l3.62,0l6.34,17.39l-4.11,0l-1.35,-3.89l-5.41,0l-1.32,3.89l-4.11,0ZM61.03,22.84 L59,16.69 56.92,22.84Z"
android:strokeLineJoin="miter"
android:strokeWidth="22.331"
android:fillColor="#7d7d7d"
android:strokeColor="#00000000"
android:strokeLineCap="butt"/>
<path
android:pathData="M55.01,108.06L17.18,108.06l0,-7.96L30.76,86.37q6.03,-6.18 7.89,-8.55 1.85,-2.41 2.67,-4.44 0.81,-2.04 0.81,-4.22 0,-3.26 -1.81,-4.85 -1.78,-1.59 -4.78,-1.59 -3.15,0 -6.11,1.44 -2.96,1.44 -6.18,4.11l-6.22,-7.37q4,-3.41 6.63,-4.81 2.63,-1.41 5.74,-2.15 3.11,-0.78 6.96,-0.78 5.07,0 8.96,1.85 3.89,1.85 6.03,5.18 2.15,3.33 2.15,7.63 0,3.74 -1.33,7.03 -1.3,3.26 -4.07,6.7 -2.74,3.44 -9.7,9.81l-6.96,6.55l0,0.52L55.01,98.44z"
android:strokeWidth="1.9"
android:fillColor="#fff"
android:strokeColor="#00000000"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68dp"
android:height="130dp"
android:viewportWidth="68"
android:viewportHeight="130">
<path
android:pathData="M0,36l68,0l0,90L0,126z"
android:strokeWidth="1.22"
android:fillColor="#f60"
android:fillType="nonZero"/>
<path
android:pathData="M4.87,19.55L4.87,29.5L0.85,29.5l0,-17.39l3.13,0L12.09,22.32L12.09,12.11l4.02,0l0,17.39l-3.23,0zM27.07,29.64q-1.93,0 -3.53,-0.76 -1.59,-0.76 -2.72,-1.98 -1.13,-1.25 -1.76,-2.84 -0.61,-1.59 -0.61,-3.28 0,-1.71 0.64,-3.31 0.66,-1.59 1.81,-2.79 1.18,-1.22 2.77,-1.93 1.59,-0.73 3.48,-0.73 1.93,0 3.53,0.76 1.59,0.76 2.72,2.01 1.13,1.25 1.74,2.84 0.61,1.59 0.61,3.23 0,1.71 -0.66,3.31 -0.64,1.59 -1.79,2.82 -1.15,1.2 -2.74,1.93 -1.59,0.73 -3.48,0.73zM22.54,20.83q0,1 0.29,1.96 0.29,0.93 0.86,1.67 0.59,0.73 1.44,1.18 0.86,0.44 1.96,0.44 1.15,0 2.01,-0.47 0.86,-0.47 1.42,-1.2 0.56,-0.76 0.83,-1.69 0.29,-0.96 0.29,-1.93 0,-1 -0.29,-1.93 -0.29,-0.96 -0.88,-1.67 -0.59,-0.73 -1.44,-1.15 -0.83,-0.44 -1.93,-0.44 -1.15,0 -2.01,0.47 -0.83,0.44 -1.42,1.18 -0.56,0.73 -0.86,1.69 -0.27,0.93 -0.27,1.91zM39.96,12.11 L44.05,24.45l4.04,-12.34l4.24,0l-6.59,17.39l-3.38,0l-6.66,-17.39ZM57.19,12.11l3.62,0l6.34,17.39l-4.11,0l-1.35,-3.89l-5.41,0l-1.32,3.89l-4.11,0ZM61.03,22.84 L59,16.69 56.92,22.84Z"
android:strokeLineJoin="miter"
android:strokeWidth="22.331"
android:fillColor="#7d7d7d"
android:strokeColor="#00000000"
android:strokeLineCap="butt"/>
<path
android:pathData="M52.66,66.05q0,5.07 -3.07,8.63 -3.07,3.55 -8.63,4.89l0,0.22q6.55,0.81 9.92,4 3.37,3.15 3.37,8.51 0,7.81 -5.66,12.18 -5.66,4.33 -16.18,4.33 -8.81,0 -15.62,-2.92L16.78,96.14q3.15,1.59 6.92,2.59 3.78,1 7.48,1 5.66,0 8.37,-1.93 2.7,-1.93 2.7,-6.18 0,-3.81 -3.11,-5.4 -3.11,-1.59 -9.92,-1.59L25.11,84.63l0,-8.77l4.18,0q6.29,0 9.18,-1.63 2.92,-1.67 2.92,-5.66 0,-6.15 -7.7,-6.15 -2.67,0 -5.44,0.89 -2.74,0.89 -6.11,3.07l-5.29,-7.89q7.4,-5.33 17.66,-5.33 8.4,0 13.25,3.41 4.89,3.41 4.89,9.48z"
android:strokeWidth="1.9"
android:fillColor="#fff"
android:strokeColor="#00000000"/>
</vector>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="68dp"
android:height="130dp"
android:viewportWidth="68"
android:viewportHeight="130">
<path
android:pathData="M0,36l68,0l0,90L0,126Z"
android:strokeWidth="1.22"
android:fillColor="#ff0000"
android:fillType="nonZero"/>
<path
android:pathData="M4.87,19.55L4.87,29.5L0.85,29.5l0,-17.39l3.13,0L12.09,22.32L12.09,12.11l4.02,0l0,17.39l-3.23,0zM27.07,29.64q-1.93,0 -3.53,-0.76 -1.59,-0.76 -2.72,-1.98 -1.13,-1.25 -1.76,-2.84 -0.61,-1.59 -0.61,-3.28 0,-1.71 0.64,-3.31 0.66,-1.59 1.81,-2.79 1.18,-1.22 2.77,-1.93 1.59,-0.73 3.48,-0.73 1.93,0 3.53,0.76 1.59,0.76 2.72,2.01 1.13,1.25 1.74,2.84 0.61,1.59 0.61,3.23 0,1.71 -0.66,3.31 -0.64,1.59 -1.79,2.82 -1.15,1.2 -2.74,1.93 -1.59,0.73 -3.48,0.73zM22.54,20.83q0,1 0.29,1.96 0.29,0.93 0.86,1.67 0.59,0.73 1.44,1.18 0.86,0.44 1.96,0.44 1.15,0 2.01,-0.47 0.86,-0.47 1.42,-1.2 0.56,-0.76 0.83,-1.69 0.29,-0.96 0.29,-1.93 0,-1 -0.29,-1.93 -0.29,-0.96 -0.88,-1.67 -0.59,-0.73 -1.44,-1.15 -0.83,-0.44 -1.93,-0.44 -1.15,0 -2.01,0.47 -0.83,0.44 -1.42,1.18 -0.56,0.73 -0.86,1.69 -0.27,0.93 -0.27,1.91zM39.96,12.11 L44.05,24.45l4.04,-12.34l4.24,0l-6.59,17.39l-3.38,0l-6.66,-17.39ZM57.19,12.11l3.62,0l6.34,17.39l-4.11,0l-1.35,-3.89l-5.41,0l-1.32,3.89l-4.11,0ZM61.03,22.84 L59,16.69 56.92,22.84Z"
android:strokeLineJoin="miter"
android:strokeWidth="22.331"
android:fillColor="#7d7d7d"
android:strokeColor="#00000000"
android:strokeLineCap="butt"/>
<path
android:pathData="M54.4,96.85l-6.52,0l0,11.22L36.7,108.06l0,-11.22l-23.1,0l0,-7.96L37.33,53.94l10.55,0l0,34.02l6.52,0zM36.7,87.96l0,-9.18q0,-2.3 0.19,-6.66 0.19,-4.37 0.3,-5.07l-0.3,0q-1.37,3.04 -3.29,5.92L23.67,87.96Z"
android:strokeWidth="1.9"
android:fillColor="#fff"
android:strokeColor="#00000000"/>
</vector>
......@@ -126,7 +126,7 @@
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tvIngredients"
android:id="@+id/tvFoodName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
......@@ -359,16 +359,16 @@
tools:text="2025.02.18 17:30" />
<TextView
android:layout_marginBottom="10dp"
app:layout_constraintBottom_toTopOf="@id/llOperation2"
android:id="@+id/tvQrContent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="14dp"
android:layout_marginTop="14dp"
android:layout_marginBottom="10dp"
android:text="Phone number:whatsapp://send?phone=+8617608923756"
android:textColor="#666666"
android:textSize="16sp"
app:layout_constraintBottom_toTopOf="@id/llOperation2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivQrIcon" />
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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"
android:layout_height="wrap_content"
android:background="@drawable/bg_f0f1f5_tlr20">
<ImageView
android:id="@+id/ivClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="20dp"
android:layout_marginEnd="16dp"
android:src="@mipmap/guanbi"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<TextView
android:id="@+id/tvName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="32dp"
android:textColor="@color/black"
android:textSize="19sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Coke Cola " />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="18dp"
android:layout_marginBottom="24dp"
android:background="@drawable/bg_ffffff_20"
android:orientation="vertical"
android:paddingVertical="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvName">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvGrade"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="13dp"
android:text="Nutr.comp:A"
android:textColor="#6473F8"
android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tvGradeDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="13dp"
android:textColor="@color/black"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/tvGrade"
app:layout_constraintTop_toBottomOf="@id/tvGrade"
tools:ignore="HardcodedText"
tools:text="Very good nutritional quality" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tvNovaTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="13dp"
android:text="Food Processing:"
android:textColor="#6473F8"
android:textSize="15sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tvNova"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="13dp"
android:textColor="@color/black"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/ivNova"
app:layout_constraintStart_toStartOf="@id/tvNovaTitle"
app:layout_constraintTop_toBottomOf="@id/tvNovaTitle"
tools:ignore="HardcodedText"
tools:text="Very good nutritional quality" />
<ImageView
android:id="@+id/ivNova"
android:layout_width="30dp"
android:layout_height="50dp"
android:layout_marginEnd="8dp"
android:src="@drawable/nova_group_1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="13dp"
android:text="Ingredients:"
android:textColor="#6473F8"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tvIngredients"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="12dp"
tools:text="Eau de source" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="13dp"
android:text="Content:"
android:textColor="#6473F8"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tvContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="12dp"
tools:text="1500ml" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginTop="13dp"
android:text="Data Source:"
android:textColor="#6473F8"
android:textSize="15sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tvDataSource"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="12dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="12dp"
android:textColor="#1965F3"
tools:text="https://world.openfoodfats.org/product /32358600050003" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment