新闻详情页替换接口方式

This commit is contained in:
itgaojian 2023-03-10 09:41:45 +08:00
parent bf8a7502f4
commit 433faa535e
36 changed files with 2269 additions and 142 deletions

View File

@ -20,7 +20,7 @@ import java.util.List;
* 邮箱: itgaojian@163.com
* 描述:
*/
public class BannerImageTextAllAdapter extends BannerAdapter<BaseImageBean, BannerTextHolder> {
public class BannerImageTextAllAdapter extends BannerAdapter<BaseImageBean, BannerTextAllHolder> {
public BannerImageTextAllAdapter(List<BaseImageBean> datas) {
super(datas);
@ -28,13 +28,13 @@ public class BannerImageTextAllAdapter extends BannerAdapter<BaseImageBean, Bann
}
@Override
public BannerTextHolder onCreateHolder(ViewGroup parent, int viewType) {
public BannerTextAllHolder onCreateHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_banner_text_all, parent, false);
return new BannerTextHolder(itemView);
return new BannerTextAllHolder(itemView);
}
@Override
public void onBindView(BannerTextHolder holder, BaseImageBean data, int position, int size) {
public void onBindView(BannerTextAllHolder holder, BaseImageBean data, int position, int size) {
RoundedCornersTransform roundedCornersTransform = new RoundedCornersTransform(holder.itemView.getContext(), ConvertUtils.dp2px(2));
roundedCornersTransform.setNeedCorner(false, false, false, false);
RequestOptions options = new RequestOptions()
@ -49,6 +49,6 @@ public class BannerImageTextAllAdapter extends BannerAdapter<BaseImageBean, Bann
.load(data.getImgUrl())
.apply(options)
.into(holder.mIvCover);
holder.mTvName.setText(data.getName());
holder.mTvName.setContent(data.getName());
}
}

View File

@ -0,0 +1,28 @@
package com.sucstepsoft.cm_utils.core.widget.base;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.sucstepsoft.cm_utils.R;
import com.sucstepsoft.cm_utils.core.widget.views.expandabletextview.ExpandableTextView;
/**
* 作者: adam
* 日期: 2020/6/10 - 5:52 PM
* 邮箱: itgaojian@163.com
* 描述:
*/
public class BannerTextAllHolder extends RecyclerView.ViewHolder {
public ExpandableTextView mTvName;
public ImageView mIvCover;
public BannerTextAllHolder(@NonNull View itemView) {
super(itemView);
mTvName = itemView.findViewById(R.id.tv_name);
mIvCover = itemView.findViewById(R.id.iv_cover);
}
}

View File

@ -0,0 +1,14 @@
package com.sucstepsoft.cm_utils.core.widget.views.expandabletextview;
/**
* @date: on 2018/9/20
* @author: cretin
* @email: mxnzp_life@163.com
* @desc: 为ExpandableTextView添加展开和收回状态的记录
*/
public interface ExpandableStatusFix {
void setStatus(StatusType status);
StatusType getStatus();
}

View File

@ -0,0 +1,102 @@
package com.sucstepsoft.cm_utils.core.widget.views.expandabletextview;
import java.util.List;
/**
* 记录可以点击的内容 位置
*/
public class FormatData {
private String formatedContent;
private List<PositionData> positionDatas;
public String getFormatedContent() {
return formatedContent;
}
public void setFormatedContent(String formatedContent) {
this.formatedContent = formatedContent;
}
public List<PositionData> getPositionDatas() {
return positionDatas;
}
public void setPositionDatas(List<PositionData> positionDatas) {
this.positionDatas = positionDatas;
}
public static class PositionData {
private int start;
private int end;
private String url;
private LinkType type;
//自定义法规则的aim
private String selfAim;
//自定义规则的内容
private String selfContent;
public String getSelfAim() {
return selfAim;
}
public void setSelfAim(String selfAim) {
this.selfAim = selfAim;
}
public String getSelfContent() {
return selfContent;
}
public void setSelfContent(String selfContent) {
this.selfContent = selfContent;
}
public LinkType getType() {
return type;
}
public void setType(LinkType type) {
this.type = type;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public PositionData(int start, int end, String url, LinkType type) {
this.start = start;
this.end = end;
this.url = url;
this.type = type;
}
public PositionData(int start, int end, String selfAim,String selfContent, LinkType type) {
this.start = start;
this.end = end;
this.selfAim = selfAim;
this.selfContent = selfContent;
this.type = type;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
public int getEnd() {
return end;
}
public void setEnd(int end) {
this.end = end;
}
}
}

View File

@ -0,0 +1,11 @@
package com.sucstepsoft.cm_utils.core.widget.views.expandabletextview;
//定义类型的枚举类型
public enum LinkType {
//普通链接
LINK_TYPE,
//@用户
MENTION_TYPE,
//自定义规则
SELF
}

View File

@ -0,0 +1,14 @@
package com.sucstepsoft.cm_utils.core.widget.views.expandabletextview;
/**
* @date: on 2018/9/20
* @author: cretin
* @email: mxnzp_life@163.com
* @desc: 添加描述
*/
public enum StatusType {
//展开
STATUS_EXPAND,
//收起
STATUS_CONTRACT
}

View File

@ -0,0 +1,35 @@
package com.sucstepsoft.cm_utils.core.widget.views.expandabletextview;
import java.util.UUID;
public class UUIDUtils {
/**
* 生成一个32位的不带-的不唯一的uuid
*
* @return
*/
public static String getUuid() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
public static String[] chars = new String[]{"a", "b", "c", "d", "e", "f",
"g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
"t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5",
"6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I",
"J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z"};
/**
* 生成一个32位的不带-的不唯一的uuid
*
* @return
*/
public static String getUuid(int length) {
StringBuilder stringBuilder = new StringBuilder(UUID.randomUUID().toString());
while (stringBuilder.length() < length) {
stringBuilder.append(UUID.randomUUID().toString());
}
return stringBuilder.substring(0,length);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
@ -14,13 +15,38 @@
android:scaleType="fitCenter"
tools:src="@drawable/ic_img_default_banner" />
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
android:id="@+id/tv_name"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/trans_black"
android:padding="8dp"
android:textColor="@color/white"
tools:text="新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题" />
android:layout_height="220dp"
android:layout_alignParentBottom="true">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end">
<com.sucstepsoft.cm_utils.core.widget.views.expandabletextview.ExpandableTextView
android:id="@+id/tv_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="@color/trans_black"
android:padding="8dp"
android:textColor="@color/white"
app:ep_contract_color="@color/app_title_9f_no"
app:ep_expand_color="@color/app_title_9f_no"
app:ep_max_line="3"
app:ep_need_contract="true"
tools:text="新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题新闻标题" />
</RelativeLayout>
</androidx.core.widget.NestedScrollView>
</RelativeLayout>
</RelativeLayout>

View File

@ -96,6 +96,43 @@
<attr name="h_textsize" format="dimension" />
<attr name="h_pro_step" format="integer" />
</declare-styleable>
<declare-styleable name="ExpandableTextView">
<!--保留的行数-->
<attr name="ep_max_line" format="integer" />
<!--是否需要展开-->
<attr name="ep_need_expand" format="boolean" />
<!--是否需要收起 这个是建立在开启展开的基础上的-->
<attr name="ep_need_contract" format="boolean" />
<!--是否需要@用户 -->
<attr name="ep_need_mention" format="boolean" />
<!--是否需要对链接进行处理 -->
<attr name="ep_need_link" format="boolean" />
<!--是否需要动画-->
<attr name="ep_need_animation" format="boolean" />
<!--是否需要永远将展开或者收回放置在最后边-->
<attr name="ep_need_always_showright" format="boolean" />
<!--是否需要将连接转换成网页链接显示 默认为true-->
<attr name="ep_need_convert_url" format="boolean" />
<!--是否需要自定义规则-->
<attr name="ep_need_self" format="boolean" />
<!--收起的文案-->
<attr name="ep_contract_text" format="string" />
<!--展开的文案-->
<attr name="ep_expand_text" format="string" />
<!--展开的文字的颜色-->
<attr name="ep_expand_color" format="color" />
<!--收起的文字的颜色-->
<attr name="ep_contract_color" format="color" />
<!--在收回和展开前面添加的内容的字体颜色-->
<attr name="ep_end_color" format="color" />
<!--链接的文字的颜色-->
<attr name="ep_link_color" format="color" />
<!--@用户的文字的颜色-->
<attr name="ep_mention_color" format="color" />
<!--自定义规则的文字的颜色-->
<attr name="ep_self_color" format="color" />
<!--链接的图标-->
<attr name="ep_link_res" format="reference" />
</declare-styleable>
</resources>

View File

@ -31,4 +31,8 @@
<string name="android_auto_update_dialog_checking">正在检查版本</string>
<string name="big_data_str">安卓%1$s%2$s%3$s</string>
<string name="social_contract">收起</string>
<string name="social_expend">展开</string>
<string name="social_text_target">网页链接</string>
</resources>

View File

@ -0,0 +1,136 @@
package com.tengshisoft.moduleijkplayer.controller;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.animation.Animation;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.tengshisoft.moduleijkplayer.R;
import com.tengshisoft.moduleijkplayer.player.VideoView;
import com.tengshisoft.moduleijkplayer.player.VideoViewManager;
/**
* 准备播放界面
*/
public class AudioPrepareView extends FrameLayout implements IControlComponent {
private ControlWrapper mControlWrapper;
private ImageView mThumb;
private ImageView mStartPlay;
private ProgressBar mLoading;
private FrameLayout mNetWarning;
private TextView mTvState;
public AudioPrepareView(@NonNull Context context) {
super(context);
}
public AudioPrepareView(@NonNull Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public AudioPrepareView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
{
LayoutInflater.from(getContext()).inflate(R.layout.dkplayer_layout_prepare_view, this, true);
mThumb = findViewById(R.id.thumb);
mTvState = findViewById(R.id.tv_state);
mStartPlay = findViewById(R.id.start_play);
mLoading = findViewById(R.id.loading);
mNetWarning = findViewById(R.id.net_warning_layout);
findViewById(R.id.status_btn).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mNetWarning.setVisibility(GONE);
VideoViewManager.instance().setPlayOnMobileNetwork(true);
mControlWrapper.start();
}
});
}
/**
* 设置点击此界面开始播放
*/
public void setClickStart() {
setOnClickListener(v -> mControlWrapper.start());
}
@Override
public void attach(@NonNull ControlWrapper controlWrapper) {
mControlWrapper = controlWrapper;
}
@Override
public View getView() {
return this;
}
@Override
public void onVisibilityChanged(boolean isVisible, Animation anim) {
}
public void setState(String state) {
mTvState.setText(state);
}
@Override
public void onPlayStateChanged(int playState) {
switch (playState) {
case VideoView.STATE_PREPARING:
bringToFront();
setVisibility(VISIBLE);
mStartPlay.setVisibility(View.GONE);
mNetWarning.setVisibility(GONE);
mLoading.setVisibility(View.VISIBLE);
break;
case VideoView.STATE_PLAYING:
case VideoView.STATE_PAUSED:
case VideoView.STATE_ERROR:
case VideoView.STATE_BUFFERING:
case VideoView.STATE_BUFFERED:
case VideoView.STATE_PLAYBACK_COMPLETED:
setVisibility(GONE);
break;
case VideoView.STATE_IDLE:
setVisibility(VISIBLE);
bringToFront();
mLoading.setVisibility(View.GONE);
mNetWarning.setVisibility(GONE);
mStartPlay.setVisibility(View.VISIBLE);
mThumb.setVisibility(View.VISIBLE);
break;
case VideoView.STATE_START_ABORT:
setVisibility(VISIBLE);
mNetWarning.setVisibility(VISIBLE);
mNetWarning.bringToFront();
break;
}
}
@Override
public void onPlayerStateChanged(int playerState) {
}
@Override
public void setProgress(int duration, int position) {
}
@Override
public void onLockStateChanged(boolean isLocked) {
}
}

View File

@ -37,6 +37,9 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
/**
* 新闻只有一级
*/
@Route(path = PathConfig.PATH_MODULE_MAIN_NEWS_LIST)
public class NewsListActivity extends BaseActivity {
@BindView(R2.id.srl_content)
@ -223,6 +226,8 @@ public class NewsListActivity extends BaseActivity {
mAdapter.setData(mNewsDatas);
}
}
mSrlContent.finishRefresh();
mSrlContent.finishLoadMore();
}
@Override
@ -275,7 +280,7 @@ public class NewsListActivity extends BaseActivity {
url = rowsBean.getTemplateRecordUrl();
}
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL)
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)
.withString("id", rowsBean.getNewsContentId())
.withString("url", url)
.withString("isComment", rowsBean.getNewsConfigComment())//是否可以评论

View File

@ -40,7 +40,6 @@ import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.sucstepsoft.cm_utils.constant.PathConfig;
import com.sucstepsoft.cm_utils.core.beans.AddPhotoBean;
import com.sucstepsoft.cm_utils.core.beans.BaseImageBean;
import com.sucstepsoft.cm_utils.core.beans.BaseSuccessBean;
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
import com.sucstepsoft.cm_utils.core.retrofit_net.RetrofitManager;
import com.sucstepsoft.cm_utils.core.widget.base.BannerImageTextAllAdapter;
@ -51,18 +50,30 @@ import com.sucstepsoft.cm_utils.core.widget.views.ButtomDialogView;
import com.sucstepsoft.cm_utils.core.widget.views.ItemSplitDivider;
import com.sucstepsoft.cm_utils.core.widget.views.NestedScrollWebView;
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
import com.sucstepsoft.cm_utils.utils.ConvertUtils;
import com.sucstepsoft.cm_utils.utils.ExceptionHandler;
import com.sucstepsoft.cm_utils.utils.FileUtils;
import com.sucstepsoft.cm_utils.utils.LogUtils;
import com.sucstepsoft.cm_utils.utils.ProiderUtil;
import com.sucstepsoft.cm_utils.utils.ScreenUtils;
import com.sucstepsoft.cm_utils.utils.TimeUtils;
import com.sucstepsoft.cm_utils.utils.UIUtil;
import com.sucstepsoft.cm_utils.utils.UserLgUtils;
import com.sucstepsoft.cm_utils.utils.toast.ToastUtils;
import com.tengshisoft.moduleijkplayer.controller.AudioControlView;
import com.tengshisoft.moduleijkplayer.controller.AudioPrepareView;
import com.tengshisoft.moduleijkplayer.controller.CompleteView;
import com.tengshisoft.moduleijkplayer.controller.ErrorView;
import com.tengshisoft.moduleijkplayer.controller.GestureView;
import com.tengshisoft.moduleijkplayer.controller.PrepareView;
import com.tengshisoft.moduleijkplayer.controller.StandardVideoController;
import com.tengshisoft.moduleijkplayer.controller.TitleView;
import com.tengshisoft.moduleijkplayer.controller.VodControlView;
import com.tengshisoft.moduleijkplayer.player.VideoView;
import com.tengshisoft.mudulemain.R;
import com.tengshisoft.mudulemain.R2;
import com.tengshisoft.mudulemain.cultural.adapter.CommentAdapter;
import com.tengshisoft.mudulemain.cultural.adapter.NewsCategoryAdapter;
import com.tengshisoft.mudulemain.cultural.beans.BaseUserBean;
import com.tengshisoft.mudulemain.cultural.beans.CollectBean;
import com.tengshisoft.mudulemain.cultural.beans.CommentListBean;
@ -145,8 +156,18 @@ public class NewsLocalDetailActivity extends BaseActivity {
TypeFaceTextView mTvPublishTime;
@BindView(R2.id.ll_title_view)
LinearLayout mLlTitleView;
@BindView(R2.id.ll_audio)//音频
LinearLayout mLlAudio;
@BindView(R2.id.vv_audio)
VideoView mAudio;
@BindView(R2.id.rlv_audio_category)
RecyclerView mRlvAudioCategory;
@BindView(R2.id.tv_audio_txt)
TypeFaceTextView mTvAudioTxt;
@BindView(R2.id.iv_banner_left)
ImageView mIvImgLeft;
@BindView(R2.id.iv_banner_right)
ImageView mIvImgRight;
private AddPhotoBean mCurrentBean;
private String mPicPath;
private Unbinder mBind;
@ -168,6 +189,7 @@ public class NewsLocalDetailActivity extends BaseActivity {
private String mTitle;
private String mPhoto;
private File mDestFile;
private NewsCategoryAdapter mCategoryAdapter;
@Override
protected int setLayoutId() {
@ -302,7 +324,6 @@ public class NewsLocalDetailActivity extends BaseActivity {
}
/**
* 获取新闻详情
*/
@ -356,14 +377,17 @@ public class NewsLocalDetailActivity extends BaseActivity {
createImgView(newsDetailBean);
break;
case "3"://音频
createAudioView(newsDetailBean);
break;
case "4"://视频
createVideoView(newsDetailBean);
break;
case "5"://PDF
break;
case "6"://6链接
createWebView(newsDetailBean);
break;
case "1":
case "1"://文章
default:
mLlTitleView.setVisibility(View.VISIBLE);
mTvTitle.setText(newsDetailBean.getNewsContentTitle());
@ -486,8 +510,13 @@ public class NewsLocalDetailActivity extends BaseActivity {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
settings.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
}
String data = b.getNewsContentContent();
mWvContent.loadData(data, "text/html", "utf-8");
if ("6".equals(b.getNewsContentType())) {
mWvContent.loadUrl(b.getNewsContentContent());
} else {
String data = b.getNewsContentContent();
mWvContent.loadDataWithBaseURL(null, getHtmlData(data), "text/html", "utf-8", null);
// mWvContent.loadData(data, "text/html", "utf-8");
}
mWvContent.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) {
@ -499,7 +528,12 @@ public class NewsLocalDetailActivity extends BaseActivity {
super.onPageFinished(view, url);
mContentSkeleton.hide();
view.getSettings().setBlockNetworkImage(false);//开启页面图片加载
runOnUiThread(() -> mWvContent.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)));
runOnUiThread(() -> {
// imgReset();
// pSection();
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
mWvContent.setLayoutParams(params);
});
}
@Override
@ -510,16 +544,16 @@ public class NewsLocalDetailActivity extends BaseActivity {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains(BaseUrlApi.BASE_SYSTEM_IP + "news/route/file/download/true")) {
//TODO 数图资源
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_MAIN_NEWS_PDF)
.withString("title", mTitle)
.withString("url", url)
.navigation();
} else {
view.loadUrl(url);
}
// if (url.contains(BaseUrlApi.BASE_SYSTEM_IP + "news/route/file/download/true")) {
// //TODO 数图资源
// ARouter.getInstance()
// .build(PathConfig.PATH_MODULE_MAIN_NEWS_PDF)
// .withString("title", mTitle)
// .withString("url", url)
// .navigation();
// } else {
// view.loadUrl(url);
// }
return true;
}
});
@ -532,44 +566,215 @@ public class NewsLocalDetailActivity extends BaseActivity {
});
}
// {margin-left:5px;margin-right:5px;margin-top:10px;}
private String getHtmlData(String content) {
String head = "<head>"
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0, user-scalable=no\">"
+ "<style>img{max-width:100%;width:100%;height:auto;}*</style>"
+ "</head>";
return "<html>" + head + "<body>" + content + "</body></html>";
}
/**
* 对图片进行重置大小宽度就是手机屏幕宽度高度根据宽度比便自动缩放
**/
private void imgReset() {
mWvContent.loadUrl("javascript:(function(){" +
"var objs = document.getElementsByTagName('img'); " +
"for(var i=0;i<objs.length;i++) " +
"{"
+ "var img = objs[i]; " +
" img.style.maxWidth = '100%'; img.style.height = 'auto'; " +
"}" +
"})()");
}
/**
* 为锻炼添加
*/
private void pSection() {
mWvContent.loadUrl("javascript:(function(){" +
"var objs = document.getElementsByTagName('p'); " +
"for(var i=0;i<objs.length;i++) " +
"{"
+ "var p = objs[i]; " +
" p.style.textIndent = '35px';" +
"}" +
"})()");
}
/**
* 加载音频新闻
*/
private void createAudioView() {
private void createAudioView(NewsDetailBean b) {
mLlAudio.setVisibility(View.VISIBLE);
for (int i = 0; i < b.getFileList().size(); i++) {
List<NewsDetailBean.FileListBean> fileList = b.getFileList();
if (i == 0) {
fileList.get(i).setCheck(true);
} else {
fileList.get(i).setCheck(false);
}
}
mCategoryAdapter = new NewsCategoryAdapter(mActivity, b.getFileList());
mRlvAudioCategory.setLayoutManager(new LinearLayoutManager(mActivity, LinearLayoutManager.HORIZONTAL, false));
mRlvAudioCategory.setAdapter(mCategoryAdapter);
mCategoryAdapter.addOnItemClickListener(fileListBean -> {
for (int i = 0; i < b.getFileList().size(); i++) {
NewsDetailBean.FileListBean fileBean = b.getFileList().get(i);
if (fileBean.getContentFileFileId().equals(fileListBean.getContentFileFileId())) {
fileBean.setCheck(true);
} else {
fileBean.setCheck(false);
}
}
mCategoryAdapter.setData(b.getFileList());
setAudioUrl(fileListBean);
});
StandardVideoController controller = new StandardVideoController(mActivity);
controller.setEnableOrientation(true);
AudioPrepareView prepareView = new AudioPrepareView(this);//准备播放界面
ImageView thumb = prepareView.findViewById(com.tengshisoft.moduleijkplayer.R.id.thumb);//封面图
Glide.with(mActivity).load(com.tengshisoft.moduleijkplayer.R.drawable.ic_img_default).into(thumb);
controller.addControlComponent(prepareView);
prepareView.setClickStart();
CompleteView completeView = new CompleteView(this);
controller.addControlComponent(completeView);//自动完成播放界面
ErrorView errorView = new ErrorView(this);
controller.addControlComponent(errorView);//错误界面
TitleView titleView = new TitleView(this);//标题栏
controller.addControlComponent(titleView);
//根据是否为直播设置不同的底部控制条
AudioControlView vodControlView = new AudioControlView(this);//点播控制条
controller.addControlComponent(vodControlView);
GestureView gestureControlView = new GestureView(this);//滑动控制视图
controller.addControlComponent(gestureControlView);
controller.setCanChangePosition(false);
//设置标题
titleView.setTitle(mTitle);
mAudio.setVideoController(controller);
mAudio.setUrl(BaseUrlApi.BASE_IMG_URL + b.getFileList().get(0).getContentFileFileId());
mAudio.setLooping(true);
mTvAudioTxt.setText(b.getFileList().get(0).getContentFileText());
}
/**
* 设置音频Url
*/
private void setAudioUrl(NewsDetailBean.FileListBean b) {
if (mAudio == null) {
return;
}
if (mAudio.isPlaying()) {
mAudio.pause();
mAudio.release();
}
mAudio.setUrl(BaseUrlApi.BASE_IMG_URL + b.getContentFileFileId());
mAudio.start();
mTvAudioTxt.setText(b.getContentFileText());
}
/**
* 加载视频新闻
*/
private void createVideoView() {
private void createVideoView(NewsDetailBean b) {
mLlVideo.setVisibility(View.VISIBLE);
for (int i = 0; i < b.getFileList().size(); i++) {
List<NewsDetailBean.FileListBean> fileList = b.getFileList();
if (i == 0) {
fileList.get(i).setCheck(true);
} else {
fileList.get(i).setCheck(false);
}
}
mCategoryAdapter = new NewsCategoryAdapter(mActivity, b.getFileList());
mRlvVideoCategory.setLayoutManager(new LinearLayoutManager(mActivity, LinearLayoutManager.HORIZONTAL, false));
mRlvVideoCategory.setAdapter(mCategoryAdapter);
mCategoryAdapter.addOnItemClickListener(fileListBean -> {
for (int i = 0; i < b.getFileList().size(); i++) {
NewsDetailBean.FileListBean fileBean = b.getFileList().get(i);
if (fileBean.getContentFileFileId().equals(fileListBean.getContentFileFileId())) {
fileBean.setCheck(true);
} else {
fileBean.setCheck(false);
}
}
mCategoryAdapter.setData(b.getFileList());
setVideoUrl(fileListBean);
});
StandardVideoController controller = new StandardVideoController(mActivity);
controller.setEnableOrientation(true);
PrepareView prepareView = new PrepareView(this);//准备播放界面
ImageView thumb = prepareView.findViewById(com.tengshisoft.moduleijkplayer.R.id.thumb);//封面图
Glide.with(mActivity).load(com.tengshisoft.moduleijkplayer.R.drawable.ic_img_default).into(thumb);
controller.addControlComponent(prepareView);
prepareView.setClickStart();
CompleteView completeView = new CompleteView(this);
controller.addControlComponent(completeView);//自动完成播放界面
ErrorView errorView = new ErrorView(this);
controller.addControlComponent(errorView);//错误界面
TitleView titleView = new TitleView(this);//标题栏
controller.addControlComponent(titleView);
//根据是否为直播设置不同的底部控制条
VodControlView vodControlView = new VodControlView(this);//点播控制条
controller.addControlComponent(vodControlView);
GestureView gestureControlView = new GestureView(this);//滑动控制视图
controller.addControlComponent(gestureControlView);
controller.setCanChangePosition(false);
//设置标题
titleView.setTitle(mTitle);
mVideo.setVideoController(controller);
mVideo.setUrl(BaseUrlApi.BASE_IMG_URL + b.getFileList().get(0).getContentFileFileId());
mTvVideoTxt.setText(b.getFileList().get(0).getContentFileText());
// mVideo.addOnStateChangeListener(mOnStateChangeListener);
// mVideo.start();
}
/**
* 设置视频URL
*/
private void setVideoUrl(NewsDetailBean.FileListBean b) {
if (mVideo == null) {
return;
}
if (mVideo.isPlaying()) {
mVideo.pause();
mVideo.release();
}
mVideo.setUrl(BaseUrlApi.BASE_IMG_URL + b.getContentFileFileId());
mVideo.start();
mTvVideoTxt.setText(b.getContentFileText());
}
/**
* 加载图片新闻
*/
private void createImgView(NewsDetailBean b) {
mRlImg.setVisibility(View.VISIBLE);
List<BaseImageBean> mBannerList = new ArrayList<>();
int screenHeight = ScreenUtils.getScreenHeight();
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(mBnImg.getLayoutParams());
LogUtils.e(screenHeight);
params.height = screenHeight - ConvertUtils.dp2px(96) - 50;
mBnImg.setLayoutParams(params);
for (int i = 0; i < b.getFileList().size(); i++) {
NewsDetailBean.FileListBean fileListBean = b.getFileList().get(i);
BaseImageBean bannerBean = new BaseImageBean();
// bannerBean.setPhoto(BaseUrlApi.BASE_NEWS_IMG_URL + fileListBean.getContentFileFileId());
if (i / 2 == 0) {
// bannerBean.setPhoto(BaseUrlApi.BASE_NEWS_IMG_URL + fileListBean.getContentFileFileId());
bannerBean.setImgUrl("https://lmg.jj20.com/up/allimg/tp08/46042223542701-lp.jpg");
} else {
bannerBean.setImgUrl("https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg");
}
bannerBean.setImgUrl(BaseUrlApi.BASE_NEWS_IMG_URL + fileListBean.getContentFileFileId());
bannerBean.setName(fileListBean.getContentFileText());
mBannerList.add(bannerBean);
}
BannerImageTextAllAdapter mBannerImageAdapter = new BannerImageTextAllAdapter(mBannerList);
mBnImg.setAdapter(mBannerImageAdapter);
mBnImg.setPageTransformer(new ScaleInTransformer());
mBnImg.setDelayTime(10000L);
mBnImg.setDelayTime(12000L);
mBnImg.start();
mIvImgLeft.setOnClickListener(v -> mBnImg.setCurrentItem(mBnImg.getCurrentItem() - 1));
mIvImgRight.setOnClickListener(v -> mBnImg.setCurrentItem(mBnImg.getCurrentItem() + 1));
}
/**
@ -1205,9 +1410,48 @@ public class NewsLocalDetailActivity extends BaseActivity {
buttomDialogView.show();
}
@Override
protected void onResume() {
super.onResume();
if (mLlAudio.getVisibility() == View.VISIBLE) {
if (mAudio != null) {
mAudio.pause();
}
}
if (mLlVideo.getVisibility() == View.VISIBLE) {
if (mVideo != null) {
mVideo.pause();
}
}
}
@Override
protected void onPause() {
super.onPause();
if (mLlAudio.getVisibility() == View.VISIBLE) {
if (mAudio != null) {
mAudio.pause();
}
}
if (mLlVideo.getVisibility() == View.VISIBLE) {
if (mVideo != null) {
mVideo.pause();
}
}
}
@Override
protected void onDestroy() {
mContentView = null;
if (mAudio != null) {
mAudio.pause();
mAudio.release();
}
if (mVideo != null) {
mVideo.pause();
mVideo.release();
}
if (mBind != null) {
mBind.unbind();
}

View File

@ -94,7 +94,7 @@ public class NewsMainActivity extends BaseActivity {
if (newsTabBeans != null && newsTabBeans.size() > 0) {
NewsTabBean allBean = new NewsTabBean();
allBean.setDirectoriesName("全部");
allBean.setNewsDirectoriesId("");
allBean.setNewsDirectoriesId(mPId);
allBean.setDirectoriesParentId(mPId);
allBean.setDirectoriesView("2");
newsTabBeans.add(0, allBean);
@ -103,6 +103,7 @@ public class NewsMainActivity extends BaseActivity {
for (int i = 0; i < newsTabBeans.size(); i++) {
Bundle bundle = new Bundle();
bundle.putString("type", newsTabBeans.get(i).getNewsDirectoriesId());
bundle.putBoolean("isAll","全部".equals(newsTabBeans.get(i).getDirectoriesName()));
bundle.putString("pId", "");
BaseFragment fragment = null;
//0 外部链接 1存在子集 2没有子集

View File

@ -142,45 +142,46 @@ public class NewsSearchActivity extends BaseActivity {
* @param type
*/
private void showNewsDetail(NewsItemBean.RowsBean rowsBean, int type) {
String url = "";
if ("6".equals(rowsBean.getNewsContentType())) {
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_MAIN_NEWS_WEB)
.withString("title", rowsBean.getNewsContentTitle())
.withString("url", rowsBean.getNewsContentContent())
.navigation();
} else {
int newsType = 0;
if (type == 1) {
//1自定义列表
//3列表详情
if ("1".equals(rowsBean.getNewsConfigWebSwitch())) {
//列表
url = rowsBean.getTemplateRecordUrl();
newsType = 0;
} else {
//内容
url = rowsBean.getNewsConfigDescriptionText();
newsType = 1;
}
} else {
newsType = 0;
url = rowsBean.getTemplateRecordUrl();
}
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL) //TODO 连接
// .build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)//TODO 接口方式
.withString("id", rowsBean.getNewsContentId())
.withString("url", url)
.withString("isComment", rowsBean.getNewsConfigComment())//是否可以评论
.withString("isCommentImg", rowsBean.getNewsConfigCommentImage())//评论是否可以上传图片
.withString("isCollect", rowsBean.getNewsContentCollectStatus())
.withString("photo",
BaseUrlApi.BASE_NEWS_IMG_URL + rowsBean.getNewsContentCoverList().get(0).getContentCoverId())
.withString("title", rowsBean.getNewsContentTitle())
.withInt("type", newsType)
.navigation();
}
ARouter.getInstance()
// .build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL) //TODO 连接
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)//TODO 接口方式
.withString("id", rowsBean.getNewsContentId())
.withString("url", "")
.withString("isComment", rowsBean.getNewsConfigComment())//是否可以评论
.withString("isCommentImg", rowsBean.getNewsConfigCommentImage())//评论是否可以上传图片
.withString("isCollect", rowsBean.getNewsContentCollectStatus())
.withString("photo",
BaseUrlApi.BASE_NEWS_IMG_URL + rowsBean.getNewsContentCoverList().get(0).getContentCoverId())
.withString("title", rowsBean.getNewsContentTitle())
.withInt("type", 2)
.navigation();
// String url = "";
// if ("6".equals(rowsBean.getNewsContentType())) {
// ARouter.getInstance()
// .build(PathConfig.PATH_MODULE_MAIN_NEWS_WEB)
// .withString("title", rowsBean.getNewsContentTitle())
// .withString("url", rowsBean.getNewsContentContent())
// .navigation();
// } else {
// int newsType = 0;
// if (type == 1) {
// //1自定义列表
// //3列表详情
// if ("1".equals(rowsBean.getNewsConfigWebSwitch())) {
// //列表
// url = rowsBean.getTemplateRecordUrl();
// newsType = 0;
// } else {
// //内容
// url = rowsBean.getNewsConfigDescriptionText();
// newsType = 1;
// }
// } else {
// newsType = 0;
// url = rowsBean.getTemplateRecordUrl();
// }
// }
}
/**

View File

@ -50,7 +50,7 @@ public class NewsAdapter extends BaseRecyclerAdapter<NewsItemBean.RowsBean, Recy
roundedCornersTransform.setNeedCorner(true, true, true, true);
mPicOptions = new RequestOptions()
.transform(roundedCornersTransform)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.error(R.drawable.ic_img_default)
.placeholder(R.drawable.ic_img_default);

View File

@ -0,0 +1,51 @@
package com.tengshisoft.mudulemain.cultural.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
import com.tengshisoft.mudulemain.R;
import com.tengshisoft.mudulemain.cultural.beans.NewsDetailBean;
import com.tengshisoft.mudulemain.cultural.holder.NewsCategoryHolder;
import java.util.List;
/**
* 作者: adam
* 日期: 2020/5/15 - 10:00 AM
* 邮箱: itgaojian@163.com
* 描述:
*/
public class NewsCategoryAdapter extends BaseRecyclerAdapter<NewsDetailBean.FileListBean, NewsCategoryHolder> {
public NewsCategoryAdapter(Context ctx, List<NewsDetailBean.FileListBean> list) {
super(ctx, list);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public NewsCategoryHolder createHolder(ViewGroup parent, int viewType) {
View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_news_category, parent, false);
return new NewsCategoryHolder(itemView);
}
@Override
public void bindHolder(NewsCategoryHolder h, int i) {
NewsDetailBean.FileListBean b = mData.get(i);
if (b.isCheck()) {
h.mTvName.setBackgroundResource(R.drawable.shape_red_line_ra_2);
} else {
h.mTvName.setBackgroundResource(0);
}
h.mTvName.setText(String.valueOf(i + 1));
}
}

View File

@ -338,6 +338,8 @@ public class NewsDetailBean {
private String contentFileText;
private String newsContentFileId;
private String newsContentId;
private boolean isCheck;
public String getContentFileFileId() {
return contentFileFileId;
@ -378,6 +380,15 @@ public class NewsDetailBean {
public void setNewsContentId(String newsContentId) {
this.newsContentId = newsContentId;
}
public boolean isCheck() {
return isCheck;
}
public void setCheck(boolean check) {
isCheck = check;
}
}
public static class NewsContentCoverListBean {

View File

@ -101,6 +101,10 @@ public class HomeFragment extends BaseFragment {
// LinearLayout mLlMainNews;
@BindView(R2.id.ll_news_content)
LinearLayout mLlNewsContent;
@BindView(R2.id.rl_main_func)
RelativeLayout mRlMainFunc;
@BindView(R2.id.rl_commend)
RelativeLayout mRlCommend;
private Unbinder mBind;
private List<NewsTabBean> mFuncBeans = new ArrayList<>();
private List<BaseImageBean> mBannerList = new ArrayList<>();
@ -109,11 +113,13 @@ public class HomeFragment extends BaseFragment {
private NewsAdapter mMAdapter;
private ViewSkeletonScreen mNewsSkeleton;
private MainCommendAdapter mCommendAdapter;
private RecyclerViewSkeletonScreen mCommendSkeleton;
private ViewSkeletonScreen mBannerSkeleton;
private RecyclerViewSkeletonScreen mLiveSkeleton;
private LiveAdapter mLiveAdapter;
private BannerImageTextAdapter mBannerImageAdapter;
private ViewSkeletonScreen mFuncSkeleton;
private MainFuncAdapter mFuncAdapter;
private ViewSkeletonScreen mCommendSkeleton;
@Override
protected void setDataToView(View dataView) {
@ -182,10 +188,6 @@ public class HomeFragment extends BaseFragment {
mNewsSkeleton = Skeleton.bind(mLlNewsContent)
.load(R.layout.item_skeleton_news_content)
.show();
mCommendSkeleton = Skeleton.bind(mRlvCommend)
.adapter(mCommendAdapter)
.load(R.layout.item_skeleton_image)
.show();
mBannerSkeleton = Skeleton.bind(mBanner)
.load(R.layout.item_skeleton_banner)
@ -195,6 +197,14 @@ public class HomeFragment extends BaseFragment {
.count(5)
.load(R.layout.item_skeleton_live_grid)
.show();
mFuncSkeleton = Skeleton.bind(mRlMainFunc)
.load(R.layout.item_skeleton_main_func_grid)
.show();
mCommendSkeleton = Skeleton.bind(mRlCommend)
.load(R.layout.item_skeleton_main_func_grid)
.show();
buildMainFuncMenu(null);
buildBannerData();
getMainFuncMenu();//获取首页功能按钮
@ -214,7 +224,7 @@ public class HomeFragment extends BaseFragment {
} else {
if (!TextUtils.isEmpty(bean.getId())) {
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL)
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)
.withString("id", bean.getId())
.withString("url", bean.getUrl())
.withString("isComment", bean.getIsComment())//是否可以评论
@ -278,6 +288,7 @@ public class HomeFragment extends BaseFragment {
* 获取首页功能
*/
private void getMainFuncMenu() {
mFuncSkeleton.show();
RetrofitManager.getInstance()
.create(HomeApi.class)
.getMainFunc()
@ -291,21 +302,21 @@ public class HomeFragment extends BaseFragment {
@Override
public void onNext(List<NewsTabBean> newsTabBeans) {
if (newsTabBeans != null && newsTabBeans.size() > 0) {
buildMainFuncMenu(newsTabBeans);
} else {
}
buildMainFuncMenu(newsTabBeans);
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
buildMainFuncMenu(null);
}
@Override
public void onComplete() {
mSrlView.finishRefresh();
if (mFuncSkeleton != null) {
mFuncSkeleton.hide();
}
}
});
}
@ -315,6 +326,9 @@ public class HomeFragment extends BaseFragment {
* 3条场馆 3条活动
*/
private void getMainCommendList() {
if (mCommendSkeleton != null) {
mCommendSkeleton.show();
}
Observable[] mObservales = new Observable[2];
Observable<PlaceListBean> hot = RetrofitManager.getInstance()
.create(HomeApi.class)
@ -387,6 +401,9 @@ public class HomeFragment extends BaseFragment {
@Override
public void onComplete() {
mSrlView.finishRefresh();
if (mCommendSkeleton != null) {
mCommendSkeleton.hide();
}
}
});
@ -479,8 +496,8 @@ public class HomeFragment extends BaseFragment {
url = rowsBean.getTemplateRecordUrl();
}
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL) //TODO 连接
// .build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)//TODO 接口方式
// .build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL) //TODO 连接
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)//TODO 接口方式
.withString("id", rowsBean.getNewsContentId())
.withString("url", url)
.withString("isComment", rowsBean.getNewsConfigComment())//是否可以评论
@ -789,7 +806,9 @@ public class HomeFragment extends BaseFragment {
*/
private void buildMainFuncMenu(List<NewsTabBean> list) {
mFuncBeans.clear();
if (mFuncSkeleton != null) {
mFuncSkeleton.hide();
}
// MainFuncBean showBean = new MainFuncBean();
// showBean.setIconRes(R.drawable.ic_show_icon);
@ -836,12 +855,12 @@ public class HomeFragment extends BaseFragment {
mFuncBeans.add(culturalBean);
mFuncBeans.add(movieBean);
MainFuncAdapter funcAdapter = new MainFuncAdapter(getActivity(), mFuncBeans);
mFuncAdapter = new MainFuncAdapter(getActivity(), mFuncBeans);
LinearLayoutManager manager = new LinearLayoutManager(mActivity, LinearLayoutManager.HORIZONTAL, false);
mRlvMainFunc.setLayoutManager(manager);
mRlvMainFunc.setAdapter(funcAdapter);
mRlvMainFunc.setAdapter(mFuncAdapter);
funcAdapter.addOnItemClickListener(this::chooseFuncPage);
mFuncAdapter.addOnItemClickListener(this::chooseFuncPage);
mRlvMainFunc.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {

View File

@ -65,6 +65,7 @@ public class NewsFragment extends BaseFragment {
private Disposable mD1;
private Disposable mD2;
private Disposable mDMenu;
private boolean mIsAll;
@Override
protected void setDataToView(View dataView) {
@ -73,6 +74,7 @@ public class NewsFragment extends BaseFragment {
mAdapter = new NewsAdapter(mActivity, mNewsDatas);
mType = getArguments().getString("type");
mPid = getArguments().getString("pId");
mIsAll = getArguments().getBoolean("isAll");
mCurrentPage = 1;
mTotalPage = 0;
mNewsDatas.clear();
@ -88,7 +90,9 @@ public class NewsFragment extends BaseFragment {
.adapter(mAdapter)
.load(R.layout.item_skeleton_news)
.show();
getNewsSubMenu(mType);
if (!mIsAll) {
getNewsSubMenu(mType);
}
if (!TextUtils.isEmpty(UserLgUtils.getToken())) {
getNewsListByTypeToken(mCurrentPage);
@ -137,8 +141,8 @@ public class NewsFragment extends BaseFragment {
url = rowsBean.getTemplateRecordUrl();
}
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL)
// .build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)
// .build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL)//TODO 详情模板
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)//TODO 接口方式
.withString("id", rowsBean.getNewsContentId())
.withString("url", url)
.withString("isComment", rowsBean.getNewsConfigComment())//是否可以评论
@ -154,7 +158,7 @@ public class NewsFragment extends BaseFragment {
private void getNewsListByTypeToken(int page) {
RetrofitManager.getInstance()
.create(HomeApi.class)
.getNewsListByToken(mType, "", page + "", UserLgUtils.getToken())
.getNewsListByToken(mIsAll ? "" : mType, mIsAll ? mType : "", page + "", UserLgUtils.getToken())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NewsItemBean>() {
@ -172,24 +176,24 @@ public class NewsFragment extends BaseFragment {
if (newsItemBean != null && newsItemBean.getRows().size() > 0) {
mTotalPage = newsItemBean.getTotal();
getCommentCount(1, newsItemBean);
// mNewsDatas = newsItemBean.getRows();
// mNewsDatas.addAll(newsItemBean.getRows());
// mAdapter.setData(mNewsDatas);
// setStateView(STATE_SUCCESS);
setStateView(STATE_SUCCESS);
} else {
setStateView(STATE_EMPTY);
}
mSrlView.finishRefresh();
} else {
if (newsItemBean != null) {
// mNewsDatas.addAll(newsItemBean.getRows());
// mAdapter.setData(mNewsDatas);
getCommentCount(2, newsItemBean);
mSrlView.finishLoadMore();
} else {
mSrlView.setNoMoreData(true);
}
}
mSrlView.finishLoadMore();
mSrlView.finishRefresh();
}
@Override
@ -218,7 +222,6 @@ public class NewsFragment extends BaseFragment {
* @param id
*/
private void getNewsSubMenu(String id) {
RetrofitManager.getInstance()
.create(HomeApi.class)
.getNewsTabListByPid(id)
@ -262,7 +265,7 @@ public class NewsFragment extends BaseFragment {
private void getNewsListByType(int page) {
RetrofitManager.getInstance()
.create(HomeApi.class)
.getNewsList(mType, "", page + "")
.getNewsList(mIsAll ? "" : mType, mIsAll ? mType : "", page + "")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Observer<NewsItemBean>() {

View File

@ -0,0 +1,24 @@
package com.tengshisoft.mudulemain.cultural.holder;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView;
import com.tengshisoft.mudulemain.R;
/**
* 作者: adam
* 日期: 2020/5/28 - 10:18 AM
* 邮箱: itgaojian@163.com
* 描述:
*/
public class NewsCategoryHolder extends RecyclerView.ViewHolder {
public TypeFaceTextView mTvName;
public NewsCategoryHolder(@NonNull View itemView) {
super(itemView);
mTvName = itemView.findViewById(R.id.tv_category);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke
android:width="1dp"
android:color="@color/white" />
<corners android:radius="3dp" />
</shape>

View File

@ -97,16 +97,33 @@
android:layout_width="match_parent"
android:layout_height="240dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_video_category"
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="目录"
android:textColor="@color/white"
app:text_type_cus="2" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_video_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:padding="5dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginTop="10dp"
android:orientation="vertical">
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
@ -132,15 +149,33 @@
<RelativeLayout
android:id="@+id/rl_img"
android:layout_width="match_parent"
android:layout_height="500dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
android:visibility="gone"
tools:visibility="gone">
<com.youth.banner.Banner
android:id="@+id/bn_img"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView
android:id="@+id/iv_banner_left"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:src="@drawable/ic_img_arrow_left" />
<ImageView
android:id="@+id/iv_banner_right"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:src="@drawable/ic_img_arrow_right" />
</RelativeLayout>
<!--====================音频===========================-->
<LinearLayout
@ -148,7 +183,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
android:visibility="gone"
tools:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
@ -156,22 +192,48 @@
android:background="@color/black"
android:orientation="vertical">
<com.tengshisoft.moduleijkplayer.player.VideoView
android:id="@+id/vv_audio"
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="240dp" />
android:layout_height="240dp">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_audio_category"
<com.tengshisoft.moduleijkplayer.player.VideoView
android:id="@+id/vv_audio"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_horizontal"
android:orientation="vertical">
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:text="目录"
android:textColor="@color/white"
app:text_type_cus="2" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_audio_category"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical">
android:layout_marginTop="10dp"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
android:layout_width="match_parent"
@ -193,10 +255,13 @@
</LinearLayout>
</LinearLayout>
<!--====================文章===========================-->
<com.sucstepsoft.cm_utils.core.widget.views.NestedScrollWebView
android:id="@+id/nwv_content"
android:layout_width="match_parent"
android:layout_height="300dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:focusable="true"
android:focusableInTouchMode="true"
android:paddingLeft="10dp"

View File

@ -19,6 +19,7 @@
android:layout_height="220dp" />
<RelativeLayout
android:id="@+id/rl_main_func"
android:layout_width="match_parent"
android:layout_height="wrap_content">
@ -93,6 +94,7 @@
android:background="@color/gray_line" />
<RelativeLayout
android:id="@+id/rl_commend"
android:layout_width="match_parent"
android:layout_height="wrap_content">

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<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"
@ -9,13 +8,25 @@
android:theme="@style/Theme.AppCompat"
tools:ignore="MissingDefaultResource">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_menu"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_news_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_menu"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_news_content"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.sucstepsoft.cm_utils.core.widget.views.TypeFaceTextView
android:id="@+id/tv_category"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="15dp"
android:textColor="@color/white"
android:textSize="@dimen/text_14"
tools:text="1" />
</LinearLayout>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<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="80dp"
android:orientation="horizontal">
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@color/light_transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_weight="1" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@color/light_transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_weight="1" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@color/light_transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_weight="1" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_margin="3dp"
android:layout_weight="1"
android:background="@color/light_transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_weight="1"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_weight="1" />
</LinearLayout>

View File

@ -92,7 +92,7 @@ public class CollectActivity extends BaseActivity {
url = rowsBean.getTemplateRecordUrl();
}
ARouter.getInstance()
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL)
.build(PathConfig.PATH_MODULE_MAIN_NEWS_DETAIL_INTERFACE)
.withString("id", rowsBean.getNewsContentId())
.withString("url", url)
.withString("isComment", rowsBean.getNewsConfigComment())//是否可以评论

View File

@ -6,6 +6,7 @@ import android.view.View;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
import com.tengshisoft.moduleplace.R;
@ -36,6 +37,7 @@ public class PlaceFuncAdapter extends BaseRecyclerAdapter<PlaceFuncBean.DataBean
placeFuncHolder.mTvName.setText(mData.get(i).getDictionaryName());
Glide.with(mContext)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.NONE)
.load(BaseUrlApi.BASE_PLACE_IMG_IP + mData.get(i).getDictionaryIcon())
.apply(options)
.into(placeFuncHolder.mIvIcon);

View File

@ -7,6 +7,7 @@ import android.view.View;
import android.view.ViewGroup;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.sucstepsoft.cm_utils.core.retrofit_net.BaseUrlApi;
import com.sucstepsoft.cm_utils.core.widget.base.BaseRecyclerAdapter;
import com.tengshisoft.moduleplace.R;
@ -55,6 +56,7 @@ public class PlaceListAdapter extends BaseRecyclerAdapter<PlaceListBean.RowsBean
String[] split = rowsBean.getVenuePanorama().split(",");
Glide.with(mContext)
.asBitmap()
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.load(BaseUrlApi.BASE_PLACE_IMG_IP + split[0])
.apply(options)
.into(holder.mIvCover);

View File

@ -26,8 +26,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="5dp"
android:orientation="horizontal">
android:orientation="horizontal"
android:padding="5dp">
<RadioButton
android:id="@+id/rb_default"
@ -125,11 +125,17 @@
tools:text="加载数据失败" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_place_content"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/item_place_list" />
android:layout_height="match_parent"
android:fillViewport="true">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_place_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:listitem="@layout/item_place_list" />
</androidx.core.widget.NestedScrollView>
</FrameLayout>