Merge branch 'master' of git.reim.ar:ReiMerc/easyeat
This commit is contained in:
commit
5c924026ed
@ -72,10 +72,10 @@ class DishDetailsActivity : AppCompatActivity() {
|
||||
|
||||
for (ingredient in ingredients) {
|
||||
val row = TextView(this)
|
||||
val amount = (ingredient.amount ?: 0.0) * multiplier
|
||||
val amountStr = amount.toBigDecimal().stripTrailingZeros().toPlainString()
|
||||
val amount = ingredient.amount?.times(multiplier)?.toBigDecimal()?.stripTrailingZeros()?.toPlainString()
|
||||
val amountStr = if (amount != null) ": $amount" else ""
|
||||
|
||||
row.text = Html.fromHtml("• ${ingredient.name}: $amountStr ${ingredient.unit ?: ""}", Html.FROM_HTML_MODE_LEGACY)
|
||||
row.text = Html.fromHtml("• ${ingredient.name}$amountStr ${ingredient.unit ?: ""}", Html.FROM_HTML_MODE_LEGACY)
|
||||
row.textSize = 18f
|
||||
row.setPadding(0, 8, 0, 8)
|
||||
container.addView(row)
|
||||
|
@ -1,5 +1,6 @@
|
||||
package tech.mercantec.easyeat.ui.dishes
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.ProgressDialog
|
||||
import android.os.Bundle
|
||||
import android.widget.Button
|
||||
@ -10,7 +11,6 @@ import tech.mercantec.easyeat.R
|
||||
import tech.mercantec.easyeat.helpers.ApiRequestException
|
||||
import tech.mercantec.easyeat.helpers.createRecipe
|
||||
import tech.mercantec.easyeat.helpers.generateRecipeWithAI
|
||||
import tech.mercantec.easyeat.models.Recipe
|
||||
import java.util.Locale
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
@ -27,7 +27,6 @@ class GenerateRecipeActivity : AppCompatActivity() {
|
||||
progressDialog.show()
|
||||
|
||||
thread {
|
||||
// val response: GenerateRecipeResponse
|
||||
try {
|
||||
val recipe = generateRecipeWithAI(this, name, Locale.getDefault().displayLanguage)
|
||||
|
||||
@ -37,6 +36,7 @@ class GenerateRecipeActivity : AppCompatActivity() {
|
||||
|
||||
createRecipe(this, recipe)
|
||||
|
||||
setResult(Activity.RESULT_OK)
|
||||
finish()
|
||||
} catch (e: ApiRequestException) {
|
||||
runOnUiThread {
|
||||
|
Loading…
Reference in New Issue
Block a user