营养接口调试、支付接口联调

This commit is contained in:
2025-12-08 18:06:48 +08:00
parent 04e318f47b
commit 086845dd16
27 changed files with 491 additions and 237 deletions
@@ -13,6 +13,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import androidx.appcompat.content.res.AppCompatResources;
import com.sw.dualscreen.R;
import com.sw.plate.utils.AppUtil;
@@ -33,10 +35,10 @@ public class CustomImageView extends androidx.appcompat.widget.AppCompatImageVie
private static final int MAX_HEIGHT = 250;
private boolean isDrawText = false;
private Drawable bigRedDrawable;
private Drawable bigGreenDrawable;
private Drawable redDrawable;
private Drawable greenDrawable;
// private Drawable bigRedDrawable;
// private Drawable bigGreenDrawable;
// private Drawable redDrawable;
// private Drawable greenDrawable;
public CustomImageView(Context context) {
super(context);
@@ -60,10 +62,10 @@ public class CustomImageView extends androidx.appcompat.widget.AppCompatImageVie
mPaint.setColor(Color.WHITE); // Set your desired color
mPaint.setTextSize(mTextSize); // Set your desired text size
mPaint.setAntiAlias(true);
bigRedDrawable = context.getDrawable(R.drawable.img_big_red_column);
bigGreenDrawable = context.getDrawable(R.drawable.img_big_green_column);
redDrawable = context.getDrawable(R.drawable.img_red_column);
greenDrawable = context.getDrawable(R.drawable.img_green_column);
// bigRedDrawable = context.getDrawable(R.drawable.img_big_red_column);
// bigGreenDrawable = context.getDrawable(R.drawable.img_big_green_column);
// redDrawable = context.getDrawable(R.drawable.img_red_column);
// greenDrawable = context.getDrawable(R.drawable.img_green_column);
// Typeface typeface = getResources().getFont(R.font.dakai);
// Typeface typeface = Typeface.create(Typeface.createFromAsset(getContext().getAssets(), "fonts/dakai.TTF"),
// Typeface.BOLD); // 创建Typeface
@@ -87,31 +89,31 @@ public class CustomImageView extends androidx.appcompat.widget.AppCompatImageVie
}
}
/**
* 设置图片
*
* @param isBig 大图
* @param isMore 是否超过
*/
public void setImageDrawable(boolean isBig, boolean isMore) {
if (isBig) {
setImageDrawable(isMore ? bigRedDrawable : bigGreenDrawable);
} else {
setImageDrawable(isMore ? redDrawable : greenDrawable);
}
}
public void setImageDrawable2(boolean isBig, Boolean isRed) {
if (isBig) {
setImageDrawable(isRed ? bigRedDrawable : bigGreenDrawable);
} else {
setImageDrawable(isRed ? redDrawable : greenDrawable);
}
}
// /**
// * 设置图片
// *
// * @param isBig 大图
// * @param isMore 是否超过
// */
// public void setImageDrawable(boolean isBig, boolean isMore) {
// if (isBig) {
// setImageDrawable(isMore ? bigRedDrawable : bigGreenDrawable);
// } else {
// setImageDrawable(isMore ? redDrawable : greenDrawable);
// }
// }
//
// public void setImageDrawable2(boolean isBig, Boolean isRed) {
// if (isBig) {
// setImageDrawable(isRed ? bigRedDrawable : bigGreenDrawable);
// } else {
// setImageDrawable(isRed ? redDrawable : greenDrawable);
// }
// }
public void setCustomHeightPercent(float percent, boolean isAnimation) {
Timber.d("setCustomHeightPercent percent = %s", percent);
if (percent<= 0){
if (percent <= 0) {
percent = 0f;
}
setCustomHeight((int) (percent * MAX_HEIGHT), false);
@@ -122,7 +124,7 @@ public class CustomImageView extends androidx.appcompat.widget.AppCompatImageVie
Timber.d("setCustomHeight height = %s", height);
setVisibility(height == 0 ? View.GONE : VISIBLE);
if (height > MAX_HEIGHT){
if (height > MAX_HEIGHT) {
height = MAX_HEIGHT;
}
ViewGroup.LayoutParams layoutParams = getLayoutParams();
@@ -184,4 +186,35 @@ public class CustomImageView extends androidx.appcompat.widget.AppCompatImageVie
float scale = getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}
public void setImageDrawable(boolean isBigImage, int index) {
int myIndex = index;
if (index < 0) {
myIndex = 0;
}else if (index > 5) {
myIndex = 5;
}
if (isBigImage) {
//使用大图bigImgArr
setImageDrawable(AppCompatResources.getDrawable(getContext(), bigImgArr[myIndex]));
return;
}
//使用小图smallImgArr
setImageDrawable(AppCompatResources.getDrawable(getContext(), smallImgArr[myIndex]));
}
private static final Integer[] bigImgArr = new Integer[]{
R.drawable.ic_gray_big,
R.drawable.ic_green_big,
R.drawable.ic_yellow_big,
R.drawable.ic_orange_big,
R.drawable.ic_red_big
};
private static final Integer[] smallImgArr = new Integer[]{
R.drawable.ic_gray_small,
R.drawable.ic_green_small,
R.drawable.ic_yellow_small,
R.drawable.ic_orange_small,
R.drawable.ic_red_small
};
}