Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xuexiangjys
TemplateAppProject
提交
fd45b238
T
TemplateAppProject
项目概览
xuexiangjys
/
TemplateAppProject
通知
17
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
4
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TemplateAppProject
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
4
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fd45b238
编写于
2月 25, 2020
作者:
xuexiangjys
😊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
丰富案例
上级
9345f928
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
834 addition
and
5 deletion
+834
-5
app/src/main/java/com/xuexiang/templateproject/adapter/NewsCardViewListAdapter.java
...iang/templateproject/adapter/NewsCardViewListAdapter.java
+115
-0
app/src/main/java/com/xuexiang/templateproject/adapter/entity/NewInfo.java
.../com/xuexiang/templateproject/adapter/entity/NewInfo.java
+199
-0
app/src/main/java/com/xuexiang/templateproject/fragment/AboutFragment.java
.../com/xuexiang/templateproject/fragment/AboutFragment.java
+0
-1
app/src/main/java/com/xuexiang/templateproject/fragment/news/NewsFragment.java
.../xuexiang/templateproject/fragment/news/NewsFragment.java
+43
-0
app/src/main/java/com/xuexiang/templateproject/utils/DemoDataProvider.java
.../com/xuexiang/templateproject/utils/DemoDataProvider.java
+100
-0
app/src/main/java/com/xuexiang/templateproject/widget/MaterialFooter.java
...a/com/xuexiang/templateproject/widget/MaterialFooter.java
+124
-0
app/src/main/res/drawable-hdpi/ic_comment.png
app/src/main/res/drawable-hdpi/ic_comment.png
+0
-0
app/src/main/res/drawable-hdpi/ic_praise.png
app/src/main/res/drawable-hdpi/ic_praise.png
+0
-0
app/src/main/res/layout/adapter_news_card_view_list_item.xml
app/src/main/res/layout/adapter_news_card_view_list_item.xml
+174
-0
app/src/main/res/layout/fragment_news.xml
app/src/main/res/layout/fragment_news.xml
+26
-4
app/src/main/res/layout/fragment_settings.xml
app/src/main/res/layout/fragment_settings.xml
+46
-0
app/src/main/res/layout/include_head_view_banner.xml
app/src/main/res/layout/include_head_view_banner.xml
+7
-0
未找到文件。
app/src/main/java/com/xuexiang/templateproject/adapter/NewsCardViewListAdapter.java
0 → 100644
浏览文件 @
fd45b238
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com.xuexiang.templateproject.adapter
;
import
android.view.View
;
import
androidx.annotation.NonNull
;
import
com.xuexiang.templateproject.R
;
import
com.xuexiang.templateproject.adapter.entity.NewInfo
;
import
com.xuexiang.templateproject.utils.XToastUtils
;
import
com.xuexiang.xui.adapter.recyclerview.BaseRecyclerAdapter
;
import
com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder
;
import
com.xuexiang.xui.adapter.recyclerview.XRecyclerAdapter
;
import
com.xuexiang.xui.widget.banner.widget.banner.BannerItem
;
import
com.xuexiang.xui.widget.banner.widget.banner.SimpleImageBanner
;
import
com.xuexiang.xui.widget.banner.widget.banner.base.BaseBanner
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 首页动态新闻【只是用于演示效果】
*
* @author XUE
* @since 2019/5/9 10:41
*/
public
class
NewsCardViewListAdapter
extends
BaseRecyclerAdapter
<
NewInfo
>
{
private
static
final
int
TYPE_BANNER_HEAD
=
0
;
private
static
final
int
TYPE_COMMON
=
1
;
private
List
<
BannerItem
>
mData
;
/**
* @param bannerData 轮播条的内容
*/
public
NewsCardViewListAdapter
(
List
<
BannerItem
>
bannerData
)
{
super
();
mData
=
bannerData
;
}
/**
* 适配的布局
*
* @param viewType
* @return
*/
@Override
protected
int
getItemLayoutId
(
int
viewType
)
{
if
(
viewType
==
TYPE_BANNER_HEAD
)
{
return
R
.
layout
.
include_head_view_banner
;
}
else
{
return
R
.
layout
.
adapter_news_card_view_list_item
;
}
}
@Override
public
int
getItemViewType
(
int
position
)
{
if
(
position
==
0
)
{
return
TYPE_BANNER_HEAD
;
}
else
{
return
TYPE_COMMON
;
}
}
public
XRecyclerAdapter
refresh
(
List
<
NewInfo
>
data
)
{
List
<
NewInfo
>
list
=
new
ArrayList
<>(
data
);
//用于占位
list
.
add
(
0
,
new
NewInfo
());
return
super
.
refresh
(
list
);
}
@Override
public
void
bindData
(
@NonNull
RecyclerViewHolder
holder
,
int
position
,
NewInfo
model
)
{
if
(
model
==
null
)
{
return
;
}
if
(
getItemViewType
(
position
)
==
TYPE_BANNER_HEAD
)
{
SimpleImageBanner
headBanner
=
holder
.
findViewById
(
R
.
id
.
sib_simple_usage
);
headBanner
.
setSource
(
mData
)
.
setOnItemClickListener
(
new
BaseBanner
.
OnItemClickListener
<
BannerItem
>()
{
@Override
public
void
onItemClick
(
View
view
,
BannerItem
item
,
int
position
)
{
XToastUtils
.
toast
(
"点击轮播条--->"
+
position
);
}
}).
startScroll
();
}
else
{
holder
.
text
(
R
.
id
.
tv_user_name
,
model
.
getUserName
());
holder
.
text
(
R
.
id
.
tv_tag
,
model
.
getTag
());
holder
.
text
(
R
.
id
.
tv_title
,
model
.
getTitle
());
holder
.
text
(
R
.
id
.
tv_summary
,
model
.
getSummary
());
holder
.
text
(
R
.
id
.
tv_praise
,
model
.
getPraise
()
==
0
?
"点赞"
:
String
.
valueOf
(
model
.
getPraise
()));
holder
.
text
(
R
.
id
.
tv_comment
,
model
.
getComment
()
==
0
?
"评论"
:
String
.
valueOf
(
model
.
getComment
()));
holder
.
text
(
R
.
id
.
tv_read
,
"阅读量 "
+
model
.
getRead
());
holder
.
image
(
R
.
id
.
iv_image
,
model
.
getImageUrl
());
}
}
}
app/src/main/java/com/xuexiang/templateproject/adapter/entity/NewInfo.java
0 → 100644
浏览文件 @
fd45b238
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com.xuexiang.templateproject.adapter.entity
;
/**
* 新闻信息
*
* @author xuexiang
* @since 2019/4/7 下午12:07
*/
public
class
NewInfo
{
/**
* 用户名
*/
private
String
UserName
=
"xuexiangjys"
;
/**
* 标签
*/
private
String
Tag
;
/**
* 标题
*/
private
String
Title
;
/**
* 摘要
*/
private
String
Summary
;
/**
* 图片
*/
private
String
ImageUrl
;
/**
* 点赞数
*/
private
int
Praise
;
/**
* 评论数
*/
private
int
Comment
;
/**
* 阅读量
*/
private
int
Read
;
/**
* 新闻的详情地址
*/
private
String
DetailUrl
;
public
NewInfo
()
{
}
public
NewInfo
(
String
userName
,
String
tag
,
String
title
,
String
summary
,
String
imageUrl
,
int
praise
,
int
comment
,
int
read
,
String
detailUrl
)
{
UserName
=
userName
;
Tag
=
tag
;
Title
=
title
;
Summary
=
summary
;
ImageUrl
=
imageUrl
;
Praise
=
praise
;
Comment
=
comment
;
Read
=
read
;
DetailUrl
=
detailUrl
;
}
public
NewInfo
(
String
tag
,
String
title
,
String
summary
,
String
imageUrl
,
String
detailUrl
)
{
Tag
=
tag
;
Title
=
title
;
Summary
=
summary
;
ImageUrl
=
imageUrl
;
DetailUrl
=
detailUrl
;
}
public
NewInfo
(
String
tag
,
String
title
)
{
Tag
=
tag
;
Title
=
title
;
Praise
=
(
int
)
(
Math
.
random
()
*
100
+
5
);
Comment
=
(
int
)
(
Math
.
random
()
*
50
+
5
);
Read
=
(
int
)
(
Math
.
random
()
*
500
+
50
);
}
public
String
getUserName
()
{
return
UserName
;
}
public
NewInfo
setUserName
(
String
userName
)
{
UserName
=
userName
;
return
this
;
}
public
String
getTag
()
{
return
Tag
;
}
public
NewInfo
setTag
(
String
tag
)
{
Tag
=
tag
;
return
this
;
}
public
String
getTitle
()
{
return
Title
;
}
public
NewInfo
setTitle
(
String
title
)
{
Title
=
title
;
return
this
;
}
public
String
getSummary
()
{
return
Summary
;
}
public
NewInfo
setSummary
(
String
summary
)
{
Summary
=
summary
;
return
this
;
}
public
String
getImageUrl
()
{
return
ImageUrl
;
}
public
NewInfo
setImageUrl
(
String
imageUrl
)
{
ImageUrl
=
imageUrl
;
return
this
;
}
public
int
getPraise
()
{
return
Praise
;
}
public
NewInfo
setPraise
(
int
praise
)
{
Praise
=
praise
;
return
this
;
}
public
int
getComment
()
{
return
Comment
;
}
public
NewInfo
setComment
(
int
comment
)
{
Comment
=
comment
;
return
this
;
}
public
int
getRead
()
{
return
Read
;
}
public
NewInfo
setRead
(
int
read
)
{
Read
=
read
;
return
this
;
}
public
String
getDetailUrl
()
{
return
DetailUrl
;
}
public
NewInfo
setDetailUrl
(
String
detailUrl
)
{
DetailUrl
=
detailUrl
;
return
this
;
}
@Override
public
String
toString
()
{
return
"NewInfo{"
+
"UserName='"
+
UserName
+
'\''
+
", Tag='"
+
Tag
+
'\''
+
", Title='"
+
Title
+
'\''
+
", Summary='"
+
Summary
+
'\''
+
", ImageUrl='"
+
ImageUrl
+
'\''
+
", Praise="
+
Praise
+
", Comment="
+
Comment
+
", Read="
+
Read
+
", DetailUrl='"
+
DetailUrl
+
'\''
+
'}'
;
}
}
app/src/main/java/com/xuexiang/templateproject/fragment/AboutFragment.java
浏览文件 @
fd45b238
...
...
@@ -17,7 +17,6 @@
package
com.xuexiang.templateproject.fragment
;
import
android.view.View
;
import
android.widget.TextView
;
import
com.xuexiang.templateproject.R
;
...
...
app/src/main/java/com/xuexiang/templateproject/fragment/news/NewsFragment.java
浏览文件 @
fd45b238
...
...
@@ -17,18 +17,37 @@
package
com.xuexiang.templateproject.fragment.news
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.xuexiang.templateproject.R
;
import
com.xuexiang.templateproject.adapter.NewsCardViewListAdapter
;
import
com.xuexiang.templateproject.core.BaseFragment
;
import
com.xuexiang.templateproject.utils.DemoDataProvider
;
import
com.xuexiang.templateproject.utils.Utils
;
import
com.xuexiang.xpage.annotation.Page
;
import
com.xuexiang.xpage.enums.CoreAnim
;
import
com.xuexiang.xui.utils.WidgetUtils
;
import
com.xuexiang.xui.widget.actionbar.TitleBar
;
import
butterknife.BindView
;
/**
* 首页动态
*
* @author xuexiang
* @since 2019-10-30 00:15
*/
@Page
(
anim
=
CoreAnim
.
none
)
public
class
NewsFragment
extends
BaseFragment
{
@BindView
(
R
.
id
.
recyclerView
)
RecyclerView
recyclerView
;
@BindView
(
R
.
id
.
refreshLayout
)
SmartRefreshLayout
refreshLayout
;
private
NewsCardViewListAdapter
mAdapter
;
/**
* @return 返回为 null意为不需要导航栏
*/
...
...
@@ -52,6 +71,30 @@ public class NewsFragment extends BaseFragment {
*/
@Override
protected
void
initViews
()
{
WidgetUtils
.
initRecyclerView
(
recyclerView
,
0
);
recyclerView
.
setAdapter
(
mAdapter
=
new
NewsCardViewListAdapter
(
DemoDataProvider
.
getBannerList
()));
}
@Override
protected
void
initListeners
()
{
//下拉刷新
refreshLayout
.
setOnRefreshListener
(
refreshLayout
->
{
// TODO: 2020-02-25 这里只是模拟了网络请求
refreshLayout
.
getLayout
().
postDelayed
(()
->
{
mAdapter
.
refresh
(
DemoDataProvider
.
getDemoNewInfos
());
refreshLayout
.
finishRefresh
();
},
1000
);
});
//上拉加载
refreshLayout
.
setOnLoadMoreListener
(
refreshLayout
->
{
// TODO: 2020-02-25 这里只是模拟了网络请求
refreshLayout
.
getLayout
().
postDelayed
(()
->
{
mAdapter
.
loadMore
(
DemoDataProvider
.
getDemoNewInfos
());
refreshLayout
.
finishLoadMore
();
},
1000
);
});
refreshLayout
.
autoRefresh
();
//第一次进入触发自动刷新,演示效果
mAdapter
.
setOnItemClickListener
((
itemView
,
item
,
position
)
->
Utils
.
goWeb
(
getContext
(),
item
.
getDetailUrl
()));
}
}
app/src/main/java/com/xuexiang/templateproject/utils/DemoDataProvider.java
0 → 100644
浏览文件 @
fd45b238
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com.xuexiang.templateproject.utils
;
import
com.xuexiang.templateproject.adapter.entity.NewInfo
;
import
com.xuexiang.xaop.annotation.MemoryCache
;
import
com.xuexiang.xui.widget.banner.widget.banner.BannerItem
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* 演示数据
*
* @author xuexiang
* @since 2018/11/23 下午5:52
*/
public
class
DemoDataProvider
{
public
static
String
[]
titles
=
new
String
[]{
"伪装者:胡歌演绎'痞子特工'"
,
"无心法师:生死离别!月牙遭虐杀"
,
"花千骨:尊上沦为花千骨"
,
"综艺饭:胖轩偷看夏天洗澡掀波澜"
,
"碟中谍4:阿汤哥高塔命悬一线,超越不可能"
,
};
public
static
String
[]
urls
=
new
String
[]{
//640*360 360/640=0.5625
"http://photocdn.sohu.com/tvmobilemvms/20150907/144160323071011277.jpg"
,
//伪装者:胡歌演绎"痞子特工"
"http://photocdn.sohu.com/tvmobilemvms/20150907/144158380433341332.jpg"
,
//无心法师:生死离别!月牙遭虐杀
"http://photocdn.sohu.com/tvmobilemvms/20150907/144160286644953923.jpg"
,
//花千骨:尊上沦为花千骨
"http://photocdn.sohu.com/tvmobilemvms/20150902/144115156939164801.jpg"
,
//综艺饭:胖轩偷看夏天洗澡掀波澜
"http://photocdn.sohu.com/tvmobilemvms/20150907/144159406950245847.jpg"
,
//碟中谍4:阿汤哥高塔命悬一线,超越不可能
};
@MemoryCache
public
static
List
<
BannerItem
>
getBannerList
()
{
List
<
BannerItem
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
urls
.
length
;
i
++)
{
BannerItem
item
=
new
BannerItem
();
item
.
imgUrl
=
urls
[
i
];
item
.
title
=
titles
[
i
];
list
.
add
(
item
);
}
return
list
;
}
/**
* 用于占位的空信息
*
* @return
*/
@MemoryCache
public
static
List
<
NewInfo
>
getDemoNewInfos
()
{
List
<
NewInfo
>
list
=
new
ArrayList
<>();
list
.
add
(
new
NewInfo
(
"源码"
,
"Android源码分析--Android系统启动"
)
.
setSummary
(
"其实Android系统的启动最主要的内容无非是init、Zygote、SystemServer这三个进程的启动,他们一起构成的铁三角是Android系统的基础。"
)
.
setDetailUrl
(
"https://juejin.im/post/5c6fc0cdf265da2dda694f05"
)
.
setImageUrl
(
"https://user-gold-cdn.xitu.io/2019/2/22/16914891cd8a950a?imageView2/0/w/1280/h/960/format/webp/ignore-error/1"
));
list
.
add
(
new
NewInfo
(
"Android UI"
,
"XUI 一个简洁而优雅的Android原生UI框架,解放你的双手"
)
.
setSummary
(
"涵盖绝大部分的UI组件:TextView、Button、EditText、ImageView、Spinner、Picker、Dialog、PopupWindow、ProgressBar、LoadingView、StateLayout、FlowLayout、Switch、Actionbar、TabBar、Banner、GuideView、BadgeView、MarqueeView、WebView、SearchView等一系列的组件和丰富多彩的样式主题。\n"
)
.
setDetailUrl
(
"https://juejin.im/post/5c3ed1dae51d4543805ea48d"
)
.
setImageUrl
(
"https://user-gold-cdn.xitu.io/2019/1/16/1685563ae5456408?imageView2/0/w/1280/h/960/format/webp/ignore-error/1"
));
list
.
add
(
new
NewInfo
(
"面试"
,
"写给即将面试的你"
)
.
setSummary
(
"最近由于公司业务发展,需要招聘技术方面的人才,由于我在技术方面比较熟悉,技术面的任务就交给我了。今天我要分享的就和面试有关,主要包含技术面的流程、经验和建议,避免大家在今后的面试过程中走一些弯路,帮助即将需要跳槽面试的人。"
)
.
setDetailUrl
(
"https://juejin.im/post/5ca4df966fb9a05e4e58320c"
)
.
setImageUrl
(
"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1554629219186&di=6cdab5cfceaae1f7e6d78dbe79104c9f&imgtype=0&src=http%3A%2F%2Fimg.qinxue365.com%2Fuploads%2Fallimg%2F1902%2F4158-1Z22FZ64E00.jpg"
));
list
.
add
(
new
NewInfo
(
"Android"
,
"XUpdate 一个轻量级、高可用性的Android版本更新框架"
)
.
setSummary
(
"XUpdate 一个轻量级、高可用性的Android版本更新框架。本框架借鉴了AppUpdate中的部分思想和UI界面,将版本更新中的各部分环节抽离出来,形成了如下几个部分:"
)
.
setDetailUrl
(
"https://juejin.im/post/5b480b79e51d45190905ef44"
)
.
setImageUrl
(
"https://user-gold-cdn.xitu.io/2018/7/13/16492d9b7877dc21?imageView2/0/w/1280/h/960/format/webp/ignore-error/1"
));
list
.
add
(
new
NewInfo
(
"Android/HTTP"
,
"XHttp2 一个功能强悍的网络请求库,使用RxJava2 + Retrofit2 + OKHttp进行组装"
)
.
setSummary
(
"一个功能强悍的网络请求库,使用RxJava2 + Retrofit2 + OKHttp组合进行封装。还不赶紧点击使用说明文档,体验一下吧!"
)
.
setDetailUrl
(
"https://juejin.im/post/5b6b9b49e51d4576b828978d"
)
.
setImageUrl
(
"https://user-gold-cdn.xitu.io/2018/8/9/1651c568a7e30e02?imageView2/0/w/1280/h/960/format/webp/ignore-error/1"
));
return
list
;
}
}
app/src/main/java/com/xuexiang/templateproject/widget/MaterialFooter.java
0 → 100644
浏览文件 @
fd45b238
/*
* Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package
com.xuexiang.templateproject.widget
;
import
android.content.Context
;
import
android.util.AttributeSet
;
import
android.view.View
;
import
android.widget.FrameLayout
;
import
android.widget.ProgressBar
;
import
androidx.annotation.NonNull
;
import
com.scwang.smartrefresh.layout.api.RefreshFooter
;
import
com.scwang.smartrefresh.layout.api.RefreshKernel
;
import
com.scwang.smartrefresh.layout.api.RefreshLayout
;
import
com.scwang.smartrefresh.layout.constant.RefreshState
;
import
com.scwang.smartrefresh.layout.constant.SpinnerStyle
;
import
com.scwang.smartrefresh.layout.util.DensityUtil
;
/**
* Material风格的上拉加载
*
* @author xuexiang
* @since 2019-08-03 11:14
*/
public
class
MaterialFooter
extends
ProgressBar
implements
RefreshFooter
{
public
MaterialFooter
(
Context
context
)
{
this
(
context
,
null
);
}
public
MaterialFooter
(
Context
context
,
AttributeSet
attrs
)
{
super
(
context
,
attrs
);
initView
();
}
private
void
initView
()
{
setVisibility
(
GONE
);
FrameLayout
.
LayoutParams
params
=
new
FrameLayout
.
LayoutParams
(
FrameLayout
.
LayoutParams
.
MATCH_PARENT
,
FrameLayout
.
LayoutParams
.
WRAP_CONTENT
);
setPadding
(
0
,
DensityUtil
.
dp2px
(
10
),
0
,
DensityUtil
.
dp2px
(
10
));
setLayoutParams
(
params
);
}
@Override
public
boolean
setNoMoreData
(
boolean
noMoreData
)
{
return
false
;
}
@NonNull
@Override
public
View
getView
()
{
return
this
;
}
@NonNull
@Override
public
SpinnerStyle
getSpinnerStyle
()
{
//指定为平移,不能null
return
SpinnerStyle
.
Translate
;
}
@Override
public
void
onStartAnimator
(
@NonNull
RefreshLayout
refreshLayout
,
int
height
,
int
maxDragHeight
)
{
setVisibility
(
VISIBLE
);
}
@Override
public
int
onFinish
(
@NonNull
RefreshLayout
refreshLayout
,
boolean
success
)
{
setVisibility
(
GONE
);
return
100
;
}
@Override
public
void
onStateChanged
(
@NonNull
RefreshLayout
refreshLayout
,
@NonNull
RefreshState
oldState
,
@NonNull
RefreshState
newState
)
{
}
@Override
public
void
setPrimaryColors
(
int
...
colors
)
{
}
@Override
public
void
onInitialized
(
@NonNull
RefreshKernel
kernel
,
int
height
,
int
maxDragHeight
)
{
}
@Override
public
void
onMoving
(
boolean
isDragging
,
float
percent
,
int
offset
,
int
height
,
int
maxDragHeight
)
{
}
@Override
public
void
onReleased
(
@NonNull
RefreshLayout
refreshLayout
,
int
height
,
int
maxDragHeight
)
{
}
@Override
public
void
onHorizontalDrag
(
float
percentX
,
int
offsetX
,
int
offsetMax
)
{
}
@Override
public
boolean
isSupportHorizontalDrag
()
{
return
false
;
}
}
app/src/main/res/drawable-hdpi/ic_comment.png
0 → 100644
浏览文件 @
fd45b238
978 字节
app/src/main/res/drawable-hdpi/ic_praise.png
0 → 100644
浏览文件 @
fd45b238
927 字节
app/src/main/res/layout/adapter_news_card_view_list_item.xml
0 → 100644
浏览文件 @
fd45b238
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2020 xuexiangjys(xuexiangjys@163.com)
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~
-->
<androidx.cardview.widget.CardView
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/card_view"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"16dp"
android:layout_marginTop=
"10dp"
android:layout_marginEnd=
"16dp"
android:layout_marginBottom=
"6dp"
app:cardBackgroundColor=
"@color/xui_config_color_white"
app:cardCornerRadius=
"8dp"
app:cardElevation=
"4dp"
app:cardPreventCornerOverlap=
"true"
app:contentPaddingBottom=
"10dp"
app:contentPaddingLeft=
"16dp"
app:contentPaddingRight=
"16dp"
app:contentPaddingTop=
"5dp"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingTop=
"5dp"
android:paddingBottom=
"5dp"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<com.xuexiang.xui.widget.imageview.RadiusImageView
android:id=
"@+id/iv_avatar"
android:layout_width=
"24dp"
android:layout_height=
"24dp"
android:src=
"@mipmap/ic_launcher"
app:riv_is_circle=
"true"
/>
<TextView
android:id=
"@+id/tv_user_name"
style=
"@style/TextStyle.Explain"
android:layout_gravity=
"end|center_vertical"
android:layout_marginStart=
"4dp"
android:textColor=
"@color/xui_config_color_pure_black"
tools:text=
"xuexiangjys"
/>
</LinearLayout>
<TextView
android:id=
"@+id/tv_tag"
style=
"@style/TextStyle.Explain"
android:layout_gravity=
"end|center_vertical"
tools:text=
"Java"
/>
</FrameLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<LinearLayout
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:orientation=
"vertical"
>
<TextView
android:id=
"@+id/tv_title"
style=
"@style/TextStyle.Content"
android:ellipsize=
"end"
android:gravity=
"start|center_vertical"
android:maxLines=
"2"
android:singleLine=
"false"
android:textColor=
"@color/xui_config_color_pure_black"
tools:text=
"深度解析RocketMQ消息发送的高可用设计"
/>
<TextView
android:id=
"@+id/tv_summary"
style=
"@style/TextStyle.Explain"
android:layout_marginTop=
"3dp"
android:ellipsize=
"end"
android:gravity=
"start|center_vertical"
android:maxLines=
"2"
android:singleLine=
"false"
android:textColor=
"?attr/xui_config_color_content_text"
tools:text=
"从rocketmq topic的创建机制可知,一个topic对应有多个消息队列,那么我们在发送消息时,是如何选择消息队列进行发送的?"
/>
</LinearLayout>
<com.xuexiang.xui.widget.imageview.RadiusImageView
android:id=
"@+id/iv_image"
android:layout_width=
"80dp"
android:layout_height=
"80dp"
android:layout_marginStart=
"8dp"
android:scaleType=
"centerCrop"
android:src=
"@drawable/xui_ic_default_img"
app:riv_border_width=
"0dp"
app:riv_corner_radius=
"5dp"
/>
</LinearLayout>
<FrameLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"5dp"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:orientation=
"horizontal"
>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_praise"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:src=
"@drawable/ic_praise"
/>
<TextView
android:id=
"@+id/tv_praise"
style=
"@style/TextStyle.Explain"
android:layout_marginStart=
"5dp"
tools:text=
"点赞"
/>
<androidx.appcompat.widget.AppCompatImageView
android:id=
"@+id/iv_comment"
android:layout_width=
"16dp"
android:layout_height=
"16dp"
android:layout_marginStart=
"30dp"
android:src=
"@drawable/ic_comment"
/>
<TextView
android:id=
"@+id/tv_comment"
style=
"@style/TextStyle.Explain"
android:layout_marginStart=
"5dp"
tools:text=
"评论"
/>
</LinearLayout>
<TextView
android:id=
"@+id/tv_read"
style=
"@style/TextStyle.Explain"
android:layout_gravity=
"center_vertical|end"
tools:text=
"阅读量 123"
/>
</FrameLayout>
</LinearLayout>
</androidx.cardview.widget.CardView>
\ No newline at end of file
app/src/main/res/layout/fragment_news.xml
浏览文件 @
fd45b238
...
...
@@ -16,14 +16,36 @@
-->
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<TextView
style=
"@style/TextStyle.Title"
<com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id=
"@+id/refreshLayout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"center"
android:text=
"@string/menu_news"
/>
app:srlEnableAutoLoadMore=
"true"
app:srlEnableLoadMore=
"true"
>
<com.scwang.smartrefresh.header.MaterialHeader
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/recyclerView"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:overScrollMode=
"never"
tools:listitem=
"@layout/adapter_news_card_view_list_item"
/>
<!-- 注意修改包名时,这里也需要修改 -->
<com.xuexiang.templateproject.widget.MaterialFooter
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/fragment_settings.xml
浏览文件 @
fd45b238
...
...
@@ -16,10 +16,56 @@
-->
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
>
<com.scwang.smartrefresh.layout.SmartRefreshLayout
style=
"@style/PullDownStyle"
>
<androidx.core.widget.NestedScrollView
style=
"@style/ScrollViewStyle"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:paddingTop=
"20dp"
>
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
style=
"@style/InfoItem.Account"
app:sLeftTextString=
"通用"
/>
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
style=
"@style/InfoItem.Account"
app:sLeftTextString=
"隐私"
/>
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
style=
"@style/InfoItem.Account"
app:sLeftTextString=
"推送"
/>
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
style=
"@style/InfoItem.Account"
app:sDividerLineType=
"none"
app:sLeftTextString=
"帮助"
/>
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
android:id=
"@+id/menu_settings"
style=
"@style/InfoItem"
android:layout_marginTop=
"16dp"
app:sCenterTextString=
"切换账号"
app:sDividerLineType=
"none"
/>
<com.xuexiang.xui.widget.textview.supertextview.SuperTextView
android:id=
"@+id/menu_about"
style=
"@style/InfoItem"
android:layout_marginTop=
"16dp"
app:sCenterTextColor=
"@color/xui_config_color_red"
app:sCenterTextString=
"退出登录"
app:sDividerLineType=
"none"
/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</LinearLayout>
\ No newline at end of file
app/src/main/res/layout/include_head_view_banner.xml
0 → 100644
浏览文件 @
fd45b238
<?xml version="1.0" encoding="utf-8"?>
<com.xuexiang.xui.widget.banner.widget.banner.SimpleImageBanner
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:id=
"@+id/sib_simple_usage"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:bb_scale=
"0.5625"
/>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录