Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.joda.time.format.DateTimeFormat
import java.util.Calendar
import java.util.Date
import java.util.Locale
import kotlin.math.roundToInt

internal class DashboardFragment : BaseFragment<DashboardViewModel>() {

Expand Down Expand Up @@ -270,14 +271,14 @@ internal class DashboardFragment : BaseFragment<DashboardViewModel>() {
.fold(UnitMass()) { acc, unitMass -> acc + unitMass }.gramsValue()

dailyNutrition.setup(
currentCalories.toInt(),
currentCalories.roundToInt(),
userProfile.caloriesTarget,
currentCarbs.toInt(),
userProfile.getCarbsGrams().toInt(),
currentProtein.toInt(),
userProfile.getProteinGrams().toInt(),
currentFat.toInt(),
userProfile.getFatGrams().toInt()
currentCarbs.roundToInt(),
userProfile.getCarbsGrams().roundToInt(),
currentProtein.roundToInt(),
userProfile.getProteinGrams().roundToInt(),
currentFat.roundToInt(),
userProfile.getFatGrams().roundToInt()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import org.joda.time.DateTime
import kotlin.math.roundToInt

/**
* A simple [Fragment] subclass.
Expand Down Expand Up @@ -169,14 +170,14 @@ internal class DiaryFragment : BaseFragment<DiaryViewModel>(), DiaryCategory.Cat
.fold(UnitMass()) { acc, unitMass -> acc + unitMass }.gramsValue()

dailyNutrition.setup(
currentCalories.toInt(),
currentCalories.roundToInt(),
userProfile.caloriesTarget,
currentCarbs.toInt(),
userProfile.getCarbsGrams().toInt(),
currentProtein.toInt(),
userProfile.getProteinGrams().toInt(),
currentFat.toInt(),
userProfile.getFatGrams().toInt()
currentCarbs.roundToInt(),
userProfile.getCarbsGrams().roundToInt(),
currentProtein.roundToInt(),
userProfile.getProteinGrams().roundToInt(),
currentFat.roundToInt(),
userProfile.getFatGrams().roundToInt()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import android.widget.AdapterView
import android.widget.AdapterView.OnItemSelectedListener
import androidx.core.view.isVisible
import org.joda.time.DateTime
import kotlin.math.roundToInt

internal class ImageFoodResultFragment : BaseFragment<ImageFoodResultViewModel>() {

Expand Down Expand Up @@ -366,14 +367,14 @@ internal class ImageFoodResultFragment : BaseFragment<ImageFoodResultViewModel>(

val userProfile = UserCache.getProfile()
dailyNutrition.setup(
currentCalories.toInt(),
currentCalories.roundToInt(),
userProfile.caloriesTarget,
currentCarbs.toInt(),
userProfile.getCarbsGrams().toInt(),
currentProtein.toInt(),
userProfile.getProteinGrams().toInt(),
currentFat.toInt(),
userProfile.getFatGrams().toInt()
currentCarbs.roundToInt(),
userProfile.getCarbsGrams().roundToInt(),
currentProtein.roundToInt(),
userProfile.getProteinGrams().roundToInt(),
currentFat.roundToInt(),
userProfile.getFatGrams().roundToInt()
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal const val dimAmount = 0.4f
@SuppressLint("SetTextI18n")
internal class CustomFoodCreatedInfoDialog(
context: Context,
) : Dialog(context, android.R.style.ThemeOverlay) {
) : Dialog(context, android.R.style.ThemeOverlay_Material_Dialog) {

val binding: DialogCommonBinding = DialogCommonBinding.inflate(layoutInflater)

Expand Down Expand Up @@ -74,7 +74,7 @@ internal class CommonDialog(
title: String?,
description: String,
listener: OnCommonDialogListener,
) : Dialog(context, android.R.style.ThemeOverlay) {
) : Dialog(context, android.R.style.ThemeOverlay_Material_Dialog) {

val binding: DialogCommonBinding = DialogCommonBinding.inflate(layoutInflater)

Expand Down Expand Up @@ -148,7 +148,7 @@ internal class CommonDialog(
@SuppressLint("SetTextI18n")
internal class CaptureNutritionFactsLabelInfoDialog(
context: Context,
) : Dialog(context, android.R.style.ThemeOverlay) {
) : Dialog(context, android.R.style.ThemeOverlay_Material_Dialog) {

val binding: DialogCaptureNutritionFactsInfoBinding =
DialogCaptureNutritionFactsInfoBinding.inflate(layoutInflater)
Expand All @@ -171,7 +171,7 @@ internal class CaptureNutritionFactsLabelInfoDialog(
internal class NoNutritionFactsResultDialog(
context: Context,
listener: OnCommonDialogListener
) : Dialog(context, android.R.style.ThemeOverlay) {
) : Dialog(context, android.R.style.ThemeOverlay_Material_Dialog) {

val binding: DialogNoNutritionFactsResultBinding =
DialogNoNutritionFactsResultBinding.inflate(layoutInflater)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ai.passio.nutrition.uimodule.ui.util

import ai.passio.nutrition.uimodule.ui.activity.PassioUiModuleActivity
import ai.passio.passiosdk.passiofood.data.measurement.Grams
import ai.passio.passiosdk.passiofood.data.measurement.Milliliters
import ai.passio.passiosdk.passiofood.data.model.PassioServingSize
Expand All @@ -11,8 +10,6 @@ import android.text.Spanned
import android.text.style.StyleSpan
import androidx.appcompat.widget.AppCompatTextView
import androidx.core.content.ContextCompat
import java.io.BufferedReader
import java.io.InputStreamReader
import java.text.DecimalFormat


Expand Down Expand Up @@ -62,7 +59,7 @@ object StringKT {
value.toInt().toString()
} else {
// String.format("%.2f", value).trimEnd('0').trimEnd('.')
twoDecimalFormat.format(this).trimEnd('0').trimEnd('.')
twoDecimalFormat.format(this)//.trimEnd('0').trimEnd('.')
}

// return oneDecimalFormat.format(this)
Expand All @@ -75,7 +72,7 @@ object StringKT {
return if (value % 1 == 0.0f) {
value.toInt().toString()
} else {
twoDecimalFormat.format(this).trimEnd('0').trimEnd('.')
twoDecimalFormat.format(this)//.trimEnd('0').trimEnd('.')
}
}

Expand Down Expand Up @@ -103,7 +100,7 @@ object StringKT {
}

// Function to load JSON from assets
fun loadJsonFromAssets(fileName: String): String? {
/* fun loadJsonFromAssets(fileName: String): String? {
return try {
val inputStream = PassioUiModuleActivity.getContext().assets.open(fileName)
val bufferedReader = BufferedReader(InputStreamReader(inputStream))
Expand All @@ -112,7 +109,7 @@ object StringKT {
e.printStackTrace()
null
}
}
}*/


}