wangkai

添加Comp

Showing 36 changed files with 3173 additions and 388 deletions

Too many changes to show.

To preserve performance only 36 of 36+ files are displayed.

... ... @@ -9,7 +9,7 @@ android {
buildToolsVersion var.buildToolsVersion
defaultConfig {
applicationId "com.example.myapplication"
applicationId "com.wondertek.easycode"
minSdkVersion var.minSdkVersion
targetSdkVersion var.targetSdkVersion
versionCode var.versionCode
... ...
... ... @@ -11,9 +11,9 @@
android:name=".MyApplication"
android:allowBackup="true"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:icon="@mipmap/ic_fastcode"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:roundIcon="@mipmap/ic_fastcode"
android:supportsRtl="true"
android:theme="@style/Theme.MyApplication"
tools:targetApi="31">
... ...
<resources>
<string name="app_name">My Application</string>
<string name="app_name">快马</string>
</resources>
\ No newline at end of file
... ...
/*
* Copyright (c) Wondertek Technologies Co., Ltd. 2019-2022. All rights reserved.
*/
package com.wd.common.dialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Typeface;
import android.text.TextUtils;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.wd.fastcoding.base.R;
import com.wd.foundation.wdkitcore.tools.ResUtils;
/**
* @author yangchenggong
* @date 2022/6/28 15:29
*/
public class AlertDialog {
private Context context;
private Dialog dialog;
private LinearLayout lLayout_bg;
private TextView txt_title;
private TextView txt_msg;
private TextView btn_neg;
private TextView btn_pos;
private ImageView img_line;
private ImageView horizontal_line;
private Display display;
private boolean showTitle = false;
private boolean showMsg = false;
private boolean showPosBtn = false;
private boolean showNegBtn = false;
public AlertDialog(Context context) {
this.context = context;
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
display = windowManager.getDefaultDisplay();
}
public AlertDialog builder() {
// 获取Dialog布局
View view = LayoutInflater.from(context).inflate(R.layout.dialog_layout, null);
// 获取自定义Dialog布局中的控件
lLayout_bg = (LinearLayout) view.findViewById(R.id.lLayout_bg);
txt_title = (TextView) view.findViewById(R.id.txt_title);
txt_title.setVisibility(View.GONE);
txt_msg = (TextView) view.findViewById(R.id.txt_msg);
txt_msg.setVisibility(View.GONE);
btn_neg = view.findViewById(R.id.btn_neg);
btn_neg.setVisibility(View.GONE);
btn_pos = view.findViewById(R.id.btn_pos);
btn_pos.setVisibility(View.GONE);
horizontal_line = view.findViewById(R.id.horizontal_line);
img_line = (ImageView) view.findViewById(R.id.img_line);
img_line.setVisibility(View.GONE);
// 定义Dialog布局和参数
dialog = new Dialog(context, R.style.AlertDialogStyle);
dialog.setContentView(view);
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
lp.dimAmount = 0.3f;
// lp.y = 250;
dialog.getWindow().setAttributes(lp);
dialog.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
// 调整dialog背景大小
lLayout_bg.setLayoutParams(
new FrameLayout.LayoutParams((int) (display.getWidth() * 0.75), LayoutParams.WRAP_CONTENT));
//设置按压效果
setButtonSelect();
return this;
}
public AlertDialog setNightKeep() {
if(lLayout_bg != null){
lLayout_bg.setBackground(ContextCompat.getDrawable(context,R.drawable.alert_bg_keep));
txt_title.setTextColor(ContextCompat.getColor(context,R.color.res_color_general_333333_keep));
txt_msg.setTextColor(ContextCompat.getColor(context,R.color.res_color_common_C3_keep));
horizontal_line.setBackground(ContextCompat.getDrawable(context,R.color.res_color_common_C7_keep));
img_line.setBackground(ContextCompat.getDrawable(context,R.color.res_color_common_C7_keep));
btn_pos.setTextColor(ContextCompat.getColor(context,R.color.res_color_general_333333_keep));
}
return this;
}
public AlertDialog setTitle(String title) {
showTitle = true;
txt_title.setText(TextUtils.isEmpty(title)?"Title":title);
return this;
}
public AlertDialog setMsg(String msg) {
showMsg = true;
txt_msg.setText(TextUtils.isEmpty(msg)?"Msg":msg);
return this;
}
public AlertDialog setCancelable(boolean cancel) {
dialog.setCancelable(cancel);
return this;
}
public AlertDialog setPositiveButton(String text, final OnClickListener listener) {
showPosBtn = true;
btn_pos.setText(TextUtils.isEmpty(text)? ResUtils.getString(R.string.yes_btn) :text);
btn_pos.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
if(listener != null){
listener.onClick(v);
}
}
});
return this;
}
public AlertDialog setNegativeButton(String text, final OnClickListener listener) {
showNegBtn = true;
btn_neg.setText(TextUtils.isEmpty(text)?ResUtils.getString(R.string.res_cancel) :text);
btn_neg.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if(listener != null){
listener.onClick(v);
}
dialog.dismiss();
}
});
return this;
}
private void setLayout() {
if (!showTitle && !showMsg) {
txt_title.setText(ResUtils.getString(R.string.tips));
txt_title.setVisibility(View.VISIBLE);
}
if (showTitle) {
txt_title.setVisibility(View.VISIBLE);
}
if (showMsg) {
txt_msg.setVisibility(View.VISIBLE);
}
if (!showPosBtn && !showNegBtn) {
btn_pos.setText(ResUtils.getString(R.string.yes_btn));
btn_pos.setVisibility(View.VISIBLE);
btn_pos.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
if (showPosBtn && showNegBtn) {
btn_pos.setVisibility(View.VISIBLE);
btn_neg.setVisibility(View.VISIBLE);
img_line.setVisibility(View.VISIBLE);
}
if (showPosBtn && !showNegBtn) {
btn_pos.setVisibility(View.VISIBLE);
}
if (!showPosBtn && showNegBtn) {
btn_neg.setVisibility(View.VISIBLE);
}
}
public void show() {
if (dialog != null && !dialog.isShowing()) {
setLayout();
dialog.show();
}
}
/**
* 设置变粗
*/
private void setButtonSelect(){
btn_pos.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
// When the user clicks the Button
case MotionEvent.ACTION_DOWN:
btn_pos.setTypeface(Typeface.DEFAULT_BOLD);
break;
// When the user releases the Button
case MotionEvent.ACTION_UP:
btn_pos.setTypeface(Typeface.DEFAULT);
break;
default:
break;
}
return false;
}
});
btn_neg.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction()) {
// When the user clicks the Button
case MotionEvent.ACTION_DOWN:
btn_neg.setTypeface(Typeface.DEFAULT_BOLD);
break;
// When the user releases the Button
case MotionEvent.ACTION_UP:
btn_neg.setTypeface(Typeface.DEFAULT);
break;
default:
break;
}
return false;
}
});
}
/**
* 是否在展示
* @return
*/
public boolean isShow(){
if(dialog != null){
return dialog.isShowing();
}
return false;
}
/**
* 隐藏弹框
*/
public void dismissDialog(){
if(dialog != null && dialog.isShowing()){
dialog.dismiss();
}
}
}
... ...
package com.wd.common.dialog;
import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.view.Window;
import android.view.WindowManager;
/**
* Time:2022/10/10
* Author:ypf
* Description:进度条
*/
public class AliPayAuthLoadingDialog {
private static AliPayAuthLoadingDialog instance = null;
private Dialog mLoadingDialog;
private AliPayAuthLoadingDialog() {
}
public static AliPayAuthLoadingDialog getInstance() {
if (instance == null) {
instance = new AliPayAuthLoadingDialog();
}
return instance;
}
/**
* 创建dialog 对象
*/
private void createLoadingDialog(Context context, boolean allowCancel) {
mLoadingDialog = DialogUtils.createRequestDialog(context, allowCancel);
}
public void startLoading(Activity activity, boolean allowCancel) {
runOnUiThreadStartLoading(activity, allowCancel);
}
/**
* 设置对话框透明度
*/
public void setAlpha(float alpha){
if (mLoadingDialog != null) {
Window window = mLoadingDialog.getWindow();
if (window != null) {
WindowManager.LayoutParams attributes = window.getAttributes();
if (attributes != null) {
attributes.alpha = alpha;
}
}
}
}
public void stopLoading() {
//异常处理,not attached to window manager
try {
if (mLoadingDialog != null && mLoadingDialog.isShowing()) {
mLoadingDialog.dismiss();
}
} catch (Exception e) {
e.printStackTrace();
}
}
private void runOnUiThreadStartLoading(Activity activity, boolean allowCancel) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
startLoadingDialog(activity, allowCancel);
}
});
}
private void startLoadingDialog(Activity activity, boolean allowCancel) {
if (activity == null || activity.isDestroyed()) {
return;
}
createLoadingDialog(activity, allowCancel);
if (mLoadingDialog != null && !mLoadingDialog.isShowing()) {
mLoadingDialog.show();
}
}
public void cancelDialog() {
if (mLoadingDialog != null) {
mLoadingDialog.cancel();
mLoadingDialog = null;
}
}
}
... ...
... ... @@ -11,8 +11,9 @@ import android.os.Bundle;
import android.os.SystemClock;
//import com.wd.common.manager.MyActivityManager;
//import com.wd.foundation.wdkit.utils.MyActivityManager;
import com.wd.base.log.Logger;
import com.wd.foundation.wdkit.utils.MyActivityManager;
import com.wd.foundation.wdkit.constant.Constants;
import com.wd.capability.network.constant.EventConstants;
import com.wd.foundation.wdkit.interfaces.ActivityState;
... ... @@ -64,7 +65,7 @@ public class UserActivityLifecycleCallbacks implements Application.ActivityLifec
}
// restartSingleInstanceActivity(activity);
}
// MyActivityManager.INSTANCE.setCurrentActivity(activity);
MyActivityManager.INSTANCE.setCurrentActivity(activity);
//拦截小窗
// ProcessUtils.interceptorPictureInPicture();
... ...
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/rmrb_dp14"/>
<solid android:color="@color/rmrb_ffffff_light"/>
</shape>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="@dimen/rmrb_dp14"/>
<solid android:color="@color/res_color_common_C8_keep"/>
</shape>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lLayout_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/alert_bg"
android:orientation="vertical">
<TextView
android:id="@+id/txt_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/rmrb_dp25"
android:layout_marginHorizontal="@dimen/rmrb_dp24"
android:gravity="center"
android:textColor="@color/res_color_general_333333"
android:textSize="@dimen/rmrb_dp17"
android:textStyle="bold" />
<TextView
android:id="@+id/txt_msg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/rmrb_dp24"
android:layout_marginTop="@dimen/rmrb_dp5"
android:gravity="center"
android:textColor="@color/res_color_common_C3_keep"
android:textSize="@dimen/rmrb_dp14" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/rmrb_dp25" />
<ImageView
android:id="@+id/horizontal_line"
android:layout_width="match_parent"
android:layout_height="@dimen/rmrb_dp1"
android:background="@color/res_color_common_C7" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/btn_pos"
android:layout_width="match_parent"
android:layout_height="@dimen/rmrb_dp50"
android:layout_alignParentLeft="true"
android:layout_marginLeft="@dimen/rmrb_dp16"
android:layout_toLeftOf="@+id/img_line"
android:gravity="center"
android:textColor="@color/res_color_general_333333"
android:textSize="@dimen/rmrb_dp18" />
<ImageView
android:id="@+id/img_line"
android:layout_width="@dimen/rmrb_dp1"
android:layout_height="@dimen/rmrb_dp44"
android:layout_centerInParent="true"
android:background="@color/res_color_common_C7" />
<TextView
android:id="@+id/btn_neg"
android:layout_width="match_parent"
android:layout_height="@dimen/rmrb_dp50"
android:layout_alignParentRight="true"
android:layout_marginRight="@dimen/rmrb_dp16"
android:layout_toRightOf="@+id/img_line"
android:gravity="center"
android:textColor="@color/res_color_general_648DF2"
android:textSize="@dimen/rmrb_dp18" />
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
... ...
... ... @@ -41,6 +41,7 @@ dependencies {
implementation rootProject.ext.dependencies["material"]
implementation project(path: ':wdlayout')
api project(path: ':wdrouter')
api project(path: ':wdinterface')
annotationProcessor 'com.alibaba:arouter-compiler:1.5.2'
implementation 'androidx.activity:activity:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
... ...
... ... @@ -10,8 +10,9 @@ import androidx.core.content.FileProvider;
import androidx.fragment.app.FragmentActivity;
import com.wd.capability.network.NetManager;
import com.wd.common.base.BaseApplication;
import com.wd.foundation.wdinterface.config.INetConfig;
import com.wd.foundation.wdinterface.constant.InterfaceConstant;
import com.wd.foundation.wdkit.constant.Constants;
import com.wd.capability.network.constant.EventConstants;
import com.wd.common.utils.ProcessUtils;
... ... @@ -20,6 +21,7 @@ import com.wd.foundation.bean.response.BottomNavBean;
import com.wd.foundation.bean.response.ChannelBean;
import com.wd.foundation.wdkit.utils.SpUtils;
import com.wd.foundation.wdkitcore.livedata.LiveDataBus;
import com.wd.foundation.wdkitcore.router.ArouterServiceManager;
import com.wd.foundation.wdkitcore.tools.JsonUtils;
import com.wd.foundation.wdkitcore.tools.StringUtils;
import com.wd.module_home.R;
... ... @@ -271,8 +273,9 @@ public class WelcomeUtils {
* @return
*/
private static boolean isProdEnvironmentMode() {
String tag = NetManager.getUrlTag();
if (NetManager.BASE_URL_REL.equals(tag)) {
INetConfig config = ArouterServiceManager.provide(InterfaceConstant.PATH_NET_CONFIG);
String tag = config.getUrlTag();
if (config.getBaseUrlRelTag().equals(tag)) {
return true;
} else {
return false;
... ...
... ... @@ -12,3 +12,23 @@ include ':wdlayout'
include ':wdinterface'
include ':wdinterfaceimpl'
include ':module_home'
include ':lib_routermanager'
include ':lib_entityclass'
include ':module_personalcenter'
include ':aar_repo:lib_logger'
include ':aar_repo:localaar_ability'
include ':base_res'
include ':lib_network'
include ':aar_repo:localaar_weiboaar'
include ':base_location'
include ':aar_repo:lib_main'
include ':aar_repo:localaar_framework'
include ':base_share'
include ':base_component'
include ':lib_liveDataBus'
include ':base_player'
include ':base_interact'
include ':lib_logutil'
include ':wd_annotation'
include ':lib_common'
include ':lib_kittools'
... ...
package com.wd.foundation.bean.analytics;
/**
* 行为类型
* @author baozhaoxin
* @version [V1.0.0, 2023/6/21]
* @since V1.0.0
*/
public class ActionConstants {
/**
* 曝光/展示
*/
public static final String SHOW = "show";
/**
* 点击
*/
public static final String DETAIL_PAGE_SHOW = "detailPageShow";
/**
*/
public static final String CLOSEINTERESTCARD = "closeInterestCard";
/**
*
*/
public static final String SELECTINTERESTCARD = "selectInterestCard";
/**
* 收藏
*/
public static final String COLLECT = "collect";
/**
* 收藏加入标签
*/
public static final String COLLECT_TAG = "collectTag";
/**
* 取消收藏
*/
public static final String UN_COLLECT = "uncollect";
/**
* 关注
*/
public static final String FOLLOW = "follow";
/**
* 取消关注
*/
public static final String UN_FOLLOW = "unfollow";
/**
* 赞/顶/喜欢
*/
public static final String LIKE = "like";
/**
* 踩/不喜欢/不感兴趣
*/
public static final String DIS_LIKE = "dislike";
/**
* 分享
*/
public static final String SHARE = "share";
/**
* 评论
*/
public static final String COMMENT = "comment";
/**
* 浏览
*/
public static final String BROWSE = "browse";
/**
* 下载
*/
public static final String DOWNLOAD = "download";
/**
* 订阅
*/
public static final String SUBSCRIBE = "subscribe";
}
... ...
... ... @@ -24,6 +24,26 @@ public class LiveTypeConstants {
public static final String LIVE_END = "liveEnd";
/**
* 直播取消-埋点用
*/
public static final String LIVE_CANCEL = "liveCancel";
/**
* 直播暂停-埋点用
*/
public static final String LIVE_PAUSED = "livePaused";
/**
* 直播回放-埋点用
*/
public static final String LIVE_BACK = "liveBack";
/**
* 未知状态-埋点用
*/
public static final String UN_KNOW = "unKnow";
/**
* 直播中
*/
public static final String RUNNING = "running";
... ...
package com.wd.foundation.bean.analytics;
/**
* Time:2023/3/22
* Author:ypf
* Description:名称:专题类型,属性值:summary_type
* 专题类型
* @author baozhaoxin
* @version [V1.0.0, 2024/1/23]
* @since V1.0.0
*/
public class SummaryTypeConstants {
/**
* 普通专题
* 直播专题
*/
public static final String NORMAL_SUBJECT = "normal_subject";
public static final String LIVE_TOPIC = "liveTopic";
/**
* 主题专题
* 文章专题
*/
public static final String THEMATIC_SUBJECT = "thematic_subject";
public static final String ARTICLE_TOPIC = "articleTopic";
/**
* 作者专题
* 音频专题
* 页面浏览(原生)
* 内容点击(原生)
* 内容曝光(原生)
* 音频专题-普通按钮点击(原生)
* 分享方式点击(原生)
* 评论点击发布(原生)
*/
public static final String AUTHOR_SUBJECT = "author_subject";
public static final String AUDIO_TOPIC = "audioTopic";
/**
* 话题专题
*/
public static final String TALK_TOPIC = "talkTopic";
/**
* 早晚报专题
*/
public static final String MORNING_AND_EVENING_NEWS_TOPIC = "morningAndEveningNewsTopic";
/**
* 时间轴专题
*/
public static final String TIME_AXIS_TOPIC = "timeAxisTopic";
}
... ...
package com.wd.foundation.bean.analytics;
import android.text.TextUtils;
import com.wd.foundation.bean.adv.CompAdvBean;
import com.wd.foundation.bean.base.BaseBean;
import com.wd.foundation.bean.custom.act.BaseActivityBean;
import com.wd.foundation.bean.custom.comp.ChannelInfoBean;
import com.wd.foundation.bean.custom.comp.CompBean;
import com.wd.foundation.bean.custom.comp.PageBean;
import com.wd.foundation.bean.custom.comp.TopicInfoBean;
import com.wd.foundation.bean.custom.content.CommentItem;
import com.wd.foundation.bean.custom.content.ContentBean;
import com.wd.foundation.bean.custom.content.ContentTypeConstant;
import com.wd.foundation.bean.custom.content.PeopleMasterBean;
import com.wd.foundation.bean.mail.LiveInfo;
import com.wd.foundation.bean.mail.VliveBean;
import com.wd.foundation.bean.response.ConvertLiveBean;
import com.wd.foundation.wdkitcore.tools.ArrayUtils;
import com.wd.foundation.wdkitcore.tools.StringUtils;
import java.util.List;
/**
* 埋点-内容bean
* TODO 涉及业务,待梳理 拆解
*
* @author baozhaoxin
* @version [V1.0.0, 2023/3/14]
... ... @@ -44,7 +50,6 @@ public class TrackContentBean extends BaseBean {
* 内容类型
*/
private String content_type;
/**
* 内容分类
*/
... ... @@ -93,12 +98,12 @@ public class TrackContentBean extends BaseBean {
/**
* 所属一级频道ID
*/
private String content_show_channel_id;
private String contentShowChannelId;
/**
* 所属二级频道ID
* 所属一级频道名称
*/
private String level2channel_id;
private String contentShowChannelName;
/**
* H5地址-待定
... ... @@ -125,6 +130,16 @@ public class TrackContentBean extends BaseBean {
*/
public String position;
/**
* 专题类型
*/
public String specialType;
/**
* 专题链接
*/
public String specialLink;
/**
* 耗时
*/
... ... @@ -143,6 +158,11 @@ public class TrackContentBean extends BaseBean {
private int complet_rate;
/**
* 试验id
*/
public String expIds;
/**
* 错误信息
*/
private String error_information;
... ... @@ -199,12 +219,6 @@ public class TrackContentBean extends BaseBean {
* 推荐数据
*/
private TraceBean traceBean;
/**
* 直播数据
*/
private TraceLiveBean traceLiveBean;
/**
* 开屏广告类型
*/
... ... @@ -214,50 +228,40 @@ public class TrackContentBean extends BaseBean {
* 活动ID
*/
public String activityId;
/**
* 活动名称
*/
public String activityName;
/**
* 活动类型
*/
public String activityType;
/**
* 活动状态
*/
public String activityState;
/**
* 直播流类型
* 直播必填,1、普通 2、VR
*/
public String live_stream_type;
public String vlive_id;
private String vlive_name;
private String live_mode;
public String vlive_name;
public String live_mode;
public String author_id;
public String author_name;
private String item_id;
private String item_type;
private String bhv_type;
private String trace_id;
private String trace_info;
private String scene_id;
private String bhv_value;
private String extend_play;
// private String expose ;
private String stay;
... ... @@ -280,6 +284,34 @@ public class TrackContentBean extends BaseBean {
*/
private String adType;
/**
* 行为针对的物料ID
*/
public String itemId;
/**
* 当前交互触点(或页面)
*/
public String saPosition;
/**
* 视频观看时长
*/
public long pybkDuration;
/**
* 发布标识,0-cms;1-表示号主发布 2-普通用户
*/
private int rmhPlatform = 0;
public int getRmhPlatform() {
return rmhPlatform;
}
public void setRmhPlatform(int rmhPlatform) {
this.rmhPlatform = rmhPlatform;
}
public String getAdId() {
return adId;
}
... ... @@ -320,12 +352,20 @@ public class TrackContentBean extends BaseBean {
this.bhv_type = bhv_type;
}
public String getContent_show_channel_id() {
return content_show_channel_id;
public String getContentShowChannelId() {
return contentShowChannelId;
}
public void setContentShowChannelId(String contentShowChannelId) {
this.contentShowChannelId = contentShowChannelId;
}
public void setContent_show_channel_id(String content_show_channel_id) {
this.content_show_channel_id = content_show_channel_id;
public String getChannelSourceId() {
return channelSourceId;
}
public void setChannelSourceId(String channelSourceId) {
this.channelSourceId = channelSourceId;
}
public String getPage_name() {
... ... @@ -416,13 +456,6 @@ public class TrackContentBean extends BaseBean {
this.live_type = live_type;
}
public String getLevel2channel_id() {
return level2channel_id;
}
public void setLevel2channel_id(String level2channel_id) {
this.level2channel_id = level2channel_id;
}
public String getH5_url() {
return h5_url;
... ... @@ -460,6 +493,7 @@ public class TrackContentBean extends BaseBean {
this.region_name = region_name;
}
public TraceBean getTraceBean() {
return traceBean;
}
... ... @@ -468,14 +502,6 @@ public class TrackContentBean extends BaseBean {
this.traceBean = traceBean;
}
public TraceLiveBean getTraceLiveBean() {
return traceLiveBean;
}
public void setTraceLiveBean(TraceLiveBean traceLiveBean) {
this.traceLiveBean = traceLiveBean;
}
public int getTime_consuming() {
return time_consuming;
}
... ... @@ -572,6 +598,7 @@ public class TrackContentBean extends BaseBean {
this.action = action;
}
/**
* ContentBean和CompBean 转换成 埋点对象( 组件和稿件使用)
*
... ... @@ -595,23 +622,27 @@ public class TrackContentBean extends BaseBean {
if (compStyle.contains("Zh_")) {
component_type = compStyle;
comp_id = compBean.getId();
contentBean.contentByStyle = component_type;
} else {
content_style = compStyle;
}
}
}
ChannelInfoBean channelInfoBean = compBean.getChannelInfoBean();
if (channelInfoBean != null) {
content_show_channel_id = channelInfoBean.getChannelId();
contentShowChannelId = channelInfoBean.getChannelId();
contentShowChannelName = channelInfoBean.getChannelName();
}
channelSourceId = contentShowChannelId;
} else {
content_style = contentBean.getAppStyle();
page_name = contentBean.getFromPage();
// 普通页面
//普通页面
String pageId = contentBean.getPageId();
if (isBlank(pageId)) {
if (StringUtils.isBlank(pageId)) {
page_id = contentBean.getFromPage();
} else {
page_id = pageId;
... ... @@ -619,6 +650,14 @@ public class TrackContentBean extends BaseBean {
}
// 广告
CompAdvBean compAdvBean = contentBean.getCompAdvBean();
if (compAdvBean != null) {
adId = contentBean.getObjectId();
adName = contentBean.getNewsTitle();
adType = "2";
}else {
if (!TextUtils.isEmpty(contentBean.getObjectType())) {
int type = Integer.parseInt(contentBean.getObjectType());
if (ContentTypeConstant.URL_TYPE_FIVE == type && !TextUtils.isEmpty(contentBean.getObjectLevel())) {
... ... @@ -627,11 +666,14 @@ public class TrackContentBean extends BaseBean {
try {
int topicTemplate = Integer.parseInt(contentBean.getObjectLevel());
summary_type = summary_type_parameter(topicTemplate);
specialType = summary_type;
specialLink = contentBean.getLinkUrl();
} catch (Exception e) {
e.printStackTrace();
}
link_url = contentBean.getLinkUrl();
} else if (ContentTypeConstant.URL_TYPE_TWO == type && contentBean.getLiveInfo() != null) {
//所属区域,专题为4
region_name = "4";
} else if (ContentTypeConstant.URL_TYPE_TWO == type && contentBean.getLiveInfo() != null) { // 直播
LiveInfo liveInfo = contentBean.getLiveInfo();
... ... @@ -646,16 +688,23 @@ public class TrackContentBean extends BaseBean {
} else if (ContentTypeConstant.LIVE_END.equals(liveState)) {
// 结束
live_type = LiveTypeConstants.LIVE_END;
}
TraceLiveBean traceLiveBean = new TraceLiveBean();
traceLiveBean.liveStreamType = liveInfo.getVrType() == 1 ? "2" : "1";
traceLiveBean.liveMode = "";
traceLiveBean.vliveId = contentBean.getObjectId();
traceLiveBean.vliveName = contentBean.getNewsTitle();
setTraceLiveBean(traceLiveBean);
} else if (ContentTypeConstant.LIVE_CANCEL.equals(liveState)) {
// 取消
live_type = LiveTypeConstants.LIVE_CANCEL;
} else if (ContentTypeConstant.LIVE_PAUSED.equals(liveState)) {
// 暂停
live_type = LiveTypeConstants.LIVE_PAUSED;
}else {
//未知
live_type = LiveTypeConstants.UN_KNOW;
}
live_stream_type = liveInfo.getVrType() == 1 ? "2" : "1";
live_mode = "";
vlive_id = contentBean.getObjectId();
vlive_name = contentBean.getNewsTitle();
} else if (ContentTypeConstant.URL_TYPE_SIX == type && ContentTypeConstant.URL_TYPE_TEN == type) {
} else if (ContentTypeConstant.URL_TYPE_SIX == type || ContentTypeConstant.URL_TYPE_TEN == type) {
link_url = contentBean.getLinkUrl();
... ... @@ -675,7 +724,8 @@ public class TrackContentBean extends BaseBean {
}
channelSourceId = "";
}
PeopleMasterBean rmhInfo = contentBean.getRmhInfo();
if (rmhInfo != null) {
... ... @@ -693,8 +743,9 @@ public class TrackContentBean extends BaseBean {
content_id = contentBean.getObjectId();
region_name = "2";
expIds = contentBean.getExpIds();
// 分享渠道
//分享渠道
shareChannel = "";
// 浏览时长
duration = 0;
... ... @@ -715,70 +766,148 @@ public class TrackContentBean extends BaseBean {
traceBean.traceId = contentBean.getTraceId();
traceBean.sceneId = contentBean.getSceneId();
traceBean.subSceneId = contentBean.getSubSceneId();
traceBean.cardItemId = contentBean.getCardItemId();
}
setTraceBean(traceBean);
if(contentBean.getTopicInfoBean() != null){
summary_type = contentBean.getTopicInfoBean().getTopicTypeWord();
summary_id = contentBean.getTopicInfoBean().getTopicId();
//所属区域,专题为4
region_name = "4";
}
//信息流内容埋点,增加来源信息
rmhPlatform = contentBean.getRmhPlatform();
//所属区域处理
if(StringUtils.isEqual("21003",page_id)){
//播报页面,所属区域为5
region_name = "5";
}else if(StringUtils.isEqual("mainPersonalPage",page_name) ||
StringUtils.isEqual("customerPersonalPage",page_name)){
//个人主页,所属区域为6
region_name = "6";
}if(StringUtils.isEqual("search_result_page",page_name) ||
StringUtils.isEqual("searchPage",page_name)){
//搜索,所属区域为7
region_name = "7";
}if(StringUtils.isEqual("newsPaperPage",page_name)){
//版面,所属区域为8
region_name = "8";
}
}
public TrackContentBean() {
}
// 专属直播使用
/**
* 评论
*
* @param likeComment
*/
public void commentItemToBean(CommentItem likeComment, String pageName, String pageId) {
page_name = pageName;
page_id = pageId;
content_name = likeComment.getRealCommentContent();
content_id = likeComment.getId() + "";
author_name = likeComment.getFromUserName();
author_id = likeComment.getFromUserId();
}
//专属直播使用
public TrackContentBean(ConvertLiveBean convertLiveBean) {
if (convertLiveBean == null) {
return;
}
this.content_name = "";
this.page_id = "liveDetailPage";
this.page_name = "liveDetailPage";
this.content_name = convertLiveBean.getTitle();
this.content_type = "2";
this.content_id = "";
this.content_id = convertLiveBean.getLiveId();
this.component_type = "";
this.comp_id = "";
this.content_style = "";
this.summary_type = "";// 没找到合适的数据
this.summary_id = "";// 没找到字段
this.summary_type = "";//没找到合适的数据
this.summary_id = "";//没找到字段
// 直播预约 live_subscribe 直播中 live_running 直播回放 live_back
String status = convertLiveBean.getStatus();
if (ContentTypeConstant.LIVE_RUNNING.equals(status)) {
this.live_type = "live_running";
}
if (ContentTypeConstant.LIVE_WAIT.equals(status)) {
this.live_type = "live_subscribe";
}
if (ContentTypeConstant.LIVE_END.equals(status)) {
this.live_type = "live_back";
}
this.content_show_channel_id = "";// 没找到字段
this.level2channel_id = "";// 没找到字段
this.h5_url = "";// 没找到字段
this.link_url = "";// 没找到字段
// 0-固定位
// 1-权重
// 2-精选-推荐因子
// 3-机器下发 确认接口是否有,接口没有不传
this.live_type = LiveTypeConstants.LIVE_RUNNING;
}else if (ContentTypeConstant.LIVE_WAIT.equals(status)) {
this.live_type = LiveTypeConstants.LIVE_SUBSCRIBE;
}else if (ContentTypeConstant.LIVE_END.equals(status)) {
this.live_type = LiveTypeConstants.LIVE_END;
} else if (ContentTypeConstant.LIVE_CANCEL.equals(status)) {
// 取消
live_type = LiveTypeConstants.LIVE_CANCEL;
} else if (ContentTypeConstant.LIVE_PAUSED.equals(status)) {
// 暂停
live_type = LiveTypeConstants.LIVE_PAUSED;
}else {
//未知
live_type = LiveTypeConstants.UN_KNOW;
}
this.contentShowChannelId = "";//没找到字段
this.h5_url = "";//没找到字段
this.link_url = "";//没找到字段
//0-固定位
//1-权重
//2-精选-推荐因子
//3-机器下发 确认接口是否有,接口没有不传
this.feed_type = "";
// 开屏 0
// 挂角 1
// 信息流 2
//开屏 0
//挂角 1
//信息流 2
this.region_name = "";
// this.position = "" ;//没找到字段
// 1、普通2、VR
this.live_stream_type = convertLiveBean.getLiveStreamType();
// 传当前直播直播的vlive_id,切了其他路直播,再曝光一次 (待确认) convertLiveBean.getLiveSourceList()
this.vlive_id = "";
// 暂时标题意思
// this.position = "" ;//没找到字段
// 直播流ID(视角id)
List<VliveBean> liveSourceList = convertLiveBean.getLiveSourceList();
VliveBean vliveBean = ArrayUtils.getListElement(liveSourceList, 0);
if (vliveBean != null) {
// 直播流ID
vlive_id = vliveBean.getVliveId();
// 1、普通 2、VR
live_stream_type = "1";
// 直播流名称
vlive_name = vliveBean.getName();
}
//暂时标题意思
if(convertLiveBean.getLiveSourceList() != null && convertLiveBean.getLiveSourceList().size()>0
&& convertLiveBean.getLiveSourceList().get(0) != null){
this.vlive_name = convertLiveBean.getLiveSourceList().get(0).getName();
}else{
this.vlive_name = convertLiveBean.getTitle();
}
// 单路直播定义 1、单路直播2、多路直播 不是多路就是单路吧
this.live_mode = convertLiveBean.getTplId() == 6 ? "2" : "1";
this.author_id = convertLiveBean.getCreateUserId();
this.author_name = convertLiveBean.getCreateUserName();
this.item_id = convertLiveBean.getLiveId();
this.item_type = "video";
this.bhv_type = "";// 没找到合适的数据
this.trace_id = "";// 没找到合适的数据
this.trace_info = "";// 没找到合适的数据
this.scene_id = "";// 没找到合适的数据
this.bhv_value = "";// 没找到合适的数据
this.bhv_type = "";//没找到合适的数据
this.trace_id = "";//没找到合适的数据
this.trace_info = "";//没找到合适的数据
this.scene_id = "";//没找到合适的数据
this.bhv_value = "";//没找到合适的数据
this.rmhPlatform = convertLiveBean.getRmhPlatform();
//添加人民号信息
PeopleMasterBean rmhInfo = convertLiveBean.getRmhInfo();
if (rmhInfo != null) {
this.author_name = rmhInfo.getRmhName();
this.author_id = rmhInfo.getRmhId();
this.followPDUserId = rmhInfo.getRmhId();
this.followUserName = rmhInfo.getRmhName();
}
if(convertLiveBean.getNewsDetailBean() != null &&
convertLiveBean.getNewsDetailBean().getReLInfo() != null){
//设置频道id
this.channelSourceId = convertLiveBean.getNewsDetailBean().getReLInfo().getChannelId();
}
}
public String getBhv_value() {
... ... @@ -811,18 +940,23 @@ public class TrackContentBean extends BaseBean {
* @param bean
*/
public void topicInfoBeanBeantoBean(TopicInfoBean bean) {
page_name = bean.getLocalPageName();
page_id = bean.getLocalPageId();
content_name = bean.getTitleName();
content_type = ContentTypeConstant.URL_TYPE_FIVE + "";
page_name = "summaryDetailPage";
page_id = "summaryDetailPage";
content_name = bean.getTitle();
content_type = bean.getTopicType()+"";
content_id = bean.getTopicId();
summary_id = bean.getTopicId();
summary_type = summary_type_parameter(bean.getTopicType());
summary_type = bean.getTopicTypeWord();
link_url = bean.getShareUrl();
region_name = "2";
specialType = summary_type;
specialLink = bean.linkUrl;
//所属区域,专题为4
region_name = "4";
rmhPlatform = bean.getRmhPlatform();
}
/**
* pageBean对象转换成TrackContentBean对象
*
... ... @@ -835,33 +969,39 @@ public class TrackContentBean extends BaseBean {
content_id = mPageBean.getId();
if (mPageBean.getTopicInfo() != null) {
TopicInfoBean bean = mPageBean.getTopicInfo();
content_type = ContentTypeConstant.URL_TYPE_FIVE + "";
//专题页pageId、pageName固定传值
page_name = "summaryDetailPage";
page_id = "summaryDetailPage";
content_type = bean.getTopicType()+"";
content_name = bean.getTitle();
content_id = bean.getTopicId();
summary_id = bean.getTopicId();
summary_type = summary_type_parameter(bean.getTopicType());
summary_type = bean.getTopicTypeWord();
link_url = bean.linkUrl;
rmhPlatform = bean.getRmhPlatform();
//所属区域,专题为4
region_name = "4";
} else if (mPageBean.getChannelInfo() != null) {
content_type = ContentTypeConstant.URL_TYPE_ELEVEN + "";
ChannelInfoBean bean = mPageBean.getChannelInfo();
content_id = bean.getChannelId();
content_show_channel_id = bean.getChannelId();
}
contentShowChannelId = bean.getChannelId();
contentShowChannelName = bean.getChannelName();
region_name = "2";
}
}
// /**
// * 设置页面浏览
// *
// * @param duration
// */
// public void setExposure(long duration) {
// setAction(ActionConstants.BROWSE);
// setDuration(duration);
// //当前交互触点(或页面)
// position = page_name + "_" + action;
// }
/**
* 设置页面浏览
*
* @param duration
*/
public void setExposure(long duration) {
setAction(ActionConstants.BROWSE);
setDuration(duration);
//当前交互触点(或页面)
position = page_name + "_" + action;
}
/**
* 专题类型
... ... @@ -870,113 +1010,106 @@ public class TrackContentBean extends BaseBean {
* @return
*/
private String summary_type_parameter(int objectLevel) {
String type = null;
if (ContentTypeConstant.SUBJECT_TOPICTYPE_21 == objectLevel) {
// 文章专题
type = "articleTopic";
} else if (ContentTypeConstant.SUBJECT_TOPICTYPE_22 == objectLevel) {
// 音频专题
type = "audioTopic";
} else if (ContentTypeConstant.SUBJECT_TOPICTYPE_23 == objectLevel) {
// 直播专题
type = "liveTopic";
} else if (ContentTypeConstant.SUBJECT_TOPICTYPE_24 == objectLevel) {
// 话题专题
type = "talkTopic";
} else if (ContentTypeConstant.SUBJECT_TOPICTYPE_25 == objectLevel) {
// 早晚报专题
type = "morningAndEveningNewsTopic";
} else if (ContentTypeConstant.SUBJECT_TOPICTYPE_26 == objectLevel) {
type = "timeAxisTopic";
}
return type;
}
// /**
// * 曝光或者点击
// *
// * @param isClick true:点击;false:曝光
// */
// public void exporeOrClick(boolean isClick) {
//
// if (isClick) {
// setAction(ActionConstants.DETAIL_PAGE_SHOW);
// } else {
// setAction(ActionConstants.SHOW);
// }
// //当前交互触点(或页面)
// position = page_name + "_" + action;
// }
//
//
// public void interestCardAction(boolean isClose){
// if(isClose){
// setAction(ActionConstants.CLOSEINTERESTCARD);
// }else {
// setAction(ActionConstants.SELECTINTERESTCARD);
// }
//
// position = page_name + "_" + action;
// }
//
// /**
// * 喜欢事件action
// *
// * @param isLike true:喜欢;false:不喜欢
// */
// public void likeAction(boolean isLike) {
// if (isLike) {
// setAction(ActionConstants.LIKE);
// } else {
// setAction(ActionConstants.DIS_LIKE);
// }
// //当前交互触点(或页面)
// position = page_name + "_" + action;
// }
//
// /**
// * 收藏事件action
// *
// * @param isCollect true:收藏;false:取消
// */
// public void collectAction(boolean isCollect) {
// if (isCollect) {
// action = ActionConstants.COLLECT;
// } else {
// action = ActionConstants.UN_COLLECT;
// }
// position = page_name + "_" + action;
// }
//
// /**
// * 评论 action
// */
// public void commentAction() {
// action = ActionConstants.COMMENT;
// position = page_name + "_" + action;
// }
//
// /**
// * 关注 action
// */
// public void followAction(boolean isFollow) {
// if (isFollow) {
// action = ActionConstants.FOLLOW;
// } else {
// action = ActionConstants.UN_FOLLOW;
// }
// position = page_name + "_" + action;
// }
//
// /**
// * 分享action
// */
// public void shareAction() {
// action = ActionConstants.SHARE;
// position = page_name + "_" + action;
// }
private static boolean isBlank(String value) {
return null == value || 0 == value.length() || "".equals(value.trim());
// 文章、音频、直播、 话题、早晚报、时间轴
if (objectLevel == ContentTypeConstant.SUBJECT_TOPICTYPE_21) {
specialType = SummaryTypeConstants.ARTICLE_TOPIC;
} else if (objectLevel == ContentTypeConstant.SUBJECT_TOPICTYPE_22) {
specialType = SummaryTypeConstants.AUDIO_TOPIC;
} else if (objectLevel == ContentTypeConstant.SUBJECT_TOPICTYPE_23) {
specialType = SummaryTypeConstants.LIVE_TOPIC;
} else if (objectLevel == ContentTypeConstant.SUBJECT_TOPICTYPE_24) {
specialType = SummaryTypeConstants.TALK_TOPIC;
} else if (objectLevel == ContentTypeConstant.SUBJECT_TOPICTYPE_25) {
specialType = SummaryTypeConstants.MORNING_AND_EVENING_NEWS_TOPIC;
} else if (objectLevel == ContentTypeConstant.SUBJECT_TOPICTYPE_26) {
specialType = SummaryTypeConstants.TIME_AXIS_TOPIC;
}
return specialType;
}
/**
* 曝光或者点击
*
* @param isClick true:点击;false:曝光
*/
public void exporeOrClick(boolean isClick) {
if (isClick) {
setAction(ActionConstants.DETAIL_PAGE_SHOW);
} else {
setAction(ActionConstants.SHOW);
}
//当前交互触点(或页面)
position = page_name + "_" + action;
}
public void interestCardAction(boolean isClose) {
if (isClose) {
setAction(ActionConstants.CLOSEINTERESTCARD);
} else {
setAction(ActionConstants.SELECTINTERESTCARD);
}
position = page_name + "_" + action;
}
/**
* 喜欢事件action
*
* @param isLike true:喜欢;false:不喜欢
*/
public void likeAction(boolean isLike) {
if (isLike) {
setAction(ActionConstants.LIKE);
} else {
setAction(ActionConstants.DIS_LIKE);
}
//当前交互触点(或页面)
position = page_name + "_" + action;
}
/**
* 收藏事件action
*
* @param isCollect true:收藏;false:取消
*/
public void collectAction(boolean isCollect) {
if (isCollect) {
action = ActionConstants.COLLECT;
} else {
action = ActionConstants.UN_COLLECT;
}
position = page_name + "_" + action;
}
/**
* 评论 action
*/
public void commentAction() {
action = ActionConstants.COMMENT;
position = page_name + "_" + action;
}
/**
* 关注 action
*/
public void followAction(boolean isFollow) {
if (isFollow) {
action = ActionConstants.FOLLOW;
} else {
action = ActionConstants.UN_FOLLOW;
}
position = page_name + "_" + action;
}
/**
* 分享action
*/
public void shareAction() {
action = ActionConstants.SHARE;
position = page_name + "_" + action;
}
}
... ...
package com.wd.foundation.bean.custom.act;
import android.text.TextUtils;
import com.wd.foundation.bean.base.BaseBean;
import com.wd.foundation.wdkitcore.tools.StringUtils;
/**
* @Description: 基本活动信息类
... ... @@ -18,6 +22,13 @@ public class BaseActivityBean extends BaseBean {
/**
* 活动类型
* collect 征集活动
* new_collect 征集活动
* raffle 抽奖活动
* vote 投票活动
* answer 答题活动
* top 榜单活动
* 后面有调整再说
*/
private String activityType;
... ... @@ -60,6 +71,50 @@ public class BaseActivityBean extends BaseBean {
* 运营图片地址
*/
private String coverUrl;
/**
* 标题前面的标签
*/
public String localFieldActivityLabelName;
/**
* 标签渐变色左边颜色
*/
public String localFieldBackgroundColor1;
/**
* 标签渐变色右边颜色
*/
public String localFieldBackgroundColor2;
/**
* 参加人数
*/
private String person;
/**
*
* @param activityType collect 征集活动 new_collect 征集活动
* raffle 抽奖活动
* vote 投票活动
* answer 答题活动
* top 榜单活动
* @return
*/
public int[] getActivityLabelNameColors(String activityType) {
int[] colors;
if(StringUtils.isEqual("raffle",activityType)){
//raffle-抽奖活动
colors = new int[]{0xFF79C888,0xFF51B189};
}else if(StringUtils.isEqual("answer",activityType)){
//answer-答题活动
colors = new int[]{0xFF4AB5F8,0xFF477AF0};
}else if(StringUtils.isEqual("vote",activityType)){
//vote-投票活动
colors = new int[]{0xFFF8AC4A,0xFFF07E47};
}else {
//其他-征稿活动
colors = new int[]{0xFFFE6A00,0xFFFF2B00};
}
return colors;
}
public String getActivityId() {
return activityId;
... ... @@ -143,18 +198,54 @@ public class BaseActivityBean extends BaseBean {
/**
* 检查活动状态
*
* @param serverTime
* @return 0:未开始;2:已结束;1:进行中
*/
public int checkActivityStatus(long serverTime){
public int checkActivityStatus(long serverTime) {
if(serverTime < startTime){
if (serverTime < startTime) {
return 0;
}else if(serverTime > endTime){
} else if (serverTime > endTime) {
return 2;
}else {
} else {
return 1;
}
}
/**
* 转换活动类型
*/
public void activityTypeToLabelName() {
if (TextUtils.isEmpty(activityType)) {
localFieldActivityLabelName = null;
} else {
// if ("collect".equals(activityType) || "new_collect".equals(activityType)) {
// localFieldActivityLabelName = ResUtils.getString(R.string.activity_type_collect);
// } else if ("raffle".equals(activityType)) {
// localFieldActivityLabelName = ResUtils.getString(R.string.activity_type_choujiang);
// } else if ("vote".equals(activityType)) {
// localFieldActivityLabelName = ResUtils.getString(R.string.activity_type_vote);
// } else if ("answer".equals(activityType)) {
// localFieldActivityLabelName = ResUtils.getString(R.string.activity_type_dati);
// } else if ("top".equals(activityType)) {
// localFieldActivityLabelName = ResUtils.getString(R.string.activity_type_bang);
// } else {
// localFieldActivityLabelName = null;
// }
}
}
public String getPerson() {
return person;
}
public void setPerson(String person) {
this.person = person;
}
}
... ...
package com.wd.foundation.bean.custom.comp;
import java.util.List;
import com.wd.foundation.bean.base.BaseBean;
import com.wd.foundation.bean.custom.content.ContentBean;
import java.util.List;
/**
* @Description: 组件多tab的业务数据
* @Author: Li Yubing
... ... @@ -19,6 +19,9 @@ public class TabContentBean extends BaseBean {
private String tabName;
//类型:1金刚卡样式,2列表样式
public int tabStyle;
private List<ContentBean> operDataList;
public int getTabId() {
... ...
package com.wd.foundation.bean.custom.comp;
import java.util.List;
import com.wd.foundation.bean.analytics.SummaryTypeConstants;
import com.wd.foundation.bean.base.BaseBean;
import com.wd.foundation.bean.custom.content.ContentBean;
import com.wd.foundation.bean.custom.content.ContentTypeConstant;
import com.wd.foundation.bean.custom.vote.VoteBean;
import com.wd.foundation.wdkitcore.tools.StringUtils;
import java.util.List;
/**
* 专题页面专题信息
... ... @@ -22,6 +24,11 @@ public class TopicInfoBean extends BaseBean {
private String backgroundImgUrl;
/**
* 背景颜色
*/
private String backgroundColor;
/**
* 分享标题
*/
private String shareTitle;
... ... @@ -76,6 +83,7 @@ public class TopicInfoBean extends BaseBean {
*/
private String shareOpen = "1";
/**
* 评论开关0:关闭,1:开启
*/
... ... @@ -123,22 +131,20 @@ public class TopicInfoBean extends BaseBean {
/**
* 播放量
*/
* */
private String viewsCnt;
public String linkUrl;
private String titleName;
private String titleName;
private String localPageId;
private String localPageName;
/**
* 评论用
*/
private String relObjectId;
/**
* 分享海报图片
*/
... ... @@ -147,7 +153,6 @@ public class TopicInfoBean extends BaseBean {
private String sharePosterOpen;
private int rmhPlatform = 0;
/**
* 收藏状态 0否,1已收藏
*/
... ... @@ -156,6 +161,16 @@ public class TopicInfoBean extends BaseBean {
// 本地字段 --》分享页面需要展示的数据
private List<ContentBean> shareContentList;
/**
* 游客评论开关:visitorComment 1:打开;0:关闭
*/
private String visitorComment;
/**
* 是否使用CMS配置的整张图 1不使用?
*/
private int sharePosterStyle;
public String getViewsCnt() {
return viewsCnt;
}
... ... @@ -188,6 +203,7 @@ public class TopicInfoBean extends BaseBean {
this.titleName = titleName;
}
public String getShareTitle() {
return shareTitle;
}
... ... @@ -220,6 +236,7 @@ public class TopicInfoBean extends BaseBean {
this.shareUrl = shareUrl;
}
public String getSummary() {
return summary;
}
... ... @@ -244,6 +261,15 @@ public class TopicInfoBean extends BaseBean {
this.voteInfo = voteInfo;
}
public int getSharePosterStyle() {
return sharePosterStyle;
}
public void setSharePosterStyle(int sharePosterStyle) {
this.sharePosterStyle = sharePosterStyle;
}
public String getLocalPageId() {
return localPageId;
}
... ... @@ -348,7 +374,7 @@ public class TopicInfoBean extends BaseBean {
this.frontLinkObject = frontLinkObject;
}
public boolean isOpenHeadView() {
public boolean isOpenHeadView(){
return frontFlag == 1;
}
... ... @@ -400,6 +426,14 @@ public class TopicInfoBean extends BaseBean {
this.backgroundImgUrl = backgroundImgUrl;
}
public String getBackgroundColor() {
return backgroundColor;
}
public void setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
}
public int getCollectStatus() {
return collectStatus;
}
... ... @@ -407,4 +441,32 @@ public class TopicInfoBean extends BaseBean {
public void setCollectStatus(int collectStatus) {
this.collectStatus = collectStatus;
}
public int getVisitorComment() {
return StringUtils.isEqual("1",visitorComment) ? 1 : 0;
}
public void setVisitorComment(String visitorComment) {
this.visitorComment = visitorComment;
}
/**
* //专题类型 21:文章专题,22:音频专题,23:直播专题,24:话题专题,25:早晚报专题,26:时间链
* */
public String getTopicTypeWord(){
if(ContentTypeConstant.SUBJECT_TOPICTYPE_21 == topicType){
return SummaryTypeConstants.ARTICLE_TOPIC;
}else if(ContentTypeConstant.SUBJECT_TOPICTYPE_22 == topicType){
return SummaryTypeConstants.AUDIO_TOPIC;
}else if(ContentTypeConstant.SUBJECT_TOPICTYPE_23 == topicType){
return SummaryTypeConstants.LIVE_TOPIC;
}else if(ContentTypeConstant.SUBJECT_TOPICTYPE_24 == topicType){
return SummaryTypeConstants.TALK_TOPIC;
}else if(ContentTypeConstant.SUBJECT_TOPICTYPE_25 == topicType){
return SummaryTypeConstants.MORNING_AND_EVENING_NEWS_TOPIC;
}else if(ContentTypeConstant.SUBJECT_TOPICTYPE_26 == topicType){
return SummaryTypeConstants.TIME_AXIS_TOPIC;
}
return "";
}
}
... ...
package com.wd.foundation.bean.response;
import java.util.ArrayList;
import java.util.List;
import android.text.TextUtils;
... ... @@ -15,6 +12,10 @@ import com.wd.foundation.bean.mail.MliveBean;
import com.wd.foundation.bean.mail.ShareInfo;
import com.wd.foundation.bean.mail.VliveBean;
import com.wd.foundation.bean.pop.PopUpsBean;
import com.wd.foundation.wdkitcore.tools.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 转化后的直播实体类
... ... @@ -22,6 +23,8 @@ import com.wd.foundation.bean.pop.PopUpsBean;
* @author wondertek
*/
public class ConvertLiveBean extends BaseBean {
/**
* 内容详情获取,内容详情没有就不传,服务端默认为0
*/
... ... @@ -34,10 +37,20 @@ public class ConvertLiveBean extends BaseBean {
/**
* 封面图
*/
* */
public String previewPicUrl;
/**
* 发布标识,0-cms;1-表示号主发布 2-普通用户
* 内容详情接口增加字段rmhPlatform,1=人民号发布,已部署。
* 为1时,需要单独请求,直播流地址接口
* /zh/c/vlive/pull-stream/{vLiveId} 普通直播获取流地址
* /zh/c/vlive/pull-stream-list/{liveId} 多路直播获取流地址
* 返回和视界一样
* */
public int rmhPlatform = -1;
/**
* 直播id
*/
private String liveId;
... ... @@ -61,7 +74,7 @@ public class ConvertLiveBean extends BaseBean {
/**
* 简介
*/
* */
public String newIntroduction;
/**
... ... @@ -94,6 +107,11 @@ public class ConvertLiveBean extends BaseBean {
*/
public String startTime;
/**
* 结束时间 2023-08-28 10:55:42
*/
public String endTime;
private String mliveId;
private String roomId;
... ... @@ -116,7 +134,6 @@ public class ConvertLiveBean extends BaseBean {
/**
* 直播 创建人id
*/
private String createUserId;
/**
... ... @@ -160,38 +177,33 @@ public class ConvertLiveBean extends BaseBean {
* 直播公告
*/
private String notice;
// 是否开启评论 1是 0否
//是否开启评论 1是 0否
private int openComment;
// 点赞样式 Love爱心型 thumb点赞手势 pray 祈福 buddha 佛手
//点赞样式 Love爱心型 thumb点赞手势 pray 祈福 buddha 佛手
private String likesStyle;
// 是否开启点赞 1是 0否
//是否开启点赞 1是 0否
private int likeEnable;
// 内容预评论显示开关;1显示 0隐藏
//内容预评论显示开关;1显示 0隐藏
private int preCommentFlag;
// 直播样式 0-正常模式,1-隐藏直播 2-隐藏大家聊
//直播样式 0-正常模式,1-隐藏直播 2-隐藏大家聊
private int liveStyle;
// 背景样式 0-蓝色 1-红色 2-黑色
//背景样式 0-蓝色 1-红色 2-黑色
private int backgroundStyle;
// 直播类型 0-视频直播,1-文字直播
private int liveWay;
// 是否开启挂角 true:开启 false:关闭
//是否开启挂角 true:开启 false:关闭
private boolean handAngleSwitch;
// 挂角图片url
//挂角图片url
private String handAngleImageUri;
// 挂角链接
//挂角链接
private String handAngleLink;
/**
* 直播点赞状态,true是点赞,false是未点赞
*/
private boolean isLike;
/**
* 稿件封面图地址【BFF聚合】
*/
private List<ManuscriptImageBean> fullColumnImgUrls;
... ... @@ -204,30 +216,43 @@ public class ConvertLiveBean extends BaseBean {
private String TextLiveCover = "";
/**
* 本地数据,人民号直播单个直播流地址
* 迁移老直播id
*/
private GetPullAddressBean getPullAddressBean;
private String oldNewsId;
/**
* 本地数据,人民号直播多个直播流地址
* 新直播id
*/
private String newsId;
/**
* 本地数据,人民号直播单个直播流地址
* */
private GetPullAddressBean getPullAddressBean;
/**
* 本地数据,人民号直播多个直播流地址
* */
private List<GetPullAddressBean> getPullAddressBeanList;
/**
* 直播背景图的 已经部署到dev了,客户端可以加下
*/
* */
public LiveInfo.BackgroundBean background;
/**
* 1 开启,2 关闭
*/
private int bestNoticer = 2;
/**
* 直播间,当前用户被禁言
*/
public boolean barrageEnable;
/**
* 游客评论开关:visitorComment 1:打开;0:关闭
*/
private int visitorComment = 0;
private String fromPage;
public String getFromPage() {
... ... @@ -238,8 +263,17 @@ public class ConvertLiveBean extends BaseBean {
this.fromPage = fromPage;
}
public boolean unBarrageAndCanComment() {
return !barrageEnable && openComment == 1;
public boolean unBarrageAndCanComment(){
//禁言 ,评论关闭,隐藏大家聊 都会不展示评论
return !barrageEnable && openComment == 1 && 2 != liveStyle;
}
public int getRmhPlatform() {
return rmhPlatform;
}
public void setRmhPlatform(int rmhPlatform) {
this.rmhPlatform = rmhPlatform;
}
public List<GetPullAddressBean> getGetPullAddressBeanList() {
... ... @@ -286,7 +320,7 @@ public class ConvertLiveBean extends BaseBean {
this.handAngleLink = handAngleLink;
}
// 处理获取封面地址
//处理获取封面地址
public String getTextLiveCover() {
return TextLiveCover;
}
... ... @@ -305,10 +339,23 @@ public class ConvertLiveBean extends BaseBean {
public void setFullColumnImgUrls(List<ManuscriptImageBean> fullColumnImgUrls) {
for (ManuscriptImageBean manuscriptImageBean : fullColumnImgUrls) {
if (manuscriptImageBean.landscape == 1 && !TextUtils.isEmpty(manuscriptImageBean.url)) {
if (manuscriptImageBean.landscape== 1 && !TextUtils.isEmpty(manuscriptImageBean.url)) {
TextLiveCover = manuscriptImageBean.url;
break;
}
}
//如果没有横图,按顺序取第一张有图的地地址
if(TextUtils.isEmpty(TextLiveCover)){
for (ManuscriptImageBean manuscriptImageBean : fullColumnImgUrls) {
if (!TextUtils.isEmpty(manuscriptImageBean.url)) {
TextLiveCover = manuscriptImageBean.url;
break;
}
}
}
//如果没有横图,取第0第图片
this.fullColumnImgUrls = fullColumnImgUrls;
}
... ... @@ -392,6 +439,7 @@ public class ConvertLiveBean extends BaseBean {
this.notice = notice;
}
public String getLiveLandScape() {
return liveLandScape;
}
... ... @@ -424,6 +472,7 @@ public class ConvertLiveBean extends BaseBean {
this.rmhInfo = rmhInfo;
}
public boolean isVrType() {
return vrType;
}
... ... @@ -522,10 +571,10 @@ public class ConvertLiveBean extends BaseBean {
}
public String getTitle() {
// if (title.length() > 15) {
// title = title.substring(0, 14) + "...";
// return title;
// }
// if (title.length() > 15) {
// title = title.substring(0, 14) + "...";
// return title;
// }
return title;
}
... ... @@ -557,6 +606,7 @@ public class ConvertLiveBean extends BaseBean {
this.previewType = previewType;
}
public String getPlanStartTime() {
return planStartTime;
}
... ... @@ -581,6 +631,14 @@ public class ConvertLiveBean extends BaseBean {
this.mliveId = mliveId;
}
public void setLiveIsLike(boolean like) {
this.isLike = like;
}
public boolean getLiveIsLike() {
return this.isLike;
}
public String getRoomId() {
return roomId;
}
... ... @@ -597,6 +655,31 @@ public class ConvertLiveBean extends BaseBean {
this.liveSourceList = liveSourceList;
}
public int getVisitorComment() {
return visitorComment;
}
public void setVisitorComment(int visitorComment) {
this.visitorComment = visitorComment;
}
public String getOldNewsId() {
return oldNewsId;
}
public void setOldNewsId(String oldNewsId) {
this.oldNewsId = oldNewsId;
}
public String getNewsId() {
return newsId;
}
public void setNewsId(String newsId) {
this.newsId = newsId;
}
public ConvertLiveBean(String liveId) {
this.liveId = liveId;
this.contentType = contentType;
... ... @@ -621,72 +704,80 @@ public class ConvertLiveBean extends BaseBean {
this.vrType = false;
}
public ConvertLiveBean(NewsDetailBean mContentBean, LiveInfo mOriginalLiveInfo, String relType, String relId,
String coverUrl) {
public ConvertLiveBean(NewsDetailBean mContentBean, LiveInfo mOriginalLiveInfo, String relType, String relId, String coverUrl) {
startTime = mOriginalLiveInfo.getStartTime();
endTime = mOriginalLiveInfo.getEndTime();
background = mOriginalLiveInfo.getBackground();
// 详情页原始数据
//详情页原始数据
newsDetailBean = mContentBean;
ShareInfo shareInfo = mContentBean.getShareInfo();
if (shareInfo != null) {
setShareInfo(shareInfo);
}
//设置游客是否评论
setVisitorComment(mContentBean.getVisitorComment());
//设置迁移老直播id
setOldNewsId(mContentBean.getOldNewsId());
//设置新直播id
setNewsId(mContentBean.getNewsId());
setLiveId(mContentBean.getNewsId());
setContentType(mContentBean.getNewsType());
// 详情标题
//详情标题
setTitle(mContentBean.getNewsTitle());
setDescription(mContentBean.getNewsSummary());
// 预约直播详情页简介 fixme 待设置简介
//预约直播详情页简介 fixme 待设置简介
newIntroduction = mContentBean.getNewIntroduction();
setRelType(relType);
setContentRelId(relId);
// 兼容旧直播间没有这个字段
if (!isBlank(mOriginalLiveInfo.getTplId())) {
//兼容旧直播间没有这个字段
if (!StringUtils.isBlank(mOriginalLiveInfo.getTplId())) {
setTplId(Integer.valueOf(mOriginalLiveInfo.getTplId()));
}
// 兼容旧直播间没有这个字段
if (!isBlank(mOriginalLiveInfo.getCreateUserId())) {
//兼容旧直播间没有这个字段
if (!StringUtils.isBlank(mOriginalLiveInfo.getCreateUserId())) {
setCreateUserId(mOriginalLiveInfo.getCreateUserId());
}
// 兼容旧直播间没有这个字段
if (!isBlank(mOriginalLiveInfo.getCreateUserName())) {
//兼容旧直播间没有这个字段
if (!StringUtils.isBlank(mOriginalLiveInfo.getCreateUserName())) {
setCreateUserName(mOriginalLiveInfo.getCreateUserName());
}
// 兼容旧直播间没有这个字段
if (!isBlank(mOriginalLiveInfo.getPadImageUri())) {
//兼容旧直播间没有这个字段
if (!StringUtils.isBlank(mOriginalLiveInfo.getPadImageUri())) {
setPadImageUri(mOriginalLiveInfo.getPadImageUri());
}
// 兼容旧直播间没有这个字段 彩蛋信息
if (mContentBean.getPopUps() != null && mContentBean.getPopUps().size() > 0) {
//兼容旧直播间没有这个字段 彩蛋信息
if (mContentBean.getPopUps() != null && mContentBean.getPopUps().size() >0) {
setPopUps(mContentBean.getPopUps());
}
// 兼容旧直播间没有这个字段 彩蛋 是否展示
if (!isBlank(mContentBean.getHasPopUp())) {
//兼容旧直播间没有这个字段 彩蛋 是否展示
if (!StringUtils.isBlank(mContentBean.getHasPopUp())) {
setHasPopUp(mContentBean.getHasPopUp());
}
// 兼容旧直播间没有这个字段 房主信息
//兼容旧直播间没有这个字段 房主信息
if (mContentBean.getRmhInfo() != null) {
setRmhInfo(mContentBean.getRmhInfo());
}
// //兼容旧直播间没有这个字段 直播公告
// if (mContentBean.getLiveInfo() != null && mContentBean.getLiveInfo().getNotice() != null ) {
//// setNotice("直播公告" + mContentBean.getLiveInfo().getNotice());
// }
// 兼容旧直播间没有这个字段 直播样式
// //兼容旧直播间没有这个字段 直播公告
// if (mContentBean.getLiveInfo() != null && mContentBean.getLiveInfo().getNotice() != null ) {
//// setNotice("直播公告" + mContentBean.getLiveInfo().getNotice());
// }
//兼容旧直播间没有这个字段 直播样式
setLiveStyle(mOriginalLiveInfo.getLiveStyle());
// 兼容旧直播间没有这个字段 直播类型
//兼容旧直播间没有这个字段 直播类型
setLiveWay(mOriginalLiveInfo.getLiveWay());
// 兼容旧直播间没有这个字段 背景样式
//兼容旧直播间没有这个字段 背景样式
setBackgroundStyle(mOriginalLiveInfo.getBackgroundStyle());
setOpenComment(mOriginalLiveInfo.getOpenComment());
setLikesStyle(mOriginalLiveInfo.getLikesStyle());
setPreCommentFlag(mOriginalLiveInfo.getPreCommentFlag());
setLikeEnable(mOriginalLiveInfo.getLikeEnable());
// 兼容旧直播间没有这个字段 文字直播用的封面地址
//兼容旧直播间没有这个字段 文字直播用的封面地址
if (mContentBean.getFullColumnImgUrls() != null && mContentBean.getFullColumnImgUrls().size() > 0) {
setFullColumnImgUrls(mContentBean.getFullColumnImgUrls());
} else {
if (!TextUtils.isEmpty(coverUrl)) {
}else{
if(!TextUtils.isEmpty(coverUrl)){
List<ManuscriptImageBean> manuscriptImageBeans = new ArrayList<>();
ManuscriptImageBean manuscriptImageBean = new ManuscriptImageBean();
manuscriptImageBean.landscape = 1;
... ... @@ -695,7 +786,7 @@ public class ConvertLiveBean extends BaseBean {
setFullColumnImgUrls(manuscriptImageBeans);
}
}
// 兼容旧直播间没有这个字段 直播 是否Vr 是否展示
//兼容旧直播间没有这个字段 直播 是否Vr 是否展示
setVrType(mOriginalLiveInfo.getVrType() == 1);
MliveBean mMliveBean = mOriginalLiveInfo.getMlive();
if (mMliveBean != null) {
... ... @@ -705,14 +796,13 @@ public class ConvertLiveBean extends BaseBean {
}
String liveStatus = getStringValue(mOriginalLiveInfo.getLiveState());
setStatus(liveStatus);
// 兼容旧直播间没有这个字段 是否开启挂角 true:开启 false:关闭
//兼容旧直播间没有这个字段 是否开启挂角 true:开启 false:关闭
setHandAngleSwitch(mOriginalLiveInfo.isHandAngleSwitch());
// 兼容旧直播间没有这个字段 挂角图片url
//兼容旧直播间没有这个字段 挂角图片url
setHandAngleImageUri(mOriginalLiveInfo.getHandAngleImageUri());
// 兼容旧直播间没有这个字段 挂角链接
//兼容旧直播间没有这个字段 挂角链接
setHandAngleLink(mOriginalLiveInfo.getHandAngleLink());
}
/**
* 获取字符串字段的值,已做非空判断
*
... ... @@ -726,12 +816,19 @@ public class ConvertLiveBean extends BaseBean {
return value;
}
}
/**
* 判断字符串是否为空或者空字符串 如果字符串是空或空字符串则返回true,否则返回false。也可以使用Android自带的TextUtil
*
* @param str
* @return
*/
private static boolean isBlank(String value) {
return null == value || 0 == value.length() || "".equals(value.trim());
public static boolean isBlank(String str) {
if (str == null || "".equals(str)) {
return true;
} else {
return false;
}
}
}
... ...
package com.wd.foundation.bean.response;
import java.util.ArrayList;
import java.util.List;
import android.content.pm.ActivityInfo;
import android.text.TextUtils;
import com.wd.foundation.bean.analytics.LiveTypeConstants;
import com.wd.foundation.bean.base.BaseBean;
import com.wd.foundation.bean.comment.DisplayWorkInfoBean;
... ... @@ -20,6 +19,10 @@ import com.wd.foundation.bean.mail.ShareInfo;
import com.wd.foundation.bean.mail.VideoInfo;
import com.wd.foundation.bean.mail.VliveBean;
import com.wd.foundation.bean.pop.PopUpsBean;
import com.wd.foundation.wdkitcore.tools.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 新闻内容详情
... ... @@ -63,13 +66,17 @@ public class NewsDetailBean extends BaseBean {
* app样式
*/
private String appStyle;
/**
* 有的接口返回appstyle
*/
private String appstyle;
/**
* 合集-稿件封面图地址
*/
private String albumCoverUrl;
/**
* 1:点播,2:直播,3:活动,4:广告,5:专题,6:链接,7:榜单,8:图文,9:组图,10:H5新闻,11:频道,12:组件,13:音频,14动态图文,15动态视频
*/
private String newsType;
... ... @@ -78,7 +85,6 @@ public class NewsDetailBean extends BaseBean {
* 新闻摘要
*/
private String newsSummary;
/**
* 新闻来源
*/
... ... @@ -88,9 +94,6 @@ public class NewsDetailBean extends BaseBean {
* 新闻来源
*/
private String newsSource;
private String newsTags;
/**
* 图文内容富文本信息
*/
... ... @@ -130,6 +133,10 @@ public class NewsDetailBean extends BaseBean {
* 分享海报图片
*/
private String posterUrl;
/**
* 视频封面
*/
private String coverUrl;
/**
* 分享对象
... ... @@ -150,13 +157,11 @@ public class NewsDetailBean extends BaseBean {
* 直播信息
*/
private LiveInfo liveInfo;
private SerialsInfo serials;
private PeopleMasterBean peopleAccountInfo;
private int bottomMargin;
/**
* 首帧图
*/
... ... @@ -184,6 +189,18 @@ public class NewsDetailBean extends BaseBean {
private String sceneId;
private String subSceneId;
/**
* 试验id
*/
private String expIds;
/**
* 频道id;【取对应频道关系的,频道id】
*/
private String channelId;
private PlayStateChangedListener mPlayStateChangedListener;
/**
... ... @@ -199,28 +216,30 @@ public class NewsDetailBean extends BaseBean {
* openAudio:语音播报开关 0不播报 1播报
*/
private int openLikes;
private int openComment;
/**
* 是否是重点稿件 1是 0否
*/
private String keyArticle;
/**
* 是否领导人文章 0 否,1 是,不存在就传0
*/
private String leaderArticle = "0";
/**
* 点赞样式 1:红心(点赞) 2:大拇指(祈福) 3:蜡烛(默哀) 4:置空
*/
private int likesStyle;
private int preCommentFlag;
private int commentDisplay;
private int commentEntryFlag;
private int posterFlag;
private int menuShow;
/**
* 是否显示功能菜单 1显示 2隐藏
*/
private int menuShow = 1;
/**
* 【图文稿件】语音播报开关 0不播报 1播报
... ... @@ -258,6 +277,7 @@ public class NewsDetailBean extends BaseBean {
// api/rmrb-interact/interact/zh/c/batchAttention/status
private MasterFollowsStatusBean followsStatusBean;
/**
* 音频地址
*/
... ... @@ -280,26 +300,22 @@ public class NewsDetailBean extends BaseBean {
* /zh/c/vlive/pull-stream/{vLiveId} 普通直播获取流地址
* /zh/c/vlive/pull-stream-list/{liveId} 多路直播获取流地址
* 返回和视界一样
*/
public int rmhPlatform;
* */
public int rmhPlatform = 0;
private String readFlag;
/**
* 页面名称
*/
private String pageName;
/**
* 专栏ID
*/
private String specialColumnId;
/**
* 是否详情页
*/
private String isDetail = "1";
/**
* 1开启、2关闭最佳评论,默认关闭
*/
... ... @@ -307,10 +323,29 @@ public class NewsDetailBean extends BaseBean {
// 关联活动对象
private List<ActivityInfo> activityInfos;
// 上个页面跳转来的
//上个页面跳转来的
private String fromPage;
/**
* 相关推荐开关:1-开启,其他情况不显示推荐
*/
private String recommendShow;
/**
* 浏览量
*/
private String viewCount;
/**
* 游客评论开关:visitorComment 1:打开;0:关闭
*/
private String visitorComment;
/**
* 迁移老直播id
*/
private String oldNewsId;
public String getNewIntroduction() {
return newIntroduction;
}
... ... @@ -319,6 +354,8 @@ public class NewsDetailBean extends BaseBean {
this.newIntroduction = newIntroduction;
}
public String getNewsSourceName() {
return newsSourceName;
}
... ... @@ -350,15 +387,6 @@ public class NewsDetailBean extends BaseBean {
public void setDisplayWorkInfoBean(DisplayWorkInfoBean displayWorkInfoBean) {
this.displayWorkInfoBean = displayWorkInfoBean;
}
public String getNewsTags() {
return newsTags;
}
public void setNewsTags(String newsTags) {
this.newsTags = newsTags;
}
public String getTraceId() {
return traceId;
}
... ... @@ -391,6 +419,14 @@ public class NewsDetailBean extends BaseBean {
this.itemId = itemId;
}
public String getAlbumCoverUrl() {
return albumCoverUrl;
}
public void setAlbumCoverUrl(String albumCoverUrl) {
this.albumCoverUrl = albumCoverUrl;
}
public String getSceneId() {
return sceneId;
}
... ... @@ -399,6 +435,30 @@ public class NewsDetailBean extends BaseBean {
this.sceneId = sceneId;
}
public String getSubSceneId() {
return subSceneId;
}
public void setSubSceneId(String subSceneId) {
this.subSceneId = subSceneId;
}
public String getExpIds() {
return expIds;
}
public void setExpIds(String expIds) {
this.expIds = expIds;
}
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public InteractResponseDataBean getInteract() {
return interact;
}
... ... @@ -484,7 +544,7 @@ public class NewsDetailBean extends BaseBean {
}
public String getAppStyle() {
if (isBlank(appStyle) && !isBlank(appstyle)) {
if (StringUtils.isBlank(appStyle) && !StringUtils.isBlank(appstyle) ){
return appstyle;
}
return appStyle;
... ... @@ -728,8 +788,8 @@ public class NewsDetailBean extends BaseBean {
return preCommentFlag;
}
public boolean isShowComment() {
return getPreCommentFlag() == 1;
public boolean isShowComment(){
return getPreCommentFlag()==1;
}
public void setPreCommentFlag(int preCommentFlag) {
... ... @@ -800,11 +860,10 @@ public class NewsDetailBean extends BaseBean {
* @return 视频地址
*/
public String getUrl() {
// 直播回放情况 拿数据 后期优化
if (liveInfo != null && liveInfo.getLiveState() != null && LiveTypeConstants.END.equals(liveInfo.getLiveState())
&& liveInfo.getVlive() != null && liveInfo.getVlive().size() > 0) {
//直播回放情况 拿数据 后期优化
if (liveInfo != null && liveInfo.getLiveState() != null && LiveTypeConstants.END.equals(liveInfo.getLiveState()) && liveInfo.getVlive() != null && liveInfo.getVlive().size()>0){
VliveBean videoInfoList = liveInfo.getVlive().get(0);
if (videoInfoList == null || TextUtils.isEmpty(videoInfoList.getReplayUri())) {
if (videoInfoList == null || TextUtils.isEmpty(videoInfoList.getReplayUri()) ) {
return null;
}
return videoInfoList.getReplayUri();
... ... @@ -893,7 +952,51 @@ public class NewsDetailBean extends BaseBean {
this.fromPage = fromPage;
}
private static boolean isBlank(String value) {
return null == value || 0 == value.length() || "".equals(value.trim());
public String getRecommendShow() {
return recommendShow;
}
public void setRecommendShow(String recommendShow) {
this.recommendShow = recommendShow;
}
public String getViewCount() {
return viewCount;
}
public void setViewCount(String viewCount) {
this.viewCount = viewCount;
}
public String getCoverUrl() {
return coverUrl;
}
public void setCoverUrl(String coverUrl) {
this.coverUrl = coverUrl;
}
public int getVisitorComment() {
return StringUtils.isEqual("1",visitorComment) ? 1 : 0;
}
public void setVisitorComment(String visitorComment) {
this.visitorComment = visitorComment;
}
public String getOldNewsId() {
return oldNewsId;
}
public void setOldNewsId(String oldNewsId) {
this.oldNewsId = oldNewsId;
}
public String getLeaderArticle() {
return leaderArticle;
}
public void setLeaderArticle(String leaderArticle) {
this.leaderArticle = leaderArticle;
}
}
... ...
... ... @@ -11,5 +11,33 @@ import okhttp3.Interceptor
interface INetConfig : IProvider {
fun getBaseUrl(): String
fun getBaseUrlSitTag(): String
fun getBaseUrlDevTag(): String
fun getBaseUrlRelTag(): String
fun getBaseUrlUatTag(): String
fun getUrlTag(): String
fun getEcommerceAddressTag(): String
fun getEcommerceAddress(): String
fun getMultiDomainBaseUrl(): String
fun getHeaderParameter(): Map<String, String>
fun getCacheFile(): String
fun getReadTimeout(): Long
fun getConnectTimeout(): Long
fun getWriteTimeout(): Long
fun getCacheTime(): Long
fun getInterceptors(): Array<Interceptor>
}
... ...
... ... @@ -10,6 +10,8 @@ import com.wd.foundation.wdinterface.config.INetConfig;
import com.wd.foundation.wdinterface.constant.InterfaceConstant;
import com.wd.foundation.wdinterfaceimpl.interceptor.TokenInterceptor;
import java.util.Map;
import okhttp3.Interceptor;
/**
... ... @@ -19,7 +21,6 @@ import okhttp3.Interceptor;
*/
@Route(path = InterfaceConstant.PATH_NET_CONFIG)
public class NetConfig implements INetConfig {
private static final String baseUrlRel = "https://pdapis.pdnews.cn/";
@Override
public void init(Context context) {
... ... @@ -29,7 +30,31 @@ public class NetConfig implements INetConfig {
@NonNull
@Override
public String getBaseUrl() {
return baseUrlRel;
return NetManager.getNetManager().getBaseUrl();
}
@NonNull
@Override
public String getBaseUrlSitTag() {
return NetManager.BASE_URL_SIT;
}
@NonNull
@Override
public String getBaseUrlDevTag() {
return NetManager.BASE_URL_DEV;
}
@NonNull
@Override
public String getBaseUrlRelTag() {
return NetManager.BASE_URL_REL;
}
@NonNull
@Override
public String getBaseUrlUatTag() {
return NetManager.BASE_URL_UAT;
}
@NonNull
... ... @@ -37,4 +62,75 @@ public class NetConfig implements INetConfig {
public Interceptor[] getInterceptors() {
return new TokenInterceptor[]{new TokenInterceptor(RetrofitClient.getInterceptorHosts())};
}
@NonNull
@Override
public String getUrlTag() {
return NetManager.getUrlTag();
}
@NonNull
@Override
public String getEcommerceAddressTag() {
return NetManager.ECOMMERCE_ADDRESS_TAG;
}
@NonNull
@Override
public String getEcommerceAddress() {
return NetManager.getEcommerceAddress();
}
@NonNull
@Override
public String getMultiDomainBaseUrl() {
String baseUrl = "";
String tag = getUrlTag();
if (NetManager.BASE_URL_DEV.equals(tag)){
baseUrl = NetManager.baseUrlSitDev;
}else if (NetManager.BASE_URL_SIT.equals(tag)){
baseUrl = NetManager.baseUrlSit;
}else if (NetManager.BASE_URL_UAT.equals(tag)){
baseUrl = NetManager.baseUrlUta;
} else {
baseUrl = NetManager.baseUrlRel;
}
return baseUrl;
}
@NonNull
@Override
public Map<String, String> getHeaderParameter() {
return NetManager.getNetManager().getHeaderParameter();
}
@NonNull
@Override
public String getCacheFile() {
return NetManager.getNetManager().builder.getCacheFile();
}
@NonNull
@Override
public long getReadTimeout() {
return NetManager.getNetManager().builder.getReadTimeout();
}
@NonNull
@Override
public long getConnectTimeout() {
return NetManager.getNetManager().builder.getConnectTimeout();
}
@NonNull
@Override
public long getWriteTimeout() {
return NetManager.getNetManager().builder.getWriteTimeout();
}
@NonNull
@Override
public long getCacheTime() {
return NetManager.getNetManager().builder.getCacheTime();
}
}
... ...
package com.wd.capability.network;
package com.wd.foundation.wdinterfaceimpl.config;
import android.text.TextUtils;
... ...
package com.wd.foundation.wdinterfaceimpl.config;
package com.wd.foundation.wdinterfaceimpl.interceptor;
import com.wd.capability.network.bean.TokenBean;
... ...
... ... @@ -19,7 +19,6 @@ import com.wd.capability.network.constant.ParameterConstant;
import com.wd.capability.network.interceptor.LoggingInterceptor;
import com.wd.capability.network.refreshtoken.IRefreshTokenForJsCallBack;
import com.wd.capability.network.response.BaseResponse;
import com.wd.foundation.wdinterfaceimpl.config.IRefreshToken;
import com.wd.foundation.wdkit.json.JsonParseUtil;
import com.wd.foundation.wdkit.utils.DeviceUtil;
import com.wd.foundation.wdkit.utils.SpUtils;
... ...
package com.wd.foundation.wdkit.utils;
import android.text.TextUtils;
import java.util.Calendar;
import java.util.Locale;
/**
* Author LiuKun
* date:2023/3/21
* desc:时间处理工具类
*/
public class DateFormatHelper {
private static long VALUE_MINUTE = 60 * 1000;
private static long VALUE_HOUR = 60 * 60 * 1000;
private static long VALUE_DAY = 24 * 60 * 60 * 1000;
/**
* 时间显示规则4
* 规则: 日期格式:月(英文缩写)日(数字),yyyy(如:Jun 15,2021)
*/
public static String formatGlobalRule$4(String timestamp) {
long targetTime;
if (TextUtils.isEmpty(timestamp)) {
return "";
}
if (timestamp.length() == 10) {
timestamp = timestamp + "000";
}
try {
targetTime = Long.parseLong(timestamp);
} catch (NumberFormatException e) {
return timestamp;
}
Calendar targetCalendar = Calendar.getInstance();
targetCalendar.setTimeInMillis(targetTime);
int targetYear = targetCalendar.get(Calendar.YEAR);
int targetDay = targetCalendar.get(Calendar.DAY_OF_MONTH);
String realMonth = targetCalendar.getDisplayName(Calendar.MONTH, Calendar.SHORT, Locale.ENGLISH);
String realDay = targetDay < 10 ? ("0" + targetDay) : String.valueOf(targetDay);
return realMonth + " " + realDay + ", " + targetYear;
}
/**
* 时间显示规则5
* 规则:
* 时间格式:hh:mm(如:16:00)
* 显示页面:
* 1)财经飞播专题列表页——时间
*/
public static String formatGlobalRule$5(String timestamp) {
long targetTime;
if (TextUtils.isEmpty(timestamp)) {
return "";
}
if (timestamp.length() == 10) {
timestamp = timestamp + "000";
}
try {
targetTime = Long.parseLong(timestamp);
} catch (NumberFormatException e) {
return timestamp;
}
return formatTime(targetTime, 4);
}
/**
* 同一天
* @param time1
* @param time2
* @return
*/
public static boolean isSameDay(long time1, long time2) {
String sTime1 = String.valueOf(time1);
if (sTime1.length() == 10) {
time1 = time1 * 1000;
}
String sTime2 = String.valueOf(time2);
if (sTime2.length() == 10) {
time2 = time2 * 1000;
}
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(time1);
int year1 = calendar.get(Calendar.YEAR);
int month1 = calendar.get(Calendar.MONTH);
int day1 = calendar.get(Calendar.DAY_OF_MONTH);
calendar.setTimeInMillis(time2);
int year2 = calendar.get(Calendar.YEAR);
int month2 = calendar.get(Calendar.MONTH);
int day2 = calendar.get(Calendar.DAY_OF_MONTH);
if (year1 != year2) {
return false;
}
if (month1 != month2) {
return false;
}
return day1 == day2;
}
/**
* 同一年
* @param time1
* @param time2
* @return
*/
public static boolean isSameYear(long time1, long time2) {
String sTime1 = String.valueOf(time1);
if (sTime1.length() == 10) {
time1 = time1 * 1000;
}
String sTime2 = String.valueOf(time2);
if (sTime2.length() == 10) {
time2 = time2 * 1000;
}
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(time1);
int year1 = calendar.get(Calendar.YEAR);
calendar.setTimeInMillis(time2);
int year2 = calendar.get(Calendar.YEAR);
return year1 == year2;
}
/**
* timestamp
* formatType 1 = yyyy-mm-dd; 2 = mm-dd ; 3 = yyyy-mm-dd hh:mm ; 4 = hh:mm
*/
private static String formatTime(long timestamp, int formatType) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(timestamp);
StringBuilder result = new StringBuilder();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DAY_OF_MONTH);
int hour = calendar.get(Calendar.HOUR_OF_DAY);
int minute = calendar.get(Calendar.MINUTE);
month += 1;
String realMonth = month < 10 ? ("0" + month) : String.valueOf(month);
String realDay = day < 10 ? ("0" + day) : String.valueOf(day);
String realHour = hour < 10 ? ("0" + hour) : String.valueOf(hour);
String realMinute = minute < 10 ? ("0" + minute) : String.valueOf(minute);
switch (formatType) {
case 1:
result.append(year);
result.append("-");
result.append(realMonth);
result.append("-");
result.append(realDay);
break;
case 2:
result.append(realMonth);
result.append("-");
result.append(realDay);
break;
case 3:
result.append(year);
result.append("-");
result.append(realMonth);
result.append("-");
result.append(realDay);
result.append("\t");
result.append(realHour);
result.append(":");
result.append(realMinute);
break;
case 4:
result.append(realHour);
result.append(":");
result.append(realMinute);
break;
}
return result.toString();
}
public static String test(String timestamp) {
long targetTime;
if (TextUtils.isEmpty(timestamp)) {
return "";
}
if (timestamp.length() == 10) {
timestamp = timestamp + "000";
}
try {
targetTime = Long.parseLong(timestamp);
} catch (NumberFormatException e) {
return timestamp;
}
return formatTime(targetTime, 3);
}
}
... ...
package com.wd.common.manager
package com.wd.foundation.wdkit.utils
import android.app.Activity
import java.lang.ref.WeakReference
... ...
... ... @@ -296,4 +296,65 @@ public class ArrayUtils {
return res;
}
}
public static boolean isOutOffIndex(int position, List<?> list) {
if (isEmpty(list)) {
return true;
}
return position < 0 || position > (list.size() - 1);
}
public static boolean isLastIndex(int position, List<?> list) {
if (isEmpty(list)) {
return false;
}
if (isOutOffIndex(position, list)) {
return false;
}
return position == (list.size() - 1);
}
@Nullable
public static <T> T safeGet(int index, List<T> list) {
if (isOutOffIndex(index, list)) {
return null;
}
return list.get(index);
}
@Nullable
public static <T> T safeGetFirst(List<T> list) {
if (isOutOffIndex(0, list)) {
return null;
}
return safeGet(0, list);
}
@Nullable
public static <T> T safeGetLast(List<T> list) {
if (isEmpty(list)) {
return null;
}
int index = list.size() - 1;
if (isOutOffIndex(index, list)) {
return null;
}
return safeGet(index, list);
}
public static void safeRemove(int index, List<?> list) {
if (isOutOffIndex(index, list)) {
return;
}
list.remove(index);
}
}
... ...
... ... @@ -74,6 +74,10 @@ dependencies {
implementation rootProject.ext.dependencies['TagTextView']
// RecyclerView多功能适配器
api rootProject.ext.dependencies["BaseRecyclerViewAdapterHelper"]
implementation rootProject.ext.dependencies["banner"]
api rootProject.ext.dependencies["fresco"]
}
uploadArchives {
... ...
package com.wd.capability.layout.comp.layoutmanager.adapter;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.capability.layout.R;
import com.wd.capability.layout.uitls.FontSettingUtil;
import com.wd.common.imageglide.ImageUtils;
import com.wd.common.viewclick.BaseClickListener;
import com.wd.foundation.bean.custom.content.ContentBean;
/**
* 内容适配器
*/
public class CompSingleRowGoldenAdapter extends BaseQuickAdapter<ContentBean, BaseViewHolder> {
private int size;
private Back back;
public CompSingleRowGoldenAdapter(int size) {
super(R.layout.comp_single_row_golden_item_content);
this.size = size;
}
public void setBack(Back back) {
this.back = back;
}
@Override
protected void convert(@NonNull BaseViewHolder baseViewHolder, ContentBean bean) {
ImageView imageView = baseViewHolder.itemView.findViewById(R.id.imageView);
TextView tvTitle = baseViewHolder.itemView.findViewById(R.id.tvTitle);
//适老化文字大小设置
FontSettingUtil.setRowGoldenTextFontSize(tvTitle);
ImageUtils.getInstance().loadImageSourceByNetStatus(imageView, bean.getCoverUrl(), R.drawable.rmrb_placeholder_compe_all);
tvTitle.setText(bean.getNewsTitle());
baseViewHolder.itemView.setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
if(back != null){
back.clickBack(bean,baseViewHolder.getBindingAdapterPosition());
}
}
});
}
public interface Back{
void clickBack(ContentBean bean,int position);
}
}
... ...
package com.wd.capability.layout.comp.layoutmanager.channel;
import android.annotation.SuppressLint;
import android.graphics.drawable.GradientDrawable;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.view.text.config.TagConfig;
import com.view.text.config.Type;
import com.view.text.view.TagTextView;
import com.wd.capability.layout.R;
import com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager;
import com.wd.capability.layout.uitls.CompentLogicUtil;
import com.wd.common.imageglide.ImageUtils;
import com.wd.common.utils.ProcessUtils;
import com.wd.common.viewclick.BaseClickListener;
import com.wd.foundation.bean.custom.NavigationBeanNews;
import com.wd.foundation.bean.custom.act.BaseActivityBean;
import com.wd.foundation.wdkit.utils.NumberStrUtils;
import com.wd.foundation.wdkit.utils.TimeUtil;
import com.wd.foundation.wdkit.utils.UiUtils;
import com.wd.foundation.wdkitcore.tools.ResUtils;
import com.wd.foundation.wdkitcore.tools.StringUtils;
/**
* @Description: 活动卡
* @Author: liyub
* @Email: liyubing@wondertek.com.cn
* @CreateDate: 2023/11/15
* @UpdateRemark: 更新说明
* @Version: 1.0
*/
public class CompActivity01 extends ItemLayoutManager<NavigationBeanNews> {
private ImageView imageView;
private TagTextView tvTitle;
private TextView tvData, tvLookDetail;
private TextView participantsNumberTv;
private View viewTag;
@Override
public int getItemViewType() {
return R.layout.comp_activity_01;
}
@Override
public int getItemSpan() {
return 1;
}
@Override
public void prepareItem(View itemView, int position) {
setFirstItemBg(itemView, position);
setCompItemMorePadding(itemView, position);
imageView = itemView.findViewById(R.id.imageView);
tvTitle = itemView.findViewById(R.id.tvTitle);
tvData = itemView.findViewById(R.id.tvData);
participantsNumberTv = itemView.findViewById(R.id.tv_participants_number);
tvLookDetail = itemView.findViewById(R.id.tvLookDetail);
viewTag = itemView.findViewById(R.id.viewTag);
// 国殇
checkOpenGrayModel(itemView, position);
}
@SuppressLint("StringFormatMatches")
@Override
public void bindItem(View itemView, int position, NavigationBeanNews data) {
if (data != null && data.getSubList() != null && data.getSubList().size() > 0) {
setLayoutManagerItemViewHeight(itemView, ViewGroup.LayoutParams.WRAP_CONTENT);
contentBean = data.getSubList().get(0);
BaseActivityBean activityBean = contentBean.itemActivity;
// 加载图片
String url = activityBean.getCoverUrl();
ImageUtils.getInstance().loadImageSourceByNetStatus(imageView, url, R.drawable.rmrb_placeholder_compe_all);
//设置已读
setReadState(tvTitle, contentBean,-1);
//适老化文字大小设置
setTextFontSize(tvTitle);
setTittleValue(activityBean.getActivityTitle(), tvTitle, contentBean.getKeyWord());
//设置默认数据
if(TextUtils.isEmpty(activityBean.localFieldActivityLabelName)){
activityBean.activityTypeToLabelName();
}
//设置标题左边的标签 征集/抽奖/答题/投票
if(!TextUtils.isEmpty(activityBean.localFieldActivityLabelName)){
// 默认样式
String activityType = activityBean.getActivityType();
TagConfig tv1Config = new TagConfig(Type.TEXT);
tv1Config.setText(activityBean.localFieldActivityLabelName);
tv1Config.setTextSize(UiUtils.dp2pxF(CompentLogicUtil.setTextTagSize()));
tv1Config.setTextColor(ContextCompat.getColor(tvTitle.getContext(), R.color.res_color_common_C8_keep));
tv1Config.setStartGradientBackgroundColor(activityBean.getActivityLabelNameColors(activityType)[0]);
tv1Config.setEndGradientBackgroundColor(activityBean.getActivityLabelNameColors(activityType)[1]);
tv1Config.setGradientOrientation(GradientDrawable.Orientation.LEFT_RIGHT);
// //设置圆角
tv1Config.setRadius(ResUtils.getDimension(R.dimen.rmrb_dp2));
// //设置内边距
tv1Config.setLeftPadding((int) ResUtils.getDimension(R.dimen.rmrb_dp4));
tv1Config.setRightPadding((int) ResUtils.getDimension(R.dimen.rmrb_dp4));
tv1Config.setTopPadding((int) ResUtils.getDimension(R.dimen.rmrb_dp1));
tv1Config.setBottomPadding((int) ResUtils.getDimension(R.dimen.rmrb_dp1));
//设置外边距
tv1Config.setMarginRight((int) ResUtils.getDimension(R.dimen.rmrb_dp5));
tvTitle.addTag(tv1Config);
}
// 处理标签
CompentLogicUtil.handleActivityTagViewLogic(viewTag, contentBean);
CompentLogicUtil.contentObjectTextMsg(tvLookDetail, contentBean);
// 活动开始和结束日期
String commentTxt = tvData.getContext().getString(R.string.comp_activity_data);
tvData.setText(String.format(commentTxt, TimeUtil.transFormTime9(activityBean.getStartTime()), TimeUtil.transFormTime9(activityBean.getEndTime())));
if(activityBean != null && StringUtils.isNotBlank(activityBean.getPerson())){
String person = NumberStrUtils.Companion.getINSTANCE().
handlerNumber(String.valueOf(activityBean.getPerson()));
if(StringUtils.isEqual("0",person)){
participantsNumberTv.setVisibility(View.GONE);
}else {
participantsNumberTv.setVisibility(View.VISIBLE);
participantsNumberTv.setText(person+"人参加");
}
}else {
participantsNumberTv.setVisibility(View.GONE);
}
itemView.setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
ProcessUtils.processPage(contentBean);
//更新已读状态
updateReadState(tvTitle, contentBean);
// 点击埋点
trackItemContent(true, contentBean, position, data.getLocalFiledType());
}
});
// 曝光埋点
itemView.post(() ->
{
trackItemContent(false, contentBean, position, data.getLocalFiledType());
});
} else {
setLayoutManagerItemViewHeight(itemView, 0);
}
}
}
... ...
package com.wd.capability.layout.comp.layoutmanager.channel;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.wd.capability.layout.R;
import com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager;
import com.wd.capability.layout.uitls.PDUtils;
import com.wd.common.imageglide.ImageUtils;
import com.wd.common.utils.ProcessUtils;
import com.wd.common.viewclick.BaseClickListener;
import com.wd.foundation.bean.custom.NavigationBeanNews;
import com.wd.foundation.bean.custom.content.ContentBean;
import com.wd.foundation.wdkit.constant.Constants;
import com.wd.foundation.wdkit.utils.FilletUtil;
import com.wd.foundation.wdkit.utils.NumberStrUtils;
import com.wd.foundation.wdkit.view.customtextview.StrokeWidthTextView;
import com.wd.foundation.wdkitcore.tools.ArrayUtils;
import com.wd.foundation.wdkitcore.tools.ResUtils;
import com.wd.foundation.wdkitcore.tools.StringUtils;
import java.util.List;
/**
* 搜索结果-更多人民号模块、搜索人民号
*
* @version 1.0.0
* @description:
* @author: wd
* @date :2023/2/6 16:21
* 参照:{@link com.people.personalcenter.adapter CompSingleRowRecommendFollow
* com.people.component.comp.layoutmanager.channel.CompSingleRowRecommendFollow}
*/
public class CompAllResultPeoplesAccount extends ItemLayoutManager<NavigationBeanNews> {
private ImageView riv_author,ivtagsplitpoint,ivadd,ivvip,imgavatarframe;
/**
* 关注按钮文本
*/
private StrokeWidthTextView btn_focus;
private TextView tvTitle,tv_fans,tv_desc;
private RelativeLayout rlcare;
private View vline,vauthorheadframe;
@Override
public void prepareItem(View itemView, int position) {
//荣誉头像框
imgavatarframe = itemView.findViewById(R.id.imgavatarframe);
//用户头像边框 #000000 0.5 dp 5%
vauthorheadframe = itemView.findViewById(R.id.vauthorheadframe);
//用户头像
riv_author = itemView.findViewById(R.id.riv_author);
//用户户V图标
ivvip = itemView.findViewById(R.id.ivvip);
//用户名称
tvTitle = itemView.findViewById(R.id.tv_author);
//粉丝数
tv_fans = itemView.findViewById(R.id.tv_fans);
//粉丝数目和简介之间的分割线
ivtagsplitpoint = itemView.findViewById(R.id.ivtagsplitpoint);
//用户简介
tv_desc = itemView.findViewById(R.id.tv_desc);
//用户关注布局
rlcare = itemView.findViewById(R.id.rlcare);
//用户关注+号
ivadd = itemView.findViewById(R.id.ivadd);
//用户关注状态标签 已关注/关注
btn_focus = itemView.findViewById(R.id.btn_focus);
//底线
vline = itemView.findViewById(R.id.vline);
// 国殇
checkOpenGrayModel(itemView,position);
}
@Override
public void bindItem(View itemView, int position, NavigationBeanNews data) {
if(data == null){
return;
}
List<ContentBean> subList = data.getSubList();
if(ArrayUtils.isEmpty(subList)){
return;
}
contentBean = subList.get(0);
if(contentBean == null || contentBean.getRmhInfo() == null){
return;
}
//设置荣誉头像框
ImageUtils.getInstance().loadImage(imgavatarframe, contentBean.getRmhInfo().getHonoraryIcon(),-1);
//设置头像
ImageUtils.getInstance().loadImageSourceByNetStatus(riv_author,
contentBean.getRmhInfo().getRmhHeadUrl(), contentBean.getRmhInfo().isMaterUser() ? R.mipmap.icon_default_head_mater: R.mipmap.icon_default_head);
//设置v标识
if(TextUtils.isEmpty(contentBean.getRmhInfo().getAuthIcon())){
ivvip.setVisibility(View.GONE);
}else{
ImageUtils.getInstance().loadImageCircle(ivvip,
contentBean.getRmhInfo().getAuthIcon(), -1);
ivvip.setVisibility(View.VISIBLE);
}
String keyWord = StringUtils.isEqual(Constants.SEARCH_PEOPLE_ACCOUNT,
contentBean.localFieldCommon) ? contentBean.getKeyWord() : "";
//设置用户昵称
setTittleValue(TextUtils.isEmpty(contentBean.getRmhInfo().getRmhName())?"":
contentBean.getRmhInfo().getRmhName(),tvTitle, keyWord);
int has = 0;
//设置粉丝
if(TextUtils.isEmpty(contentBean.getRmhInfo().fansNum) || "0".equals(contentBean.getRmhInfo().fansNum)){
tv_fans.setText("");
}else{
has = has+1;
tv_fans.setText("粉丝"+ NumberStrUtils.Companion.getINSTANCE().handlerNumber(contentBean.getRmhInfo().fansNum));
}
//设置简介
if(TextUtils.isEmpty(contentBean.getRmhInfo().getRmhDesc())){
tv_desc.setText("");
}else{
has = has+1;
tv_desc.setText(contentBean.getRmhInfo().getRmhDesc());
}
//设置分割点
if(has == 2){
ivtagsplitpoint.setVisibility(View.VISIBLE);
}else{
ivtagsplitpoint.setVisibility(View.GONE);
}
if (PDUtils.judgeIsSelf(contentBean.getRmhInfo().getUserId())){
rlcare.setVisibility(View.GONE);
}else{
rlcare.setVisibility(View.VISIBLE);
//设置关注状态
refreshCareState(contentBean.getRmhInfo().followStatus);
}
//点击关注/取消关注
rlcare.setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
if(!PDUtils.isLogin()){
ProcessUtils.toOneKeyLoginActivity();
return;
}
if (PDUtils.judgeIsSelf(contentBean.getRmhInfo().getUserId())){
return;
}
int status = TextUtils.isEmpty(contentBean.getRmhInfo().followStatus)?0:Integer.parseInt(contentBean.getRmhInfo().followStatus);
// CommonNetUtils.getInstance().operation(contentBean.getRmhInfo().getUserId(),
// contentBean.getRmhInfo().getUserType(),
// contentBean.getRmhInfo().getRmhId(),
// status == 1 ?0:1, new BaseObserver<String>() {
// @Override
// protected void dealSpecialCode(int code, String message) {
//
// }
//
// @Override
// protected void onSuccess(String s) {
// if (status == 1) {
// contentBean.getRmhInfo().followStatus = "0";
// }else{
// contentBean.getRmhInfo().followStatus = "1";
// }
// refreshCareState(contentBean.getRmhInfo().followStatus);
// if(status == 0){
// //执行任务:关注
// TaskManager.getInstance().executePointLevelOperate(TaskOperateTypeConstants.FOLLOW);
// }
//
// EventMessage mEventMessage = new EventMessage(EventConstants.FRESH_FOLLOW_CREATOR_EVENT);
// mEventMessage.putExtra(IntentConstants.USER_ID, contentBean.getRmhInfo().getUserId());
// mEventMessage.putExtra(IntentConstants.PARAM_CREATOR_ID, contentBean.getRmhInfo().getRmhId());
// mEventMessage.putExtra(IntentConstants.IS_FOLLOW, status == 1);
// //全局刷新创作者关注状态
// LiveDataBus.getInstance().with(EventConstants.FRESH_FOLLOW_CREATOR_EVENT).postValue(mEventMessage);
// }
// });
}
});
//跳转到号主页
itemView.setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
//跳转个人中心页
// ProcessUtils.jumpToPersonalCenterActivity(
// contentBean.getRmhInfo().getBanControl(),
// contentBean.getRmhInfo().getCnMainControl(),
// contentBean.getRmhInfo().getUserId(),
// contentBean.getRmhInfo().getUserType(),
// contentBean.getRmhInfo().getRmhId()
// );
}
});
}
private void refreshCareState(String status) {
int linesize = (int) rlcare.getContext().getResources().getDimension(R.dimen.rmrb_dp1);
if ("1".equals(status)) {
//已关注
rlcare.setPadding(0,0,0,0);
rlcare.setBackground(ContextCompat.getDrawable(rlcare.getContext(), R.drawable.bg_follow_yes));
ivadd.setVisibility(View.GONE);
btn_focus.setTextColor(btn_focus.getContext().getResources().getColor(R.color.res_color_common_C5));
btn_focus.setText(btn_focus.getContext().getResources().getString(R.string.res_followed));
}else{
rlcare.setPadding(0,0, (int) ResUtils.getDimension(R.dimen.rmrb_dp2),0);
//未关注
rlcare.setBackground(FilletUtil.createRectangleDrawable(0x00000000,
0x1AED2800,linesize,rlcare.getContext().getResources().getDimension(R.dimen.rmrb_dp3)));
ivadd.setVisibility(View.VISIBLE);
btn_focus.setTextColor(btn_focus.getContext().getResources().getColor(R.color.res_color_common_C11));
btn_focus.setText(btn_focus.getContext().getResources().getString(R.string.res_follow));
}
}
@Override
public int getItemViewType() {
return R.layout.comp_single_row_allresultpeoplesaccount;
}
@Override
public int getItemSpan() {
return 1;
}
}
... ...
package com.wd.capability.layout.comp.layoutmanager.channel;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import com.wd.capability.layout.R;
import com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager;
import com.wd.capability.layout.ui.widget.TagStokeWidthTextView;
import com.wd.capability.layout.uitls.CompentLogicUtil;
import com.wd.common.imageglide.ImageUtils;
import com.wd.common.utils.ProcessUtils;
import com.wd.common.viewclick.BaseClickListener;
import com.wd.common.widget.RoundRectImageView;
import com.wd.foundation.bean.custom.NavigationBeanNews;
import com.wd.foundation.bean.custom.content.ContentTypeConstant;
import com.wd.foundation.bean.custom.content.ManuscriptImageBean;
import com.wd.foundation.wdkit.constant.Constants;
import com.wd.foundation.wdkit.utils.DeviceUtil;
import com.wd.foundation.wdkitcore.tools.AppContext;
import com.wd.foundation.wdkitcore.tools.ResUtils;
/**
* 头图卡
*
* @version 1.0.0
* @description:
* @author: liyubing
* @date :2023/2/6 16:21
*/
public class CompBanner01 extends ItemLayoutManager<NavigationBeanNews> {
private static final String TAG = "CompBanner01";
private CheckBox cbSelect;
private RoundRectImageView imageView;
private View flImage;
private TagStokeWidthTextView tvTitle;
// 标题
private boolean haveTitle = true;
@Override
public int getItemViewType() {
return R.layout.comp_banner_01;
}
@Override
public int getItemSpan() {
return 1;
}
@Override
public void prepareItem(View itemView, int position) {
setFirstItemBg(itemView, position);
View rlImage = itemView.findViewById(R.id.rlImage);
if (position == 0 && isInChannelFlag()) {
int top = (int) ResUtils.getDimension(R.dimen.rmrb_dp10);
rlImage.setPadding(0, top, 0, 0);
} else {
int top = (int) ResUtils.getDimension(R.dimen.rmrb_dp14);
rlImage.setPadding(0, top, 0, 0);
}
imageView = itemView.findViewById(R.id.imageView);
tvTitle = itemView.findViewById(R.id.tvTitle);
flImage = itemView.findViewById(R.id.flImage);
imageView.setRadius((int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp4));
cbSelect = initEdit(itemView);
//适老化设置文字大小
setTextFontSize(tvTitle);
checkOpenGrayModel(itemView, position);
// 处理底线
ImageView bottomLine = itemView.findViewById(R.id.bottomLine);
bottomLine(bottomLine);
}
@Override
public void bindItem(View itemView, int position, NavigationBeanNews data) {
if (data != null && data.getSubList() != null && data.getSubList().size() > 0) {
setLayoutManagerItemViewHeight(itemView, ViewGroup.LayoutParams.WRAP_CONTENT);
contentBean = data.getSubList().get(0);
if (section != null) {
compStyle = section.getCompBean().getCompStyle();
} else {
compStyle = contentBean.getAppStyle();
}
itemViewRecordPublish(itemView);
String title = contentBean.getNewsTitle();
// 检测稿件头图卡的标题,是否需要显示
if (String.valueOf(ContentTypeConstant.MANUSCRIPT_STYLE_FIVE).equals(compStyle)) {
haveTitle = !TextUtils.isEmpty(title);
} else {
haveTitle = section.getCompBean().showTitleView();
}
// 绘制图片
int screenWith = DeviceUtil.getDeviceWidth();
float imageW = screenWith - AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp32);
float imageH = contentBean.getCalHeightByW(imageW);
// 没有高度 设置默认高度
if (imageH == 0) {
imageH = imageW * 9 / 16;
}
RelativeLayout.LayoutParams imageViewLp = (RelativeLayout.LayoutParams) imageView.getLayoutParams();
imageViewLp.width = (int) imageW;
imageViewLp.height = (int) imageH;
imageView.setLayoutParams(imageViewLp);
RelativeLayout.LayoutParams flImageLp = (RelativeLayout.LayoutParams) flImage.getLayoutParams();
flImageLp.width = (int) imageW;
flImageLp.height = (int) imageH;
flImage.setLayoutParams(flImageLp);
String url = contentBean.getCoverUrl();
if (TextUtils.isEmpty(url) && contentBean.getManuscriptImageUrl() != null) {
ManuscriptImageBean manuscriptImageBean = contentBean.getManuscriptImageUrl();
url = manuscriptImageBean.url;
}
int placeHolder = R.drawable.rmrb_placeholder_compe_all;
ImageUtils.getInstance().loadImageSourceByNetStatus(imageView, url, placeHolder);
if (haveTitle) {
boolean showTitleView = contentBean.showTitleContent();
if (showTitleView) {
tvTitle.setVisibility(View.VISIBLE);
//设置已读
setTittleValue(title, tvTitle, contentBean.getKeyWord());
//增加角标
CompentLogicUtil.showLabel(tvTitle, contentBean, true);
} else {
tvTitle.setVisibility(View.GONE);
}
} else {
tvTitle.setVisibility(View.GONE);
//21:文章专题,23:直播专题,24:话题专题,26时间轴专题 请求接口缓存 给H5使用
CompentLogicUtil.requestH5TopicCache(contentBean);
}
itemView.setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
if (cbSelect != null && Constants.isEdit) {
boolean checked = cbSelect.isChecked();
cbSelect.setChecked(!checked);
} else {
ProcessUtils.processPage(contentBean);
// 点击埋点
trackItemContent(true, contentBean, position, data.getLocalFiledType());
}
}
});
// 收藏列表中用到,是否处于编辑模式
setEditState(cbSelect, contentBean);
// 曝光埋点
itemView.post(() -> {
trackItemContent(false, contentBean, position, data.getLocalFiledType());
});
} else {
setLayoutManagerItemViewHeight(itemView, 0);
}
}
}
... ...
/*
* Copyright (c) People Technologies Co., Ltd. 2019-2022. All rights reserved.
*/
package com.wd.capability.layout.comp.layoutmanager.channel;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager2.widget.ViewPager2;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.wd.base.log.Logger;
import com.wd.capability.layout.R;
import com.wd.capability.layout.comp.layoutmanager.ItemLayoutManager;
import com.wd.capability.layout.ui.widget.AnimIndicator;
import com.wd.capability.layout.ui.widget.CompBanner;
import com.wd.capability.layout.ui.widget.ParallelogramView;
import com.wd.capability.layout.ui.widget.TagStokeWidthTextView;
import com.wd.capability.layout.uitls.CompentLogicUtil;
import com.wd.common.imageglide.ImageUtils;
import com.wd.common.utils.ProcessUtils;
import com.wd.common.viewclick.BaseClickListener;
import com.wd.foundation.bean.custom.NavigationBeanNews;
import com.wd.foundation.bean.custom.content.ContentBean;
import com.wd.foundation.bean.response.MasterObjectData;
import com.wd.foundation.wdkit.utils.DeviceUtil;
import com.wd.foundation.wdkit.utils.TextViewUtils;
import com.wd.foundation.wdkit.utils.ViewUtils;
import com.wd.foundation.wdkit.view.RoundCornerImageView;
import com.wd.foundation.wdkitcore.tools.AppContext;
import com.wd.foundation.wdkitcore.tools.ResUtils;
import com.youth.banner.adapter.BannerAdapter;
import java.util.List;
/**
* 轮播卡
*
* @version 1.0.0
* @description:
* @author: liyubing
* @date :2023/2/6 16:48
*/
public class CompBanner02 extends ItemLayoutManager<NavigationBeanNews> {
private static final String TAG = "CompBanner02";
private static final long PLAY_DELAY_TIME = 3000;
/**
* banner滑动需要时间
*/
private static final int PLAY_SCROLL_TIME = 300;
private CompBanner banner;
private InnerBannerAdapter innerAdapter;
// 指示器
private RecyclerView indicatorRv;
// private MagicIndicator magicIndicator;
private OnPageChangeCallback onPageChangeCallback;
private IndicatorAdapter indicatorAdapter;
// 选择的内容对象
private ContentBean selectContentBean;
private float imageW;
private float imageH;
private float indicatorW;
private int choosePosition = 0;
/**
* 逆向滚动
*/
private int isReserve = -1;
/**
* 默认滑动偏移量
*/
private int lastValue = -1;
/**
* 数据大小
*/
private int size;
/**
* banner选择的下标
*/
private int bannerIndex;
/**
* 是否执行了pause方法
*/
boolean isPause = false;
/**
* 自动播放(默认开启)
*/
private boolean autoplay = true;
@Override
public int getItemViewType() {
return R.layout.comp_banner_02;
}
@Override
public int getItemSpan() {
return 1;
}
@Override
public void prepareItem(View itemView, int position) {
setFirstItemBg(itemView, position);
setCompItemTopPadding(itemView, position);
banner = itemView.findViewById(R.id.banner);
indicatorRv = itemView.findViewById(R.id.indicatorRv);
//indicatorRv.setNestedScrollingEnabled(false);
// magicIndicator = itemView.findViewById(R.id.newIndicatorRv);
int screenWith = DeviceUtil.getDeviceWidth();
imageW = screenWith - AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp32);
imageH = imageW * 9 / 16;
indicatorW = imageW;
indicatorRv.getLayoutParams().width = (int) indicatorW;
banner.getLayoutParams().height = (int) imageH;
View flFrament = itemView.findViewById(R.id.flFrament);
flFrament.getLayoutParams().height = (int) imageH;
checkOpenGrayModel(itemView, position);
// 处理底线
ImageView bottomLine = itemView.findViewById(R.id.bottomLine);
bottomLine(bottomLine);
}
@Override
public void bindItem(View itemView, int position, NavigationBeanNews data) {
Logger.t(TAG).d("bindItem position:" + position + " banner:" + banner);
if (data == null) {
setLayoutManagerItemViewHeight(itemView, 0);
return;
}
List<ContentBean> dataBeanList = data.getSubList();
if (dataBeanList == null) {
setLayoutManagerItemViewHeight(itemView, 0);
return;
}
size = dataBeanList.size();
if (size == 0) {
setLayoutManagerItemViewHeight(itemView, 0);
return;
}
setLayoutManagerItemViewHeight(itemView, ViewGroup.LayoutParams.WRAP_CONTENT);
if (size > 1) {
banner.getViewPager2().setUserInputEnabled(true);
} else {
banner.getViewPager2().setUserInputEnabled(false);
}
// 上下滑动列表会重复调用bind,避免重复创建adapter
// if (innerAdapter == null) {
MasterObjectData masterObjectData = data.getMasterExtraData();
if(masterObjectData != null){
if( masterObjectData.containsKey("autoplay")){
autoplay = masterObjectData.getInt("autoplay") == 1;
}else {
autoplay = true;
}
}else {
autoplay = true;
}
innerAdapter = new InnerBannerAdapter(dataBeanList, data.getLocalFiledType());
// 默认3000ms循环播放
banner.setAdapter(innerAdapter)
.setLoopTime(PLAY_DELAY_TIME)
.setScrollTime(PLAY_SCROLL_TIME)
.isAutoLoop(autoplay)
// .setIndicator(new RectangleIndicator(banner.getContext()))
// .setIndicatorWidth(UiUtils.dp2px(3), UiUtils.dp2px(10))
// .setIndicatorNormalColor(0x80B71D26)
// .setIndicatorSelectedColor(0xB71D26)
// .setIndicatorSpace(UiUtils.dp2px(4))
.addBannerLifecycleObserver(mFragment);
setBannerPageChangeListener();
if (size > 1) {
// 指示器
indicatorAdapter = new IndicatorAdapter(size);
indicatorRv.setLayoutManager(new LinearLayoutManager(indicatorRv.getContext(), LinearLayoutManager.HORIZONTAL, false));
indicatorRv.setAdapter(indicatorAdapter);
indicatorAdapter.addData(dataBeanList);
// magicIndicator.setVisibility(View.VISIBLE);
// CommonNavigator commonNavigator = new CommonNavigator(banner.getContext());
// commonNavigator.setAdjustMode(true);
// commonNavigator.setAdapter(new CommonNavigatorAdapter() {
//
// @Override
// public int getCount() {
// return size;
// }
//
// @Override
// public IPagerTitleView getTitleView(Context context, int index) {
// BannerTitleView clipPagerTitleView = new BannerTitleView(context);
// if (index > 9) {
// clipPagerTitleView.setText((index + 1) + "");
// } else {
// clipPagerTitleView.setText("0" + (index + 1));
// }
// clipPagerTitleView.setTextColor(AppContext.getContext().getResources().getColor(R.color.res_color_common_C4));
// clipPagerTitleView.setClipColor(Color.WHITE);
// return clipPagerTitleView;
// }
//
// @Override
// public IPagerIndicator getIndicator(Context context) {
// return null;
// }
// });
// magicIndicator.setNavigator(commonNavigator);
} else {
// magicIndicator.setVisibility(View.GONE);
}
// } else {
//// onPause();
// innerAdapter.notifyDataSetChanged();
//
// }
}
/**
* 处理banner滑动动画
*/
private void setBannerPageChangeListener() {
if (onPageChangeCallback == null) {
onPageChangeCallback = new OnPageChangeCallback();
}
banner.getViewPager2().registerOnPageChangeCallback(onPageChangeCallback);
}
// @Override
// public void OnBannerClick(ContentBean data, int position) {
//
// }
@Override
public void onPause() {
super.onPause();
Logger.t(TAG).d("onPause");
if (banner != null && autoplay) {
banner.stop().isAutoLoop(false);
isPause = true;
}
}
@Override
public void onResume() {
super.onResume();
Logger.t(TAG).d("onResume");
if(autoplay){
banner.isAutoLoop(true).start();
if (isPause){
if (bannerIndex == size){
banner.setCurrentItem(1);
}else{
banner.setCurrentItem(bannerIndex+1);
}
}
isPause = false;
}
}
@Override
public void onVisible() {
super.onVisible();
Logger.t(TAG).d("onVisible");
if(autoplay){
banner.isAutoLoop(true).start();
}
}
@Override
public void onInvisible() {
super.onInvisible();
Logger.t(TAG).d("onInvisible");
if (banner != null && autoplay) {
banner.stop().isAutoLoop(false);
}
}
/**
* 自定义布局
*
* @author zhangbo
* @version [V1.0.0, 2022/3/23]
* @since V1.0.0
*/
private class InnerBannerAdapter extends BannerAdapter<ContentBean, InnerBannerAdapter.BannerViewHolder> {
private String type;
private int size;
private InnerBannerAdapter(List<ContentBean> data, String type) {
super(data);
this.size = data.size();
this.type = type;
// int screenWith = DeviceUtil.getDeviceWidth();
}
@Override
public BannerViewHolder onCreateHolder(ViewGroup parent, int viewType) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.comp_banner_02_adpter_item, parent, false);
return new BannerViewHolder(view);
}
@Override
public void onBindView(BannerViewHolder holder, ContentBean data, int position, int size) {
if (data == null) {
return;
}
// int goalH = data.getCalHeightByW(imageW);
// if (goalH != 0) {
// FrameLayout.LayoutParams imageViewLp = (FrameLayout.LayoutParams) holder.imageView.getLayoutParams();
// imageViewLp.height = goalH;
// holder.imageView.setLayoutParams(imageViewLp);
// }
String url = data.getCoverUrl();
// if (goalH > 0) {
//ImageUtils.getInstance().loadImage(holder.imageView, url, R.drawable.rmrb_placeholder_w16h9);
//ImageUtils.getInstance().loadAngleImage(holder.imageView, url, R.drawable.rmrb_placeholder_w16h9, 4);
ImageUtils.getInstance().loadImageSourceByNetStatus(holder.imageView, url, R.drawable.rmrb_placeholder_compe_all);
// } else {
// ImageUtils.getInstance().loadImageSource(holder.imageView, url, new LoadImageCallback() {
// @Override
// public void callbackBitmap(Bitmap bitmap) {
// int with = bitmap.getWidth();
// int height = bitmap.getHeight();
// }
// });
// }
FrameLayout.LayoutParams imageViewLp = (FrameLayout.LayoutParams) holder.imageView.getLayoutParams();
// imageViewLp.width = (int) imageW;
imageViewLp.height = (int) imageH;
holder.imageView.setLayoutParams(imageViewLp);
TextViewUtils.setText(holder.titleView, data.getNewsTitle());
//适老化文字大小设置
setTextFontSize(holder.titleView);
// 处理频道和发布日期
// CompentLogicUtil.handlerFromDataInfor(holder.llFromm, data);
data.isSupportThemeColor = false;
//增加角标
CompentLogicUtil.showLabel(holder.titleView, data, true);
// 加标签
CompentLogicUtil.handleBannerTagViewLogic(holder.viewTag, data);
// 曝光埋点
holder.itemView.post(() -> {
trackItemContent(false, data, position, innerAdapter.type);
});
holder.itemView.setOnClickListener(new BaseClickListener() {
@Override
protected void onNoDoubleClick(View v) {
if (data != null) {
// 业务内部跳转
selectContentBean = data;
ProcessUtils.processPage(data);
//更新已读状态
if (data.getCompAdvBean() != null) {
//只有广告需要处理
updateReadState(holder.titleView, data);
}
// 点击埋点
trackItemContent(true, data, position, innerAdapter.type);
} else {
Logger.t(TAG).e("OnBannerClick data is null");
// 数据为空,也抛出去统一处理
}
}
});
//设置已读
if (data.getCompAdvBean() != null) {
//只有广告需要处理
setReadState(holder.titleView, data, R.color.white);
} else {
holder.titleView.setTextColor(ContextCompat.getColor(holder.titleView.getContext(), R.color.white));
}
}
/**
* 自定义布局holder
*
* @author zhangbo
* @version [V1.0.0, 2022/3/23]
* @since V1.0.0
*/
private class BannerViewHolder extends RecyclerView.ViewHolder {
RoundCornerImageView imageView;
FrameLayout flImage;
TagStokeWidthTextView titleView;
View viewTag;
BannerViewHolder(@NonNull View view) {
super(view);
initView(view);
}
private void initView(View view) {
flImage = ViewUtils.findViewById(view, R.id.flImage);
imageView = ViewUtils.findViewById(view, R.id.imageView);
titleView = ViewUtils.findViewById(view, R.id.tvTitle);
// llFromm = ViewUtils.findViewById(view, R.id.llFromm);
viewTag = ViewUtils.findViewById(view, R.id.viewTag);
// int screenWith = DeviceUtil.getDeviceWidth();
// float imageW = screenWith - AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp32);
RelativeLayout.LayoutParams flImageLp = (RelativeLayout.LayoutParams) flImage.getLayoutParams();
flImageLp.height = (int) imageH;
// flImageLp.width = (int) imageW;
flImage.setLayoutParams(flImageLp);
// RecyclerView.LayoutParams rlParentItemLp = (RecyclerView.LayoutParams) rlParentItem.getLayoutParams();
// rlParentItemLp.width = (int) imageW;
RelativeLayout.LayoutParams lp = (RelativeLayout.LayoutParams) titleView.getLayoutParams();
// lp.width = (int) imageW;
lp.height = (int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp94);
int paddLr = (int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp12);
if (size > 1) {
titleView.setPadding(paddLr, 0, paddLr, (int) AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp26));
} else {
titleView.setPadding(paddLr, 0, paddLr, paddLr);
}
}
}
}
class OnPageChangeCallback extends ViewPager2.OnPageChangeCallback {
@Override
public void onPageSelected(int position) {
super.onPageSelected(position);
Logger.t(TAG).d("onPageSelected position:" + position);
//magicIndicator.onPageSelected(position - 1);
bannerIndex = position;
if (indicatorAdapter != null) {
indicatorAdapter.setCurrentIndex(position - 1);
}
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// magicIndicator.onPageScrolled(position - 1, positionOffset, positionOffsetPixels);
//判断当前是正向滚动还是逆向滚动
if (positionOffsetPixels != 0) {
if (lastValue > positionOffsetPixels) {
//右滑
isReserve = 0;
} else if (lastValue < positionOffsetPixels) {
//左滑
isReserve = 1;
}
}
lastValue = positionOffsetPixels;
}
@Override
public void onPageScrollStateChanged(int state) {
// magicIndicator.onPageScrollStateChanged(state);
}
}
/**
* 指示器适配器
*/
private class IndicatorAdapter extends BaseQuickAdapter<ContentBean, BaseViewHolder> {
private int position = 0;
int itemWith = 0;
int size = 0;
public IndicatorAdapter(int size) {
super(R.layout.comp_banner_02_adpter_line_num_indicator);
// float screenWith = DeviceUtil.getDeviceWidth() - AppContext.getContext().getResources().getDimension(R.dimen.rmrb_dp28) * 2;
itemWith = (int) ((indicatorW - ResUtils.getDimension(R.dimen.rmrb_dp20)) / size);
this.size = size;
}
@Override
protected void convert(@NonNull BaseViewHolder baseViewHolder, ContentBean bean) {
RelativeLayout llParent = baseViewHolder.itemView.findViewById(R.id.llParent);
ViewGroup.LayoutParams llParentLp = llParent.getLayoutParams();
llParentLp.width = itemWith;
int layoutPosition = baseViewHolder.getLayoutPosition();
AnimIndicator animIndicator = llParent.findViewById(R.id.animIndicator);
animIndicator.setAutoLoop(autoplay);
ParallelogramView ivLine = llParent.findViewById(R.id.ivLine);
//当从数据的最后一条轮到第一条时,banner的轮播时间loopTime需要减去滑动时间scrollTime,不然就会出现动效未加载完,但是已经滑到下一个的情况
if (position == 0) {
if (choosePosition == size - 1 && isReserve == 1) {
animIndicator.setAnimTime(PLAY_DELAY_TIME - PLAY_SCROLL_TIME);
} else {
animIndicator.setAnimTime(PLAY_DELAY_TIME);
}
} else if (position == size - 1) {
if (choosePosition == 0 && isReserve == 0) {
animIndicator.setAnimTime(PLAY_DELAY_TIME - PLAY_SCROLL_TIME);
} else {
animIndicator.setAnimTime(PLAY_DELAY_TIME);
}
} else {
animIndicator.setAnimTime(PLAY_DELAY_TIME);
}
if (position == layoutPosition) {
String text = "";
if (layoutPosition >= 9) {
text = (layoutPosition + 1) + "";
} else {
text = ("0" + (layoutPosition + 1));
}
animIndicator.setTvNum(text, itemWith);
animIndicator.setVisibility(View.VISIBLE);
animIndicator.startOrStopRunning(true);
ivLine.setVisibility(View.GONE);
choosePosition = position;
} else {
animIndicator.setAllInVisible();
animIndicator.startOrStopRunning(false);
ivLine.setVisibility(View.VISIBLE);
}
}
public void setCurrentIndex(int position) {
if (position >= 0) {
this.position = position;
notifyDataSetChanged();
}
}
}
}
... ...