文件整理

This commit is contained in:
huangzhuanghua
2016-08-31 14:41:41 +08:00
parent d4498fb573
commit efc19441cd
219 changed files with 1738 additions and 1873 deletions

View File

@ -1,7 +1,6 @@
package com.gh.common.util;
import android.content.Context;
import android.graphics.Color;
import android.util.TypedValue;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
@ -27,50 +26,53 @@ import java.util.TimeZone;
*/
public class GameViewUtils {
public static void setLabelList(Context context, LinearLayout labelLayout,
List<String> tag) {
public static void setLabelList(Context context, LinearLayout labelLayout, List<String> tag) {
labelLayout.removeAllViews();
if (tag == null || tag.isEmpty()) {
labelLayout.addView(getGameTagView(context, "官方版"));
labelLayout.addView(getGameTagView(context, "官方版", 0));
} else {
for (int i = 0, size = tag.size() > 3 ? 3 : tag.size(); i < size; i++) {
labelLayout.addView(getGameTagView(context, tag.get(i)));
if (i == size - 1) {
labelLayout.addView(getGameTagView(context, tag.get(i), 0));
} else {
labelLayout.addView(getGameTagView(context, tag.get(i), DisplayUtils.dip2px(context, 5)));
}
}
}
}
// 获取游戏标签列表视图
public static void setLabelList(Context context, LinearLayout labelLayout,
String tag) {
public static void setLabelList(Context context, LinearLayout labelLayout, String tag) {
labelLayout.removeAllViews();
// 添加tag标签
if (tag != null && !tag.isEmpty()) {
String[] tags = tag.split(",");
for (int i = 0; i < tags.length; i++) {
labelLayout.addView(getGameTagView(context, tags[i]));
if (i == tags.length - 1) {
labelLayout.addView(getGameTagView(context, tags[i], 0));
} else {
labelLayout.addView(getGameTagView(context, tags[i], DisplayUtils.dip2px(context, 5)));
}
}
}
}
public static TextView getGameTagView(Context context, String tagStr) {
LayoutParams lp = new LayoutParams(
public static TextView getGameTagView(Context context, String tagStr, int rightMargin) {
LinearLayout.LayoutParams lparams = new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
lp.setMargins(0, 0, DisplayUtils.dip2px(context, 5), 0);
lparams.rightMargin = rightMargin;
TextView tag = new TextView(context);
tag.setTextSize(TypedValue.COMPLEX_UNIT_SP, 11);
tag.setSingleLine(true);
tag.setText(tagStr);
if ("官方版".equals(tagStr) || "已关注".equals(tagStr)) {
tag.setBackgroundResource(R.drawable.border_green_bg);
tag.setTextColor(Color.parseColor("#05c400"));
} else if ("已安装".equals(tagStr)) {
tag.setBackgroundResource(R.drawable.border_red_bg);
tag.setTextColor(Color.parseColor("#bc2132"));
tag.setTextColor(context.getResources().getColor(R.color.tag_green));
} else {
tag.setBackgroundResource(R.drawable.border_blue_bg);
tag.setTextColor(0xff1BA4FC);
tag.setTextColor(context.getResources().getColor(R.color.theme));
}
tag.setLayoutParams(lp);
tag.setLayoutParams(lparams);
tag.setPadding(DisplayUtils.dip2px(context, 3),
0,
DisplayUtils.dip2px(context, 3),
@ -80,13 +82,10 @@ public class GameViewUtils {
public static String getGameTestDate(long testTime) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd",
Locale.CHINA);
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
format.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
String testDate;
try {
long today = format.parse(format.format(new Date())).getTime();
long day = Long.parseLong(testTime + "000");