Skip to content

Commit 7515c2d

Browse files
committed
升级版本 视频自定义图片
1 parent 94caa3f commit 7515c2d

File tree

6 files changed

+59
-10
lines changed

6 files changed

+59
-10
lines changed

app/src/main/java/org/yh/yhframe/app/MyApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
*/
4747
public class MyApplication extends Application
4848
{
49-
public static final String HOME_HOST = "http://192.168.0.5/CI/";//IP地址
49+
public static final String HOME_HOST = "http://192.168.0.129:8081/";//IP地址
5050
private static final String TAG = MyApplication.class.getSimpleName();
5151
private static MyApplication mInstance = null;
5252
private static final long cacheSize = 1024 * 1024 * 20;//缓存文件最大限制大小20M

app/src/main/res/values/strings.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@
1414
<string name="two_fragment">Two fragment</string>
1515
<string name="three_fragment">Three fragment</string>
1616
<string name="four_fragment">Four fragment</string>
17+
18+
19+
<string name="listview_header_hint_normal">下拉刷新1</string>
20+
<string name="listview_header_hint_release">释放立即刷新1</string>
21+
<string name="listview_loading">正在加载...1</string>
22+
<string name="nomore_loading">没有了1</string>
23+
<string name="refreshing">正在刷新...1</string>
24+
<string name="refresh_done">刷新完成1</string>
25+
<string name="loading_done">加载完成1</string>
26+
<string name="listview_header_last_time">上次更新时间1:</string>
27+
<string name="loading_default_message">正在提交1</string>
1728
</resources>

yhlibrary/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ publish{
6666
userOrg = 'androidcoco'//https://bintray.com用户名
6767
groupId = 'org.yh.yhframe'//jcenter上的路径
6868
artifactId = 'YhLibraryForAndroid'//项目名称
69-
publishVersion = '1.0.16'//版本号
69+
publishVersion = '1.0.17'//版本号
7070
desc = 'Android实用框架采用MVC设计模式,多个项目经验总结,持续完善中'//描述,不重要
7171
website = siteUrl//项目主页
7272
}

yhlibrary/src/main/java/org/yh/library/view/video/YHVideoPlayerController.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,35 @@ public void setImage(String imageUrl)
138138

139139
}
140140

141+
142+
public void setImage(String imageUrl,int deault,int error)
143+
{
144+
if (!StringUtils.isEmpty(imageUrl))
145+
{
146+
if (imageUrl.endsWith(".gif"))
147+
{
148+
Glide.with(mContext)
149+
.load(imageUrl)
150+
.asGif()
151+
.diskCacheStrategy(DiskCacheStrategy.ALL)
152+
.placeholder(deault)
153+
.error(error)
154+
.crossFade()
155+
.into(mImage);
156+
}else
157+
{
158+
//YHGlide.getInstanse(mContext).loadImgeForUrl(imageUrl,mImage);
159+
Glide.with(mContext)
160+
.load(imageUrl)
161+
.diskCacheStrategy(DiskCacheStrategy.ALL)
162+
.placeholder(deault)
163+
.error(error)
164+
.crossFade()
165+
.into(mImage);
166+
}
167+
}
168+
169+
}
141170
public void setImage(@DrawableRes int resId)
142171
{
143172
mImage.setImageResource(resId);

yhlibrary/src/main/java/org/yh/library/view/yhrecyclerview/ArrowRefreshHeader.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public void setArrowImageView(int resid)
112112
mArrowImageView.setImageResource(resid);
113113
}
114114

115+
115116
public void setState(int state)
116117
{
117118
if (state == mState)
@@ -287,7 +288,7 @@ public void onAnimationUpdate(ValueAnimator animation)
287288
animator.start();
288289
}
289290
static Date oldtime = null;//记录最后刷新时间
290-
public static String friendlyTime(Date time)
291+
public String friendlyTime(Date time)
291292
{
292293

293294
//获取time距离当前的秒数
@@ -296,38 +297,38 @@ public static String friendlyTime(Date time)
296297
if (ct == 0)
297298
{
298299
oldtime = time;
299-
return "刚刚";
300+
return getContext().getString(R.string.just);
300301
}
301302

302303
if (ct > 0 && ct < 60)
303304
{
304305
oldtime = time;
305-
return ct + "秒前";
306+
return ct + getContext().getString(R.string.seconds_before);
306307
}
307308

308309
if (ct >= 60 && ct < 3600)
309310
{
310311
oldtime = time;
311-
return Math.max(ct / 60, 1) + "分钟前";
312+
return Math.max(ct / 60, 1) + getContext().getString(R.string.minutes_ago);
312313
}
313314
if (ct >= 3600 && ct < 86400)
314315
{
315316
oldtime = time;
316-
return ct / 3600 + "小时前";
317+
return ct / 3600 + getContext().getString(R.string.hours_before);
317318
}
318319
if (ct >= 86400 && ct < 2592000)
319320
{ //86400 * 30
320321
int day = ct / 86400;
321322
oldtime = time;
322-
return day + "天前";
323+
return day + getContext().getString(R.string.days_ago);
323324
}
324325
if (ct >= 2592000 && ct < 31104000)
325326
{ //86400 * 30
326327
oldtime = time;
327-
return ct / 2592000 + "月前";
328+
return ct / 2592000 + getContext().getString(R.string.minutes_ago);
328329
}
329330
oldtime = time;
330-
return ct / 31104000 + "年前";
331+
return ct / 31104000 + getContext().getString(R.string.years_ago);
331332
}
332333

333334
}

yhlibrary/src/main/res/values-zh/strings.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,12 @@
88
<string name="loading_done">加载完成</string>
99
<string name="listview_header_last_time">上次更新时间:</string>
1010
<string name="loading_default_message">正在提交</string>
11+
12+
<string name="just">刚刚</string>
13+
<string name="seconds_before">秒前</string>
14+
<string name="minutes_ago">分钟前</string>
15+
<string name="hours_before">小时前</string>
16+
<string name="days_ago">天前</string>
17+
<string name="month_ago">月前</string>
18+
<string name="years_ago">年前</string>
1119
</resources>

0 commit comments

Comments
 (0)