修改了用户热量信息界面
This commit is contained in:
@@ -121,7 +121,11 @@ class MainActivity : AppCompatActivity() {
|
||||
)
|
||||
binding.recyclerview.adapter = adapter
|
||||
binding.tvFoodName.setOnClickListener {
|
||||
presentation.step3()
|
||||
if (presentation.currentStep == 2) {
|
||||
presentation.step3()
|
||||
} else {
|
||||
presentation.step1()
|
||||
}
|
||||
}
|
||||
registerDataChange()
|
||||
}
|
||||
|
||||
@@ -95,6 +95,11 @@ class SecondaryScreenPresentation(
|
||||
itemUserNutritionBinding.tvUserName.text = it.userName.maskName()
|
||||
itemUserNutritionBinding.tvRecommendHeat.text =
|
||||
"推荐热量:${it.recommendMin}-${it.recommendMax}"
|
||||
|
||||
itemUserNutritionBinding.customKcalColumn.setCustomHeight(280, true)
|
||||
itemUserNutritionBinding.customFoodColumn.setCustomHeightPercent(1f, true)
|
||||
itemUserNutritionBinding.customVegetableColumn.setCustomHeightPercent(0.5f, true)
|
||||
itemUserNutritionBinding.customMeatColumn.setCustomHeightPercent(0f, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,8 +155,8 @@ class SecondaryScreenPresentation(
|
||||
currentStep = 1
|
||||
stepChangeCallback(currentStep)
|
||||
binding.tvFoodInfo.text = "菜品识别中"
|
||||
binding.ivFaceBg.visibility = View.GONE
|
||||
binding.flPreview.visibility = View.VISIBLE
|
||||
// binding.previewView.visibility = View.VISIBLE
|
||||
binding.ivImg.visibility = View.VISIBLE
|
||||
binding.flFace.visibility = View.GONE
|
||||
pauseCamera()
|
||||
@@ -171,6 +176,7 @@ class SecondaryScreenPresentation(
|
||||
resumeCamera()
|
||||
binding.tvFoodInfo.text = foodInfo.foodName
|
||||
|
||||
binding.ivFaceBg.visibility = View.VISIBLE
|
||||
binding.flPreview.visibility = View.GONE
|
||||
|
||||
binding.flFace.visibility = View.VISIBLE
|
||||
@@ -205,9 +211,6 @@ class SecondaryScreenPresentation(
|
||||
}
|
||||
binding.tvFoodInfo.text = currentFood!!.foodName
|
||||
|
||||
binding.flPreview.visibility = View.VISIBLE
|
||||
// binding.previewView.visibility = View.GONE
|
||||
binding.ivImg.visibility = View.VISIBLE
|
||||
|
||||
GlideUtils.loadRoundCornerImage(
|
||||
context,
|
||||
@@ -215,7 +218,9 @@ class SecondaryScreenPresentation(
|
||||
imageView = binding.ivImg,
|
||||
radius = 12
|
||||
)
|
||||
|
||||
binding.flPreview.visibility = View.VISIBLE
|
||||
// binding.previewView.visibility = View.GONE
|
||||
binding.ivImg.visibility = View.VISIBLE
|
||||
binding.flFace.visibility = View.GONE
|
||||
binding.ivFaceBg.visibility = View.GONE
|
||||
binding.tvFaceTip.visibility = View.GONE
|
||||
@@ -317,7 +322,7 @@ class SecondaryScreenPresentation(
|
||||
recognizeViewModel.recognizeNotice.observe(activity, Observer { notice: String? ->
|
||||
Timber.i("recognizeNotice observe notice = $notice")
|
||||
if (currentStep == 3 && notice == "leave") {
|
||||
step1()
|
||||
// step1()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ public class CustomImageView extends androidx.appcompat.widget.AppCompatImageVie
|
||||
private String textToDraw;
|
||||
private Paint mPaint;
|
||||
private int mTextSize = dpToPixels(26);
|
||||
/**
|
||||
* 最大高度
|
||||
*/
|
||||
private static final int MAX_HEIGHT = 280;
|
||||
|
||||
private boolean isDrawText = false;
|
||||
|
||||
@@ -65,6 +69,10 @@ public class CustomImageView extends androidx.appcompat.widget.AppCompatImageVie
|
||||
}
|
||||
}
|
||||
|
||||
public void setCustomHeightPercent(float percent, boolean isAnimation) {
|
||||
setCustomHeight((int) (percent * MAX_HEIGHT), isAnimation);
|
||||
}
|
||||
|
||||
// 用于设置自定义高度的方法
|
||||
public void setCustomHeight(int height, boolean isAnimation) {
|
||||
ViewGroup.LayoutParams layoutParams = getLayoutParams();
|
||||
|
||||
Reference in New Issue
Block a user