语言中英文完善
This commit is contained in:
@@ -4,6 +4,9 @@ package com.ckkj.water.utils.time;
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.ckkj.water.R;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
@@ -1062,16 +1065,24 @@ public class ZYTimeUtils {
|
||||
}
|
||||
}
|
||||
|
||||
private static final String[] WEEK_NAMES = {"周一", "周二", "周三", "周四", "周五", "周六", "周日"};
|
||||
|
||||
/**
|
||||
* 根据星期索引获取星期名称
|
||||
* @param weekday 星期索引,0=周一,1=周二,...,6=周日
|
||||
* @return 对应的星期名称
|
||||
*/
|
||||
public static String getWeekName(int weekday) {
|
||||
public static String getWeekName(int weekday,Context context) {
|
||||
String[] weekNames = {
|
||||
context.getString(R.string.week_monday),
|
||||
context.getString(R.string.week_tuesday),
|
||||
context.getString(R.string.week_wednesday),
|
||||
context.getString(R.string.week_thursday),
|
||||
context.getString(R.string.week_friday),
|
||||
context.getString(R.string.week_saturday),
|
||||
context.getString(R.string.week_sunday)
|
||||
};
|
||||
if (weekday >= 0 && weekday < 7) {
|
||||
return WEEK_NAMES[weekday];
|
||||
return weekNames[weekday];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user