androidx版本首次提交
This commit is contained in:
83
live/src/main/AndroidManifest.xml
Normal file
83
live/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.yunbao.live">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".activity.LiveTRTCAnchorActivity"></activity>
|
||||
<activity
|
||||
android:name=".activity.LiveAnchorActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme"
|
||||
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name=".activity.LiveAudienceActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@style/AppTheme"
|
||||
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name=".activity.LiveChooseClassActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveReportActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:windowSoftInputMode="adjustPan|stateAlwaysHidden" />
|
||||
<activity
|
||||
android:name=".activity.LiveAddImpressActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveContributeActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveGuardListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveRecordActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveRecordPlayActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.RoomManageActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.RoomManageDetailActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveAdminListActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveShutUpActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveBlackActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.Beauty360Activity2"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.Beauty360Activity3"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.WebViewActivityMedal"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.MedalQuestionWebViewActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".views.ZhuangBanActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||
android:screenOrientation="portrait" /> <!-- Android 9.0移除了apache的HttpClient,而金山sdk中用到了这个,不加这个的话在Android 9.0会崩溃 -->
|
||||
<activity
|
||||
android:name=".activity.SystemMessageActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<activity
|
||||
android:name=".activity.LiveRyAnchorActivity"
|
||||
android:screenOrientation="portrait" />
|
||||
<uses-library
|
||||
android:name="org.apache.http.legacy"
|
||||
android:required="false" />
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
BIN
live/src/main/assets/filterData.zip
Normal file
BIN
live/src/main/assets/filterData.zip
Normal file
Binary file not shown.
BIN
live/src/main/assets/model-all.zip
Normal file
BIN
live/src/main/assets/model-all.zip
Normal file
Binary file not shown.
BIN
live/src/main/assets/week_bg.svga
Normal file
BIN
live/src/main/assets/week_bg.svga
Normal file
Binary file not shown.
139
live/src/main/java/com/yunbao/live/LiveConfig.java
Normal file
139
live/src/main/java/com/yunbao/live/LiveConfig.java
Normal file
@@ -0,0 +1,139 @@
|
||||
package com.yunbao.live;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.live.bean.LiveKsyConfigBean;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
* 直播相关的参数配置
|
||||
*/
|
||||
|
||||
public class LiveConfig {
|
||||
//推流参数配置
|
||||
// public static final int PUSH_CAP_RESOLUTION = StreamerConstants.VIDEO_RESOLUTION_540P;//采集分辨率
|
||||
// public static final int PUSH_PREVIEW_RESOLUTION = StreamerConstants.VIDEO_RESOLUTION_540P;//直播预览分辨率
|
||||
// public static final int LINK_MIC_PUSH_PREVIEW_RESOLUTION = StreamerConstants.VIDEO_RESOLUTION_540P;//连麦预览分辨率
|
||||
// public static final int PUSH_VIDEO_RESOLUTION = StreamerConstants.VIDEO_RESOLUTION_480P;//推流分辨率
|
||||
// public static final int PUSH_ENCODE_TYPE = AVConst.CODEC_ID_AVC;//H264
|
||||
// public static final int PUSH_ENCODE_METHOD = StreamerConstants.ENCODE_METHOD_SOFTWARE;//软编
|
||||
// public static final int PUSH_ENCODE_SCENE = VideoEncodeFormat.ENCODE_SCENE_SHOWSELF;//秀场模式
|
||||
// public static final int PUSH_ENCODE_PROFILE = VideoEncodeFormat.ENCODE_PROFILE_LOW_POWER;//低功耗
|
||||
public static final int PUSH_FRAME_RATE = 20;//采集帧率
|
||||
public static final int PUSH_VIDEO_BITRATE = 500;//视频码率
|
||||
public static final int PUSH_VIDEO_BITRATE_MAX = 800;//视频码率
|
||||
public static final int PUSH_VIDEO_BITRATE_MIN = 300;//视频码率
|
||||
public static final int PUSH_AUDIO_BITRATE = 48;//音频码率
|
||||
public static final int PUSH_GOP = 3;//gop
|
||||
|
||||
|
||||
public static LiveKsyConfigBean getDefaultKsyConfig() {
|
||||
LiveKsyConfigBean bean = new LiveKsyConfigBean();
|
||||
// bean.setEncodeMethod(PUSH_ENCODE_METHOD);
|
||||
// bean.setTargetResolution(PUSH_VIDEO_RESOLUTION);
|
||||
bean.setTargetFps(PUSH_FRAME_RATE);
|
||||
bean.setTargetGop(PUSH_GOP);
|
||||
bean.setVideoKBitrate(PUSH_VIDEO_BITRATE);
|
||||
bean.setVideoKBitrateMax(PUSH_VIDEO_BITRATE_MAX);
|
||||
bean.setVideoKBitrateMin(PUSH_VIDEO_BITRATE_MIN);
|
||||
bean.setAudioKBitrate(PUSH_AUDIO_BITRATE);
|
||||
bean.setPreviewFps(PUSH_FRAME_RATE);
|
||||
// bean.setPreviewResolution(PUSH_PREVIEW_RESOLUTION);
|
||||
return bean;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取手机相关信息,开播时候用到
|
||||
*/
|
||||
// public static String getSystemParams() {
|
||||
//// String sysParams = StringUtil.contact(
|
||||
//// android.os.Build.BRAND,//手机厂商
|
||||
//// "_",
|
||||
//// android.os.Build.MODEL,//手机型号
|
||||
//// "_",
|
||||
//// android.os.Build.VERSION.RELEASE,//系统版本号
|
||||
//// "_",
|
||||
//// getMemory(),
|
||||
//// "_",
|
||||
//// getNetworkType()
|
||||
//// );
|
||||
//// L.e("开播", "手机信息------> " + sysParams);
|
||||
//// return sysParams;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 获取手机内存大小
|
||||
*/
|
||||
public static String getMemory() {
|
||||
String MemorySize = "NONE";
|
||||
BufferedReader br = null;
|
||||
try {
|
||||
FileReader fileReader = new FileReader("/proc/meminfo");
|
||||
br = new BufferedReader(fileReader, 8192);
|
||||
String str = br.readLine();// 读取meminfo第一行,系统总内存大小
|
||||
if (!TextUtils.isEmpty(str)) {
|
||||
String[] array = str.split("\\s+");
|
||||
int totalRam = (int) Math.ceil(Double.valueOf(array[1]) / (1024 * 1024));
|
||||
MemorySize = StringUtil.contact(String.valueOf(totalRam), "GB");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (br != null) {
|
||||
try {
|
||||
br.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return MemorySize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前网络类型
|
||||
**/
|
||||
// public static String getNetworkType() {
|
||||
// String netType = "NONE";
|
||||
// ConnectivityManager manager = (ConnectivityManager) CommonAppContext.sInstance.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
// NetworkInfo networkInfo = manager.getActiveNetworkInfo();
|
||||
// if (networkInfo == null) {
|
||||
// return netType;
|
||||
// }
|
||||
// int nType = networkInfo.getType();
|
||||
// if (nType == ConnectivityManager.TYPE_WIFI) {
|
||||
// netType = "WIFI";
|
||||
// } else if (nType == ConnectivityManager.TYPE_MOBILE) {
|
||||
// int nSubType = networkInfo.getSubtype();
|
||||
// TelephonyManager telephonyManager = (TelephonyManager) CommonAppContext.sInstance.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
// if (nSubType == TelephonyManager.NETWORK_TYPE_LTE
|
||||
// && !telephonyManager.isNetworkRoaming()) {
|
||||
// netType = "4G";
|
||||
// } else if (nSubType == TelephonyManager.NETWORK_TYPE_UMTS
|
||||
// || nSubType == TelephonyManager.NETWORK_TYPE_HSDPA
|
||||
// || nSubType == TelephonyManager.NETWORK_TYPE_EVDO_0
|
||||
// && !telephonyManager.isNetworkRoaming()) {
|
||||
// } else if (nSubType == TelephonyManager.NETWORK_TYPE_GPRS
|
||||
// || nSubType == TelephonyManager.NETWORK_TYPE_EDGE
|
||||
// || nSubType == TelephonyManager.NETWORK_TYPE_CDMA
|
||||
// && !telephonyManager.isNetworkRoaming()) {
|
||||
// netType = "2G";
|
||||
// } else
|
||||
// netType = "NO DISPLAY";
|
||||
// }
|
||||
// return netType;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,338 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
|
||||
//Camera360美颜2
|
||||
public class Beauty360Activity2 extends Activity {
|
||||
// implements SurfaceHolder.Callback,
|
||||
// SurfaceTexture.OnFrameAvailableListener,
|
||||
// SeekBar.OnSeekBarChangeListener, Camera.PreviewCallback, MyItemClickListener {
|
||||
//
|
||||
// private float mPinkValue = 0.4f;
|
||||
// private float mWhitenValue = 0.7f;
|
||||
// private float mReddenValue = 0.5f;
|
||||
// private int mSoftenValue = 70;
|
||||
// private int mFilterValue = 100;
|
||||
// private boolean mClear = false;
|
||||
//
|
||||
// private RecyclerView mListView;
|
||||
// private MyRecycleAdapter4LvJing mAdapter;
|
||||
// private List<IRecycleCell> mListData;
|
||||
// private String mCurFilterStrength;
|
||||
//
|
||||
// private PreviewUtils mPreviewUtils;
|
||||
// private SurfaceView mSurfaceView;
|
||||
// private boolean mFirstFrame = true;
|
||||
//
|
||||
// private boolean isSticker = false;
|
||||
// private boolean zipSuccess = false;
|
||||
// Context mContext;
|
||||
// TextView tvSticker;
|
||||
// private OrientationEventListener mOrientationListener;
|
||||
// TXLivePusher mTxLivePusher;
|
||||
//
|
||||
// @Override
|
||||
// protected void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// setContentView(com.by.lib_beauty360.R.layout.activity_main2);
|
||||
// mContext = this;
|
||||
// mPreviewUtils = new PreviewUtils(getApplicationContext(), this);
|
||||
// initViews();
|
||||
//
|
||||
// /**
|
||||
// * 贴纸zip 解压到本地
|
||||
// */
|
||||
// new UnzipAssets().unZipRequest(this, "TestSticker.zip", new UnzipAssets.IUnZipCallBack() {
|
||||
// @Override
|
||||
// public void onStart() {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Response(String outFileDirectory) {
|
||||
// zipSuccess = true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError() {
|
||||
// }
|
||||
// });
|
||||
// mTxLivePusher=getTxLivePush();
|
||||
// }
|
||||
//
|
||||
// public void initViews() {
|
||||
// mSurfaceView = (SurfaceView) findViewById(com.by.lib_beauty360.R.id.surface_view);
|
||||
//
|
||||
// SeekBar m_Seekpink = (SeekBar) findViewById(com.by.lib_beauty360.R.id.seek_pink);
|
||||
// m_Seekpink.setOnSeekBarChangeListener(this);
|
||||
// m_Seekpink.setProgress((int) (mPinkValue * 100));
|
||||
// TextView tv_pink = (TextView) findViewById(com.by.lib_beauty360.R.id.pink_value);
|
||||
// tv_pink.setText(String.valueOf(mPinkValue));
|
||||
//
|
||||
// SeekBar m_Seekwhiten = (SeekBar) findViewById(com.by.lib_beauty360.R.id.seek_whiten);
|
||||
// m_Seekwhiten.setOnSeekBarChangeListener(this);
|
||||
// m_Seekwhiten.setProgress((int) (mWhitenValue * 100));
|
||||
// TextView tv_whiten = (TextView) findViewById(com.by.lib_beauty360.R.id.whiten_value);
|
||||
// tv_whiten.setText(String.valueOf(mWhitenValue));
|
||||
//
|
||||
// SeekBar m_Seekredden = (SeekBar) findViewById(com.by.lib_beauty360.R.id.seek_redden);
|
||||
// m_Seekredden.setOnSeekBarChangeListener(this);
|
||||
// m_Seekredden.setProgress((int) (mReddenValue * 100));
|
||||
// TextView tv_redden = (TextView) findViewById(com.by.lib_beauty360.R.id.redden_value);
|
||||
// tv_redden.setText(String.valueOf(mReddenValue));
|
||||
//
|
||||
//
|
||||
// SeekBar m_Seeksoften = (SeekBar) findViewById(com.by.lib_beauty360.R.id.seek_soften);
|
||||
// m_Seeksoften.setOnSeekBarChangeListener(this);
|
||||
// m_Seeksoften.setProgress(mSoftenValue);
|
||||
// TextView tv_soften = (TextView) findViewById(com.by.lib_beauty360.R.id.soften_value);
|
||||
// tv_soften.setText(String.valueOf(mSoftenValue));
|
||||
//
|
||||
// SeekBar m_SeeksFilter = (SeekBar) findViewById(com.by.lib_beauty360.R.id.filter_redden);
|
||||
// m_SeeksFilter.setOnSeekBarChangeListener(this);
|
||||
// m_SeeksFilter.setProgress(mFilterValue);
|
||||
// TextView tv_filter = (TextView) findViewById(com.by.lib_beauty360.R.id.filter_value);
|
||||
// tv_filter.setText(String.valueOf(mFilterValue));
|
||||
//
|
||||
// tvSticker = (TextView) findViewById(com.by.lib_beauty360.R.id.tv_sticker);
|
||||
// tvSticker.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// if (!zipSuccess) return;
|
||||
// if (!isSticker) {
|
||||
// tvSticker.setText("取消贴纸");
|
||||
// isSticker = true;
|
||||
// mPreviewUtils.setSticker(AppConfig.STICKER_LOCAL_PATH + "TestSticker/dog");
|
||||
// } else {
|
||||
// tvSticker.setText("贴纸");
|
||||
// isSticker = false;
|
||||
// mPreviewUtils.removeSticker();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// tvSticker.setVisibility(View.VISIBLE);
|
||||
//
|
||||
// View layoutSurface = findViewById(com.by.lib_beauty360.R.id.layout_surface);
|
||||
// layoutSurface.setOnTouchListener(new View.OnTouchListener() {
|
||||
// @Override
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// switch (event.getAction()) {
|
||||
// case MotionEvent.ACTION_DOWN:
|
||||
// case MotionEvent.ACTION_MOVE:
|
||||
// clearAllBuffer();
|
||||
// break;
|
||||
// case MotionEvent.ACTION_CANCEL:
|
||||
// case MotionEvent.ACTION_UP:
|
||||
// resetBuffer();
|
||||
// break;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mListView = (RecyclerView) findViewById(com.by.lib_beauty360.R.id.listview);
|
||||
// LinearLayoutManager mLayoutManager = new LinearLayoutManager(mListView.getContext(), LinearLayoutManager.HORIZONTAL, false);
|
||||
// mListView.setLayoutManager(mLayoutManager);
|
||||
// ConstructList();
|
||||
// mAdapter = new MyRecycleAdapter4LvJing(this, mListData);
|
||||
// mListView.setAdapter(mAdapter);
|
||||
// mListView.setItemAnimator(new DefaultItemAnimator());
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
// int id = seekBar.getId();
|
||||
// if (id == com.by.lib_beauty360.R.id.seek_pink) {
|
||||
// if (fromUser) {
|
||||
// mPinkValue = progress / 100f;
|
||||
// mPreviewUtils.SetSkinColor(mPinkValue, mWhitenValue, mReddenValue);
|
||||
// TextView tv_pink = (TextView) findViewById(com.by.lib_beauty360.R.id.pink_value);
|
||||
// tv_pink.setText(String.valueOf(mPinkValue));
|
||||
// }
|
||||
// } else if (id == com.by.lib_beauty360.R.id.seek_whiten) {
|
||||
// if (fromUser) {
|
||||
// mWhitenValue = progress / 100f;
|
||||
// mPreviewUtils.SetSkinColor(mPinkValue, mWhitenValue, mReddenValue);
|
||||
// TextView tv_whiten = (TextView) findViewById(com.by.lib_beauty360.R.id.whiten_value);
|
||||
// tv_whiten.setText(String.valueOf(mWhitenValue));
|
||||
// }
|
||||
// } else if (id == com.by.lib_beauty360.R.id.seek_redden) {
|
||||
// if (fromUser) {
|
||||
// mReddenValue = progress / 100f;
|
||||
// mPreviewUtils.SetSkinColor(mPinkValue, mWhitenValue, mReddenValue);
|
||||
// TextView tv_redden = (TextView) findViewById(com.by.lib_beauty360.R.id.redden_value);
|
||||
// tv_redden.setText(String.valueOf(mReddenValue));
|
||||
// }
|
||||
// } else if (id == com.by.lib_beauty360.R.id.filter_redden) {
|
||||
// if (fromUser) {
|
||||
// mFilterValue = progress;
|
||||
// mPreviewUtils.SetColorFilterStrength(mFilterValue);
|
||||
// TextView tv_blur = (TextView) findViewById(com.by.lib_beauty360.R.id.filter_value);
|
||||
// tv_blur.setText(String.valueOf(mFilterValue));
|
||||
// }
|
||||
// } else if (id == com.by.lib_beauty360.R.id.seek_soften) {
|
||||
// if (fromUser) {
|
||||
// mSoftenValue = progress;
|
||||
// mPreviewUtils.SetSkinSoftenStrength(mSoftenValue);
|
||||
// TextView tv_soften = (TextView) findViewById(com.by.lib_beauty360.R.id.soften_value);
|
||||
// tv_soften.setText(String.valueOf(mSoftenValue));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onResume() {
|
||||
// super.onResume();
|
||||
// mPreviewUtils.onresume();//启动照相机
|
||||
// reStartEngine();
|
||||
//
|
||||
// // 注册方向回调,检测屏幕方向改变
|
||||
// if (null == mOrientationListener) {
|
||||
// mOrientationListener = new OrientationEventListener(this) {
|
||||
// @Override
|
||||
// public void onOrientationChanged(int orientation) {
|
||||
// mPreviewUtils.onScreenOriChanged(orientation);
|
||||
// }
|
||||
// };
|
||||
// mOrientationListener.enable();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void reStartEngine() {
|
||||
// DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
// float fScreenHeight = displayMetrics.heightPixels;
|
||||
//
|
||||
// int iLayoutHeight = (int) fScreenHeight;//- (int)(fScreenHeight * 0.2f);
|
||||
// int iLayoutWidth = (int) ((iLayoutHeight / (float) mPreviewUtils.getCameraWidth()) * mPreviewUtils.getCameraHeight());
|
||||
//
|
||||
// mSurfaceView.getHolder().addCallback(this);
|
||||
//
|
||||
// ViewGroup.LayoutParams surfaceLayout;
|
||||
// surfaceLayout = mSurfaceView.getLayoutParams();
|
||||
// surfaceLayout.width = iLayoutWidth;
|
||||
// surfaceLayout.height = iLayoutHeight;
|
||||
// mSurfaceView.setLayoutParams(surfaceLayout);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// protected void onPause() {
|
||||
// super.onPause();
|
||||
// mPreviewUtils.pause();
|
||||
// mFirstFrame = true;
|
||||
//
|
||||
// if (null != mOrientationListener) {
|
||||
// mOrientationListener.disable();
|
||||
// mOrientationListener = null;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onDestroy() {
|
||||
// super.onDestroy();
|
||||
// mPreviewUtils.freeRes();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void surfaceCreated(SurfaceHolder holder) {
|
||||
// mPreviewUtils.startCameraPreview(holder);//开始预览 绑定surface
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||
// mPreviewUtils.setCameraInfo(width, height);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFrameAvailable(SurfaceTexture surfaceTexture) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPreviewFrame(byte[] data, Camera camera) {
|
||||
// mPreviewUtils.frameProcess(data, 0, mFirstFrame, false);//data 可以传空 根据TextureId进行美颜
|
||||
// mFirstFrame = false;
|
||||
// if (mTxLivePusher != null)
|
||||
// {
|
||||
// mTxLivePusher.sendCustomVideoData(mPreviewUtils.getSkinSoftenByte(),TXLivePusher.YUV_420P
|
||||
// ,mPreviewUtils.getCameraHeight(),mPreviewUtils.getCameraWidth());
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private TXLivePusher getTxLivePush() {
|
||||
// TXLivePusher livePusher = new TXLivePusher(this);
|
||||
// TXLivePushConfig livePushConfig = new TXLivePushConfig();
|
||||
//
|
||||
// int customModeType = TXLiveConstants.CUSTOM_MODE_VIDEO_CAPTURE;
|
||||
// // 只能分辨率的宽和高小于或者等于预览画面的宽和高的分辨率
|
||||
// // 还能选择 360x640 等,但不能选择 540x960。因指定分辨率的高(960) > 预览画面的高(720),编码器无法裁剪画面。
|
||||
// livePushConfig.setVideoResolution(TXLiveConstants.VIDEO_RESOLUTION_TYPE_640_360);
|
||||
// livePushConfig.setAutoAdjustBitrate(false);
|
||||
// livePushConfig.setVideoBitrate(1300);
|
||||
// livePushConfig.setVideoEncodeGop(3);
|
||||
// livePushConfig.setCustomModeType(customModeType);
|
||||
// livePusher.setConfig(livePushConfig);
|
||||
// return livePusher;
|
||||
// }
|
||||
//
|
||||
// private void ConstructList() {
|
||||
// mListData = new ArrayList<>();
|
||||
// for (int i = 0; i < AppConfig.mFilterName.length; ++i) {
|
||||
// ItemData4LvJing itemData = new ItemData4LvJing();
|
||||
// itemData.filterName = AppConfig.mFilterName[i];
|
||||
// itemData.filterType = AppConfig.mFilterType[i];
|
||||
// mListData.add(new HomeItemCell4LvJing(this, itemData, this));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onItemClick(String filtertype) {
|
||||
// if (TextUtils.isEmpty(filtertype))
|
||||
// return;
|
||||
//
|
||||
// if (filtertype.equals(mCurFilterStrength)) {
|
||||
// return;
|
||||
// }
|
||||
// mCurFilterStrength = filtertype;
|
||||
// mPreviewUtils.SetColorFilterByName(filtertype);
|
||||
// mPreviewUtils.SetColorFilterStrength(mFilterValue);
|
||||
// mAdapter.notifyDataSetChanged();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getCurFilterType() {
|
||||
// return mCurFilterStrength;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private void clearAllBuffer() {
|
||||
// if (mClear) return;
|
||||
// mClear = true;
|
||||
// mPreviewUtils.SetSkinColor(0, 0, 0);
|
||||
// mPreviewUtils.SetSkinSoftenStrength(0);
|
||||
// mPreviewUtils.SetColorFilterStrength(0);
|
||||
// }
|
||||
//
|
||||
// private void resetBuffer() {
|
||||
// mClear = false;
|
||||
// mPreviewUtils.SetSkinColor(mPinkValue, mWhitenValue, mReddenValue);
|
||||
// mPreviewUtils.SetSkinSoftenStrength(mSoftenValue);
|
||||
// mPreviewUtils.SetColorFilterStrength(mFilterValue);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
}
|
||||
@@ -0,0 +1,375 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
|
||||
public class Beauty360Activity3 extends Activity {
|
||||
// implements SurfaceHolder.Callback,
|
||||
// SurfaceTexture.OnFrameAvailableListener,
|
||||
// SeekBar.OnSeekBarChangeListener, Camera.PreviewCallback, MyItemClickListener, ITXLivePushListener {
|
||||
//
|
||||
// private static final String TAG = "PGSDKLive";
|
||||
// private float mPinkValue = 0.4f;
|
||||
// private float mWhitenValue = 0.7f;
|
||||
// private float mReddenValue = 0.5f;
|
||||
// private int mSoftenValue = 70;
|
||||
// private int mFilterValue = 100;
|
||||
// private boolean mClear = false;
|
||||
//
|
||||
// private RecyclerView mListView;
|
||||
// private MyRecycleAdapter4LvJing mAdapter;
|
||||
// private List<IRecycleCell> mListData;
|
||||
// private String mCurFilterStrength;
|
||||
//
|
||||
// private PreviewUtils mPreviewUtils;
|
||||
// private SurfaceView mSurfaceView;
|
||||
// private boolean mFirstFrame = true;
|
||||
//
|
||||
// private boolean isSticker = false;
|
||||
// private boolean zipSuccess = false;
|
||||
// Context mContext;
|
||||
// TextView tvSticker;
|
||||
// private OrientationEventListener mOrientationListener;
|
||||
//
|
||||
//
|
||||
// private TXLivePushConfig mLivePushConfig; // SDK 推流 config
|
||||
// private TXLivePusher mLivePusher; // SDK 推流类
|
||||
//
|
||||
// private int mCurrentVideoResolution = TXLiveConstants.VIDEO_RESOLUTION_TYPE_540_960; // 当前分辨率
|
||||
//// private boolean ; // 当前是否正在推流
|
||||
//
|
||||
// private String TMPURL = "rtmp://65652.livepush.myqcloud.com/live/test?txSecret=a33ac1d577e6dddfcdab70918497a3a7&txTime=5DBC567F";
|
||||
// @Override
|
||||
// protected void onCreate(Bundle savedInstanceState) {
|
||||
// super.onCreate(savedInstanceState);
|
||||
// setContentView(R.layout.activity_main2);
|
||||
// initPusher(); // 初始化 SDK 推流器
|
||||
// mContext = this;
|
||||
//
|
||||
// mPreviewUtils = new PreviewUtils(getApplicationContext(), this);
|
||||
// initViews();
|
||||
//
|
||||
// /**
|
||||
// * 贴纸zip 解压到本地
|
||||
// */
|
||||
// new UnzipAssets().unZipRequest(this, "TestSticker.zip", new UnzipAssets.IUnZipCallBack() {
|
||||
// @Override
|
||||
// public void onStart() {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void Response(String outFileDirectory) {
|
||||
// zipSuccess = true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onError() {
|
||||
// }
|
||||
// });
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void initViews() {
|
||||
// mSurfaceView = (SurfaceView) findViewById(R.id.surface_view);
|
||||
//
|
||||
// SeekBar m_Seekpink = (SeekBar) findViewById(R.id.seek_pink);
|
||||
// m_Seekpink.setOnSeekBarChangeListener(this);
|
||||
// m_Seekpink.setProgress((int) (mPinkValue * 100));
|
||||
// TextView tv_pink = (TextView) findViewById(R.id.pink_value);
|
||||
// tv_pink.setText(String.valueOf(mPinkValue));
|
||||
//
|
||||
// SeekBar m_Seekwhiten = (SeekBar) findViewById(R.id.seek_whiten);
|
||||
// m_Seekwhiten.setOnSeekBarChangeListener(this);
|
||||
// m_Seekwhiten.setProgress((int) (mWhitenValue * 100));
|
||||
// TextView tv_whiten = (TextView) findViewById(R.id.whiten_value);
|
||||
// tv_whiten.setText(String.valueOf(mWhitenValue));
|
||||
//
|
||||
// SeekBar m_Seekredden = (SeekBar) findViewById(R.id.seek_redden);
|
||||
// m_Seekredden.setOnSeekBarChangeListener(this);
|
||||
// m_Seekredden.setProgress((int) (mReddenValue * 100));
|
||||
// TextView tv_redden = (TextView) findViewById(R.id.redden_value);
|
||||
// tv_redden.setText(String.valueOf(mReddenValue));
|
||||
//
|
||||
//
|
||||
// SeekBar m_Seeksoften = (SeekBar) findViewById(R.id.seek_soften);
|
||||
// m_Seeksoften.setOnSeekBarChangeListener(this);
|
||||
// m_Seeksoften.setProgress(mSoftenValue);
|
||||
// TextView tv_soften = (TextView) findViewById(R.id.soften_value);
|
||||
// tv_soften.setText(String.valueOf(mSoftenValue));
|
||||
//
|
||||
// SeekBar m_SeeksFilter = (SeekBar) findViewById(R.id.filter_redden);
|
||||
// m_SeeksFilter.setOnSeekBarChangeListener(this);
|
||||
// m_SeeksFilter.setProgress(mFilterValue);
|
||||
// TextView tv_filter = (TextView) findViewById(R.id.filter_value);
|
||||
// tv_filter.setText(String.valueOf(mFilterValue));
|
||||
//
|
||||
// tvSticker = (TextView) findViewById(R.id.tv_sticker);
|
||||
// tvSticker.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// if (!zipSuccess) return;
|
||||
// if (!isSticker) {
|
||||
// tvSticker.setText("取消贴纸");
|
||||
// isSticker = true;
|
||||
// mPreviewUtils.setSticker(AppConfig.STICKER_LOCAL_PATH + "TestSticker/dog");
|
||||
// startRTMPPush();
|
||||
// } else {
|
||||
// tvSticker.setText("贴纸");
|
||||
// isSticker = false;
|
||||
// mPreviewUtils.removeSticker();
|
||||
// stopRTMPPush();
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// tvSticker.setVisibility(View.VISIBLE);
|
||||
//
|
||||
// View layoutSurface = findViewById(R.id.layout_surface);
|
||||
// layoutSurface.setOnTouchListener(new View.OnTouchListener() {
|
||||
// @Override
|
||||
// public boolean onTouch(View v, MotionEvent event) {
|
||||
// switch (event.getAction()) {
|
||||
// case MotionEvent.ACTION_DOWN:
|
||||
// case MotionEvent.ACTION_MOVE:
|
||||
// clearAllBuffer();
|
||||
// break;
|
||||
// case MotionEvent.ACTION_CANCEL:
|
||||
// case MotionEvent.ACTION_UP:
|
||||
// resetBuffer();
|
||||
// break;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// mListView = (RecyclerView) findViewById(R.id.listview);
|
||||
// LinearLayoutManager mLayoutManager = new LinearLayoutManager(mListView.getContext(), LinearLayoutManager.HORIZONTAL, false);
|
||||
// mListView.setLayoutManager(mLayoutManager);
|
||||
// ConstructList();
|
||||
// mAdapter = new MyRecycleAdapter4LvJing(this, mListData);
|
||||
// mListView.setAdapter(mAdapter);
|
||||
// mListView.setItemAnimator(new DefaultItemAnimator());
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 初始化 SDK 推流器
|
||||
// */
|
||||
// private void initPusher() {
|
||||
// mLivePusher = new TXLivePusher(this);
|
||||
// mLivePushConfig = new TXLivePushConfig();
|
||||
// mLivePushConfig.setVideoEncodeGop(5);
|
||||
// // 添加播放回调
|
||||
// mLivePusher.setPushListener(this);
|
||||
// mLivePushConfig.setPauseImg(300, 5);
|
||||
// mLivePushConfig.setPauseFlag(TXLiveConstants.PAUSE_FLAG_PAUSE_VIDEO);// 设置暂停时,只停止画面采集,不停止声音采集。
|
||||
// // 设置推流分辨率
|
||||
// mLivePushConfig.setVideoResolution(mCurrentVideoResolution);
|
||||
// // 横竖屏推流相关
|
||||
// int renderRotation = 0;
|
||||
// mLivePushConfig.setHomeOrientation(TXLiveConstants.VIDEO_ANGLE_HOME_DOWN);
|
||||
// mLivePusher.setRenderRotation(renderRotation);
|
||||
// mLivePusher.setMirror(true);
|
||||
// mLivePushConfig.setWatermark(null, 0, 0, 0);
|
||||
// // 设置推流配置
|
||||
// mLivePusher.setConfig(mLivePushConfig);
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPushEvent(int event, Bundle param) {
|
||||
// String msg = param.getString(TXLiveConstants.EVT_DESCRIPTION);
|
||||
// String pushEventLog = "receive event: " + event + ", " + msg;//1001
|
||||
// Log.d(TAG, pushEventLog);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNetStatus(Bundle status) {
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onResume() {
|
||||
// super.onResume();
|
||||
// mPreviewUtils.onresume();//启动照相机
|
||||
// reStartEngine();
|
||||
//
|
||||
// if (null == mOrientationListener) {
|
||||
// mOrientationListener = new OrientationEventListener(this) {
|
||||
// @Override
|
||||
// public void onOrientationChanged(int orientation) {
|
||||
// mPreviewUtils.onScreenOriChanged(orientation);
|
||||
// }
|
||||
// };
|
||||
// mOrientationListener.enable();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// public void reStartEngine() {
|
||||
// DisplayMetrics displayMetrics = getResources().getDisplayMetrics();
|
||||
// float fScreenHeight = displayMetrics.heightPixels;
|
||||
//
|
||||
// int iLayoutHeight = (int) fScreenHeight;//- (int)(fScreenHeight * 0.2f);
|
||||
// int iLayoutWidth = (int) ((iLayoutHeight / (float) mPreviewUtils.getCameraWidth()) * mPreviewUtils.getCameraHeight());
|
||||
//
|
||||
// mSurfaceView.getHolder().addCallback(this);
|
||||
//
|
||||
// ViewGroup.LayoutParams surfaceLayout;
|
||||
// surfaceLayout = mSurfaceView.getLayoutParams();
|
||||
// surfaceLayout.width = iLayoutWidth;
|
||||
// surfaceLayout.height = iLayoutHeight;
|
||||
// mSurfaceView.setLayoutParams(surfaceLayout);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// protected void onPause() {
|
||||
// super.onPause();
|
||||
// mPreviewUtils.pause();
|
||||
// mFirstFrame = true;
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onStop() {
|
||||
// super.onStop();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onDestroy() {
|
||||
// super.onDestroy();
|
||||
// mPreviewUtils.freeRes();
|
||||
// stopRTMPPush(); // 停止推流
|
||||
// }
|
||||
//
|
||||
//
|
||||
// @Override
|
||||
// public void surfaceCreated(SurfaceHolder holder) {
|
||||
// mPreviewUtils.startCameraPreview(holder);//开始预览 绑定surface
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
||||
// mPreviewUtils.setCameraInfo(width, height);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFrameAvailable(SurfaceTexture surfaceTexture) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPreviewFrame(byte[] data, Camera camera) {
|
||||
// mPreviewUtils.frameProcess(data, 0, mFirstFrame, false);//data 可以传空 根据TextureId进行美颜
|
||||
// mFirstFrame = false;
|
||||
// mLivePusher.sendCustomVideoData(mPreviewUtils.getSkinSoftenByte(), TXLivePusher.RGB_RGBA, mPreviewUtils.getCameraWidth(), mPreviewUtils.getCameraHeight());
|
||||
// }
|
||||
//
|
||||
// private void ConstructList() {
|
||||
// mListData = new ArrayList<>();
|
||||
// for (int i = 0; i < AppConfig.mFilterName.length; ++i) {
|
||||
// ItemData4LvJing itemData = new ItemData4LvJing();
|
||||
// itemData.filterName = AppConfig.mFilterName[i];
|
||||
// itemData.filterType = AppConfig.mFilterType[i];
|
||||
// mListData.add(new HomeItemCell4LvJing(this, itemData, this));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onItemClick(String filtertype) {
|
||||
// if (TextUtils.isEmpty(filtertype))
|
||||
// return;
|
||||
//
|
||||
// if (filtertype.equals(mCurFilterStrength)) {
|
||||
// return;
|
||||
// }
|
||||
// mCurFilterStrength = filtertype;
|
||||
// mPreviewUtils.SetColorFilterByName(filtertype);
|
||||
// mPreviewUtils.SetColorFilterStrength(mFilterValue);
|
||||
// mAdapter.notifyDataSetChanged();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getCurFilterType() {
|
||||
// return mCurFilterStrength;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private void clearAllBuffer() {
|
||||
// if (mClear) return;
|
||||
// mClear = true;
|
||||
// mPreviewUtils.SetSkinColor(0, 0, 0);
|
||||
// mPreviewUtils.SetSkinSoftenStrength(0);
|
||||
// mPreviewUtils.SetColorFilterStrength(0);
|
||||
// }
|
||||
//
|
||||
// private void resetBuffer() {
|
||||
// mClear = false;
|
||||
// mPreviewUtils.SetSkinColor(mPinkValue, mWhitenValue, mReddenValue);
|
||||
// mPreviewUtils.SetSkinSoftenStrength(mSoftenValue);
|
||||
// mPreviewUtils.SetColorFilterStrength(mFilterValue);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// private boolean startRTMPPush() {
|
||||
// String tRTMPURL = "";
|
||||
// String inputUrl = TMPURL;
|
||||
// if (!TextUtils.isEmpty(inputUrl)) {
|
||||
// String url[] = inputUrl.split("###");
|
||||
// if (url.length > 0) {
|
||||
// tRTMPURL = url[0];
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (TextUtils.isEmpty(tRTMPURL) || (!tRTMPURL.trim().toLowerCase().startsWith("rtmp://"))) {
|
||||
// Toast.makeText(getApplicationContext(), "推流地址不合法,目前支持rtmp推流!", Toast.LENGTH_SHORT).show();
|
||||
// Bundle params = new Bundle();
|
||||
// params.putString(TXLiveConstants.EVT_DESCRIPTION, "检查地址合法性");
|
||||
// return false;
|
||||
// }
|
||||
// // 输出状态log
|
||||
// Bundle params = new Bundle();
|
||||
// params.putString(TXLiveConstants.EVT_DESCRIPTION, "检查地址合法性");
|
||||
// // 发起推流
|
||||
// int ret = mLivePusher.startPusher(tRTMPURL.trim());
|
||||
// Log.d("发起推流","ret="+ret);
|
||||
//
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 停止 RTMP 推流
|
||||
// */
|
||||
// private void stopRTMPPush() {
|
||||
// mLivePusher.stopBGM();
|
||||
// mLivePusher.stopCameraPreview(true);
|
||||
// mLivePusher.setPushListener(null);
|
||||
// mLivePusher.stopPusher();
|
||||
// // 移除垫片图像
|
||||
// mLivePushConfig.setPauseImg(null);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.text.InputFilter;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.ChatRemarksBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import static com.yunbao.live.views.SystemMessageViewHolder.updataNkname;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Chen Haoxuan on 2022/7/1.
|
||||
* 修改备注
|
||||
*/
|
||||
|
||||
public class EditNameRemarksActivity extends AbsActivity implements View.OnClickListener {
|
||||
|
||||
private EditText mEditText;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_edit_remarks;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(WordUtil.getString(R.string.edit_profile_update_remarks));
|
||||
mEditText = (EditText) findViewById(R.id.edit);
|
||||
mEditText.setFilters(new InputFilter[]{
|
||||
new InputFilter.LengthFilter(10)
|
||||
});
|
||||
findViewById(R.id.btn_save).setOnClickListener(this);
|
||||
String content = getIntent().getStringExtra(Constants.REMARKS);
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
if (content.length() > 10) {
|
||||
content = content.substring(0, 10);
|
||||
}
|
||||
mEditText.setText(content);
|
||||
mEditText.setSelection(content.length());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!canClick()) {
|
||||
return;
|
||||
}
|
||||
final String content = mEditText.getText().toString().trim();
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
ToastUtil.show(R.string.edit_profile_name_empty);
|
||||
return;
|
||||
}
|
||||
|
||||
LiveHttpUtil.setInstructorRemark(SystemMessageActivity.nowUid, content, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
ToastUtil.show(msg);
|
||||
if (code == 0) {
|
||||
Constants.isSetRemark = SystemMessageActivity.nowUid;
|
||||
Constants.isSetRemarkText = content;
|
||||
updataNkname();
|
||||
//增加备注本地存储
|
||||
Constants.remarksListNow.add(new ChatRemarksBean(SystemMessageActivity.nowUid,content));
|
||||
String remarksList = new Gson().toJson(Constants.remarksListNow);
|
||||
SpUtil.setStringValue("remarksList", remarksList);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
1680
live/src/main/java/com/yunbao/live/activity/LiveActivity.java
Normal file
1680
live/src/main/java/com/yunbao/live/activity/LiveActivity.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.views.LiveAddImpressViewHolder;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/15.
|
||||
* 添加印象
|
||||
*/
|
||||
|
||||
public class LiveAddImpressActivity extends AbsActivity {
|
||||
|
||||
private LiveAddImpressViewHolder mLiveAddImpressViewHolder;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_empty;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
String toUid = getIntent().getStringExtra(Constants.TO_UID);
|
||||
if (TextUtils.isEmpty(toUid)) {
|
||||
return;
|
||||
}
|
||||
mLiveAddImpressViewHolder = new LiveAddImpressViewHolder(mContext, (ViewGroup) findViewById(R.id.container));
|
||||
mLiveAddImpressViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveAddImpressViewHolder.addToParent();
|
||||
mLiveAddImpressViewHolder.setToUid(toUid);
|
||||
mLiveAddImpressViewHolder.loadData();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (mLiveAddImpressViewHolder != null && mLiveAddImpressViewHolder.isUpdatedImpress()) {
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
} else {
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.views.LiveAdminListViewHolder;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
*/
|
||||
|
||||
public class LiveAdminListActivity extends AbsActivity {
|
||||
|
||||
public static void forward(Context context, String liveUid) {
|
||||
Intent intent = new Intent(context, LiveAdminListActivity.class);
|
||||
intent.putExtra(Constants.LIVE_UID, liveUid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_live_admin_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
String liveUid = getIntent().getStringExtra(Constants.LIVE_UID);
|
||||
if (TextUtils.isEmpty(liveUid)) {
|
||||
return;
|
||||
}
|
||||
LiveAdminListViewHolder liveAdminListViewHolder = new LiveAdminListViewHolder(mContext, (ViewGroup) findViewById(R.id.container), liveUid);
|
||||
liveAdminListViewHolder.addToParent();
|
||||
liveAdminListViewHolder.subscribeActivityLifeCycle();
|
||||
liveAdminListViewHolder.loadData();
|
||||
}
|
||||
}
|
||||
1258
live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java
Normal file
1258
live/src/main/java/com/yunbao/live/activity/LiveAnchorActivity.java
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveBlackAdapter;
|
||||
import com.yunbao.live.bean.LiveShutUpBean;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
* 直播间拉黑用户列表
|
||||
*/
|
||||
|
||||
public class LiveBlackActivity extends AbsActivity implements OnItemClickListener<LiveShutUpBean> {
|
||||
|
||||
|
||||
public static void forward(Context context, String liveUid) {
|
||||
Intent intent = new Intent(context, LiveBlackActivity.class);
|
||||
intent.putExtra(Constants.LIVE_UID, liveUid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private CommonRefreshView mRefreshView;
|
||||
private LiveBlackAdapter mAdapter;
|
||||
private String mLiveUid;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_shut_up;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(WordUtil.getString(R.string.live_user_black_list));
|
||||
mLiveUid = getIntent().getStringExtra(Constants.LIVE_UID);
|
||||
if (TextUtils.isEmpty(mLiveUid)) {
|
||||
return;
|
||||
}
|
||||
mRefreshView = findViewById(R.id.refreshView);
|
||||
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_black);
|
||||
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<LiveShutUpBean>() {
|
||||
@Override
|
||||
public RefreshAdapter<LiveShutUpBean> getAdapter() {
|
||||
if (mAdapter == null) {
|
||||
mAdapter = new LiveBlackAdapter(mContext);
|
||||
mAdapter.setOnItemClickListener(LiveBlackActivity.this);
|
||||
}
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(int p, HttpCallback callback) {
|
||||
LiveHttpUtil.getLiveBlackList(mLiveUid, p, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LiveShutUpBean> processData(String[] info) {
|
||||
return JSON.parseArray(Arrays.toString(info), LiveShutUpBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshSuccess(List<LiveShutUpBean> list, int listCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreSuccess(List<LiveShutUpBean> loadItemList, int loadItemCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreFailure() {
|
||||
|
||||
}
|
||||
});
|
||||
mRefreshView.initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(final LiveShutUpBean bean, int position) {
|
||||
LiveHttpUtil.liveCancelBlack(mLiveUid, bean.getUid(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (mAdapter != null) {
|
||||
mAdapter.removeItem(bean.getUid());
|
||||
}
|
||||
}
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_LIVE_BLACK_LIST);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.LIVE_CANCEL_BLACK);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Intent;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.bean.LiveClassBean;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveReadyClassAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
* 选择直播频道
|
||||
*/
|
||||
|
||||
public class LiveChooseClassActivity extends AbsActivity implements OnItemClickListener<LiveClassBean> {
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_live_choose_class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(WordUtil.getString(R.string.live_class_choose));
|
||||
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
final int checkedClassId = getIntent().getIntExtra(Constants.CLASS_ID, 0);
|
||||
CommonAppConfig.getInstance().getConfig(new CommonCallback<ConfigBean>() {
|
||||
@Override
|
||||
public void callback(ConfigBean configBean) {
|
||||
if (configBean != null) {
|
||||
List<LiveClassBean> list1 = configBean.getLiveClass();
|
||||
List<LiveClassBean> list = new ArrayList<>();
|
||||
for(int i = 0; i < list1.size(); i++) {
|
||||
if(!list1.get(i).getName().equals("New")&&!list1.get(i).getName().equals("Hot")&&!list1.get(i).getName().equals("熱門")&&!list1.get(i).getName().equals("新秀")){
|
||||
list.add(list1.get(i));
|
||||
}
|
||||
}
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0, size = list.size(); i < size; i++) {
|
||||
LiveClassBean bean = list.get(i);
|
||||
if (bean.getId() == checkedClassId) {
|
||||
bean.setChecked(true);
|
||||
} else {
|
||||
bean.setChecked(false);
|
||||
}
|
||||
}
|
||||
LiveReadyClassAdapter adapter = new LiveReadyClassAdapter(mContext, list);
|
||||
adapter.setOnItemClickListener(LiveChooseClassActivity.this);
|
||||
mRecyclerView.setAdapter(adapter);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemClick(LiveClassBean bean, int position) {
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(Constants.CLASS_ID, bean.getId());
|
||||
intent.putExtra(Constants.CLASS_NAME, bean.getName());
|
||||
setResult(RESULT_OK, intent);
|
||||
finish();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.views.LiveContributeViewHolder;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/19.
|
||||
*/
|
||||
|
||||
public class LiveContributeActivity extends AbsActivity {
|
||||
|
||||
private LiveContributeViewHolder mLiveContributeViewHolder;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_empty;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
String toUid = getIntent().getStringExtra(Constants.TO_UID);
|
||||
if (TextUtils.isEmpty(toUid)) {
|
||||
return;
|
||||
}
|
||||
mLiveContributeViewHolder = new LiveContributeViewHolder(mContext, (ViewGroup) findViewById(R.id.container), toUid);
|
||||
mLiveContributeViewHolder.addToParent();
|
||||
mLiveContributeViewHolder.loadData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
if(mLiveContributeViewHolder!=null){
|
||||
mLiveContributeViewHolder.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.adapter.GuardAdapter;
|
||||
import com.yunbao.live.bean.GuardUserBean;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/15.
|
||||
*/
|
||||
|
||||
public class LiveGuardListActivity extends AbsActivity {
|
||||
|
||||
public static void forward(Context context, String toUid) {
|
||||
Intent intent = new Intent(context, LiveGuardListActivity.class);
|
||||
intent.putExtra(Constants.TO_UID, toUid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private CommonRefreshView mRefreshView;
|
||||
private GuardAdapter mGuardAdapter;
|
||||
private String mToUid;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_guard_list;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(WordUtil.getString(R.string.guard_list));
|
||||
mToUid = getIntent().getStringExtra(Constants.TO_UID);
|
||||
if (TextUtils.isEmpty(mToUid)) {
|
||||
return;
|
||||
}
|
||||
mRefreshView = findViewById(R.id.refreshView);
|
||||
boolean self = mToUid.equals(CommonAppConfig.getInstance().getUid());
|
||||
mRefreshView.setEmptyLayoutId(self ? R.layout.view_no_data_guard_anc_2 : R.layout.view_no_data_guard_aud_2);
|
||||
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<GuardUserBean>() {
|
||||
@Override
|
||||
public RefreshAdapter<GuardUserBean> getAdapter() {
|
||||
if (mGuardAdapter == null) {
|
||||
mGuardAdapter = new GuardAdapter(mContext, false);
|
||||
}
|
||||
return mGuardAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(int p, HttpCallback callback) {
|
||||
LiveHttpUtil.getGuardList(mToUid, p, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GuardUserBean> processData(String[] info) {
|
||||
return JSON.parseArray(Arrays.toString(info), GuardUserBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshSuccess(List<GuardUserBean> list, int listCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreSuccess(List<GuardUserBean> loadItemList, int loadItemCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreFailure() {
|
||||
|
||||
}
|
||||
});
|
||||
mRefreshView.initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_GUARD_LIST);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.views.LiveRecordViewHolder;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/30.
|
||||
*/
|
||||
|
||||
public class LiveRecordActivity extends AbsActivity {
|
||||
|
||||
public static void forward(Context context, UserBean userBean) {
|
||||
if (userBean == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(context, LiveRecordActivity.class);
|
||||
intent.putExtra(Constants.USER_BEAN, userBean);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private UserBean mUserBean;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_live_record;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(WordUtil.getString(R.string.live_record));
|
||||
mUserBean = getIntent().getParcelableExtra(Constants.USER_BEAN);
|
||||
if (mUserBean == null) {
|
||||
return;
|
||||
}
|
||||
LiveRecordViewHolder liveRecordViewHolder = new LiveRecordViewHolder(mContext, (ViewGroup) findViewById(R.id.container),mUserBean.getId());
|
||||
liveRecordViewHolder.setActionListener(new LiveRecordViewHolder.ActionListener() {
|
||||
@Override
|
||||
public UserBean getUserBean() {
|
||||
return mUserBean;
|
||||
}
|
||||
});
|
||||
liveRecordViewHolder.addToParent();
|
||||
liveRecordViewHolder.subscribeActivityLifeCycle();
|
||||
liveRecordViewHolder.loadData();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.SeekBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.SearchUserBean;
|
||||
import com.yunbao.live.dialog.LiveShareDialogFragment;
|
||||
import com.yunbao.live.presenter.UserHomeSharePresenter;
|
||||
import com.yunbao.live.views.LiveRecordPlayViewHolder;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/29.
|
||||
*/
|
||||
|
||||
public class LiveRecordPlayActivity extends AbsActivity implements
|
||||
LiveRecordPlayViewHolder.ActionListener, View.OnClickListener, LiveShareDialogFragment.ActionListener {
|
||||
|
||||
private LiveRecordPlayViewHolder mLiveRecordPlayViewHolder;
|
||||
private ImageView mAvatar;
|
||||
private ImageView mLevelAnchor;
|
||||
private TextView mName;
|
||||
private TextView mID;
|
||||
private View mBtnFollow;
|
||||
private SeekBar mSeekBar;
|
||||
private long mDuration;
|
||||
private TextView mCurTimeTextView;
|
||||
private TextView mDurationTextView;
|
||||
private ImageView mBtnPlay;
|
||||
private UserBean mUserBean;
|
||||
private UserHomeSharePresenter mUserHomeSharePresenter;
|
||||
private boolean mPausePlay;
|
||||
|
||||
public static void forward(Context context, String url, UserBean userBean) {
|
||||
if (TextUtils.isEmpty(url) || userBean == null) {
|
||||
return;
|
||||
}
|
||||
Intent intent = new Intent(context, LiveRecordPlayActivity.class);
|
||||
intent.putExtra(Constants.URL, url);
|
||||
intent.putExtra(Constants.USER_BEAN, userBean);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_live_record_play;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isStatusBarWhite() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
Intent intent = getIntent();
|
||||
mUserBean = intent.getParcelableExtra(Constants.USER_BEAN);
|
||||
if (mUserBean == null) {
|
||||
return;
|
||||
}
|
||||
String url = intent.getStringExtra(Constants.URL);
|
||||
if (TextUtils.isEmpty(url)) {
|
||||
return;
|
||||
}
|
||||
mAvatar = (ImageView) findViewById(R.id.avatar);
|
||||
mLevelAnchor = (ImageView) findViewById(R.id.level_anchor);
|
||||
mName = (TextView) findViewById(R.id.name);
|
||||
mID = (TextView) findViewById(R.id.id_val);
|
||||
mBtnFollow = findViewById(R.id.btn_follow);
|
||||
ImgLoader.displayAvatar(mContext,mUserBean.getAvatar(), mAvatar);
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getAnchorLevel(mUserBean.getLevelAnchor());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext,levelBean.getThumbIcon(), mLevelAnchor);
|
||||
}
|
||||
mName.setText(mUserBean.getUserNiceName());
|
||||
mID.setText(mUserBean.getLiangNameTip());
|
||||
if (mUserBean instanceof SearchUserBean) {
|
||||
SearchUserBean searchUserBean = (SearchUserBean) mUserBean;
|
||||
int attention = searchUserBean.getAttention();
|
||||
if (attention == 0) {
|
||||
if (mBtnFollow.getVisibility() != View.VISIBLE) {
|
||||
mBtnFollow.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
mBtnFollow.setOnClickListener(this);
|
||||
}
|
||||
mUserHomeSharePresenter = new UserHomeSharePresenter(mContext);
|
||||
mUserHomeSharePresenter.setToUid(mUserBean.getId())
|
||||
.setToName(mUserBean.getUserNiceName())
|
||||
.setAvatarThumb(mUserBean.getAvatarThumb())
|
||||
.setFansNum(String.valueOf(mUserBean.getFans()));
|
||||
findViewById(R.id.btn_back).setOnClickListener(this);
|
||||
findViewById(R.id.btn_share).setOnClickListener(this);
|
||||
mBtnPlay = findViewById(R.id.btn_play);
|
||||
mBtnPlay.setOnClickListener(this);
|
||||
mSeekBar = (SeekBar) findViewById(R.id.seek_bar);
|
||||
mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
|
||||
@Override
|
||||
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartTrackingTouch(SeekBar seekBar) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopTrackingTouch(SeekBar seekBar) {
|
||||
if (mLiveRecordPlayViewHolder != null) {
|
||||
mLiveRecordPlayViewHolder.clickResume();
|
||||
int progress = seekBar.getProgress();
|
||||
mLiveRecordPlayViewHolder.seekTo(mDuration * progress / 100000f);
|
||||
}
|
||||
}
|
||||
});
|
||||
mCurTimeTextView = findViewById(R.id.cur_time);
|
||||
mDurationTextView = findViewById(R.id.duration);
|
||||
ViewGroup container = (ViewGroup) findViewById(R.id.container);
|
||||
mLiveRecordPlayViewHolder = new LiveRecordPlayViewHolder(mContext, container);
|
||||
mLiveRecordPlayViewHolder.setActionListener(this);
|
||||
mLiveRecordPlayViewHolder.subscribeActivityLifeCycle();
|
||||
mLiveRecordPlayViewHolder.addToParent();
|
||||
mLiveRecordPlayViewHolder.play(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
if (mLiveRecordPlayViewHolder != null) {
|
||||
mLiveRecordPlayViewHolder.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mLiveRecordPlayViewHolder != null) {
|
||||
mLiveRecordPlayViewHolder.release();
|
||||
}
|
||||
if (mUserHomeSharePresenter != null) {
|
||||
mUserHomeSharePresenter.release();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
if (mSeekBar != null) {
|
||||
mSeekBar.setProgress(progress);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDuration(long duration) {
|
||||
mDuration = duration;
|
||||
if (mDurationTextView != null) {
|
||||
mDurationTextView.setText(StringUtil.getDurationText(duration));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCurTime(long curTime) {
|
||||
if (mCurTimeTextView != null) {
|
||||
mCurTimeTextView.setText(StringUtil.getDurationText(curTime));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickPause() {
|
||||
if (mBtnPlay != null) {
|
||||
mBtnPlay.setImageResource(R.mipmap.icon_live_record_play);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClickResume() {
|
||||
if (mBtnPlay != null) {
|
||||
mBtnPlay.setImageResource(R.mipmap.icon_live_record_pause);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_back) {
|
||||
onBackPressed();
|
||||
|
||||
} else if (i == R.id.btn_share) {
|
||||
share();
|
||||
|
||||
} else if (i == R.id.btn_play) {
|
||||
togglePlay();
|
||||
|
||||
} else if (i == R.id.btn_follow) {
|
||||
follow();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换播放暂停
|
||||
*/
|
||||
private void togglePlay() {
|
||||
if (mLiveRecordPlayViewHolder != null) {
|
||||
if (mPausePlay) {
|
||||
mLiveRecordPlayViewHolder.clickResume();
|
||||
} else {
|
||||
mLiveRecordPlayViewHolder.clickPause();
|
||||
}
|
||||
mPausePlay = !mPausePlay;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关注主播
|
||||
*/
|
||||
private void follow() {
|
||||
if (mUserBean == null) {
|
||||
return;
|
||||
}
|
||||
CommonHttpUtil.setAttention(mUserBean.getId(), new CommonCallback<Integer>() {
|
||||
@Override
|
||||
public void callback(Integer isAttention) {
|
||||
if (isAttention == 1) {
|
||||
if (mBtnFollow.getVisibility() == View.VISIBLE) {
|
||||
mBtnFollow.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享
|
||||
*/
|
||||
private void share() {
|
||||
LiveShareDialogFragment fragment = new LiveShareDialogFragment();
|
||||
fragment.setActionListener(this);
|
||||
fragment.show(((AbsActivity) mContext).getSupportFragmentManager(), "LiveShareDialogFragment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(String type) {
|
||||
if (Constants.LINK.equals(type)) {
|
||||
copyLink();
|
||||
} else {
|
||||
shareHomePage(type);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制页面链接
|
||||
*/
|
||||
private void copyLink() {
|
||||
if (mUserHomeSharePresenter != null) {
|
||||
mUserHomeSharePresenter.copyLink();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分享页面链接
|
||||
*/
|
||||
private void shareHomePage(String type) {
|
||||
if (mUserHomeSharePresenter != null) {
|
||||
mUserHomeSharePresenter.shareHomePage(type);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,203 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.KeyBoardHeightChangeListener;
|
||||
import com.yunbao.common.utils.KeyBoardHeightUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveReportAdapter;
|
||||
import com.yunbao.live.bean.LiveReportBean;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/12/15.
|
||||
* 直播间举报 短视频举报功能共用此页面
|
||||
*/
|
||||
@Route(path = RouteUtil.PATH_LIVEREPORT)
|
||||
public class LiveReportActivity extends AbsActivity implements LiveReportAdapter.ActionListener, KeyBoardHeightChangeListener {
|
||||
|
||||
public static void forward(Context context, String toUid) {
|
||||
Intent intent = new Intent(context, LiveReportActivity.class);
|
||||
intent.putExtra(Constants.TO_UID, toUid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void forward2(Context context, String VideoId) {
|
||||
Intent intent = new Intent(context, LiveReportActivity.class);
|
||||
intent.putExtra(Constants.VIDEO_ID, VideoId);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void forward3(Context context, String dynamic_id, int intoIndex, String community_type, String comment_id) {
|
||||
Intent intent = new Intent(context, LiveReportActivity.class);
|
||||
intent.putExtra(Constants.TO_UID, dynamic_id);
|
||||
intent.putExtra(Constants.INTOINDEX, intoIndex);
|
||||
intent.putExtra("community_type", community_type);
|
||||
intent.putExtra("comment_id", comment_id);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private String community_type;
|
||||
private String comment_id;
|
||||
private String mToUid;
|
||||
private String mVideoId;
|
||||
private int mIntoIndex;
|
||||
private RecyclerView mRecyclerView;
|
||||
private LiveReportAdapter mAdapter;
|
||||
private KeyBoardHeightUtil mKeyBoardHeightUtil;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_video_report;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(WordUtil.getString(R.string.report));
|
||||
mToUid = getIntent().getStringExtra(Constants.TO_UID);
|
||||
mVideoId = getIntent().getStringExtra(Constants.VIDEO_ID);
|
||||
mIntoIndex = getIntent().getIntExtra(Constants.INTOINDEX, 0);
|
||||
community_type = getIntent().getStringExtra("community_type");
|
||||
comment_id = getIntent().getStringExtra("comment_id");
|
||||
mRecyclerView = findViewById(R.id.recyclerView);
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mKeyBoardHeightUtil = new KeyBoardHeightUtil(mContext, findViewById(android.R.id.content), this);
|
||||
LiveHttpUtil.getLiveReportList(new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
List<LiveReportBean> list = JSON.parseArray(Arrays.toString(info), LiveReportBean.class);
|
||||
mAdapter = new LiveReportAdapter(mContext, list);
|
||||
mAdapter.setActionListener(LiveReportActivity.this);
|
||||
if (mRecyclerView != null) {
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
}
|
||||
if (mKeyBoardHeightUtil != null) {
|
||||
mKeyBoardHeightUtil.start();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReportClick(LiveReportBean bean, String text) {
|
||||
// if (TextUtils.isEmpty(mToUid)) {
|
||||
// return;
|
||||
// }
|
||||
// if (bean == null) {
|
||||
// ToastUtil.show(R.string.video_report_tip_3);
|
||||
// return;
|
||||
// }
|
||||
// String content = bean.getName();
|
||||
// if (!TextUtils.isEmpty(text)) {
|
||||
// content += " " + text;
|
||||
// }
|
||||
// LiveHttpUtil.setReport(mToUid, content, mReportCallback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReportClick(LiveReportBean bean, String text, File file1, File file2, File file3) {
|
||||
if (TextUtils.isEmpty(mToUid)) {
|
||||
mToUid = "";
|
||||
}
|
||||
if (bean == null) {
|
||||
ToastUtil.show(R.string.video_report_tip_3);
|
||||
return;
|
||||
}
|
||||
String content = "";
|
||||
try {
|
||||
content = bean.getName();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (!TextUtils.isEmpty(text)) {
|
||||
content += " " + text;
|
||||
}
|
||||
if (mIntoIndex == 0) {
|
||||
LiveHttpUtil.setReport(mToUid, content, file1, file2, file3, mVideoId, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
ToastUtil.show(R.string.video_report_tip_4);
|
||||
onBackPressed();
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
CommonHttpUtil.setCommunityReport(community_type, comment_id, mToUid, text, file1, file2, file3, bean.getId(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
ToastUtil.show(R.string.video_report_tip_4);
|
||||
onBackPressed();
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyBoardHeightChanged(int visibleHeight, int keyboardHeight) {
|
||||
if (mRecyclerView != null) {
|
||||
mRecyclerView.setTranslationY(-keyboardHeight);
|
||||
}
|
||||
if (keyboardHeight > 0 && mAdapter != null) {
|
||||
mRecyclerView.smoothScrollToPosition(mAdapter.getItemCount() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoftInputShowed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void release() {
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_LIVE_REPORT_LIST);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.SET_REPORT);
|
||||
if (mKeyBoardHeightUtil != null) {
|
||||
mKeyBoardHeightUtil.release();
|
||||
}
|
||||
mKeyBoardHeightUtil = null;
|
||||
if (mAdapter != null) {
|
||||
mAdapter.setActionListener(null);
|
||||
}
|
||||
mAdapter = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
release();
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
release();
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,124 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.custom.CommonRefreshView;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.LiveShutUpAdapter;
|
||||
import com.yunbao.live.bean.LiveShutUpBean;
|
||||
import com.yunbao.live.http.LiveHttpConsts;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
* 直播间禁言用户列表
|
||||
*/
|
||||
|
||||
public class LiveShutUpActivity extends AbsActivity implements OnItemClickListener<LiveShutUpBean> {
|
||||
|
||||
|
||||
public static void forward(Context context, String liveUid) {
|
||||
Intent intent = new Intent(context, LiveShutUpActivity.class);
|
||||
intent.putExtra(Constants.LIVE_UID, liveUid);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
private CommonRefreshView mRefreshView;
|
||||
private LiveShutUpAdapter mAdapter;
|
||||
private String mLiveUid;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_shut_up;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
setTitle(WordUtil.getString(R.string.live_user_shut_up_list));
|
||||
mLiveUid = getIntent().getStringExtra(Constants.LIVE_UID);
|
||||
if (TextUtils.isEmpty(mLiveUid)) {
|
||||
return;
|
||||
}
|
||||
mRefreshView = findViewById(R.id.refreshView);
|
||||
mRefreshView.setEmptyLayoutId(R.layout.view_no_data_shut_up);
|
||||
mRefreshView.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
|
||||
mRefreshView.setDataHelper(new CommonRefreshView.DataHelper<LiveShutUpBean>() {
|
||||
@Override
|
||||
public RefreshAdapter<LiveShutUpBean> getAdapter() {
|
||||
if (mAdapter == null) {
|
||||
mAdapter = new LiveShutUpAdapter(mContext);
|
||||
mAdapter.setOnItemClickListener(LiveShutUpActivity.this);
|
||||
}
|
||||
return mAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadData(int p, HttpCallback callback) {
|
||||
LiveHttpUtil.getLiveShutUpList(mLiveUid, p, callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LiveShutUpBean> processData(String[] info) {
|
||||
return JSON.parseArray(Arrays.toString(info), LiveShutUpBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshSuccess(List<LiveShutUpBean> list, int listCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRefreshFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreSuccess(List<LiveShutUpBean> loadItemList, int loadItemCount) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadMoreFailure() {
|
||||
|
||||
}
|
||||
});
|
||||
mRefreshView.initData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemClick(final LiveShutUpBean bean, int position) {
|
||||
LiveHttpUtil.liveCancelShutUp(mLiveUid, bean.getUid(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
if (mAdapter != null) {
|
||||
mAdapter.removeItem(bean.getUid());
|
||||
}
|
||||
}
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.GET_LIVE_SHUT_UP_LIST);
|
||||
LiveHttpUtil.cancel(LiveHttpConsts.LIVE_CANCEL_SHUT_UP);
|
||||
super.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,368 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.tencent.liteav.TXLiteAVCode;
|
||||
import com.tencent.liteav.device.TXDeviceManager;
|
||||
import com.tencent.rtmp.ui.TXCloudVideoView;
|
||||
import com.tencent.trtc.TRTCCloud;
|
||||
import com.tencent.trtc.TRTCCloudDef;
|
||||
import com.tencent.trtc.TRTCCloudListener;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
import com.yunbao.live.dialog.LiveBeautyDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveRoomTypeDialogFragment;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.momo.GenerateTestUserSig;
|
||||
import com.yunbao.live.momo.TencentTRTCBeautyManager;
|
||||
import com.yunbao.live.utils.TRTCBaseActivity;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_APP_SCENE_LIVE;
|
||||
import static com.tencent.trtc.TRTCCloudDef.TRTC_VIDEO_STREAM_TYPE_BIG;
|
||||
|
||||
public class LiveTRTCAnchorActivity extends TRTCBaseActivity {
|
||||
|
||||
|
||||
private TXCloudVideoView mTxcvvAnchorPreviewView;
|
||||
private ImageView mButtonSwitchCamera;
|
||||
|
||||
private TRTCCloud mTRTCCloud;
|
||||
private TXDeviceManager mTXDeviceManager;
|
||||
private TRTCCloudDef.TRTCParams mTRTCParams;
|
||||
private boolean mIsFrontCamera = true;
|
||||
private String mRoomId = "1256732";
|
||||
private String mUserId = "95895736";
|
||||
String TAG = "TX";
|
||||
private Handler mMainHandler;
|
||||
public TencentTRTCBeautyManager tencentTRTCBeautyManager;
|
||||
|
||||
public static View ready_view;
|
||||
//美颜
|
||||
TextView btn_beauty;
|
||||
private TextView mLiveTypeTextView;//房间类型TextView
|
||||
private int mLiveClassID;//直播频道id
|
||||
private int mLiveType;//房间类型
|
||||
private int mLiveTypeVal;//房间密码
|
||||
|
||||
TextView live_class;
|
||||
EditText mEditTitle;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_live_trtcanchor);
|
||||
|
||||
|
||||
mTRTCCloud = TRTCCloud.sharedInstance(LiveTRTCAnchorActivity.this);
|
||||
mMainHandler = new Handler(Looper.getMainLooper());
|
||||
|
||||
mTXDeviceManager = mTRTCCloud.getDeviceManager();
|
||||
mTRTCCloud.setListener(new TRTCCloudImplListener(LiveTRTCAnchorActivity.this));
|
||||
|
||||
mTRTCCloud.setLocalVideoProcessListener(TRTCCloudDef.TRTC_VIDEO_PIXEL_FORMAT_Texture_2D,
|
||||
TRTCCloudDef.TRTC_VIDEO_BUFFER_TYPE_TEXTURE,
|
||||
new TRTCCloudListener.TRTCVideoFrameListener() {
|
||||
|
||||
@Override
|
||||
public void onGLContextCreated() {
|
||||
mMainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tencentTRTCBeautyManager = new TencentTRTCBeautyManager(LiveTRTCAnchorActivity.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onProcessVideoFrame(TRTCCloudDef.TRTCVideoFrame srcFrame, TRTCCloudDef.TRTCVideoFrame dstFrame) {
|
||||
if (tencentTRTCBeautyManager != null) {
|
||||
dstFrame.texture.textureId = tencentTRTCBeautyManager.renderWithTexture(srcFrame.texture.textureId, srcFrame.width, srcFrame.height, srcFrame.rotation == 270);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGLContextDestory() {
|
||||
tencentTRTCBeautyManager.textureDestoryed();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (checkPermission()) {
|
||||
initView();
|
||||
enterRoom();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
exitRoom();
|
||||
}
|
||||
|
||||
|
||||
protected void initView() {
|
||||
mButtonSwitchCamera = findViewById(R.id.live_btn_switch_camera);
|
||||
mTxcvvAnchorPreviewView = findViewById(R.id.live_cloud_view_main);
|
||||
btn_beauty = findViewById(R.id.btn_beauty);
|
||||
ready_view = (View) findViewById(R.id.ready_view);
|
||||
live_class = (TextView) findViewById(R.id.live_class);
|
||||
mEditTitle = (EditText) findViewById(R.id.edit_title);
|
||||
mLiveTypeTextView = (TextView) findViewById(R.id.btn_room_type);
|
||||
mLiveTypeTextView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
chooseLiveType();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.btn_start_live).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
startLive();
|
||||
}
|
||||
});
|
||||
live_class.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(LiveTRTCAnchorActivity.this, LiveChooseClassActivity.class);
|
||||
intent.putExtra(Constants.CLASS_ID, mLiveClassID);
|
||||
startActivityForResult(intent, 1);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
btn_beauty.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
LiveBeautyDialogFragment fragment = new LiveBeautyDialogFragment();
|
||||
// fragment.setiBeautyModule(BeautyManager.iBeautyModule);
|
||||
fragment.show(getSupportFragmentManager(), "LiveBeautyDialogFragment");
|
||||
ready_view.setVisibility(View.GONE);
|
||||
|
||||
}
|
||||
});
|
||||
mTRTCCloud.setListener(new TRTCCloudImplListener(LiveTRTCAnchorActivity.this));
|
||||
mButtonSwitchCamera.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
switchCamera();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void enterRoom() {
|
||||
|
||||
mTRTCParams = new TRTCCloudDef.TRTCParams();
|
||||
mTRTCParams.sdkAppId = GenerateTestUserSig.SDKAPPID;
|
||||
mTRTCParams.userId = mUserId;
|
||||
mTRTCParams.roomId = Integer.parseInt(mRoomId);
|
||||
mTRTCParams.userSig = GenerateTestUserSig.genTestUserSig(mTRTCParams.userId);
|
||||
mTRTCParams.role = TRTCCloudDef.TRTCRoleAnchor;
|
||||
|
||||
mTRTCCloud.startLocalPreview(mIsFrontCamera, mTxcvvAnchorPreviewView);
|
||||
mTRTCCloud.startLocalAudio(TRTCCloudDef.TRTC_AUDIO_QUALITY_DEFAULT);
|
||||
mTRTCCloud.enterRoom(mTRTCParams, TRTC_APP_SCENE_LIVE);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == 1 && resultCode == RESULT_OK) {
|
||||
mLiveClassID = data.getIntExtra(Constants.CLASS_ID, 0);
|
||||
live_class.setText(data.getStringExtra(Constants.CLASS_NAME));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 请求创建直播间接口,开始直播
|
||||
*/
|
||||
private void createRoom() {
|
||||
if (mLiveClassID == 0) {
|
||||
ToastUtil.show(R.string.live_choose_live_class);
|
||||
return;
|
||||
}
|
||||
String title = mEditTitle.getText().toString().trim();
|
||||
LiveHttpUtil.newcreateRoom(title, mLiveClassID, mLiveType, mLiveTypeVal, null, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, final String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
L.e("开播", "createRoom------->" + info[0]);
|
||||
final CommonAppConfig appConfig = CommonAppConfig.getInstance();
|
||||
UserBean u = appConfig.getUserBean();
|
||||
|
||||
try {
|
||||
JSONObject data = new JSONObject(info[0]);
|
||||
mTRTCCloud.startPublishing(data.getString("stream"), TRTC_VIDEO_STREAM_TYPE_BIG);
|
||||
ready_view.setVisibility(View.VISIBLE);
|
||||
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected void switchCamera() {
|
||||
if (mIsFrontCamera) {
|
||||
mIsFrontCamera = false;
|
||||
} else {
|
||||
mIsFrontCamera = true;
|
||||
}
|
||||
mTXDeviceManager.switchCamera(mIsFrontCamera);
|
||||
}
|
||||
|
||||
|
||||
protected class TRTCCloudImplListener extends TRTCCloudListener {
|
||||
|
||||
private WeakReference<LiveTRTCAnchorActivity> mContext;
|
||||
|
||||
public TRTCCloudImplListener(LiveTRTCAnchorActivity activity) {
|
||||
super();
|
||||
mContext = new WeakReference<>(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteUserEnterRoom(String userId) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRemoteUserLeaveRoom(String userId, int reason) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserVideoAvailable(String userId, boolean available) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(int errCode, String errMsg, Bundle extraInfo) {
|
||||
Log.d(TAG, "sdk callback onError");
|
||||
LiveTRTCAnchorActivity activity = mContext.get();
|
||||
if (activity != null) {
|
||||
Toast.makeText(activity, "onError: " + errMsg + "[" + errCode + "]", Toast.LENGTH_SHORT).show();
|
||||
if (errCode == TXLiteAVCode.ERR_ROOM_ENTER_FAIL) {
|
||||
activity.exitRoom();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void exitRoom() {
|
||||
if (mTRTCCloud != null) {
|
||||
mTRTCCloud.stopLocalAudio();
|
||||
mTRTCCloud.stopLocalPreview();
|
||||
mTRTCCloud.exitRoom();
|
||||
mTRTCCloud.setListener(null);
|
||||
}
|
||||
mTRTCCloud = null;
|
||||
TRTCCloud.destroySharedInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPermissionGranted() {
|
||||
initView();
|
||||
enterRoom();
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择直播类型
|
||||
*/
|
||||
private void chooseLiveType() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(Constants.CHECKED_ID, mLiveType);
|
||||
LiveRoomTypeDialogFragment fragment = new LiveRoomTypeDialogFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.setCallback(new CommonCallback<LiveRoomTypeBean>() {
|
||||
@Override
|
||||
public void callback(LiveRoomTypeBean bean) {
|
||||
if (bean.getId() == Constants.LIVE_TYPE_NORMAL) {
|
||||
onLiveTypeNormal(bean);
|
||||
} else {
|
||||
onLiveTypePwd(bean);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
fragment.show((this).getSupportFragmentManager(), "LiveRoomTypeDialogFragment");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 普通房间
|
||||
*/
|
||||
private void onLiveTypeNormal(LiveRoomTypeBean bean) {
|
||||
mLiveType = bean.getId();
|
||||
mLiveTypeTextView.setText(bean.getName());
|
||||
mLiveTypeVal = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 密码房间
|
||||
*/
|
||||
private void onLiveTypePwd(final LiveRoomTypeBean bean) {
|
||||
DialogUitl.showSimpleInputDialog(this, WordUtil.getString(R.string.live_set_pwd), DialogUitl.INPUT_TYPE_NUMBER_PASSWORD, 8, new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
ToastUtil.show(R.string.live_set_pwd_empty);
|
||||
} else {
|
||||
mLiveType = bean.getId();
|
||||
mLiveTypeTextView.setText(bean.getName());
|
||||
if (StringUtil.isInt(content)) {
|
||||
mLiveTypeVal = Integer.parseInt(content);
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 点击开始直播按钮
|
||||
*/
|
||||
private void startLive() {
|
||||
createRoom();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/25.
|
||||
* 我的徽章 右上角问号h5页面
|
||||
*/
|
||||
|
||||
public class MedalQuestionWebViewActivity extends AbsActivity {
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private WebView mWebView;
|
||||
private final int CHOOSE = 100;//Android 5.0以下的
|
||||
private final int CHOOSE_ANDROID_5 = 200;//Android 5.0以上的
|
||||
private ValueCallback<Uri> mValueCallback;
|
||||
private ValueCallback<Uri[]> mValueCallback2;
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_webview;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
String url = getIntent().getStringExtra(Constants.URL);
|
||||
L.e("H5---2>" + url);
|
||||
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
|
||||
mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
|
||||
mWebView = new WebView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
params.topMargin = DpUtil.dp2px(1);
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
rootView.addView(mWebView);
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
L.e("H5-------->" + url);
|
||||
if (url.startsWith(Constants.COPY_PREFIX)) {
|
||||
String content = url.substring(Constants.COPY_PREFIX.length());
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
copy(content);
|
||||
}
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
setTitle(view.getTitle());
|
||||
}
|
||||
});
|
||||
mWebView.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
if (newProgress == 100) {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
} else {
|
||||
mProgressBar.setProgress(newProgress);
|
||||
}
|
||||
}
|
||||
|
||||
//以下是在各个Android版本中 WebView调用文件选择器的方法
|
||||
// For Android < 3.0
|
||||
public void openFileChooser(ValueCallback<Uri> valueCallback) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
// For Android >= 3.0
|
||||
public void openFileChooser(ValueCallback valueCallback, String acceptType) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
//For Android >= 4.1
|
||||
public void openFileChooser(ValueCallback<Uri> valueCallback,
|
||||
String acceptType, String capture) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
// For Android >= 5.0
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public boolean onShowFileChooser(WebView webView,
|
||||
ValueCallback<Uri[]> filePathCallback,
|
||||
FileChooserParams fileChooserParams) {
|
||||
mValueCallback2 = filePathCallback;
|
||||
Intent intent = fileChooserParams.createIntent();
|
||||
startActivityForResult(intent, CHOOSE_ANDROID_5);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
mWebView.loadUrl(url);
|
||||
}
|
||||
private void openImageChooserActivity(ValueCallback<Uri> valueCallback) {
|
||||
mValueCallback = valueCallback;
|
||||
Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT < 19) {
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
} else {
|
||||
intent.setAction(Intent.ACTION_PICK);
|
||||
intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
}
|
||||
intent.setType("image/*");
|
||||
startActivityForResult(Intent.createChooser(intent, WordUtil.getString(R.string.choose_flie)), CHOOSE);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
super.onActivityResult(requestCode, resultCode, intent);
|
||||
switch (requestCode) {
|
||||
case CHOOSE://5.0以下选择图片后的回调
|
||||
processResult(resultCode, intent);
|
||||
break;
|
||||
case CHOOSE_ANDROID_5://5.0以上选择图片后的回调
|
||||
processResultAndroid5(resultCode, intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void processResult(int resultCode, Intent intent) {
|
||||
if (mValueCallback == null) {
|
||||
return;
|
||||
}
|
||||
if (resultCode == RESULT_OK && intent != null) {
|
||||
Uri result = intent.getData();
|
||||
mValueCallback.onReceiveValue(result);
|
||||
} else {
|
||||
mValueCallback.onReceiveValue(null);
|
||||
}
|
||||
mValueCallback = null;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private void processResultAndroid5(int resultCode, Intent intent) {
|
||||
if (mValueCallback2 == null) {
|
||||
return;
|
||||
}
|
||||
if (resultCode == RESULT_OK && intent != null) {
|
||||
mValueCallback2.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
|
||||
} else {
|
||||
mValueCallback2.onReceiveValue(null);
|
||||
}
|
||||
mValueCallback2 = null;
|
||||
}
|
||||
|
||||
protected boolean canGoBack() {
|
||||
return mWebView != null && mWebView.canGoBack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (isNeedExitActivity()) {
|
||||
finish();
|
||||
} else {
|
||||
if (canGoBack()) {
|
||||
mWebView.goBack();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isNeedExitActivity() {
|
||||
if (mWebView != null) {
|
||||
String url = mWebView.getUrl();
|
||||
if (!TextUtils.isEmpty(url)) {
|
||||
return url.contains("g=Appapi&m=Auth&a=success")//身份认证成功页面
|
||||
|| url.contains("g=Appapi&m=Family&a=home");//家族申请提交成功页面
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void forward(Context context, String url, boolean addArgs) {
|
||||
if (addArgs) {
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
}
|
||||
Intent intent = new Intent(context, MedalQuestionWebViewActivity.class);
|
||||
intent.putExtra(Constants.URL, url);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void forward(Context context, String url) {
|
||||
forward(context, url, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mWebView != null) {
|
||||
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
||||
if (parent != null) {
|
||||
parent.removeView(mWebView);
|
||||
}
|
||||
mWebView.destroy();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制到剪贴板
|
||||
*/
|
||||
private void copy(String content) {
|
||||
ClipboardManager cm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
ClipData clipData = ClipData.newPlainText("text", content);
|
||||
cm.setPrimaryClip(clipData);
|
||||
ToastUtil.show(getString(R.string.copy_success));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,727 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.ChatRemarksBean;
|
||||
import com.yunbao.common.event.UpdateTablePoint;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.SpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.adapter.ImListAdapter;
|
||||
import com.yunbao.live.bean.ImUserBean;
|
||||
import com.yunbao.live.bean.RongIMEvent;
|
||||
import com.yunbao.live.bean.SearchUserBean;
|
||||
import com.yunbao.live.http.ImHttpConsts;
|
||||
import com.yunbao.live.http.ImHttpUtil;
|
||||
import com.yunbao.live.views.ChatListViewHolder;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imlib.RongCoreClient;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.listener.OnReceiveMessageWrapperListener;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.ReceivedProfile;
|
||||
import io.rong.message.RecallNotificationMessage;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.logger;
|
||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||
|
||||
public class MyTUIConversationFragment extends Fragment {
|
||||
|
||||
private LinearLayout lt_nodata_msg;
|
||||
private View mBaseView;
|
||||
private RecyclerView mRecyclerView;
|
||||
public static ImListAdapter mAdapter;
|
||||
private ChatListViewHolder.ActionListener mActionListener;
|
||||
private SystemMessageActivity systemMessageActivity;
|
||||
private List<ImUserBean> listUserBean;
|
||||
private int tabPoint = 0;
|
||||
private Handler mHandler;
|
||||
private long timeStamp = 0;
|
||||
private int count = 10;
|
||||
private final int runOnUI = 20;
|
||||
private Message messageHandler;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
|
||||
mBaseView = inflater.inflate(R.layout.my_conversation_fragment, container, false);
|
||||
initView();
|
||||
return mBaseView;
|
||||
}
|
||||
|
||||
//获取动态信息
|
||||
public void loadData() {
|
||||
ImHttpUtil.getImUserInfo("", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0) {
|
||||
|
||||
if (mRecyclerView != null && mAdapter != null && listUserBean != null) {
|
||||
if (Constants.firstInto == 0) {
|
||||
listUserBean.clear();
|
||||
listUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
|
||||
Constants.firstInto = 1;
|
||||
tabPoint = 0;
|
||||
timeStamp = 0;
|
||||
getRyChatList();
|
||||
} else {
|
||||
List<ImUserBean> newlistUserBean = JSON.parseArray(Arrays.toString(info), ImUserBean.class);
|
||||
if (listUserBean.size() > 2) {
|
||||
listUserBean.remove(0);
|
||||
listUserBean.add(0, newlistUserBean.get(0));
|
||||
listUserBean.remove(1);
|
||||
listUserBean.add(1, newlistUserBean.get(1));
|
||||
listUserBean.remove(2);
|
||||
listUserBean.add(2, newlistUserBean.get(2));
|
||||
mHandler.sendEmptyMessage(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (listUserBean.size() >= 2) {
|
||||
//目前就三条消息,需求判断前两条消息是否有未读消息
|
||||
for (int i = 0; i < listUserBean.size() - 2; i++) {
|
||||
//消息对象
|
||||
ImUserBean userBean = listUserBean.get(i);
|
||||
//未读消息数
|
||||
String number = userBean.getNum();
|
||||
//未读消息不为空并且大于0
|
||||
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
|
||||
tabPoint = Integer.parseInt(number);
|
||||
changeTablePoint();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setActionListener(ChatListViewHolder.ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
release();
|
||||
}
|
||||
|
||||
public void release() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
mActionListener = null;
|
||||
|
||||
ImHttpUtil.cancel(ImHttpConsts.GET_SYSTEM_MESSAGE_LIST);
|
||||
ImHttpUtil.cancel(ImHttpConsts.GET_IM_USER_INFO);
|
||||
RongCoreClient.removeOnReceiveMessageListener(listener);
|
||||
listener = null;
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
systemMessageActivity = new SystemMessageActivity();
|
||||
|
||||
lt_nodata_msg = (LinearLayout) mBaseView.findViewById(R.id.lt_nodata_msg);
|
||||
mRecyclerView = (RecyclerView) mBaseView.findViewById(R.id.my_msg_recyclerView);
|
||||
mRecyclerView.setHasFixedSize(false);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
|
||||
mAdapter = new ImListAdapter(getContext());
|
||||
|
||||
mAdapter.setActionListener(new ImListAdapter.ActionListener() {
|
||||
@Override
|
||||
public void onItemClick(ImUserBean bean) {
|
||||
if(bean.getContent().equals("在線客服")){
|
||||
mFirebaseAnalytics.logEvent("FS_customer_service", null);
|
||||
logger.logEvent("FB_customer_service");
|
||||
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("ww5z2p");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
|
||||
}else if(bean.getContent().equals("新手指導員")){
|
||||
mFirebaseAnalytics.logEvent("FS_guide", null);
|
||||
logger.logEvent("FB_guide", null);
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("m0nfpn");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
}
|
||||
if (bean.getLink() != null && !bean.getLink().equals("")) {
|
||||
// startActivity(new Intent(getContext(), ZhuangBanActivity.class).putExtra("url", bean.getLink()));
|
||||
startActivity(new Intent(getContext(), WebViewActivity.class).putExtra("url", bean.getLink()));
|
||||
} else if ("1".equals(bean.getType()) || "2".equals(bean.getType())) {//系统消息,互动消息,猜你喜欢
|
||||
systemMessageActivity.forward(getContext(), bean.getType(), "", bean.getTitle(), "");
|
||||
} else if ("3".equals(bean.getType())) {
|
||||
if (bean.getLink() != null && !"".equals(bean.getLink())) {
|
||||
WebViewActivity.forward(getActivity(), bean.getLink());
|
||||
} else {
|
||||
systemMessageActivity.forward(getContext(), bean.getType(), "", bean.getTitle(), "");
|
||||
}
|
||||
} else {//聊天消息
|
||||
openMessage(bean, bean.getUserId(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDelete(ImUserBean bean, int p, View v) {
|
||||
showMoreDialog(v, p, bean);
|
||||
}
|
||||
});
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
|
||||
RongCoreClient.addOnReceiveMessageListener(listener);
|
||||
RongIMClient.setOnRecallMessageListener(listenerBack);
|
||||
|
||||
Constants.nowId = "";
|
||||
Constants.remarks = "";
|
||||
Constants.isAdmin = "";
|
||||
timeStamp = 0;
|
||||
listUserBean = new ArrayList<>();
|
||||
// loadData();
|
||||
|
||||
mHandler = new Handler() {
|
||||
@SuppressLint("HandlerLeak")
|
||||
@Override
|
||||
public void handleMessage(android.os.Message msg) {
|
||||
switch (msg.what) {
|
||||
case 1:
|
||||
mAdapter.setList(listUserBean);
|
||||
if (listUserBean.size() > 3) {
|
||||
if (lt_nodata_msg.getVisibility() == View.VISIBLE) {
|
||||
lt_nodata_msg.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case runOnUI:
|
||||
if (lt_nodata_msg.getVisibility() == View.VISIBLE) {
|
||||
lt_nodata_msg.setVisibility(View.GONE);
|
||||
}
|
||||
if (systemMessageActivity != null && !Constants.nowId.equals("")) {
|
||||
if (!Constants.isShowLiveDialog) {//首页单聊插入消息
|
||||
if (messageHandler.getObjectName().equals("RC:TxtMsg")) {
|
||||
systemMessageActivity.getNewMsg(messageHandler);
|
||||
} else if (messageHandler.getObjectName().equals("RC:ImgMsg")) {
|
||||
systemMessageActivity.getNewMsg(messageHandler);
|
||||
} else if (messageHandler.getObjectName().equals("RC:SightMsg")) {
|
||||
systemMessageActivity.getNewMsg(messageHandler);
|
||||
}
|
||||
cleanMessage(null, messageHandler.getTargetId());
|
||||
getOneUserChat(messageHandler.getTargetId());
|
||||
}
|
||||
} else {
|
||||
if (systemMessageActivity.nowUid != null && !messageHandler.getTargetId().equals(systemMessageActivity.nowUid)) {
|
||||
//新信息提示
|
||||
try {
|
||||
Uri notification = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
|
||||
Ringtone r = RingtoneManager.getRingtone(getActivity(), notification);
|
||||
r.play();
|
||||
} catch (Exception e) {
|
||||
e.getMessage();
|
||||
}
|
||||
}
|
||||
getChatPoint();
|
||||
getOneUserChat(messageHandler.getTargetId());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
getNameRemarks();
|
||||
}
|
||||
|
||||
//打开单聊
|
||||
private void openMessage(ImUserBean bean, String targetId, int messageId) {
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
long timestamp = new Date().getTime();
|
||||
|
||||
RongIMClient.getInstance().clearMessagesUnreadStatus(conversationType, targetId, timestamp, new RongIMClient.OperationCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
if (bean != null) {
|
||||
Constants.nowId = bean.getUserId();
|
||||
Constants.remarks = bean.getRemarks();
|
||||
Constants.isAdmin = bean.getIs_admin();
|
||||
if (Constants.isAdmin == null) {
|
||||
Constants.isAdmin = "0";
|
||||
}
|
||||
systemMessageActivity.forward(getContext(), bean.getType(), bean.getUserId(), bean.getTitle(), bean.getImage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
ToastUtil.show(getResources().getString(R.string.load_failure));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取新信息
|
||||
OnReceiveMessageWrapperListener listener = new OnReceiveMessageWrapperListener() {
|
||||
@Override
|
||||
public void onReceivedMessage(Message message, ReceivedProfile profile) {
|
||||
Log.d("刷新消息", "message=" + message);
|
||||
Log.i("Log", "message=" + message);
|
||||
if (message.getTargetId() != null && !"".endsWith(message.getTargetId())) {
|
||||
String firstIndex = message.getTargetId().substring(0, 1);
|
||||
if (!"g".endsWith(firstIndex) && !"__system__".endsWith(message.getTargetId())) {
|
||||
String firstIndexRM = "";
|
||||
String firstIndexRM2 = "";
|
||||
if (message.getObjectName().equals("RC:TxtMsg")) {
|
||||
TextMessage rongMsg = (TextMessage) message.getContent();
|
||||
if (rongMsg.getContent().length() > 4) {
|
||||
firstIndexRM = rongMsg.getContent().substring(0, 5);
|
||||
}
|
||||
if (rongMsg.getContent().length() > 9) {
|
||||
firstIndexRM2 = rongMsg.getContent().substring(0, 10);
|
||||
}
|
||||
}
|
||||
if (!"{\"msg".equals(firstIndexRM) && !"{\"retcode\"".equals(firstIndexRM2)) {
|
||||
//切换回主线程做UI操作
|
||||
mHandler.sendEmptyMessage(runOnUI);
|
||||
messageHandler = message;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//撤回消息
|
||||
RongIMClient.OnRecallMessageListener listenerBack = new RongIMClient.OnRecallMessageListener() {
|
||||
@Override
|
||||
public boolean onMessageRecalled(Message message, RecallNotificationMessage recallNotificationMessage) {
|
||||
if (systemMessageActivity != null && !Constants.nowId.equals("")) {
|
||||
systemMessageActivity.getWithdrawMsg(message.getMessageId());
|
||||
}
|
||||
getOneUserChat(message.getTargetId());
|
||||
|
||||
getChatPoint();
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
//获取会话列表
|
||||
private void getRyChatList() {
|
||||
Conversation.ConversationType[] conversationTypes = {Conversation.ConversationType.PRIVATE, Conversation.ConversationType.GROUP};
|
||||
RongIMClient.getInstance().getConversationListByPage(new RongIMClient.ResultCallback<List<Conversation>>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(List<Conversation> conversations) {
|
||||
if (conversations != null) {
|
||||
if (conversations.size() > 0) {
|
||||
timeStamp = conversations.get(conversations.size() - 1).getSentTime();
|
||||
}
|
||||
for (Conversation conversation2 : conversations) {
|
||||
ImUserBean imUserBean = new ImUserBean();
|
||||
imUserBean.setAddtime(conversation2.getSentTime() + "");
|
||||
imUserBean.setNum(conversation2.getUnreadMessageCount() + "");
|
||||
imUserBean.setLink("");
|
||||
imUserBean.setUserId(conversation2.getTargetId());
|
||||
imUserBean.setType("-1");
|
||||
if (conversation2.getObjectName().equals("RC:TxtMsg")) {
|
||||
TextMessage rongMsg = (TextMessage) conversation2.getLatestMessage();
|
||||
imUserBean.setContent(rongMsg.getContent());
|
||||
} else if (conversation2.getObjectName().equals("RC:ImgMsg")) {
|
||||
imUserBean.setContent(getResources().getString(R.string.im_input_img));
|
||||
} else if (conversation2.getObjectName().equals("RC:SightMsg")) {
|
||||
imUserBean.setContent(getResources().getString(R.string.video));
|
||||
} else {
|
||||
imUserBean.setContent("");
|
||||
}
|
||||
listUserBean.add(imUserBean);
|
||||
}
|
||||
// if (conversations.size() < 10) {
|
||||
// getUserData();
|
||||
// } else {
|
||||
getRyChatList();
|
||||
// }
|
||||
} else {
|
||||
|
||||
getUserData();
|
||||
}
|
||||
if (listUserBean.size() == 3) {
|
||||
lt_nodata_msg.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
lt_nodata_msg.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode ErrorCode) {
|
||||
getRyChatList();
|
||||
mAdapter.setList(listUserBean);
|
||||
}
|
||||
}, timeStamp, count, conversationTypes);
|
||||
|
||||
}
|
||||
|
||||
private void getChatPoint() {
|
||||
Conversation.ConversationType[] conversationTypes = {Conversation.ConversationType.PRIVATE, Conversation.ConversationType.GROUP};
|
||||
boolean containBlocked = true;
|
||||
RongIMClient.getInstance().getUnreadCount(conversationTypes, containBlocked,
|
||||
new RongIMClient.ResultCallback<Integer>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Integer unReadCount) {
|
||||
//未读消息大于1并且列表页面处于不可见状态消息图标展示红点
|
||||
if (unReadCount >= 1) {
|
||||
tabPoint = unReadCount;
|
||||
changeTablePoint();
|
||||
|
||||
} else {
|
||||
tabPoint = 0;
|
||||
changeTablePoint();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode ErrorCode) {
|
||||
tabPoint = 0;
|
||||
changeTablePoint();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//未读数
|
||||
private void changeTablePoint() {
|
||||
EventBus.getDefault().post(new UpdateTablePoint(tabPoint));
|
||||
}
|
||||
|
||||
//获取会话列表的用户信息
|
||||
private void getUserData() {
|
||||
for (int i = 0; i < listUserBean.size(); i++) {
|
||||
int finalI = i;
|
||||
if (i > 2) {
|
||||
CommonHttpUtil.getUserBaseinfo(listUserBean.get(i).getUserId(), new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class);
|
||||
String toName = userBean.getUserNiceName();
|
||||
String avatar = userBean.getAvatar();
|
||||
String is_admin = userBean.getIs_admin();
|
||||
listUserBean.get(finalI).setTitle(toName);
|
||||
listUserBean.get(finalI).setImage(avatar);
|
||||
listUserBean.get(finalI).setIs_admin(is_admin);
|
||||
if (Constants.remarksListNow != null) {
|
||||
for (int j = 0; j < Constants.remarksListNow.size(); j++) {
|
||||
if (Constants.remarksListNow.get(j).getUserId().equals(listUserBean.get(finalI).getUserId())) {
|
||||
listUserBean.get(finalI).setRemarks(Constants.remarksListNow.get(j).getRemarks());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (finalI == listUserBean.size() - 1) {
|
||||
mAdapter.setList(listUserBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//获取单个会话
|
||||
private void getOneUserChat(String uid) {
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
RongIMClient.getInstance().getConversation(conversationType, uid, new RongIMClient.ResultCallback<Conversation>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Conversation conversation) {
|
||||
// 成功并返回会话信息
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Constants.nowId.equals("")) {
|
||||
cleanMessage(null, conversation.getTargetId());
|
||||
conversation.setUnreadMessageCount(0);
|
||||
}
|
||||
if (conversation != null && conversation.getTargetId() != null) {
|
||||
if (listUserBean.size() > 3) {
|
||||
for (int i = 0; i < listUserBean.size(); i++) {
|
||||
if (listUserBean.get(i).getUserId() != null) {
|
||||
if (listUserBean.get(i).getUserId().equals(conversation.getTargetId())) {
|
||||
listUserBean.get(i).setAddtime(conversation.getSentTime() + "");
|
||||
listUserBean.get(i).setNum(conversation.getUnreadMessageCount() + "");
|
||||
listUserBean.get(i).setLink("");
|
||||
listUserBean.get(i).setUserId(conversation.getTargetId());
|
||||
listUserBean.get(i).setType("-1");
|
||||
if (conversation.getObjectName().equals("RC:TxtMsg")) {
|
||||
TextMessage rongMsg = (TextMessage) conversation.getLatestMessage();
|
||||
listUserBean.get(i).setContent(rongMsg.getContent());
|
||||
} else if (conversation.getObjectName().equals("RC:ImgMsg")) {
|
||||
listUserBean.get(i).setContent(getResources().getString(R.string.im_input_img));
|
||||
} else if (conversation.getObjectName().equals("RC:SightMsg")) {
|
||||
listUserBean.get(i).setContent(getResources().getString(R.string.video));
|
||||
} else {
|
||||
listUserBean.get(i).setContent("");
|
||||
}
|
||||
Collections.swap(listUserBean, i, 3);
|
||||
mHandler.sendEmptyMessage(1);
|
||||
|
||||
return;
|
||||
} else if (i == listUserBean.size() - 1) {
|
||||
getOneUserData(uid, conversation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getOneUserData(uid, conversation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
|
||||
}
|
||||
});
|
||||
CommonHttpUtil.getUserBaseinfo(uid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class);
|
||||
String toName = userBean.getUserNiceName();
|
||||
String avatar = userBean.getAvatar();
|
||||
mAdapter.setList(listUserBean);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取单个会话列表的用户信息
|
||||
private void getOneUserData(String uid, Conversation conversation) {
|
||||
CommonHttpUtil.getUserBaseinfo(uid, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
JSONObject obj = JSON.parseObject(info[0]);
|
||||
SearchUserBean userBean = JSON.toJavaObject(obj, SearchUserBean.class);
|
||||
ImUserBean imUserBean = new ImUserBean();
|
||||
imUserBean.setAddtime(conversation.getSentTime() + "");
|
||||
imUserBean.setNum(conversation.getUnreadMessageCount() + "");
|
||||
imUserBean.setLink("");
|
||||
imUserBean.setUserId(conversation.getTargetId());
|
||||
imUserBean.setType("-1");
|
||||
imUserBean.setImage(userBean.getAvatar());
|
||||
imUserBean.setTitle(userBean.getUserNiceName());
|
||||
imUserBean.setIs_admin(userBean.getIs_admin());
|
||||
if (conversation.getObjectName().equals("RC:TxtMsg")) {
|
||||
TextMessage rongMsg = (TextMessage) conversation.getLatestMessage();
|
||||
imUserBean.setContent(rongMsg.getContent());
|
||||
} else if (conversation.getObjectName().equals("RC:ImgMsg")) {
|
||||
imUserBean.setContent(getResources().getString(R.string.im_input_img));
|
||||
} else if (conversation.getObjectName().equals("RC:SightMsg")) {
|
||||
imUserBean.setContent(getResources().getString(R.string.video));
|
||||
} else {
|
||||
imUserBean.setContent("");
|
||||
}
|
||||
if (listUserBean.size() > 3)
|
||||
listUserBean.add(3, imUserBean);
|
||||
// if (listUserBean.size() > 4) {
|
||||
// Collections.swap(listUserBean, listUserBean.size() - 1, 3);
|
||||
// }
|
||||
mHandler.sendEmptyMessage(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//view当前点击的控件,手指长按任意位置弹窗
|
||||
private void showMoreDialog(View v, int position, ImUserBean bean) {
|
||||
View pop_layout = LayoutInflater.from(getContext()).inflate(R.layout.popwindow_chat_withdraw, null);
|
||||
final PopupWindow mPopupWindow = new PopupWindow(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
mPopupWindow.setContentView(pop_layout);
|
||||
mPopupWindow.setFocusable(true);
|
||||
mPopupWindow.setOutsideTouchable(true);
|
||||
mPopupWindow.setBackgroundDrawable(new BitmapDrawable());
|
||||
mPopupWindow.update();
|
||||
|
||||
int w = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
int h = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
||||
pop_layout.measure(w, h);
|
||||
//获取PopWindow宽和高,Constants.xIndex手势X轴Constants.xIndey手势Y轴
|
||||
int mHeight = pop_layout.getMeasuredHeight();
|
||||
int mWidth = pop_layout.getMeasuredWidth();
|
||||
//偏移量
|
||||
getActivity().getWindowManager();
|
||||
int xoff = Constants.xIndex - 2 * mWidth - 70;
|
||||
int yoff = 0 - (pop_layout.getHeight() - Constants.yindex) - 70;
|
||||
mPopupWindow.showAsDropDown(v, xoff, yoff, Gravity.RIGHT);
|
||||
|
||||
TextView tv_withdraw;
|
||||
CardView cv_chat;
|
||||
cv_chat = (CardView) pop_layout.findViewById(R.id.cv_chat);
|
||||
tv_withdraw = (TextView) pop_layout.findViewById(R.id.tv_withdraw);
|
||||
|
||||
// cv_chat.setBackgroundColor(getResources().getColor(R.color.gray_dcdcdc));
|
||||
tv_withdraw.setText(getResources().getString(R.string.delete));
|
||||
tv_withdraw.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mAdapter != null) {
|
||||
mAdapter.removeItem(position);
|
||||
cleanMessage(bean, "");
|
||||
removeMessage(bean);
|
||||
}
|
||||
mPopupWindow.dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//清除指定会话未读数
|
||||
private void cleanMessage(ImUserBean bean, String toId) {
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
String targetId = "";
|
||||
if (bean != null) {
|
||||
targetId = bean.getUserId();
|
||||
} else {
|
||||
targetId = toId;
|
||||
}
|
||||
long timestamp = new Date().getTime();
|
||||
|
||||
RongIMClient.getInstance().clearMessagesUnreadStatus(conversationType, targetId, timestamp, new RongIMClient.OperationCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.i("Log", "清除未读数成功");
|
||||
getChatPoint();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
Log.i("Log", "清除未读数失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//删除会话
|
||||
private void removeMessage(ImUserBean bean) {
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
String targetId = bean.getUserId();
|
||||
long timestamp = new Date().getTime();
|
||||
|
||||
RongIMClient.getInstance().removeConversation(conversationType, targetId, new RongIMClient.ResultCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean success) {
|
||||
listUserBean.remove(bean);
|
||||
getChatPoint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
EventBus.getDefault().register(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getChatPoint();
|
||||
loadData();
|
||||
if (!"".equals(Constants.nowSendUid)) {
|
||||
getOneUserChat(Constants.nowSendUid);
|
||||
Constants.nowSendUid = "";
|
||||
}
|
||||
if (!"".equals(Constants.isSetRemark)) {
|
||||
for (int i = 0; i < listUserBean.size(); i++) {
|
||||
if (Constants.isSetRemark.equals(listUserBean.get(i).getUserId())) {
|
||||
listUserBean.get(i).setRemarks(Constants.isSetRemarkText);
|
||||
mHandler.sendEmptyMessage(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
//存储备注名称
|
||||
// public void saveNameRemarks(List<ChatRemarksBean> remarksList) {
|
||||
// Gson gson = new Gson();
|
||||
// String str = gson.toJson(remarksList);
|
||||
// //用Sp或者sqlit也一样,已经变成json格式的一串字符串了
|
||||
// sharedPreferences.edit().putString("remarksList", str);
|
||||
// }
|
||||
|
||||
//取出备注的名称
|
||||
public void getNameRemarks() {
|
||||
Gson gson = new Gson();
|
||||
Type type = new TypeToken<List<ChatRemarksBean>>() {
|
||||
}.getType();
|
||||
Constants.remarksListNow = gson.fromJson(SpUtil.getStringValue("remarksList"), type);
|
||||
}
|
||||
|
||||
//粘性事件
|
||||
@Subscribe(threadMode = ThreadMode.MAIN, sticky = true)
|
||||
public void onRongIMEvent(RongIMEvent event) {
|
||||
if (event.isInitRongIM()) {
|
||||
onResume();
|
||||
}
|
||||
//删除粘性事件
|
||||
RongIMEvent stickyEvent = EventBus.getDefault().getStickyEvent(RongIMEvent.class);
|
||||
if (stickyEvent != null) {
|
||||
EventBus.getDefault().removeStickyEvent(stickyEvent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.adapter.ViewPagerAdapter;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.views.AbsCommonViewHolder;
|
||||
import com.yunbao.live.views.LiveMyLiveRoomViewHolder;
|
||||
import com.yunbao.live.views.LiveMyRoomViewHolder;
|
||||
|
||||
import net.lucode.hackware.magicindicator.MagicIndicator;
|
||||
import net.lucode.hackware.magicindicator.ViewPagerHelper;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.SimplePagerTitleView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
*/
|
||||
|
||||
public class RoomManageActivity extends AbsActivity {
|
||||
|
||||
private static final int PAGE_COUNT = 2;
|
||||
private List<FrameLayout> mViewList;
|
||||
private MagicIndicator mIndicator;
|
||||
private AbsCommonViewHolder[] mViewHolders;
|
||||
private ViewPager mViewPager;
|
||||
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_room_manage;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
mViewList = new ArrayList<>();
|
||||
for (int i = 0; i < PAGE_COUNT; i++) {
|
||||
FrameLayout frameLayout = new FrameLayout(mContext);
|
||||
frameLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
||||
mViewList.add(frameLayout);
|
||||
}
|
||||
mViewPager = (ViewPager) findViewById(R.id.viewPager);
|
||||
if (PAGE_COUNT > 1) {
|
||||
mViewPager.setOffscreenPageLimit(PAGE_COUNT - 1);
|
||||
}
|
||||
mViewPager.setAdapter(new ViewPagerAdapter(mViewList));
|
||||
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
loadPageData(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageScrollStateChanged(int state) {
|
||||
|
||||
}
|
||||
});
|
||||
mViewHolders = new AbsCommonViewHolder[PAGE_COUNT];
|
||||
mIndicator = (MagicIndicator) findViewById(R.id.indicator);
|
||||
final String[] titles = new String[]{WordUtil.getString(R.string.live_my_live_room), WordUtil.getString(R.string.live_my_room)};
|
||||
CommonNavigator commonNavigator = new CommonNavigator(mContext);
|
||||
commonNavigator.setAdapter(new CommonNavigatorAdapter() {
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return titles.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPagerTitleView getTitleView(Context context, final int index) {
|
||||
SimplePagerTitleView simplePagerTitleView = new ColorTransitionPagerTitleView(context);
|
||||
simplePagerTitleView.setNormalColor(ContextCompat.getColor(mContext, R.color.gray1));
|
||||
simplePagerTitleView.setSelectedColor(ContextCompat.getColor(mContext, R.color.textColor));
|
||||
simplePagerTitleView.setText(titles[index]);
|
||||
simplePagerTitleView.setTextSize(17);
|
||||
simplePagerTitleView.getPaint().setFakeBoldText(true);
|
||||
simplePagerTitleView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (mViewPager != null) {
|
||||
mViewPager.setCurrentItem(index);
|
||||
}
|
||||
}
|
||||
});
|
||||
return simplePagerTitleView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPagerIndicator getIndicator(Context context) {
|
||||
LinePagerIndicator linePagerIndicator = new LinePagerIndicator(context);
|
||||
linePagerIndicator.setMode(LinePagerIndicator.MODE_EXACTLY);
|
||||
linePagerIndicator.setLineWidth(DpUtil.dp2px(18));
|
||||
linePagerIndicator.setRoundRadius(DpUtil.dp2px(2));
|
||||
linePagerIndicator.setColors(ContextCompat.getColor(mContext, R.color.global));
|
||||
return linePagerIndicator;
|
||||
}
|
||||
|
||||
});
|
||||
mIndicator.setNavigator(commonNavigator);
|
||||
LinearLayout titleContainer = commonNavigator.getTitleContainer();
|
||||
titleContainer.setShowDividers(LinearLayout.SHOW_DIVIDER_MIDDLE);
|
||||
titleContainer.setDividerDrawable(new ColorDrawable() {
|
||||
@Override
|
||||
public int getIntrinsicWidth() {
|
||||
return DpUtil.dp2px(30);
|
||||
}
|
||||
});
|
||||
ViewPagerHelper.bind(mIndicator, mViewPager);
|
||||
loadPageData(0);
|
||||
}
|
||||
|
||||
|
||||
private void loadPageData(int position) {
|
||||
if (mViewHolders == null) {
|
||||
return;
|
||||
}
|
||||
AbsCommonViewHolder vh = mViewHolders[position];
|
||||
if (vh == null) {
|
||||
if (mViewList != null && position < mViewList.size()) {
|
||||
FrameLayout parent = mViewList.get(position);
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
if (position == 0) {
|
||||
vh = new LiveMyLiveRoomViewHolder(mContext, parent);
|
||||
} else if (position == 1) {
|
||||
vh = new LiveMyRoomViewHolder(mContext, parent);
|
||||
}
|
||||
if (vh == null) {
|
||||
return;
|
||||
}
|
||||
mViewHolders[position] = vh;
|
||||
vh.addToParent();
|
||||
vh.subscribeActivityLifeCycle();
|
||||
}
|
||||
}
|
||||
if (vh != null) {
|
||||
vh.loadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.View;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveAdminRoomBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
*/
|
||||
|
||||
public class RoomManageDetailActivity extends AbsActivity implements View.OnClickListener {
|
||||
|
||||
public static void forward(Context context, LiveAdminRoomBean bean) {
|
||||
Intent intent = new Intent(context, RoomManageDetailActivity.class);
|
||||
intent.putExtra(Constants.LIVE_ADMIN_ROOM, bean);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
|
||||
private LiveAdminRoomBean mAdminRoomBean;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_room_manage_detail;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
mAdminRoomBean = getIntent().getParcelableExtra(Constants.LIVE_ADMIN_ROOM);
|
||||
if (mAdminRoomBean == null) {
|
||||
return;
|
||||
}
|
||||
setTitle(StringUtil.contact(mAdminRoomBean.getUserNiceName(), WordUtil.getString(R.string.live_admin_room)));
|
||||
findViewById(R.id.btn_user_shut_up).setOnClickListener(this);
|
||||
findViewById(R.id.btn_user_black).setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
int i = v.getId();
|
||||
if (i == R.id.btn_user_shut_up) {
|
||||
LiveShutUpActivity.forward(mContext, mAdminRoomBean.getLiveUid());
|
||||
} else if (i == R.id.btn_user_black) {
|
||||
LiveBlackActivity.forward(mContext, mAdminRoomBean.getLiveUid());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.activity.SelectImageActivity;
|
||||
import com.yunbao.common.bean.ImageEntity;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.views.SystemMessageViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
import io.rong.imlib.RongCoreClient;
|
||||
import io.rong.imlib.RongIMClient;
|
||||
import io.rong.imlib.listener.OnReceiveMessageWrapperListener;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.ReceivedProfile;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/24.
|
||||
*/
|
||||
|
||||
public class SystemMessageActivity extends AbsActivity {
|
||||
|
||||
public static SystemMessageViewHolder mSystemMessageViewHolder;
|
||||
public static String type;//-1=单聊消息,1=系统消息,2=互动消息,3=猜你喜欢,-2=web页面打开
|
||||
public static String type2 = "0";//判断是否注册监听
|
||||
public static String nowUid, nowTitle, mowHeadImg;
|
||||
// public static int mowMsgId;
|
||||
|
||||
public static void forward(Context context, String type, String uid, String title, String headImg) {
|
||||
context.startActivity(new Intent(context, SystemMessageActivity.class)
|
||||
.putExtra("type", type)
|
||||
.putExtra("uid", uid)
|
||||
.putExtra("title", title)
|
||||
.putExtra("headImg", headImg));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_sys_msg;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
|
||||
Constants.isSetRemark = "";
|
||||
Constants.isSetRemarkText = "";
|
||||
type = getIntent().getStringExtra("type");
|
||||
if ("-2".equals(type)) {
|
||||
type = "-1";
|
||||
type2 = "-2";
|
||||
RongCoreClient.addOnReceiveMessageListener(listener);
|
||||
} else {
|
||||
type2 = "0";
|
||||
}
|
||||
nowUid = getIntent().getStringExtra("uid");
|
||||
nowTitle = getIntent().getStringExtra("title");
|
||||
mowHeadImg = getIntent().getStringExtra("headImg");
|
||||
// mowMsgId = getIntent().getIntExtra("headImg", 0);
|
||||
// if ("".equals(nowUid)) {
|
||||
mSystemMessageViewHolder = new SystemMessageViewHolder(mContext, (ViewGroup) findViewById(R.id.root), SystemMessageActivity.this);
|
||||
mSystemMessageViewHolder.addToParent();
|
||||
mSystemMessageViewHolder.loadData();
|
||||
// } else {
|
||||
// mSystemMessageViewHolder = new SystemMessageViewHolder(mContext, (ViewGroup) findViewById(R.id.root));
|
||||
// mSystemMessageViewHolder.addToParent();
|
||||
// mSystemMessageViewHolder.loadData();
|
||||
// }
|
||||
init();
|
||||
|
||||
mSystemMessageViewHolder.btn_back.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
finish();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//更新新消息
|
||||
public void getNewMsg(Message message) {
|
||||
if (mSystemMessageViewHolder != null && !"".equals(nowUid)) {
|
||||
mSystemMessageViewHolder.intoMsg(message);
|
||||
}
|
||||
}
|
||||
|
||||
//撤回消息
|
||||
public void getWithdrawMsg(int messageId) {
|
||||
if (mSystemMessageViewHolder != null && !"".equals(nowUid)) {
|
||||
mSystemMessageViewHolder.withdrawMsg(messageId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mSystemMessageViewHolder != null) {
|
||||
mSystemMessageViewHolder.release();
|
||||
}
|
||||
nowUid = "";
|
||||
nowTitle = "";
|
||||
Constants.nowId = "";
|
||||
Constants.remarks = "";
|
||||
Constants.isAdmin = "";
|
||||
if ("-2".equals(type2)) {
|
||||
RongCoreClient.removeOnReceiveMessageListener(listener);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (data != null) {
|
||||
ArrayList<ImageEntity> selectImages = data.getParcelableArrayListExtra(SelectImageActivity.EXTRA_RESULT);
|
||||
sendBack(requestCode, selectImages);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendBack(int requestCode, ArrayList<ImageEntity> selectImages) {
|
||||
mSystemMessageViewHolder.mSelectImages.clear();
|
||||
mSystemMessageViewHolder.mSelectImages.addAll(selectImages);
|
||||
Log.i("Log", "mSystemMessageViewHolder.mSelectImages=" + mSystemMessageViewHolder.mSelectImages.size());
|
||||
if (mSystemMessageViewHolder.mSelectImages.size() > 0) {
|
||||
//发送
|
||||
if (requestCode == mSystemMessageViewHolder.SELECT_IMAGE_REQUEST) {
|
||||
Log.i("Log", "发送图片");
|
||||
mSystemMessageViewHolder.getPiclist();
|
||||
} else if (requestCode == mSystemMessageViewHolder.SELECT_VIDEO_REQUEST) {
|
||||
Log.i("Log", "发送视频");
|
||||
mSystemMessageViewHolder.mediaVideo(mSystemMessageViewHolder.mSelectImages.get(0).getPath());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取新信息
|
||||
private OnReceiveMessageWrapperListener listener = new OnReceiveMessageWrapperListener() {
|
||||
@Override
|
||||
public void onReceivedMessage(Message message, ReceivedProfile profile) {
|
||||
Log.i("Log", "message=" + message);
|
||||
if (message.getTargetId() != null && !"".endsWith(message.getTargetId())) {
|
||||
String firstIndex = message.getTargetId().substring(0, 1);
|
||||
if (!"g".endsWith(firstIndex) && !"__system__".endsWith(message.getTargetId())) {
|
||||
String firstIndexRM = "";
|
||||
String firstIndexRM2 = "";
|
||||
if (message.getObjectName().equals("RC:TxtMsg")) {
|
||||
TextMessage rongMsg = (TextMessage) message.getContent();
|
||||
if (rongMsg.getContent().length() > 4) {
|
||||
firstIndexRM = rongMsg.getContent().substring(0, 5);
|
||||
}
|
||||
if (rongMsg.getContent().length() > 9) {
|
||||
firstIndexRM2 = rongMsg.getContent().substring(0, 10);
|
||||
}
|
||||
}
|
||||
if (!"{\"msg".equals(firstIndexRM) && !"{\"retcode\"".equals(firstIndexRM2)) {
|
||||
if (message.getObjectName().equals("RC:TxtMsg")) {
|
||||
getNewMsg(message);
|
||||
} else if (message.getObjectName().equals("RC:ImgMsg")) {
|
||||
getNewMsg(message);
|
||||
} else if (message.getObjectName().equals("RC:SightMsg")) {
|
||||
getNewMsg(message);
|
||||
}
|
||||
cleanMessage(message.getTargetId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//清除指定会话未读数
|
||||
private void cleanMessage(String toId) {
|
||||
Conversation.ConversationType conversationType = Conversation.ConversationType.PRIVATE;
|
||||
String targetId = toId;
|
||||
long timestamp = new Date().getTime();
|
||||
|
||||
RongIMClient.getInstance().clearMessagesUnreadStatus(conversationType, targetId, timestamp, new RongIMClient.OperationCallback() {
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
Log.i("Log", "清除未读数成功");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(RongIMClient.ErrorCode errorCode) {
|
||||
Log.i("Log", "清除未读数失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.MediaStore;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.R;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.live.dialog.LiveUserDialogFragment;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/25.
|
||||
* 我的徽章 h5页面
|
||||
*/
|
||||
|
||||
public class WebViewActivityMedal extends AbsActivity {
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private WebView mWebView;
|
||||
private final int CHOOSE = 100;//Android 5.0以下的
|
||||
private final int CHOOSE_ANDROID_5 = 200;//Android 5.0以上的
|
||||
private ValueCallback<Uri> mValueCallback;
|
||||
private ValueCallback<Uri[]> mValueCallback2;
|
||||
private ImageView mIvQuestion;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_webview_medal;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
String url = getIntent().getStringExtra(Constants.URL);
|
||||
L.e("H5---3>" + url);
|
||||
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
|
||||
mIvQuestion = findViewById(R.id.btn_question);
|
||||
mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
|
||||
ivQuestionClick();
|
||||
mWebView = new WebView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
params.topMargin = DpUtil.dp2px(1);
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
rootView.addView(mWebView);
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
L.e("H5-------->" + url);
|
||||
if (url.startsWith(Constants.COPY_PREFIX)) {
|
||||
String content = url.substring(Constants.COPY_PREFIX.length());
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
copy(content);
|
||||
}
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
setTitle(view.getTitle());
|
||||
}
|
||||
});
|
||||
mWebView.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
if (newProgress == 100) {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
} else {
|
||||
mProgressBar.setProgress(newProgress);
|
||||
}
|
||||
}
|
||||
|
||||
//以下是在各个Android版本中 WebView调用文件选择器的方法
|
||||
// For Android < 3.0
|
||||
public void openFileChooser(ValueCallback<Uri> valueCallback) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
// For Android >= 3.0
|
||||
public void openFileChooser(ValueCallback valueCallback, String acceptType) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
//For Android >= 4.1
|
||||
public void openFileChooser(ValueCallback<Uri> valueCallback,
|
||||
String acceptType, String capture) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
// For Android >= 5.0
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public boolean onShowFileChooser(WebView webView,
|
||||
ValueCallback<Uri[]> filePathCallback,
|
||||
FileChooserParams fileChooserParams) {
|
||||
mValueCallback2 = filePathCallback;
|
||||
Intent intent = fileChooserParams.createIntent();
|
||||
startActivityForResult(intent, CHOOSE_ANDROID_5);
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
mWebView.loadUrl(url);
|
||||
}
|
||||
|
||||
private void ivQuestionClick() {
|
||||
mIvQuestion.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
MedalQuestionWebViewActivity.forward(mContext, HtmlConfig.MEDAL_QUESTION);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//js调用原生
|
||||
public class JsInteration {
|
||||
@JavascriptInterface
|
||||
public String androidMethodLookLive(String uId, String liveId, String isLiving) {
|
||||
//跳转个人主页
|
||||
RouteUtil.forwardUserHome(mContext, liveId, 0);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidMethodLookToLive(String liveId) {
|
||||
//看直播
|
||||
gotoLive(liveId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private LiveRoomCheckLivePresenter mCheckLivePresenter;
|
||||
|
||||
private void gotoLive(final String live_id) {
|
||||
LiveHttpUtil.getLiveInfo(live_id, new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if (code == 0 && info.length > 0) {
|
||||
LiveBean liveBean = JSON.parseObject(info[0], LiveBean.class);
|
||||
|
||||
if (mCheckLivePresenter == null) {
|
||||
mCheckLivePresenter = new LiveRoomCheckLivePresenter(mContext, new LiveRoomCheckLivePresenter.ActionListener() {
|
||||
@Override
|
||||
public void onLiveRoomChanged(LiveBean liveBean, int liveType, int liveTypeVal, int liveSdk) {
|
||||
if (liveBean == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
LiveAudienceActivity.forward(mContext, liveBean, liveType, liveTypeVal, "", 0, liveSdk);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
mCheckLivePresenter.checkLive(liveBean);
|
||||
} else {
|
||||
RouteUtil.forwardUserHome(mContext, live_id,0);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 显示个人资料弹窗
|
||||
*/
|
||||
private void showUserDialog(String toUid, String liveId) {
|
||||
if (!TextUtils.isEmpty(liveId) && !TextUtils.isEmpty(toUid)) {
|
||||
LiveUserDialogFragment fragment = new LiveUserDialogFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Constants.LIVE_UID, liveId);
|
||||
bundle.putString(Constants.STREAM, "");
|
||||
bundle.putString(Constants.TO_UID, toUid);
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((WebViewActivityMedal) mContext).getSupportFragmentManager(), "LiveUserDialogFragment");
|
||||
}
|
||||
}
|
||||
|
||||
private void openImageChooserActivity(ValueCallback<Uri> valueCallback) {
|
||||
mValueCallback = valueCallback;
|
||||
Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT < 19) {
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
} else {
|
||||
intent.setAction(Intent.ACTION_PICK);
|
||||
intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
}
|
||||
intent.setType("image/*");
|
||||
startActivityForResult(Intent.createChooser(intent, WordUtil.getString(R.string.choose_flie)), CHOOSE);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
super.onActivityResult(requestCode, resultCode, intent);
|
||||
switch (requestCode) {
|
||||
case CHOOSE://5.0以下选择图片后的回调
|
||||
processResult(resultCode, intent);
|
||||
break;
|
||||
case CHOOSE_ANDROID_5://5.0以上选择图片后的回调
|
||||
processResultAndroid5(resultCode, intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void processResult(int resultCode, Intent intent) {
|
||||
if (mValueCallback == null) {
|
||||
return;
|
||||
}
|
||||
if (resultCode == RESULT_OK && intent != null) {
|
||||
Uri result = intent.getData();
|
||||
mValueCallback.onReceiveValue(result);
|
||||
} else {
|
||||
mValueCallback.onReceiveValue(null);
|
||||
}
|
||||
mValueCallback = null;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private void processResultAndroid5(int resultCode, Intent intent) {
|
||||
if (mValueCallback2 == null) {
|
||||
return;
|
||||
}
|
||||
if (resultCode == RESULT_OK && intent != null) {
|
||||
mValueCallback2.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
|
||||
} else {
|
||||
mValueCallback2.onReceiveValue(null);
|
||||
}
|
||||
mValueCallback2 = null;
|
||||
}
|
||||
|
||||
protected boolean canGoBack() {
|
||||
return mWebView != null && mWebView.canGoBack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (isNeedExitActivity()) {
|
||||
finish();
|
||||
} else {
|
||||
if (canGoBack()) {
|
||||
mWebView.goBack();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isNeedExitActivity() {
|
||||
if (mWebView != null) {
|
||||
String url = mWebView.getUrl();
|
||||
if (!TextUtils.isEmpty(url)) {
|
||||
return url.contains("g=Appapi&m=Auth&a=success")//身份认证成功页面
|
||||
|| url.contains("g=Appapi&m=Family&a=home");//家族申请提交成功页面
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void forward(Context context, String url, boolean addArgs) {
|
||||
if (addArgs) {
|
||||
url += "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
}
|
||||
Intent intent = new Intent(context, WebViewActivityMedal.class);
|
||||
intent.putExtra(Constants.URL, url);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void forward(Context context, String url) {
|
||||
forward(context, url, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mWebView != null) {
|
||||
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
||||
if (parent != null) {
|
||||
parent.removeView(mWebView);
|
||||
}
|
||||
mWebView.destroy();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制到剪贴板
|
||||
*/
|
||||
private void copy(String content) {
|
||||
ClipboardManager cm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
ClipData clipData = ClipData.newPlainText("text", content);
|
||||
cm.setPrimaryClip(clipData);
|
||||
ToastUtil.show(getString(R.string.copy_success));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,328 @@
|
||||
package com.yunbao.live.activity;
|
||||
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.MediaStore;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import static com.yunbao.common.CommonAppContext.logger;
|
||||
import static com.yunbao.common.CommonAppContext.mFirebaseAnalytics;
|
||||
import static com.yunbao.common.utils.RouteUtil.PATH_COIN;
|
||||
|
||||
public class ZhuangBanActivity extends AbsActivity {
|
||||
|
||||
private ProgressBar mProgressBar;
|
||||
private WebView mWebView;
|
||||
private final int CHOOSE = 100;//Android 5.0以下的
|
||||
private final int CHOOSE_ANDROID_5 = 200;//Android 5.0以上的
|
||||
private ValueCallback<Uri> mValueCallback;
|
||||
private ValueCallback<Uri[]> mValueCallback2;
|
||||
private SVGAImageView svga;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.activity_zhuang_ban;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void main() {
|
||||
String url = getIntent().getStringExtra(Constants.URL);
|
||||
L.e("H5---2s>" + url);
|
||||
LinearLayout rootView = (LinearLayout) findViewById(R.id.rootView);
|
||||
mProgressBar = (ProgressBar) findViewById(R.id.progressbar);
|
||||
svga = (SVGAImageView) findViewById(R.id.svga);
|
||||
|
||||
mWebView = new WebView(mContext);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.topMargin = DpUtil.dp2px(1);
|
||||
mWebView.setLayoutParams(params);
|
||||
mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
|
||||
rootView.addView(mWebView);
|
||||
|
||||
mWebView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
L.e("H5-------->" + url);
|
||||
if (url.startsWith(Constants.COPY_PREFIX)) {
|
||||
String content = url.substring(Constants.COPY_PREFIX.length());
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
copy(content);
|
||||
}
|
||||
} else {
|
||||
view.loadUrl(url);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {
|
||||
setTitle(view.getTitle());
|
||||
}
|
||||
});
|
||||
mWebView.setWebChromeClient(new WebChromeClient() {
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
if (newProgress == 100) {
|
||||
mProgressBar.setVisibility(View.GONE);
|
||||
} else {
|
||||
mProgressBar.setProgress(newProgress);
|
||||
}
|
||||
}
|
||||
|
||||
//以下是在各个Android版本中 WebView调用文件选择器的方法
|
||||
// For Android < 3.0
|
||||
public void openFileChooser(ValueCallback<Uri> valueCallback) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
// For Android >= 3.0
|
||||
public void openFileChooser(ValueCallback valueCallback, String acceptType) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
//For Android >= 4.1
|
||||
public void openFileChooser(ValueCallback<Uri> valueCallback,
|
||||
String acceptType, String capture) {
|
||||
openImageChooserActivity(valueCallback);
|
||||
}
|
||||
|
||||
// For Android >= 5.0
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
public boolean onShowFileChooser(WebView webView,
|
||||
ValueCallback<Uri[]> filePathCallback,
|
||||
FileChooserParams fileChooserParams) {
|
||||
mValueCallback2 = filePathCallback;
|
||||
Intent intent = fileChooserParams.createIntent();
|
||||
startActivityForResult(intent, CHOOSE_ANDROID_5);
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
mWebView.addJavascriptInterface(new JsInteration(), "androidObject");
|
||||
mWebView.getSettings().setJavaScriptEnabled(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mWebView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
||||
}
|
||||
mWebView.loadUrl(url);
|
||||
}
|
||||
|
||||
//js调用原生
|
||||
public class JsInteration {
|
||||
@JavascriptInterface
|
||||
public void androidOpeningNoble(String svg) {
|
||||
Log.e("Zhu", "svg" + svg);
|
||||
try {
|
||||
new SVGAParser(mContext).parse(new URL(svg), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
svga.setImageDrawable(drawable);
|
||||
svga.setLoops(1);
|
||||
svga.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
}
|
||||
});
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidGoBack() {
|
||||
ZhuangBanActivity.this.finish();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void AndroidAdjustConsume() {
|
||||
mFirebaseAnalytics.logEvent("FS_event_interaction", null);
|
||||
logger.logEvent("FB_event_interaction", null);
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("rq2c5n");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void androidGoToRe() {
|
||||
ARouter.getInstance().build(PATH_COIN).withInt("p", 1).navigation();
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
public void onBack() {
|
||||
finish();
|
||||
}
|
||||
}
|
||||
|
||||
// //js调用原生
|
||||
// public class JsInteration {
|
||||
// @JavascriptInterface
|
||||
// public String androidMethodLookLive(String liveId,String isLiving) {
|
||||
// //进入直播间
|
||||
// if (!TextUtils.isEmpty(isLiving) ) {
|
||||
// if (isLiving.equals("1")){
|
||||
// //跳转直播间
|
||||
// }else {
|
||||
// //打开主播个人主页
|
||||
// }
|
||||
// }
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
|
||||
private void openImageChooserActivity(ValueCallback<Uri> valueCallback) {
|
||||
mValueCallback = valueCallback;
|
||||
Intent intent = new Intent();
|
||||
if (Build.VERSION.SDK_INT < 19) {
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
} else {
|
||||
intent.setAction(Intent.ACTION_PICK);
|
||||
intent.setData(MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
|
||||
}
|
||||
intent.setType("image/*");
|
||||
startActivityForResult(Intent.createChooser(intent, WordUtil.getString(R.string.choose_flie)), CHOOSE);
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
super.onActivityResult(requestCode, resultCode, intent);
|
||||
switch (requestCode) {
|
||||
case CHOOSE://5.0以下选择图片后的回调
|
||||
processResult(resultCode, intent);
|
||||
break;
|
||||
case CHOOSE_ANDROID_5://5.0以上选择图片后的回调
|
||||
processResultAndroid5(resultCode, intent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void processResult(int resultCode, Intent intent) {
|
||||
if (mValueCallback == null) {
|
||||
return;
|
||||
}
|
||||
if (resultCode == RESULT_OK && intent != null) {
|
||||
Uri result = intent.getData();
|
||||
mValueCallback.onReceiveValue(result);
|
||||
} else {
|
||||
mValueCallback.onReceiveValue(null);
|
||||
}
|
||||
mValueCallback = null;
|
||||
}
|
||||
|
||||
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||
private void processResultAndroid5(int resultCode, Intent intent) {
|
||||
if (mValueCallback2 == null) {
|
||||
return;
|
||||
}
|
||||
if (resultCode == RESULT_OK && intent != null) {
|
||||
mValueCallback2.onReceiveValue(WebChromeClient.FileChooserParams.parseResult(resultCode, intent));
|
||||
} else {
|
||||
mValueCallback2.onReceiveValue(null);
|
||||
}
|
||||
mValueCallback2 = null;
|
||||
}
|
||||
|
||||
protected boolean canGoBack() {
|
||||
return mWebView != null && mWebView.canGoBack();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
if (isNeedExitActivity()) {
|
||||
finish();
|
||||
} else {
|
||||
// if (canGoBack()) {
|
||||
// mWebView.goBack();
|
||||
// } else {
|
||||
finish();
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isNeedExitActivity() {
|
||||
if (mWebView != null) {
|
||||
String url = mWebView.getUrl();
|
||||
if (!TextUtils.isEmpty(url)) {
|
||||
return url.contains("g=Appapi&m=Auth&a=success")//身份认证成功页面
|
||||
|| url.contains("g=Appapi&m=Family&a=home");//家族申请提交成功页面
|
||||
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void forward(Context context, String url, boolean addArgs) {
|
||||
if (addArgs) {
|
||||
url += "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
}
|
||||
Intent intent = new Intent(context, ZhuangBanActivity.class);
|
||||
Log.i("tag", url);
|
||||
intent.putExtra(Constants.URL, url);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void forward(Context context, String url) {
|
||||
forward(context, url, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
if (mWebView != null) {
|
||||
ViewGroup parent = (ViewGroup) mWebView.getParent();
|
||||
if (parent != null) {
|
||||
parent.removeView(mWebView);
|
||||
}
|
||||
mWebView.destroy();
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制到剪贴板
|
||||
*/
|
||||
private void copy(String content) {
|
||||
ClipboardManager cm = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
|
||||
ClipData clipData = ClipData.newPlainText("text", content);
|
||||
cm.setPrimaryClip(clipData);
|
||||
ToastUtil.show(getString(R.string.copy_success));
|
||||
}
|
||||
|
||||
}
|
||||
119
live/src/main/java/com/yunbao/live/adapter/BeautyAdapter.java
Normal file
119
live/src/main/java/com/yunbao/live/adapter/BeautyAdapter.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.BeautyFaceBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BeautyAdapter extends RecyclerView.Adapter<BeautyAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<BeautyFaceBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
//选中的
|
||||
public int choice = 0;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<BeautyFaceBean> mOnItemClickListener;
|
||||
|
||||
public BeautyAdapter(Context context) {
|
||||
mContext = context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mList = new ArrayList<>();
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
BeautyFaceBean bean = mList.get(position);
|
||||
choice = position;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean, position);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<BeautyFaceBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
|
||||
public void setList(List<BeautyFaceBean> list) {
|
||||
Log.i("tags",choice+"choice");
|
||||
if (list != null && list.size() > 0) {
|
||||
mList.clear();
|
||||
mList.addAll(list);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_beauty, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int i) {
|
||||
vh.setData(i);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView mName,value;
|
||||
LinearLayout bg;
|
||||
ImageView ico;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mName = itemView.findViewById(R.id.name);
|
||||
value = itemView.findViewById(R.id.value);
|
||||
bg = itemView.findViewById(R.id.bg);
|
||||
ico = itemView.findViewById(R.id.ico);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(final int position) {
|
||||
itemView.setTag(position);
|
||||
if(mList.get(position).getB_name()!=null){
|
||||
value.setVisibility(View.INVISIBLE);
|
||||
}else{
|
||||
value.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mName.setText(mList.get(position).getTitle());
|
||||
value.setText(mList.get(position).getValue()+"");
|
||||
ico.setImageResource(mList.get(position).getImg_id());
|
||||
if(position == choice){
|
||||
bg.setBackgroundResource(R.mipmap.box_c);
|
||||
}else{
|
||||
bg.setBackgroundResource(R.mipmap.box);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class FragmentAdapter extends FragmentPagerAdapter {
|
||||
|
||||
|
||||
|
||||
private List<Fragment> listfragment; //创建一个List<Fragment>
|
||||
|
||||
//定义构造带两个参数
|
||||
|
||||
public FragmentAdapter(FragmentManager fm, List<Fragment> list) {
|
||||
super(fm);
|
||||
this.listfragment = list;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public Fragment getItem(int arg0) {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return listfragment.get(arg0); //返回第几个fragment
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
public int getCount() {
|
||||
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
return listfragment.size(); //总共有多少个fragment
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
104
live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java
Normal file
104
live/src/main/java/com/yunbao/live/adapter/GiftTopAdapter.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.GiftTopBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GiftTopAdapter extends RecyclerView.Adapter<GiftTopAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<GiftTopBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
//选中的
|
||||
public int choice = 0;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<GiftTopBean> mOnItemClickListener;
|
||||
|
||||
public GiftTopAdapter(Context context) {
|
||||
mContext = context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mList = new ArrayList<>();
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
GiftTopBean bean = mList.get(position);
|
||||
choice = position;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean, position);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<GiftTopBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
|
||||
public void setList(List<GiftTopBean> list) {
|
||||
Log.i("tags",choice+"choice");
|
||||
if (list != null && list.size() > 0) {
|
||||
mList.clear();
|
||||
mList.addAll(list);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_gift_top, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int i) {
|
||||
vh.setData(i);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView mName;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mName = itemView.findViewById(R.id.name);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(final int position) {
|
||||
itemView.setTag(position);
|
||||
mName.setText(mList.get(position).getName());
|
||||
if(position == choice){
|
||||
mName.setTextColor(Color.parseColor("#FFBE41"));
|
||||
}else{
|
||||
mName.setTextColor(Color.parseColor("#FFFFFF"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
150
live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java
Normal file
150
live/src/main/java/com/yunbao/live/adapter/GuardAdapter.java
Normal file
@@ -0,0 +1,150 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.GuardUserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/6.
|
||||
*/
|
||||
|
||||
public class GuardAdapter extends RefreshAdapter<GuardUserBean> {
|
||||
|
||||
private static final int HEAD = 1;
|
||||
private static final int NORMAL = 0;
|
||||
private String mVotesName;
|
||||
private String mWeekContributeString;//本周贡献
|
||||
private boolean mDialog;
|
||||
private Drawable mGuardDrawable0;
|
||||
private Drawable mGuardDrawable1;
|
||||
private Drawable mGuardDrawable2;
|
||||
|
||||
public GuardAdapter(Context context, boolean dialog) {
|
||||
super(context);
|
||||
mDialog = dialog;
|
||||
mVotesName = CommonAppConfig.getInstance().getVotesName();
|
||||
mWeekContributeString = WordUtil.getString(R.string.guard_week_con);
|
||||
mGuardDrawable0 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_0);
|
||||
mGuardDrawable1 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_1);
|
||||
mGuardDrawable2 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == 0) {
|
||||
return HEAD;
|
||||
}
|
||||
return NORMAL;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (viewType == HEAD) {
|
||||
return new HeadVh(mInflater.inflate(mDialog ? R.layout.guard_list_head : R.layout.guard_list_head_2, parent, false));
|
||||
}
|
||||
return new Vh(mInflater.inflate(mDialog ? R.layout.guard_list : R.layout.guard_list_2, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
if (vh instanceof HeadVh) {
|
||||
((HeadVh) vh).setData(mList.get(position));
|
||||
} else {
|
||||
((Vh) vh).setData(mList.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
|
||||
class HeadVh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
TextView mVotes;
|
||||
|
||||
|
||||
public HeadVh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
mVotes = (TextView) itemView.findViewById(R.id.votes);
|
||||
}
|
||||
|
||||
void setData(GuardUserBean bean) {
|
||||
ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
}
|
||||
mVotes.setText(Html.fromHtml( " <font color='#ffdd00'>" + bean.getContribute() + "</font> " + mVotesName));
|
||||
}
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mIcon;
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
TextView mVotes;
|
||||
|
||||
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
mVotes = (TextView) itemView.findViewById(R.id.votes);
|
||||
}
|
||||
|
||||
void setData(GuardUserBean bean) {
|
||||
ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
}
|
||||
mVotes.setText(bean.getContribute() + " " + mVotesName);
|
||||
if (bean.getType() == Constants.GUARD_TYPE_DAY) {
|
||||
mIcon.setImageDrawable(mGuardDrawable0);
|
||||
} else if (bean.getType() == Constants.GUARD_TYPE_MONTH) {
|
||||
mIcon.setImageDrawable(mGuardDrawable1);
|
||||
} else if (bean.getType() == Constants.GUARD_TYPE_YEAR){
|
||||
mIcon.setImageDrawable(mGuardDrawable2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.GuardRightBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/6.
|
||||
*/
|
||||
|
||||
public class GuardRightAdapter extends RecyclerView.Adapter<GuardRightAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<GuardRightBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
// private int mColor1;
|
||||
// private int mColor2;
|
||||
|
||||
public GuardRightAdapter(Context context, List<GuardRightBean> list) {
|
||||
mContext = context;
|
||||
mList = list;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
// mColor1 = ContextCompat.getColor(context, R.color.textColor);
|
||||
// mColor2 = ContextCompat.getColor(context, R.color.gray3);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int position) {
|
||||
return new Vh(mInflater.inflate(R.layout.guard_right, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mIcon;
|
||||
TextView mTitle;
|
||||
TextView mDes;
|
||||
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mTitle = (TextView) itemView.findViewById(R.id.title);
|
||||
mDes = (TextView) itemView.findViewById(R.id.des);
|
||||
}
|
||||
|
||||
void setData(GuardRightBean bean) {
|
||||
mTitle.setText(bean.getTitle());
|
||||
mDes.setText(bean.getDes());
|
||||
if (bean.isChecked()) {
|
||||
ImgLoader.display(mContext, bean.getIcon1(), mIcon);
|
||||
} else {
|
||||
ImgLoader.display(mContext, bean.getIcon0(), mIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
415
live/src/main/java/com/yunbao/live/adapter/ImListAdapter.java
Normal file
415
live/src/main/java/com/yunbao/live/adapter/ImListAdapter.java
Normal file
@@ -0,0 +1,415 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.ImUserBean;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/24.
|
||||
*/
|
||||
|
||||
public class ImListAdapter extends RecyclerView.Adapter
|
||||
// implements ItemSlideHelper.Callback
|
||||
{
|
||||
|
||||
private static final int HEAD = -1;
|
||||
private static final int ANCHOR = -2;
|
||||
private Context mContext;
|
||||
private RecyclerView mRecyclerView;
|
||||
private List<ImUserBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private View.OnClickListener mOnDeleteClickListener;
|
||||
private View.OnLongClickListener mOnDeleteLongClickListener;
|
||||
private ActionListener mActionListener;
|
||||
|
||||
|
||||
public ImListAdapter(Context context) {
|
||||
mContext = context;
|
||||
mList = new ArrayList<>();
|
||||
mList.add(new ImUserBean());
|
||||
mInflater = LayoutInflater.from(context);
|
||||
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
ImUserBean bean = mList.get(position);
|
||||
// if (bean.getUnReadCount() != 0) {
|
||||
// bean.setUnReadCount(0);
|
||||
// notifyItemChanged(position, Constants.PAYLOAD);
|
||||
// }
|
||||
if (mActionListener != null) {
|
||||
mList.get(position).setNum("0");
|
||||
mActionListener.onItemClick(bean);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mOnDeleteClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (position >= 3) {
|
||||
ImUserBean bean = mList.get(position);
|
||||
removeItem(position);
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onItemDelete(bean, mList.size(), v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mOnDeleteLongClickListener = new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (position >= 3) {
|
||||
ImUserBean bean = mList.get(position);
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onItemDelete(bean, position, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void setList(List<ImUserBean> list) {
|
||||
if (list != null && list.size() > 0) {
|
||||
mList.clear();
|
||||
mList.addAll(list);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除数据源
|
||||
*/
|
||||
public void removeAllDate() {
|
||||
if (mList != null) {
|
||||
mList.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
|
||||
public void removeItem(int position) {
|
||||
mList.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
notifyItemRangeChanged(position, mList.size());
|
||||
}
|
||||
|
||||
|
||||
public void insertItem(ImUserBean bean) {
|
||||
int position = mList.size();
|
||||
mList.add(bean);
|
||||
notifyItemInserted(position);
|
||||
}
|
||||
|
||||
// public void resetAllUnReadCount() {
|
||||
// if (mList != null && mList.size() > 0) {
|
||||
// for (ImUserBean bean : mList) {
|
||||
// bean.setUnReadCount(0);
|
||||
// }
|
||||
// notifyDataSetChanged();
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// if (position == 0) {
|
||||
// return HEAD;
|
||||
// } else if (mList.get(position).isAnchorItem()) {
|
||||
// return ANCHOR;
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_im_list, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position, @NonNull List payloads) {
|
||||
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
|
||||
// if (vh instanceof Vh) {
|
||||
((Vh) vh).setData(mList.get(position), position, payload);
|
||||
// } else if (vh instanceof AnchorVh) {
|
||||
// ((AnchorVh) vh).setData(mList.get(position), position, payload);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mAvatar;
|
||||
TextView mName, name_remarks;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
TextView mMsg;
|
||||
TextView mTime;
|
||||
View mBtnDelete;
|
||||
TextView mRedPoint;
|
||||
ImageView img_new;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
name_remarks = (TextView) itemView.findViewById(R.id.name_remarks);
|
||||
mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
mMsg = (TextView) itemView.findViewById(R.id.msg);
|
||||
mTime = (TextView) itemView.findViewById(R.id.time);
|
||||
mRedPoint = (TextView) itemView.findViewById(R.id.red_point);
|
||||
mBtnDelete = itemView.findViewById(R.id.btn_delete);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
itemView.setOnLongClickListener(mOnDeleteLongClickListener);
|
||||
// mBtnDelete.setOnClickListener(mOnDeleteClickListener);
|
||||
|
||||
img_new = (ImageView) itemView.findViewById(R.id.img_new);
|
||||
}
|
||||
|
||||
void setData(ImUserBean bean, int position, Object payload) {
|
||||
itemView.setTag(position);
|
||||
mBtnDelete.setTag(position);
|
||||
if (payload == null) {
|
||||
ImgLoader.displayWithError(mContext, bean.getImage(), mAvatar, R.mipmap.chat_head_mo);
|
||||
|
||||
if (bean.getRemarks() != null) {
|
||||
// name_remarks.setText(bean.getRemarks());
|
||||
mName.setText(bean.getTitle() + "(" + bean.getRemarks() + ")");
|
||||
} else {
|
||||
mName.setText(bean.getTitle());
|
||||
// name_remarks.setText("");
|
||||
}
|
||||
// mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
// LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
// if (levelBean != null) {
|
||||
// ImgLoader.display(mContext,levelBean.getThumb(), mLevel);
|
||||
// }
|
||||
}
|
||||
if (position == 2) {
|
||||
if (bean.getLink() != null && !"".equals(bean.getLink())) {
|
||||
mMsg.setText(bean.getContent());
|
||||
} else {
|
||||
mMsg.setText(mContext.getResources().getString(R.string.chat_like));
|
||||
}
|
||||
} else {
|
||||
if (position == 1) {
|
||||
if (bean.getContent() != null && !"".equals(bean.getContent())) {
|
||||
mMsg.setText(bean.getContent());
|
||||
} else {
|
||||
mMsg.setText(mContext.getResources().getString(R.string.chat_action_no));
|
||||
}
|
||||
} else {
|
||||
if (bean.getContent() != null && bean.getContent().length() > 0) {
|
||||
mMsg.setText(bean.getContent());
|
||||
} else {
|
||||
mMsg.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (position > 2) {
|
||||
mAvatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!"1".equals(bean.getIs_admin())) {
|
||||
RouteUtil.forwardUserHome(mContext, bean.getUserId(), 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
mAvatar.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
if (bean.getAddtime() != null && !bean.getAddtime().equals("0")) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Date currenTimeZone;
|
||||
if (bean.getType().equals("-1")) {
|
||||
currenTimeZone = new Date(Long.parseLong(bean.getAddtime()));
|
||||
} else {
|
||||
currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000"));
|
||||
}
|
||||
mTime.setText(sdf.format(currenTimeZone));
|
||||
}
|
||||
if (bean.getNum() != null && !bean.getNum().equals("0")) {
|
||||
if (mRedPoint.getVisibility() != View.VISIBLE) {
|
||||
mRedPoint.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mRedPoint.setText(String.valueOf(bean.getNum()));
|
||||
} else {
|
||||
if (mRedPoint.getVisibility() == View.VISIBLE) {
|
||||
mRedPoint.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
if ("1".equals(bean.getIs_admin())) {
|
||||
ImgLoader.display(mContext, "https://qny.shayucm.com/Instructors.png", img_new);
|
||||
img_new.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
img_new.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// class AnchorVh extends RecyclerView.ViewHolder {
|
||||
//
|
||||
// ImageView mAvatar;
|
||||
// TextView mName;
|
||||
// ImageView mSex;
|
||||
// ImageView mLevel;
|
||||
// TextView mMsg;
|
||||
// TextView mTime;
|
||||
// TextView mRedPoint;
|
||||
// View mBtnPriChat;
|
||||
//
|
||||
// public AnchorVh(View itemView) {
|
||||
// super(itemView);
|
||||
// mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
// mName = (TextView) itemView.findViewById(R.id.name);
|
||||
// mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
// mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
// mMsg = (TextView) itemView.findViewById(R.id.msg);
|
||||
// mTime = (TextView) itemView.findViewById(R.id.time);
|
||||
// mRedPoint = (TextView) itemView.findViewById(R.id.red_point);
|
||||
//// mBtnPriChat = itemView.findViewById(R.id.btn_pri_chat);
|
||||
// itemView.setOnClickListener(mOnClickListener);
|
||||
// }
|
||||
//
|
||||
// void setData(ImUserBean bean, int position, Object payload) {
|
||||
// itemView.setTag(position);
|
||||
// if (payload == null) {
|
||||
// ImgLoader.display(mContext, bean.getImage(), mAvatar);
|
||||
// mName.setText(bean.getTitle());
|
||||
//// mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
//// LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
//// if (levelBean != null) {
|
||||
//// ImgLoader.display(mContext,levelBean.getThumb(), mLevel);
|
||||
//// }
|
||||
// }
|
||||
// mMsg.setText(bean.getContent());
|
||||
//
|
||||
// if (!bean.getNum().equals("")) {
|
||||
// if (mBtnPriChat.getVisibility() == View.VISIBLE) {
|
||||
// mBtnPriChat.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
// if (!bean.getAddtime().equals("0")) {
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
// Date currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000"));
|
||||
// mTime.setText(sdf.format(currenTimeZone));
|
||||
// }
|
||||
// if (!bean.getNum().equals("")) {
|
||||
// if (mRedPoint.getVisibility() != View.VISIBLE) {
|
||||
// mRedPoint.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// mRedPoint.setText(String.valueOf(bean.getNum()));
|
||||
// } else {
|
||||
// if (mRedPoint.getVisibility() == View.VISIBLE) {
|
||||
// mRedPoint.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// mTime.setText("");
|
||||
// if (mRedPoint.getVisibility() == View.VISIBLE) {
|
||||
// mRedPoint.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
// if (mBtnPriChat.getVisibility() != View.VISIBLE) {
|
||||
// mBtnPriChat.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
|
||||
super.onAttachedToRecyclerView(recyclerView);
|
||||
mRecyclerView = recyclerView;
|
||||
//添加事件监听
|
||||
// mRecyclerView.addOnItemTouchListener(new ItemSlideHelper(mContext, this));
|
||||
}
|
||||
|
||||
// //滑动等 事件操作
|
||||
// @Override
|
||||
// public int getHorizontalRange(RecyclerView.ViewHolder vh) {
|
||||
// return DpUtil.dp2px(60);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public RecyclerView.ViewHolder getChildViewHolder(View childView) {
|
||||
// if (mRecyclerView != null && childView != null) {
|
||||
// return mRecyclerView.getChildViewHolder(childView);
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public View findTargetView(float x, float y) {
|
||||
// return mRecyclerView.findChildViewUnder(x, y);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean useLeftScroll() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLeftScroll(RecyclerView.ViewHolder holder) {
|
||||
//
|
||||
// }
|
||||
|
||||
public interface ActionListener {
|
||||
|
||||
void onItemClick(ImUserBean bean);
|
||||
|
||||
void onItemDelete(ImUserBean bean, int size, View v);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.SystemMessageBean;
|
||||
import com.yunbao.live.views.SystemMessageViewHolder;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 互動信息
|
||||
*/
|
||||
public class InteractionMessageAdapter extends RefreshAdapter<SystemMessageBean> {
|
||||
private SystemMessageViewHolder nowSystemMessageViewHolder;
|
||||
|
||||
public InteractionMessageAdapter(Context context, SystemMessageViewHolder systemMessageViewHolder) {
|
||||
super(context);
|
||||
this.nowSystemMessageViewHolder = systemMessageViewHolder;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new InteractionMessageAdapter.Vh(mInflater.inflate(R.layout.item_interaction_msg, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
((InteractionMessageAdapter.Vh) vh).setData(mList.get(position));
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
RoundedImageView mIco;
|
||||
TextView mContent;
|
||||
TextView mTime;
|
||||
TextView mText;
|
||||
LinearLayout toView, lt_content2, lt_reply, lt_img;
|
||||
ImageView img_content_pic1, img_content_pic2, img_content_pic3, img_content2_pic1, img_content2_pic2, img_item_interaction;
|
||||
RelativeLayout rt_root;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mIco = itemView.findViewById(R.id.ico);
|
||||
mContent = itemView.findViewById(R.id.content);
|
||||
mTime = itemView.findViewById(R.id.time);
|
||||
mText = itemView.findViewById(R.id.text);
|
||||
toView = itemView.findViewById(R.id.to_view);
|
||||
lt_content2 = itemView.findViewById(R.id.lt_content2);
|
||||
img_content_pic1 = itemView.findViewById(R.id.img_content_pic1);
|
||||
img_content_pic2 = itemView.findViewById(R.id.img_content_pic2);
|
||||
img_content_pic3 = itemView.findViewById(R.id.img_content_pic3);
|
||||
img_content2_pic1 = itemView.findViewById(R.id.img_content2_pic1);
|
||||
img_content2_pic2 = itemView.findViewById(R.id.img_content2_pic2);
|
||||
rt_root = itemView.findViewById(R.id.rt_root);
|
||||
lt_reply = itemView.findViewById(R.id.lt_reply);
|
||||
lt_img = itemView.findViewById(R.id.lt_img);
|
||||
img_item_interaction = itemView.findViewById(R.id.img_item_interaction);
|
||||
|
||||
}
|
||||
|
||||
void setData(SystemMessageBean bean) {
|
||||
ImgLoader.displayWithError(mContext, bean.getAvatar_thumb(), mIco, R.mipmap.chat_head_mo);
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Date currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000"));
|
||||
mTime.setText(sdf.format(currenTimeZone));
|
||||
mText.setText(bean.getUser_nicename());
|
||||
mContent.setText(bean.getContent());
|
||||
mIco.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RouteUtil.forwardUserHome(mContext, bean.getUid(), 2);
|
||||
}
|
||||
});
|
||||
if (bean.getDynamic_id() != null && !"0".equals(bean.getDynamic_id())) {
|
||||
lt_img.setVisibility(View.VISIBLE);
|
||||
rt_root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Constants.myIntoIndex = 2;
|
||||
Constants.chatActionUrl=CommonAppConfig.HOST
|
||||
+ "/h5/shequ/index.html#/h5/shequ/details?isDetailsChat=1&dynamic_uid="
|
||||
+ bean.getUid()
|
||||
+ "&id=" + bean.getDynamic_id();
|
||||
RouteUtil.forwardUserHome(mContext, bean.getUid(), 2);
|
||||
}
|
||||
});
|
||||
if (bean.getType() != null && !"0".equals(bean.getType())) {
|
||||
lt_reply.setVisibility(View.VISIBLE);
|
||||
lt_reply.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
nowSystemMessageViewHolder.editPopupWindow(bean.getDynamic_id(), bean.getTo_comment_id());
|
||||
}
|
||||
});
|
||||
} else {
|
||||
lt_reply.setVisibility(View.GONE);
|
||||
}
|
||||
ImgLoader.displayWithError(mContext, bean.getShowImg(), img_item_interaction, R.mipmap.chat_head_mo);
|
||||
} else {
|
||||
lt_img.setVisibility(View.GONE);
|
||||
lt_reply.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/16.
|
||||
*/
|
||||
|
||||
public class LiveAdminListAdapter extends RecyclerView.Adapter<LiveAdminListAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<UserBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<UserBean> mOnItemClickListener;
|
||||
|
||||
public LiveAdminListAdapter(Context context, List<UserBean> list) {
|
||||
mContext=context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mList = list;
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(mList.get(position), position);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<UserBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
public void setList(List<UserBean> list){
|
||||
mList=list;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_admin_list, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position, @NonNull List<Object> payloads) {
|
||||
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
|
||||
vh.setData(mList.get(position), position, payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
View mBtnDel;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mAvatar =(ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName =(TextView) itemView.findViewById(R.id.name);
|
||||
mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
mLevel =(ImageView) itemView.findViewById(R.id.level);
|
||||
mBtnDel = itemView.findViewById(R.id.btn_delete);
|
||||
mBtnDel.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(UserBean bean, int position, Object payload) {
|
||||
mBtnDel.setTag(position);
|
||||
if (payload == null) {
|
||||
ImgLoader.displayAvatar(mContext,bean.getAvatar(), mAvatar);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext,levelBean.getThumb(), mLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeItem(String uid) {
|
||||
if (TextUtils.isEmpty(uid)) {
|
||||
return;
|
||||
}
|
||||
int position = -1;
|
||||
for (int i = 0, size = mList.size(); i < size; i++) {
|
||||
if (uid.equals(mList.get(i).getId())) {
|
||||
position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (position >= 0) {
|
||||
mList.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
notifyItemRangeChanged(position, mList.size(), Constants.PAYLOAD);
|
||||
}
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
mList.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void release(){
|
||||
if(mList!=null){
|
||||
mList.clear();
|
||||
}
|
||||
mOnClickListener=null;
|
||||
mOnItemClickListener=null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveAdminRoomBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
*/
|
||||
|
||||
public class LiveAdminRoomAdapter extends RefreshAdapter<LiveAdminRoomBean> {
|
||||
|
||||
private String mSuffix;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
|
||||
public LiveAdminRoomAdapter(Context context) {
|
||||
super(context);
|
||||
mSuffix = WordUtil.getString(R.string.live_admin_room);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null && mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick((LiveAdminRoomBean) tag, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_admin_room, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
((Vh) vh).setData(mList.get(position));
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView mName;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mName = itemView.findViewById(R.id.name);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveAdminRoomBean bean) {
|
||||
itemView.setTag(bean);
|
||||
mName.setText(StringUtil.contact(bean.getUserNiceName(), mSuffix));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
113
live/src/main/java/com/yunbao/live/adapter/LiveBlackAdapter.java
Normal file
113
live/src/main/java/com/yunbao/live/adapter/LiveBlackAdapter.java
Normal file
@@ -0,0 +1,113 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveShutUpBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
*/
|
||||
|
||||
public class LiveBlackAdapter extends RefreshAdapter<LiveShutUpBean> {
|
||||
|
||||
private View.OnClickListener mOnClickListener;
|
||||
|
||||
public LiveBlackAdapter(Context context) {
|
||||
super(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(mList.get(position), position);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_black, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position, @NonNull List payloads) {
|
||||
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
|
||||
((Vh) vh).setData(mList.get(position), position, payload);
|
||||
}
|
||||
|
||||
public void removeItem(String uid) {
|
||||
if (TextUtils.isEmpty(uid)) {
|
||||
return;
|
||||
}
|
||||
int position = -1;
|
||||
for (int i = 0, size = mList.size(); i < size; i++) {
|
||||
if (uid.equals(mList.get(i).getUid())) {
|
||||
position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (position >= 0) {
|
||||
mList.remove(position);
|
||||
// notifyItemRemoved(position);
|
||||
// notifyItemRangeChanged(position, mList.size(), Constants.PAYLOAD);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
View mBtnDel;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = itemView.findViewById(R.id.avatar);
|
||||
mName = itemView.findViewById(R.id.name);
|
||||
mSex = itemView.findViewById(R.id.sex);
|
||||
mLevel = itemView.findViewById(R.id.level);
|
||||
mBtnDel = itemView.findViewById(R.id.btn_delete);
|
||||
mBtnDel.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveShutUpBean bean, int position, Object payload) {
|
||||
mBtnDel.setTag(position);
|
||||
if (payload == null) {
|
||||
ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
444
live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
Normal file
444
live/src/main/java/com/yunbao/live/adapter/LiveChatAdapter.java
Normal file
@@ -0,0 +1,444 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.Spannable;
|
||||
import android.text.SpannableStringBuilder;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.bean.LiveChatBean;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.utils.LiveTextRender;
|
||||
import com.yunbao.live.utils.LoadDian9TuUtil;
|
||||
import com.yunbao.live.views.LiveRoomViewHolder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/10.
|
||||
*/
|
||||
|
||||
public class LiveChatAdapter extends RecyclerView.Adapter {
|
||||
|
||||
private Context mContext;
|
||||
private List<LiveChatBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<LiveChatBean> mOnItemClickListener;
|
||||
private RecyclerView mRecyclerView;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
|
||||
public LiveChatAdapter(Context context) {
|
||||
mContext = context;
|
||||
mList = new ArrayList<>();
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
LiveChatBean bean = (LiveChatBean) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
if (bean.getType() != LiveChatBean.SYSTEM) {
|
||||
mOnItemClickListener.onItemClick(bean, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<LiveChatBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return mList.get(position).getType();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (viewType == LiveChatBean.RED_PACK) {
|
||||
return new RedPackVh(mInflater.inflate(R.layout.item_live_chat_red_pack, parent, false));
|
||||
} else {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_chat, parent, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
if (vh instanceof Vh) {
|
||||
((Vh) vh).setData(mList.get(position), position);
|
||||
} else if (vh instanceof RedPackVh) {
|
||||
((RedPackVh) vh).setData(mList.get(position));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
|
||||
mRecyclerView = recyclerView;
|
||||
mLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
}
|
||||
|
||||
class RedPackVh extends RecyclerView.ViewHolder {
|
||||
|
||||
LinearLayout mBg;
|
||||
TextView mTextView;
|
||||
|
||||
public RedPackVh(View itemView) {
|
||||
super(itemView);
|
||||
mBg = (LinearLayout) itemView.findViewById(R.id.bg);
|
||||
mTextView = (TextView) itemView.findViewById(R.id.text_txt);
|
||||
}
|
||||
|
||||
void setData(LiveChatBean bean) {
|
||||
mTextView.setText(bean.getContent());
|
||||
}
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
LinearLayout mBg, view_follow, view_action_game, view_zg;
|
||||
TextView mTextView, tv_chat_active_into, tv_chat_avtive_name, tv_zg_anchorname;
|
||||
RoundedImageView avatar;
|
||||
View v_chat_active_close;
|
||||
RecyclerView rv_chat_active;
|
||||
ImageView img_zg_img;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mBg = (LinearLayout) itemView.findViewById(R.id.bg);
|
||||
mTextView = (TextView) itemView.findViewById(R.id.text_txt);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
|
||||
view_follow = (LinearLayout) itemView.findViewById(R.id.view_follow);
|
||||
avatar = (RoundedImageView) itemView.findViewById(R.id.avatar);
|
||||
|
||||
view_action_game = (LinearLayout) itemView.findViewById(R.id.view_action_game);
|
||||
tv_chat_active_into = (TextView) itemView.findViewById(R.id.tv_chat_active_into);
|
||||
tv_chat_avtive_name = (TextView) itemView.findViewById(R.id.tv_chat_avtive_name);
|
||||
v_chat_active_close = (View) itemView.findViewById(R.id.v_chat_active_close);
|
||||
rv_chat_active = (RecyclerView) itemView.findViewById(R.id.rv_chat_active);
|
||||
|
||||
view_zg = (LinearLayout) itemView.findViewById(R.id.view_zg);
|
||||
tv_zg_anchorname = (TextView) itemView.findViewById(R.id.tv_zg_anchorname);
|
||||
img_zg_img = (ImageView) itemView.findViewById(R.id.img_zg_img);
|
||||
|
||||
}
|
||||
|
||||
void setData(final LiveChatBean bean, int position) {
|
||||
itemView.setTag(bean);
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, 0, 0, 12);
|
||||
mBg.setLayoutParams(params);
|
||||
if (bean.getType() == 6) {//大作战活动
|
||||
view_action_game.setVisibility(View.VISIBLE);
|
||||
bean.setHeart(position);
|
||||
params = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, 0, 80, 12);
|
||||
mBg.setLayoutParams(params);
|
||||
|
||||
mTextView.setVisibility(View.GONE);
|
||||
tv_chat_avtive_name.setText(bean.getUserNiceName());
|
||||
|
||||
String wordStore = bean.getMedalLevelImageUrl();
|
||||
String[] word = wordStore.split(",");
|
||||
List<String> wordsList = Arrays.asList(word);
|
||||
Collections.reverse(wordsList);
|
||||
|
||||
ListAdapter listAdapter = new ListAdapter(mContext, wordsList);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext, 10);
|
||||
rv_chat_active.setLayoutManager(gridLayoutManager);
|
||||
rv_chat_active.setAdapter(listAdapter);
|
||||
|
||||
tv_chat_active_into.setOnClickListener(new View.OnClickListener() {//点击打开活动
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String url = CommonAppConfig.HOST + "/" + bean.getContent() + "?uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken() + "&anchorUid=" + LiveRoomViewHolder.mLiveUid;
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", url);
|
||||
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
}
|
||||
});
|
||||
v_chat_active_close.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
removetItem(bean);
|
||||
}
|
||||
});
|
||||
} else if (bean.getType() == -3 || bean.getType() == -4 || bean.getType() == -5) {//整蛊
|
||||
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
||||
//加载.9图聊天气泡
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||
} else {
|
||||
mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
||||
}
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
if (bean.getType() == -3) {
|
||||
String str1 = "整蠱來了! ";
|
||||
String str2 = "向 ";
|
||||
builder.append(str1);
|
||||
int length = builder.length();
|
||||
builder.append(bean.getUserNiceName());
|
||||
builder.setSpan(new ForegroundColorSpan(0xFF73FFFF), length, length + bean.getUserNiceName().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.append(str2);
|
||||
int length2 = builder.length();
|
||||
builder.append(bean.getAnchorName());
|
||||
builder.setSpan(new ForegroundColorSpan(0xFF73FFFF), length2, length2 + bean.getAnchorName().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.append("發出了 " + bean.getContent());
|
||||
mTextView.setText(builder);
|
||||
} else if (bean.getType() == -4) {
|
||||
String str1 = "成功拯救了 ";
|
||||
String str2 = "免除了 ";
|
||||
int length = builder.length();
|
||||
builder.append(bean.getMedal());
|
||||
builder.setSpan(new ForegroundColorSpan(0xFF73FFFF), length, length + bean.getMedal().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.append(str1);
|
||||
int length2 = builder.length();
|
||||
builder.append(bean.getAnchorName());
|
||||
builder.setSpan(new ForegroundColorSpan(0xFF73FFFF), length2, length2 + bean.getAnchorName().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.append(str2 + bean.getUserNiceName() + "發起的" + bean.getContent());
|
||||
mTextView.setText(builder);
|
||||
} else if (bean.getType() == -5) {
|
||||
mBg.setBackground(null);
|
||||
mTextView.setVisibility(View.GONE);
|
||||
view_zg.setVisibility(View.VISIBLE);
|
||||
tv_zg_anchorname.setText(Constants.nowAnchorName);
|
||||
ImgLoader.display(mContext, bean.getPrankIcon(), img_zg_img);
|
||||
}
|
||||
} else if (bean.getType() == -6) {
|
||||
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
||||
//加载.9图聊天气泡
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||
} else {
|
||||
mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
||||
}
|
||||
String str1 = "火力四射,魅力無限!感謝";
|
||||
String str2 = "為本直播間加成熱度";
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
builder.append(str1);
|
||||
int length = builder.length();
|
||||
builder.append(bean.getUserNiceName());
|
||||
builder.setSpan(new ForegroundColorSpan(0xffffff00), length, length + bean.getUserNiceName().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.append(str2);
|
||||
int length2 = builder.length();
|
||||
builder.append(bean.getHot_card());
|
||||
builder.setSpan(new ForegroundColorSpan(0xffffff00), length2, length2 + bean.getHot_card().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
mTextView.setText(builder);
|
||||
} else if (bean.getType() == -7) {
|
||||
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
||||
//加载.9图聊天气泡
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||
} else {
|
||||
mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
||||
}
|
||||
String str1 = "甜蜜不停,愛意不斷!恭喜";
|
||||
String str2 = "在甜蜜約會中搶購到了";
|
||||
String str3 = "!";
|
||||
SpannableStringBuilder builder = new SpannableStringBuilder();
|
||||
builder.append(str1);
|
||||
int length = builder.length();
|
||||
builder.append(bean.getUserNiceName());
|
||||
builder.setSpan(new ForegroundColorSpan(0xffffff00), length, length + bean.getUserNiceName().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
builder.append(str2);
|
||||
int length2 = builder.length();
|
||||
builder.append(bean.getHot_num());
|
||||
builder.append(str3);
|
||||
builder.setSpan(new ForegroundColorSpan(0xffffff00), length2, length2 + bean.getHot_num().length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
mTextView.setText(builder);
|
||||
} else if (bean.getType() == -10) {
|
||||
mBg.setBackground(null);
|
||||
// mTextView.setVisibility(View.GONE);
|
||||
} else if (bean.getType() == LiveChatBean.SYSTEM) {
|
||||
mTextView.setTextColor(0xffffffff);
|
||||
mBg.setBackground(null);
|
||||
mTextView.setText(bean.getContent());
|
||||
} else if (bean.getType() == -1) {//自动消息,关注
|
||||
mBg.setBackground(null);
|
||||
mTextView.setVisibility(View.GONE);
|
||||
view_follow.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(mContext, bean.getId(), avatar);
|
||||
bean.setHeart(position);
|
||||
} else if (bean.getType() == -2) {//自动消息,点击发言
|
||||
mBg.setBackgroundResource(R.drawable.bg_chat_automatic_item);
|
||||
mTextView.setText(R.string.automatic_chat);
|
||||
bean.setHeart(position);
|
||||
} else {
|
||||
// LoadDian9TuUtil.loadDian9Tu(mContext, mBg, "https://qny.shayucm.com/huangdi-new-qipao.png");
|
||||
if (bean.getBubble() != null && !bean.getBubble().equals("")) {
|
||||
//加载.9图聊天气泡
|
||||
LoadDian9TuUtil.loadDian9Tu(mContext, mBg, bean.getBubble(), 1);
|
||||
} else {
|
||||
mBg.setBackgroundResource(R.drawable.bg_live_chat_item);
|
||||
}
|
||||
if (bean.getType() == LiveChatBean.ENTER_ROOM || bean.getType() == LiveChatBean.LIGHT) {
|
||||
mTextView.setTextColor(0xffc8c8c8);
|
||||
} else {
|
||||
mTextView.setTextColor(0xffffffff);
|
||||
}
|
||||
// Log.e("tag",bean.getContent().length()+"");
|
||||
// RecyclerView.LayoutParams linearParams = (RecyclerView.LayoutParams) mBg.getLayoutParams();
|
||||
// linearParams.height = RecyclerView.LayoutParams.WRAP_CONTENT;
|
||||
// // 控件的宽强制设成40
|
||||
// mBg.setLayoutParams(linearParams); //使设置好的布局参数应用到控件
|
||||
// if(bean.getContent().length()<=7) {
|
||||
// RecyclerView.LayoutParams linearParams1 = (RecyclerView.LayoutParams) mBg.getLayoutParams();
|
||||
// linearParams1.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_chat1);
|
||||
// // 控件的宽强制设成40
|
||||
// mBg.setLayoutParams(linearParams1); //使设置好的布局参数应用到控件
|
||||
// }
|
||||
// else if(bean.getContent().length()<=20){
|
||||
// RecyclerView.LayoutParams linearParams = (RecyclerView.LayoutParams) mBg.getLayoutParams();
|
||||
// linearParams.height = mContext.getResources().getDimensionPixelOffset(R.dimen.live_chat2);
|
||||
// // 控件的宽强制设成40
|
||||
// mBg.setLayoutParams(linearParams); //使设置好的布局参数应用到控件
|
||||
// }
|
||||
LiveTextRender.render(mContext, mTextView, bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void insertItem(LiveChatBean bean) {
|
||||
if (bean == null) {
|
||||
return;
|
||||
}
|
||||
int size = mList.size();
|
||||
if (size > 0) {
|
||||
if (mList.get(size - 1).getType() == -10) {
|
||||
mList.remove(size - 1);
|
||||
size = size - 1;
|
||||
}
|
||||
}
|
||||
|
||||
mList.add(bean);
|
||||
notifyItemChanged(size);
|
||||
|
||||
LiveChatBean beanNull = new LiveChatBean();
|
||||
beanNull.setType(-10);
|
||||
mList.add(beanNull);
|
||||
notifyItemChanged(size + 1);
|
||||
|
||||
mRecyclerView.scrollToPosition(size + 1);
|
||||
}
|
||||
|
||||
public void removetItem(LiveChatBean bean) {
|
||||
if (bean == null) {
|
||||
return;
|
||||
}
|
||||
mList.remove(bean.getHeart());
|
||||
notifyItemRemoved(bean.getHeart());
|
||||
notifyItemRangeChanged(bean.getHeart(), getItemCount());
|
||||
}
|
||||
|
||||
public void scrollToBottom() {
|
||||
if (mList.size() > 0) {
|
||||
mRecyclerView.smoothScrollToPosition(mList.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
if (mList != null) {
|
||||
mList.clear();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public class ListAdapter extends
|
||||
RecyclerView.Adapter<ListAdapter.ViewHolder> {
|
||||
private LayoutInflater mInflater;
|
||||
private List<String> mDatas;
|
||||
|
||||
/**
|
||||
* 是否可选
|
||||
*/
|
||||
public ListAdapter(Context context, List<String> datats) {
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mDatas = datats;
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder {
|
||||
ImageView ico;
|
||||
|
||||
public ViewHolder(View arg0) {
|
||||
super(arg0);
|
||||
ico = (ImageView) arg0.findViewById(R.id.ico);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mDatas.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建ViewHolder
|
||||
*/
|
||||
@Override
|
||||
public ListAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
||||
View view = mInflater.inflate(R.layout.item_chat_active,
|
||||
viewGroup, false);
|
||||
ListAdapter.ViewHolder viewHolder = new ListAdapter.ViewHolder(view);
|
||||
|
||||
return viewHolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置值
|
||||
*/
|
||||
@Override
|
||||
public void onBindViewHolder(final ListAdapter.ViewHolder viewHolder, @SuppressLint("RecyclerView") final int position) {
|
||||
int img = 0;
|
||||
if ("1".equals(mDatas.get(position))) {
|
||||
img = R.mipmap.monster_1;
|
||||
} else if ("2".equals(mDatas.get(position))) {
|
||||
img = R.mipmap.monster_2;
|
||||
} else if ("3".equals(mDatas.get(position))) {
|
||||
img = R.mipmap.monster_3;
|
||||
} else if ("4".equals(mDatas.get(position))) {
|
||||
img = R.mipmap.monster_4;
|
||||
} else if ("5".equals(mDatas.get(position))) {
|
||||
img = R.mipmap.monster_5;
|
||||
} else if ("6".equals(mDatas.get(position))) {
|
||||
img = R.mipmap.monster_6;
|
||||
} else if ("7".equals(mDatas.get(position))) {
|
||||
img = R.mipmap.monster_7;
|
||||
} else if ("8".equals(mDatas.get(position))) {
|
||||
img = R.mipmap.monster_8;
|
||||
}
|
||||
if (img != 0) {
|
||||
viewHolder.ico.setBackground(mContext.getResources().getDrawable(img));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveRyAnchorActivity;
|
||||
import com.yunbao.live.bean.LiveFunctionBean;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.yunbao.live.activity.LiveAnchorActivity.leave;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/9.
|
||||
*/
|
||||
|
||||
public class LiveFunctionAdapter extends RecyclerView.Adapter<LiveFunctionAdapter.Vh> {
|
||||
|
||||
private List<LiveFunctionBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<Integer> mOnItemClickListener;
|
||||
|
||||
public LiveFunctionAdapter(Context context, boolean hasGame, boolean openFlash) {
|
||||
mList = new ArrayList<>();
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_BEAUTY, R.mipmap.icon_live_func_beauty, R.string.live_beauty));
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_CAMERA, R.mipmap.icon_live_func_camera, R.string.live_camera));
|
||||
// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_MIRROR, R.mipmap.icon_horizontally, R.string.live_camera_s));
|
||||
|
||||
// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_FLASH, openFlash ? R.mipmap.icon_live_func_flash : R.mipmap.icon_live_func_flash_1, R.string.live_flash));
|
||||
// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_MUSIC, R.mipmap.icon_live_func_music, R.string.live_music));
|
||||
// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_SHARE, R.mipmap.icon_live_func_share, R.string.live_share));
|
||||
|
||||
// // TODO: 2019-11-15
|
||||
// if (hasGame) {//含有游戏
|
||||
// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_GAME, R.mipmap.icon_live_func_game, R.string.live_game));
|
||||
// }
|
||||
// mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_RED_PACK, R.mipmap.icon_live_func_rp, R.string.live_red_pack));
|
||||
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_LINK_MIC, R.mipmap.icon_danrenpk, R.string.live_link_pk));
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_DR, R.mipmap.icon_duorenpk, R.string.live_dr));
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_MIC, R.mipmap.icon_microphone, R.string.live_mic));
|
||||
|
||||
if(LiveRyAnchorActivity.mLivePushViewHolder!=null ) {
|
||||
if (LiveRyAnchorActivity.leave == 0) {
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave, R.string.live_zslk));
|
||||
} else {
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave_p, R.string.live_zslk1));
|
||||
}
|
||||
}else{
|
||||
if(leave == 0) {
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave, R.string.live_zslk));
|
||||
}else{
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZSLK, R.mipmap.icon_leave_p, R.string.live_zslk1));
|
||||
}
|
||||
}
|
||||
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_WISHLIST, R.mipmap.icon_xinyuandan, R.string.live_wishlist));
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_ZG, R.mipmap.icon_zhenggu, R.string.live_zg));
|
||||
mList.add(new LiveFunctionBean(Constants.LIVE_FUNC_WKS, R.mipmap.icon_weekstar, R.string.live_wks));
|
||||
|
||||
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int functionID = (int) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(functionID, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<Integer> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_function, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mIcon;
|
||||
TextView mName;
|
||||
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveFunctionBean bean) {
|
||||
itemView.setTag(bean.getID());
|
||||
mIcon.setImageResource(bean.getIcon());
|
||||
mName.setText(bean.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
248
live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java
Normal file
248
live/src/main/java/com/yunbao/live/adapter/LiveGiftAdapter.java
Normal file
@@ -0,0 +1,248 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.ScaleAnimation;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.common.bean.LiveGiftBean2;
|
||||
import com.yunbao.common.custom.MyRadioButton;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.custom.GiftMarkView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/12.
|
||||
*/
|
||||
|
||||
public class LiveGiftAdapter extends RecyclerView.Adapter<LiveGiftAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<LiveGiftBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private String mCoinName;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private ActionListener mActionListener;
|
||||
private int mCheckedPosition = -1;
|
||||
private ScaleAnimation mAnimation;
|
||||
private View mAnimView;
|
||||
private String mName1,mName2;
|
||||
|
||||
public LiveGiftAdapter(Context context,LayoutInflater inflater, List<LiveGiftBean> list, String coinName) {
|
||||
mContext=context;
|
||||
mInflater = inflater;
|
||||
mList = list;
|
||||
mCoinName = coinName;
|
||||
mName1 = CommonAppConfig.getInstance().getCoinName();
|
||||
mName2 = CommonAppConfig.getInstance().getGoldCoinName();
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
LiveGiftBean bean = mList.get(position);
|
||||
if (!bean.isChecked()) {
|
||||
if (!cancelChecked()) {
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onCancel();
|
||||
}
|
||||
}
|
||||
bean.setChecked(true);
|
||||
notifyItemChanged(position, Constants.PAYLOAD);
|
||||
View view = bean.getView();
|
||||
if (view != null) {
|
||||
view.startAnimation(mAnimation);
|
||||
mAnimView = view;
|
||||
}
|
||||
mCheckedPosition = position;
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onItemChecked(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mAnimation = new ScaleAnimation(0.9f, 1.1f, 0.9f, 1.1f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
|
||||
mAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
|
||||
mAnimation.setDuration(400);
|
||||
mAnimation.setRepeatMode(Animation.REVERSE);
|
||||
mAnimation.setRepeatCount(-1);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_gift, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position, @NonNull List<Object> payloads) {
|
||||
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
|
||||
vh.setData(mList.get(position), position, payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消选中
|
||||
*/
|
||||
public boolean cancelChecked() {
|
||||
if (mCheckedPosition >= 0 && mCheckedPosition < mList.size()) {
|
||||
LiveGiftBean bean = mList.get(mCheckedPosition);
|
||||
if (bean.isChecked()) {
|
||||
View view = bean.getView();
|
||||
if (mAnimView == view) {
|
||||
mAnimView.clearAnimation();
|
||||
} else {
|
||||
if (view != null) {
|
||||
view.clearAnimation();
|
||||
}
|
||||
}
|
||||
mAnimView = null;
|
||||
bean.setChecked(false);
|
||||
notifyItemChanged(mCheckedPosition, Constants.PAYLOAD);
|
||||
}
|
||||
mCheckedPosition = -1;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if (mAnimView != null) {
|
||||
mAnimView.clearAnimation();
|
||||
}
|
||||
if (mList != null) {
|
||||
mList.clear();
|
||||
}
|
||||
mOnClickListener = null;
|
||||
mActionListener = null;
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
GiftMarkView mMark;
|
||||
ImageView mIcon;
|
||||
TextView mName;
|
||||
TextView mPrice;
|
||||
MyRadioButton mRadioButton;
|
||||
TextView tvRedpoint;
|
||||
ImageView mPayico;
|
||||
TextView expire;
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mMark = (GiftMarkView) itemView.findViewById(R.id.mark);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mPrice = (TextView) itemView.findViewById(R.id.price);
|
||||
mRadioButton = (MyRadioButton) itemView.findViewById(R.id.radioButton);
|
||||
tvRedpoint = (TextView) itemView.findViewById(R.id.tvRedpoint);
|
||||
mPayico = (ImageView) itemView.findViewById(R.id.pay_ico);
|
||||
expire = (TextView)itemView.findViewById(R.id.expire);
|
||||
mRadioButton.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveGiftBean bean, int position, Object payload) {
|
||||
if (payload == null) {
|
||||
ImgLoader.display(mContext,bean.getIcon(), mIcon);
|
||||
bean.setView(mIcon);
|
||||
mName.setText(bean.getName());
|
||||
if (bean.getSendType() != null && bean.getSendType().equals("1"))
|
||||
{
|
||||
// mCoinName = mName2;
|
||||
mPayico.setImageResource(R.mipmap.gold_coin);
|
||||
}else {
|
||||
// mCoinName = mName1;
|
||||
mPayico.setImageResource(R.mipmap.diamond);
|
||||
}
|
||||
mPrice.setText(bean.getPrice());
|
||||
expire.setVisibility(View.GONE);
|
||||
if(bean.getEnd_time()!=null){
|
||||
expire.setVisibility(View.VISIBLE);
|
||||
expire.setText(bean.getEnd_time());
|
||||
}
|
||||
//包裹数量
|
||||
if (!TextUtils.isEmpty(bean.getGiftNum())){
|
||||
try {
|
||||
tvRedpoint.setVisibility(View.VISIBLE);
|
||||
tvRedpoint.setText(bean.getGiftNum());
|
||||
}catch (Exception e){e.printStackTrace();}
|
||||
}
|
||||
|
||||
|
||||
int mark=bean.getMark();
|
||||
|
||||
if (bean.getSwf()!=null&&!bean.getSwf().contains("svga")) {
|
||||
if (mark== LiveGiftBean2.MARK_HOT) {
|
||||
mMark.setIconRes(R.mipmap.icon_live_gift_hot, 0);
|
||||
}
|
||||
else if (mark == LiveGiftBean2.MARK_GUARD) {
|
||||
mMark.setIconRes(R.mipmap.icon_live_gift_guard, 0);
|
||||
}
|
||||
else if (mark == LiveGiftBean2.MARK_LUCK) {
|
||||
mMark.setIconRes(R.mipmap.icon_live_gift_luck, 0);
|
||||
}
|
||||
else if (bean.getIsweek()!=null&&bean.getIsweek().equals("1")) {
|
||||
mMark.setIconRes(0,R.mipmap.icon_live_gift_weekstar);
|
||||
}
|
||||
else {
|
||||
mMark.setIconRes(0, 0);
|
||||
}
|
||||
} else {
|
||||
if (mark == LiveGiftBean2.MARK_HOT) {
|
||||
mMark.setIconRes(R.mipmap.icon_live_gift_hot, R.mipmap.icon_live_gift_hao);
|
||||
} else if (mark == LiveGiftBean2.MARK_GUARD) {
|
||||
mMark.setIconRes(R.mipmap.icon_live_gift_guard, R.mipmap.icon_live_gift_hao);
|
||||
}
|
||||
else if (mark == LiveGiftBean2.MARK_LUCK) {
|
||||
mMark.setIconRes(R.mipmap.icon_live_gift_luck, R.mipmap.icon_live_gift_hao);
|
||||
}
|
||||
else if (bean.getIsweek()!=null && bean.getIsweek().equals("1")) {
|
||||
mMark.setIconRes(0,R.mipmap.icon_live_gift_weekstar);
|
||||
}
|
||||
else {
|
||||
mMark.setIconRes(0, R.mipmap.icon_live_gift_hao);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
mRadioButton.setTag(position);
|
||||
mRadioButton.doChecked(bean.isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
public interface ActionListener {
|
||||
void onCancel();
|
||||
|
||||
void onItemChecked(LiveGiftBean bean);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/13.
|
||||
*/
|
||||
|
||||
public class LiveGiftCountAdapter extends RecyclerView.Adapter<LiveGiftCountAdapter.Vh> {
|
||||
|
||||
private String[] mArray;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<String> mOnItemClickListener;
|
||||
|
||||
public LiveGiftCountAdapter(Context context) {
|
||||
mArray = new String[]{"1", "10", "66", "88", "100", "520", "1314"};
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null && mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick((String) tag, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<String> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_gift_count, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mArray[position]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mArray.length;
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(String text) {
|
||||
itemView.setTag(text);
|
||||
((TextView) itemView).setText(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
import androidx.recyclerview.widget.GridLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.LiveGiftBean;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/7/11.
|
||||
*/
|
||||
|
||||
public class LiveGiftPagerAdapter extends PagerAdapter {
|
||||
|
||||
private Context mContext;
|
||||
private List<RecyclerView> mViewList;
|
||||
private static final int GIFT_COUNT = 10;//每页10个礼物
|
||||
private int mPage = -1;
|
||||
private ActionListener mActionListener;
|
||||
|
||||
public LiveGiftPagerAdapter(Context context, List<LiveGiftBean> giftList) {
|
||||
mContext=context;
|
||||
mViewList = new ArrayList<>();
|
||||
int fromIndex = 0;
|
||||
int size = giftList.size();
|
||||
int pageCount = size / GIFT_COUNT;
|
||||
if (size % GIFT_COUNT > 0) {
|
||||
pageCount++;
|
||||
}
|
||||
LayoutInflater inflater = LayoutInflater.from(context);
|
||||
String coinName = CommonAppConfig.getInstance().getCoinName();
|
||||
LiveGiftAdapter.ActionListener actionListener = new LiveGiftAdapter.ActionListener() {
|
||||
@Override
|
||||
public void onCancel() {
|
||||
if (mPage >= 0 && mPage < mViewList.size()) {
|
||||
LiveGiftAdapter adapter = (LiveGiftAdapter) mViewList.get(mPage).getAdapter();
|
||||
if (adapter != null) {
|
||||
adapter.cancelChecked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemChecked(LiveGiftBean bean) {
|
||||
mPage = bean.getPage();
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onItemChecked(bean);
|
||||
}
|
||||
}
|
||||
};
|
||||
for (int i = 0; i < pageCount; i++) {
|
||||
RecyclerView recyclerView = (RecyclerView) inflater.inflate(R.layout.view_gift_page, null, false);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
recyclerView.setLayoutManager(new GridLayoutManager(context, 5, GridLayoutManager.VERTICAL, false));
|
||||
int endIndex = fromIndex + GIFT_COUNT;
|
||||
if (endIndex > size) {
|
||||
endIndex = size;
|
||||
}
|
||||
List<LiveGiftBean> list = new ArrayList<>();
|
||||
for (int j = fromIndex; j < endIndex; j++) {
|
||||
LiveGiftBean bean = giftList.get(j);
|
||||
bean.setPage(i);
|
||||
list.add(bean);
|
||||
}
|
||||
LiveGiftAdapter adapter = new LiveGiftAdapter(mContext,inflater, list, coinName);
|
||||
adapter.setActionListener(actionListener);
|
||||
recyclerView.setAdapter(adapter);
|
||||
mViewList.add(recyclerView);
|
||||
fromIndex = endIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public void notifyRefresh(){
|
||||
if (mViewList != null) {
|
||||
for (RecyclerView recyclerView : mViewList) {
|
||||
LiveGiftAdapter adapter = (LiveGiftAdapter) recyclerView.getAdapter();
|
||||
if (adapter != null) {
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public void notifyRefresh(int position){
|
||||
if (mViewList != null) {
|
||||
for (RecyclerView recyclerView : mViewList) {
|
||||
LiveGiftAdapter adapter = (LiveGiftAdapter) recyclerView.getAdapter();
|
||||
if (adapter != null) {
|
||||
adapter.notifyItemChanged(position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mViewList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view == object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
View view = mViewList.get(position);
|
||||
container.addView(view);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
container.removeView(mViewList.get(position));
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if (mViewList != null) {
|
||||
for (RecyclerView recyclerView : mViewList) {
|
||||
LiveGiftAdapter adapter = (LiveGiftAdapter) recyclerView.getAdapter();
|
||||
if (adapter != null) {
|
||||
adapter.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public interface ActionListener {
|
||||
void onItemChecked(LiveGiftBean bean);
|
||||
}
|
||||
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LivePkBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/15.
|
||||
*/
|
||||
|
||||
public class LivePkAdapter extends RefreshAdapter<LivePkBean> {
|
||||
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private String mLivePkInviteString;//邀请连麦
|
||||
private String mLivePkInviteString2;//已邀请
|
||||
|
||||
public LivePkAdapter(Context context) {
|
||||
super(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null && mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick((LivePkBean) tag, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
mLivePkInviteString = "PK";
|
||||
mLivePkInviteString2 = WordUtil.getString(R.string.live_pk_invite_2);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_pk, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
((Vh) vh).setData(mList.get(position));
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
TextView mBtnInvite;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
mBtnInvite = (TextView) itemView.findViewById(R.id.btn_invite);
|
||||
mBtnInvite.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LivePkBean bean) {
|
||||
mBtnInvite.setTag(bean);
|
||||
ImgLoader.display(mContext,bean.getAvatar(), mAvatar);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getAnchorLevel(bean.getLevelAnchor());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext,levelBean.getThumb(), mLevel);
|
||||
}
|
||||
if (bean.isLinkMic()) {
|
||||
mBtnInvite.setText(mLivePkInviteString2);
|
||||
mBtnInvite.setEnabled(false);
|
||||
} else {
|
||||
mBtnInvite.setText(mLivePkInviteString);
|
||||
mBtnInvite.setEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.bean.LivePromotionBean;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.LivePromotionDialogFragment;
|
||||
|
||||
public class LivePromotionAdapter extends RefreshAdapter<LivePromotionBean> {
|
||||
|
||||
|
||||
String mLiveUid;
|
||||
LivePromotionDialogFragment fs;
|
||||
public LivePromotionAdapter(Context context, String mLiveUids, LivePromotionDialogFragment f) {
|
||||
super(context);
|
||||
mLiveUid=mLiveUids;
|
||||
this.fs = f;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return position;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_promotion, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
((Vh) vh).setData(mList.get(position), position);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
TextView text;
|
||||
ImageView img;
|
||||
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
text = (TextView)itemView.findViewById(R.id.text);
|
||||
img = (ImageView) itemView.findViewById(R.id.img);
|
||||
}
|
||||
|
||||
void setData(final LivePromotionBean bean, int position) {
|
||||
ImgLoader.display(mContext, bean.getActive_img(), img);
|
||||
text.setText(bean.getActive_name());
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
String url = CommonAppConfig.HOST +"/"+bean.getActive_src()+"?uid="+CommonAppConfig.getInstance().getUid()+"&token="+CommonAppConfig.getInstance().getToken()
|
||||
+"&anchorUid="+mLiveUid
|
||||
+"&active_id="+bean.getActive_id();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("url", url);
|
||||
LiveHDDialogFragment fragment = new LiveHDDialogFragment();
|
||||
fragment.setArguments(bundle);
|
||||
fragment.show(((LiveAudienceActivity) mContext).getSupportFragmentManager(), "LiveHDDialogFragment");
|
||||
fs.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.bean.LiveClassBean;
|
||||
import com.yunbao.common.custom.MyRadioButton;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
*/
|
||||
|
||||
public class LiveReadyClassAdapter extends RecyclerView.Adapter<LiveReadyClassAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<LiveClassBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<LiveClassBean> mOnItemClickListener;
|
||||
|
||||
public LiveReadyClassAdapter(Context context, List<LiveClassBean> list) {
|
||||
mContext=context;
|
||||
mList = list;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null && mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick((LiveClassBean) tag, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<LiveClassBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_ready_class, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mList.get(position));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mThumb;
|
||||
TextView mName;
|
||||
TextView mDes;
|
||||
MyRadioButton mRadioButton;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mThumb = (ImageView) itemView.findViewById(R.id.thumb);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mDes = (TextView) itemView.findViewById(R.id.des);
|
||||
mRadioButton = (MyRadioButton) itemView.findViewById(R.id.radioButton);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveClassBean bean) {
|
||||
itemView.setTag(bean);
|
||||
ImgLoader.display(mContext,bean.getThumb(), mThumb);
|
||||
mName.setText(bean.getName());
|
||||
mDes.setText(bean.getDes());
|
||||
mRadioButton.doChecked(bean.isChecked());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/7.
|
||||
*/
|
||||
|
||||
public class LiveReadyShareAdapter extends RecyclerView.Adapter<LiveReadyShareAdapter.Vh> {
|
||||
|
||||
|
||||
// private List<MobBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private int mCheckedPosition = -1;
|
||||
|
||||
public LiveReadyShareAdapter(Context context) {
|
||||
// mList = new ArrayList<>();
|
||||
ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
|
||||
if (configBean != null) {
|
||||
// List<MobBean> list = MobBean.getLiveReadyShareTypeList(configBean.getShareType());
|
||||
// mList.addAll(list);
|
||||
}
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (position == mCheckedPosition) {
|
||||
// mList.get(position).setChecked(false);
|
||||
notifyItemChanged(position);
|
||||
mCheckedPosition = -1;
|
||||
} else {
|
||||
// if (mCheckedPosition >= 0 && mCheckedPosition < mList.size()) {
|
||||
// mList.get(mCheckedPosition).setChecked(false);
|
||||
// notifyItemChanged(mCheckedPosition);
|
||||
// }
|
||||
// mList.get(position).setChecked(true);
|
||||
notifyItemChanged(position);
|
||||
mCheckedPosition = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public String getShareType() {
|
||||
// if (mCheckedPosition >= 0 && mCheckedPosition < mList.size()) {
|
||||
// return mList.get(mCheckedPosition).getType();
|
||||
// }
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_ready_share, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
// vh.setData(mList.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
// return mList.size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
ImageView mImg;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mImg = (ImageView) itemView.findViewById(R.id.img);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
// void setData(MobBean bean, int position) {
|
||||
// itemView.setTag(position);
|
||||
// if (bean.isChecked()) {
|
||||
// mImg.setImageResource(bean.getIcon1());
|
||||
// } else {
|
||||
// mImg.setImageResource(bean.getIcon2());
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveRecordBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/30.
|
||||
*/
|
||||
|
||||
public class LiveRecordAdapter extends RefreshAdapter<LiveRecordBean> {
|
||||
|
||||
private View.OnClickListener mOnClickListener;
|
||||
|
||||
public LiveRecordAdapter(Context context) {
|
||||
super(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!canClick()) {
|
||||
return;
|
||||
}
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
LiveRecordBean bean = (LiveRecordBean) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_record, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
((Vh) vh).setData(mList.get(position));
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView mTitle;
|
||||
TextView mTime;
|
||||
TextView mNum;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mTitle = (TextView) itemView.findViewById(R.id.title);
|
||||
mTime = (TextView) itemView.findViewById(R.id.time);
|
||||
mNum = (TextView) itemView.findViewById(R.id.num);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveRecordBean bean) {
|
||||
itemView.setTag(bean);
|
||||
mTitle.setText(bean.getTitle());
|
||||
mTime.setText(bean.getDateEndTime());
|
||||
mNum.setText(StringUtil.toWan(bean.getNums()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.ImageResultCallback;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.ProcessImageUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveReportActivity;
|
||||
import com.yunbao.live.bean.LiveReportBean;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/12/15.
|
||||
* 增加功能:可以上传3张图片
|
||||
*/
|
||||
|
||||
public class LiveReportAdapter extends RecyclerView.Adapter {
|
||||
|
||||
private static final int HEAD = -1;
|
||||
private static final int FOOT = -2;
|
||||
private static final int NORMAL = 0;
|
||||
private static final int NORMAL_LAST = 1;
|
||||
|
||||
private List<LiveReportBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private Drawable mCheckedDrawable;
|
||||
private Drawable mUnCheckedDrawable;
|
||||
private int mCheckedPosition;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private View.OnClickListener mReportListener;
|
||||
private FootVh mFootVh;
|
||||
private ActionListener mActionListener;
|
||||
private LiveReportBean mCurVideoReportBean;
|
||||
private ProcessImageUtil mImageUtil;
|
||||
private Context mContext;
|
||||
private ImageView mIvPh1,mIvPh2,mIvPh3;
|
||||
private int photoIndex = 0;
|
||||
private File mFile1, mFile2, mFile3;
|
||||
|
||||
public LiveReportAdapter(Context context, List<LiveReportBean> list) {
|
||||
mContext = context;
|
||||
mList = list;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_1);
|
||||
mUnCheckedDrawable = ContextCompat.getDrawable(context, R.mipmap.icon_cash_radio_0);
|
||||
mCheckedPosition = -1;
|
||||
imageUtilInit();
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag == null) {
|
||||
return;
|
||||
}
|
||||
int position = (int) tag;
|
||||
LiveReportBean bean = mList.get(position - 1);
|
||||
if (mCheckedPosition == position) {
|
||||
bean.setChecked(false);
|
||||
notifyItemChanged(position, Constants.PAYLOAD);
|
||||
mCheckedPosition = -1;
|
||||
mCurVideoReportBean = null;
|
||||
} else {
|
||||
if (mCheckedPosition >= 0) {
|
||||
mList.get(mCheckedPosition - 1).setChecked(false);
|
||||
notifyItemChanged(mCheckedPosition, Constants.PAYLOAD);
|
||||
}
|
||||
bean.setChecked(true);
|
||||
notifyItemChanged(position, Constants.PAYLOAD);
|
||||
mCheckedPosition = position;
|
||||
mCurVideoReportBean = bean;
|
||||
}
|
||||
}
|
||||
};
|
||||
mReportListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.btn_report){
|
||||
if (mFootVh != null) {
|
||||
mFootVh.submit();
|
||||
}
|
||||
}else if (v.getId() == R.id.photo1){
|
||||
photoIndex = 0;
|
||||
if (mFootVh != null) {
|
||||
mFootVh.showAddPhoto();
|
||||
}
|
||||
}
|
||||
else if (v.getId() == R.id.photo2){
|
||||
photoIndex = 1;
|
||||
if (mFootVh != null) {
|
||||
mFootVh.showAddPhoto();
|
||||
}
|
||||
}
|
||||
else if (v.getId() == R.id.photo3){
|
||||
photoIndex = 2;
|
||||
if (mFootVh != null) {
|
||||
mFootVh.showAddPhoto();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void imageUtilInit() {
|
||||
mImageUtil = new ProcessImageUtil((LiveReportActivity)mContext);
|
||||
mImageUtil.setImageResultCallback(new ImageResultCallback() {
|
||||
@Override
|
||||
public void beforeCamera() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(File file) {
|
||||
if (file != null) {
|
||||
if (photoIndex == 0) {
|
||||
mFile1 = file;
|
||||
ImgLoader.display(mContext, file, mIvPh1);
|
||||
}
|
||||
else if (photoIndex == 1){
|
||||
mFile2 = file;
|
||||
ImgLoader.display(mContext, file, mIvPh2);
|
||||
}
|
||||
else if (photoIndex == 2){
|
||||
mFile3 = file;
|
||||
ImgLoader.display(mContext, file, mIvPh3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == 0) {
|
||||
return HEAD;
|
||||
} else if (position == mList.size() + 1) {
|
||||
return FOOT;
|
||||
} else {
|
||||
if (position == mList.size()) {
|
||||
return NORMAL_LAST;
|
||||
}
|
||||
return NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
if (viewType == HEAD) {
|
||||
return new HeadVh(mInflater.inflate(R.layout.item_live_report_head, parent, false));
|
||||
} else if (viewType == FOOT) {
|
||||
if (mFootVh == null) {
|
||||
mFootVh = new FootVh(mInflater.inflate(R.layout.item_live_report_foot, parent, false));
|
||||
}
|
||||
return mFootVh;
|
||||
} else {
|
||||
if (viewType == NORMAL_LAST) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_report_2, parent, false));
|
||||
}
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_report, parent, false));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position, @NonNull List payloads) {
|
||||
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
|
||||
if (vh instanceof Vh) {
|
||||
((Vh) vh).setData(mList.get(position - 1), position, payload);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size() + 2;
|
||||
}
|
||||
|
||||
class HeadVh extends RecyclerView.ViewHolder {
|
||||
|
||||
public HeadVh(View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
}
|
||||
|
||||
class FootVh extends RecyclerView.ViewHolder {
|
||||
|
||||
EditText mEditText;
|
||||
|
||||
public FootVh(View itemView) {
|
||||
super(itemView);
|
||||
mEditText = itemView.findViewById(R.id.edit);
|
||||
itemView.findViewById(R.id.btn_report).setOnClickListener(mReportListener);
|
||||
itemView.findViewById(R.id.photo1).setOnClickListener(mReportListener);
|
||||
itemView.findViewById(R.id.photo2).setOnClickListener(mReportListener);
|
||||
itemView.findViewById(R.id.photo3).setOnClickListener(mReportListener);
|
||||
mIvPh1 = itemView.findViewById(R.id.ivPh1);
|
||||
mIvPh2 = itemView.findViewById(R.id.ivPh2);
|
||||
mIvPh3 = itemView.findViewById(R.id.ivPh3);
|
||||
}
|
||||
|
||||
void submit() {
|
||||
String text = mEditText.getText().toString().trim();
|
||||
if (mActionListener != null) {
|
||||
// mActionListener.onReportClick(mCurVideoReportBean, text);
|
||||
mActionListener.onReportClick(mCurVideoReportBean, text,mFile1,mFile2,mFile3);
|
||||
}
|
||||
}
|
||||
void showAddPhoto() {
|
||||
DialogUitl.showStringArrayDialog(mContext, new Integer[]{
|
||||
R.string.camera, R.string.alumb}, new DialogUitl.StringArrayDialogCallback() {
|
||||
@Override
|
||||
public void onItemClick(String text, int tag) {
|
||||
if (tag == R.string.camera) {
|
||||
mImageUtil.getImageByCamera();
|
||||
} else {
|
||||
mImageUtil.getImageByAlumb();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mImg;
|
||||
TextView mText;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mImg = itemView.findViewById(R.id.img);
|
||||
mText = itemView.findViewById(R.id.text);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveReportBean bean, int position, Object payload) {
|
||||
if (payload == null) {
|
||||
itemView.setTag(position);
|
||||
mText.setText(bean.getName());
|
||||
}
|
||||
mImg.setImageDrawable(bean.isChecked() ? mCheckedDrawable : mUnCheckedDrawable);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ActionListener {
|
||||
void onReportClick(LiveReportBean bean, String text);
|
||||
void onReportClick(LiveReportBean bean, String text,File file1,File file2,File file3);
|
||||
}
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.PagerSnapHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.util.SparseArray;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/12/13.
|
||||
*/
|
||||
|
||||
public class LiveRoomScrollAdapter extends RecyclerView.Adapter<LiveRoomScrollAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<LiveBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private int mCurPosition;
|
||||
private boolean mFirstLoad;
|
||||
private SparseArray<Vh> mMap;
|
||||
private LinearLayoutManager mLayoutManager;
|
||||
private ActionListener mActionListener;
|
||||
|
||||
public LiveRoomScrollAdapter(Context context, List<LiveBean> list, int curPosition) {
|
||||
mContext=context;
|
||||
mList = list;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mCurPosition = curPosition;
|
||||
mFirstLoad = true;
|
||||
mMap = new SparseArray<>();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_room, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mList.get(position), position);
|
||||
if (mFirstLoad) {
|
||||
mFirstLoad = false;
|
||||
vh.hideCover();
|
||||
vh.onPageSelected(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ViewGroup mContainer;
|
||||
ImageView mCover;
|
||||
LiveBean mLiveBean;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mContainer = itemView.findViewById(R.id.container);
|
||||
mCover = itemView.findViewById(R.id.cover);
|
||||
}
|
||||
|
||||
void setData(LiveBean bean, int position) {
|
||||
mLiveBean = bean;
|
||||
mMap.put(position, this);
|
||||
ImgLoader.display(mContext,bean.getThumb(), mCover);
|
||||
}
|
||||
|
||||
void onPageOutWindow() {
|
||||
if (mCover != null && mCover.getVisibility() != View.VISIBLE) {
|
||||
mCover.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onPageOutWindow(mLiveBean.getUid());
|
||||
}
|
||||
}
|
||||
|
||||
void onPageSelected(boolean first) {
|
||||
if (mActionListener != null) {
|
||||
mActionListener.onPageSelected(mLiveBean, mContainer, first);
|
||||
}
|
||||
}
|
||||
|
||||
void hideCover() {
|
||||
if (mCover != null && mCover.getVisibility() == View.VISIBLE) {
|
||||
mCover.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void hideCover() {
|
||||
Vh vh = mMap.get(mCurPosition);
|
||||
if (vh != null) {
|
||||
vh.hideCover();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(@NonNull Vh vh) {
|
||||
vh.onPageOutWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttachedToRecyclerView(@NonNull final RecyclerView recyclerView) {
|
||||
mLayoutManager = (LinearLayoutManager) recyclerView.getLayoutManager();
|
||||
mLayoutManager.setInitialPrefetchItemCount(4);
|
||||
recyclerView.scrollToPosition(mCurPosition);
|
||||
PagerSnapHelper pagerSnapHelper = new PagerSnapHelper();
|
||||
pagerSnapHelper.attachToRecyclerView(recyclerView);
|
||||
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
|
||||
int position = mLayoutManager.findFirstCompletelyVisibleItemPosition();
|
||||
if (position >= 0 && mCurPosition != position) {
|
||||
Vh vh = mMap.get(position);
|
||||
if (vh != null) {
|
||||
vh.onPageSelected(false);
|
||||
}
|
||||
mCurPosition = position;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public interface ActionListener {
|
||||
void onPageSelected(LiveBean liveBean, ViewGroup container, boolean first);
|
||||
|
||||
void onPageOutWindow(String liveUid);
|
||||
}
|
||||
|
||||
|
||||
public void setActionListener(ActionListener actionListener) {
|
||||
mActionListener = actionListener;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveRoomTypeBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/8.
|
||||
*/
|
||||
|
||||
public class LiveRoomTypeAdapter extends RecyclerView.Adapter<LiveRoomTypeAdapter.Vh> {
|
||||
|
||||
private List<LiveRoomTypeBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<LiveRoomTypeBean> mOnItemClickListener;
|
||||
private int mCheckedColor;
|
||||
private int mUnCheckedColor;
|
||||
|
||||
public LiveRoomTypeAdapter(Context context, int checkedId) {
|
||||
mCheckedColor = ContextCompat.getColor(context, R.color.global);
|
||||
mUnCheckedColor = 0xffffffff;
|
||||
mList = new ArrayList<>();
|
||||
ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
|
||||
Log.i("tag",configBean.toString());
|
||||
if (configBean != null) {
|
||||
String[][] liveType = configBean.getLiveType();
|
||||
if (liveType != null) {
|
||||
Log.i("tag", Arrays.toString(liveType));
|
||||
List<LiveRoomTypeBean> list = LiveRoomTypeBean.getLiveTypeList(liveType);
|
||||
mList.addAll(list);
|
||||
for (LiveRoomTypeBean bean : mList) {
|
||||
if (bean.getId() == checkedId) {
|
||||
bean.setChecked(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(mList.get(position), position);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<LiveRoomTypeBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_type, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mList.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mIcon;
|
||||
TextView mName;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveRoomTypeBean bean, int position) {
|
||||
itemView.setTag(position);
|
||||
mName.setText(bean.getName());
|
||||
if (bean.isChecked()) {
|
||||
mName.setTextColor(mCheckedColor);
|
||||
mIcon.setImageResource(bean.getCheckedIcon());
|
||||
} else {
|
||||
mName.setTextColor(mUnCheckedColor);
|
||||
mIcon.setImageResource(bean.getUnCheckedIcon());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/19.
|
||||
* 直播分享
|
||||
*/
|
||||
|
||||
public class LiveShareAdapter extends RecyclerView.Adapter<LiveShareAdapter.Vh> {
|
||||
|
||||
// private List<MobBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
// private OnItemClickListener<MobBean> mOnItemClickListener;
|
||||
|
||||
public LiveShareAdapter(Context context,boolean noLink) {
|
||||
// mList = new ArrayList<>();
|
||||
ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
|
||||
if (configBean != null) {
|
||||
// List<MobBean> list = MobBean.getLiveShareTypeList(configBean.getShareType());
|
||||
// mList.addAll(list);
|
||||
}
|
||||
if(!noLink){
|
||||
// MobBean linkBean = new MobBean();
|
||||
// linkBean.setType(Constants.LINK);
|
||||
// linkBean.setName(R.string.copy_link);
|
||||
// linkBean.setIcon1(R.mipmap.icon_share_link);
|
||||
// mList.add(linkBean);
|
||||
}
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
// if (mOnItemClickListener != null) {
|
||||
// mOnItemClickListener.onItemClick((MobBean) tag, 0);
|
||||
// }
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// public void setOnItemClickListener(OnItemClickListener<MobBean> onItemClickListener) {
|
||||
// mOnItemClickListener = onItemClickListener;
|
||||
// }
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_share, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
// vh.setData(mList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
// return mList.size();
|
||||
return 0;
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mIcon;
|
||||
TextView mName;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
// void setData(MobBean bean) {
|
||||
// itemView.setTag(bean);
|
||||
// mIcon.setImageResource(bean.getIcon1());
|
||||
// mName.setText(bean.getName());
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveShutUpBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
*/
|
||||
|
||||
public class LiveShutUpAdapter extends RefreshAdapter<LiveShutUpBean> {
|
||||
|
||||
private View.OnClickListener mOnClickListener;
|
||||
|
||||
public LiveShutUpAdapter(Context context) {
|
||||
super(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(mList.get(position), position);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_shut_up, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position, @NonNull List payloads) {
|
||||
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
|
||||
((Vh) vh).setData(mList.get(position), position, payload);
|
||||
}
|
||||
|
||||
public void removeItem(String uid) {
|
||||
if (TextUtils.isEmpty(uid)) {
|
||||
return;
|
||||
}
|
||||
int position = -1;
|
||||
for (int i = 0, size = mList.size(); i < size; i++) {
|
||||
if (uid.equals(mList.get(i).getUid())) {
|
||||
position = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (position >= 0) {
|
||||
mList.remove(position);
|
||||
// notifyItemRemoved(position);
|
||||
// notifyItemRangeChanged(position, mList.size(), Constants.PAYLOAD);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
View mBtnDel;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = itemView.findViewById(R.id.avatar);
|
||||
mName = itemView.findViewById(R.id.name);
|
||||
mSex = itemView.findViewById(R.id.sex);
|
||||
mLevel = itemView.findViewById(R.id.level);
|
||||
mBtnDel = itemView.findViewById(R.id.btn_delete);
|
||||
mBtnDel.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveShutUpBean bean, int position, Object payload) {
|
||||
mBtnDel.setTag(position);
|
||||
if (payload == null) {
|
||||
ImgLoader.displayAvatar(mContext, bean.getAvatar(), mAvatar);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.bean.ConfigBean;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveTimeChargeBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/8.
|
||||
*/
|
||||
|
||||
public class LiveTimeChargeAdapter extends RecyclerView.Adapter<LiveTimeChargeAdapter.Vh> {
|
||||
|
||||
private List<LiveTimeChargeBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private int mCheckedPosition = -1;
|
||||
private String mCoinName;
|
||||
private int mCheckedColor;
|
||||
private int mUnCheckedColor;
|
||||
|
||||
public LiveTimeChargeAdapter(Context context, int checkedCoin) {
|
||||
mCheckedColor= ContextCompat.getColor(context,R.color.global);
|
||||
mUnCheckedColor= ContextCompat.getColor(context,R.color.textColor);
|
||||
mList = new ArrayList<>();
|
||||
ConfigBean configBean = CommonAppConfig.getInstance().getConfig();
|
||||
if (configBean != null) {
|
||||
mCoinName = configBean.getCoinName();
|
||||
String[] coins = configBean.getLiveTimeCoin();
|
||||
if (coins != null) {
|
||||
for (int i = 0, length = coins.length; i < length; i++) {
|
||||
int coin = Integer.parseInt(coins[i]);
|
||||
LiveTimeChargeBean bean = new LiveTimeChargeBean(coin);
|
||||
if (coin == checkedCoin) {
|
||||
bean.setChecked(true);
|
||||
mCheckedPosition = i;
|
||||
}
|
||||
mList.add(bean);
|
||||
}
|
||||
if (mCheckedPosition < 0) {
|
||||
mCheckedPosition = 0;
|
||||
mList.get(0).setChecked(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (mCheckedPosition == position) {
|
||||
return;
|
||||
}
|
||||
if (mCheckedPosition >= 0 && mCheckedPosition < mList.size()) {
|
||||
mList.get(mCheckedPosition).setChecked(false);
|
||||
notifyItemChanged(mCheckedPosition);
|
||||
}
|
||||
mList.get(position).setChecked(true);
|
||||
notifyItemChanged(position);
|
||||
mCheckedPosition = position;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public int getCheckedCoin() {
|
||||
if (mCheckedPosition >= 0 && mCheckedPosition < mList.size()) {
|
||||
return mList.get(mCheckedPosition).getCoin();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_time_charge, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mList.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
TextView mTextView;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mTextView = (TextView) itemView;
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveTimeChargeBean bean, int position) {
|
||||
itemView.setTag(position);
|
||||
mTextView.setText(bean.getCoin() + "/" + mCoinName);
|
||||
if (bean.isChecked()) {
|
||||
mTextView.setTextColor(mCheckedColor);
|
||||
} else {
|
||||
mTextView.setTextColor(mUnCheckedColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
272
live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java
Normal file
272
live/src/main/java/com/yunbao/live/adapter/LiveUserAdapter.java
Normal file
@@ -0,0 +1,272 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.text.TextUtils.isEmpty;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/10.
|
||||
*/
|
||||
|
||||
public class LiveUserAdapter extends RecyclerView.Adapter<LiveUserAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<LiveUserGiftBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<UserBean> mOnItemClickListener;
|
||||
private Drawable mGuardDrawable0;
|
||||
private Drawable mGuardDrawable1;
|
||||
private Drawable mGuardDrawable2;
|
||||
|
||||
public LiveUserAdapter(Context context) {
|
||||
mContext = context;
|
||||
mList = new ArrayList<>();
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
int position = (int) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(mList.get(position), position);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
mGuardDrawable0 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_0);
|
||||
mGuardDrawable1 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_1);
|
||||
mGuardDrawable2 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_2);
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<UserBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_user, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position, @NonNull List<Object> payloads) {
|
||||
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
|
||||
vh.setData(mList.get(position), position, payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
if(mList.size()>3) {
|
||||
return 3;
|
||||
}else{
|
||||
return mList.size();
|
||||
}
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mWrap;
|
||||
SVGAImageView gift_svga;
|
||||
ImageView mAvatar;
|
||||
ImageView mIcon;
|
||||
ImageView mGuardIcon;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mWrap = (ImageView) itemView.findViewById(R.id.wrap);
|
||||
gift_svga = (SVGAImageView)itemView.findViewById(R.id.gift_svga);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mGuardIcon = (ImageView) itemView.findViewById(R.id.guard_icon);
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveUserGiftBean userBean, int position, Object payload) {
|
||||
itemView.setTag(position);
|
||||
|
||||
if (payload == null) {
|
||||
ImgLoader.displayAvatar(mContext, userBean.getAvatar(), mAvatar);
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(userBean.getLevel());
|
||||
// if (levelBean != null) {
|
||||
// ImgLoader.display(mContext, levelBean.getThumbIcon(), mIcon);
|
||||
// }
|
||||
}
|
||||
int guardType = userBean.getGuardType();
|
||||
// if (guardType == Constants.GUARD_TYPE_NONE) {
|
||||
// if (mIcon.getVisibility() != View.VISIBLE) {
|
||||
// mIcon.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// if (mGuardIcon.getVisibility() == View.VISIBLE) {
|
||||
// mGuardIcon.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
// } else {
|
||||
// if (mIcon.getVisibility() == View.VISIBLE) {
|
||||
// mIcon.setVisibility(View.INVISIBLE);
|
||||
// }
|
||||
// if (mGuardIcon.getVisibility() != View.VISIBLE) {
|
||||
// mGuardIcon.setVisibility(View.VISIBLE);
|
||||
// }
|
||||
// if (guardType == Constants.GUARD_TYPE_DAY) {
|
||||
// mGuardIcon.setImageDrawable(mGuardDrawable0);
|
||||
// }else if (guardType == Constants.GUARD_TYPE_MONTH) {
|
||||
// mGuardIcon.setImageDrawable(mGuardDrawable1);
|
||||
// } else if (guardType == Constants.GUARD_TYPE_YEAR) {
|
||||
// mGuardIcon.setImageDrawable(mGuardDrawable2);
|
||||
// }
|
||||
// }
|
||||
if(userBean.getDress()!=null){
|
||||
if(userBean.getDress().getAvatar_frame().contains("svga")) {
|
||||
|
||||
try {
|
||||
new SVGAParser(mContext).parse(new URL(userBean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
gift_svga.setImageDrawable(drawable);
|
||||
gift_svga.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
}
|
||||
});
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
ImgLoader.display(mContext,userBean.getDress().getAvatar_frame(), gift_svga);
|
||||
}
|
||||
}
|
||||
// if (position == 0) {
|
||||
// if (userBean.hasContribution()) {
|
||||
// mWrap.setImageResource(R.mipmap.icon_live_user_list_1);
|
||||
// }
|
||||
// } else if (position == 1) {
|
||||
// if (userBean.hasContribution()) {
|
||||
// mWrap.setImageResource(R.mipmap.icon_live_user_list_2);
|
||||
// }
|
||||
// } else if (position == 2) {
|
||||
// if (userBean.hasContribution()) {
|
||||
// mWrap.setImageResource(R.mipmap.icon_live_user_list_3);
|
||||
// }
|
||||
// } else {
|
||||
// mWrap.setImageDrawable(null);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void refreshList(List<LiveUserGiftBean> list) {
|
||||
if (mList != null && list != null && list.size() > 0) {
|
||||
mList.clear();
|
||||
mList.addAll(list);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private int findItemPosition(String uid) {
|
||||
if (!isEmpty(uid)) {
|
||||
for (int i = 0, size = mList.size(); i < size; i++) {
|
||||
if (uid.equals(mList.get(i).getId())) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void removeItem(String uid) {
|
||||
if (isEmpty(uid)) {
|
||||
return;
|
||||
}
|
||||
int position = findItemPosition(uid);
|
||||
if (position >= 0) {
|
||||
mList.remove(position);
|
||||
notifyItemRemoved(position);
|
||||
notifyItemRangeChanged(position, mList.size(), Constants.PAYLOAD);
|
||||
}
|
||||
}
|
||||
|
||||
// public void insertItem(LiveUserGiftBean userBean) {
|
||||
// if (userBean == null) {
|
||||
// return;
|
||||
// }
|
||||
// int position = findItemPosition(userBean.getId());
|
||||
// if (position >= 0) {
|
||||
// return;
|
||||
// }
|
||||
// int size = mList.size();
|
||||
// mList.add(userBean);
|
||||
// notifyDataSetChanged();
|
||||
//// notifyItemInserted(size);
|
||||
// }
|
||||
//
|
||||
// public void insertList(List<LiveUserGiftBean> list) {
|
||||
// for (int i = 0; i < list.size(); i++) {
|
||||
// }
|
||||
// if (mList != null && list != null && list.size() > 0) {
|
||||
// int position = mList.size();
|
||||
// mList.addAll(list);
|
||||
// notifyItemRangeInserted(position, mList.size());
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 守护信息发生变化
|
||||
// */
|
||||
// public void onGuardChanged(String uid, int guardType) {
|
||||
// if (!isEmpty(uid)) {
|
||||
// for (int i = 0, size = mList.size(); i < size; i++) {
|
||||
// LiveUserGiftBean bean = mList.get(i);
|
||||
// if (uid.equals(bean.getId())) {
|
||||
// if (bean.getGuardType() != guardType) {
|
||||
// Log.d("onGuardChanged",""+bean.getGuardType());
|
||||
// bean.setGuardType(guardType);
|
||||
// notifyItemChanged(i, Constants.PAYLOAD);
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public void clear() {
|
||||
if (mList != null) {
|
||||
mList.clear();
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.LiveWishlistBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 直播 心愿单
|
||||
*/
|
||||
|
||||
public class LiveWishListAdapter extends RecyclerView.Adapter<LiveWishListAdapter.Vh> {
|
||||
private List<LiveWishlistBean> mWishList;
|
||||
private LayoutInflater mInflater;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<LiveWishlistBean> mOnItemClickListener;
|
||||
private Context mContext;
|
||||
|
||||
public LiveWishListAdapter(Context context, boolean noLink) {
|
||||
mContext = context;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag != null) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick((LiveWishlistBean) tag, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void setData(List<LiveWishlistBean> list) {
|
||||
mWishList = list;
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<LiveWishlistBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_live_wish_list, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mWishList.get(position), position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mWishList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mIcon;
|
||||
TextView mName;
|
||||
TextView mNum;
|
||||
TextView mIncrease;
|
||||
TextView mDecrease;
|
||||
View mRlDelete;
|
||||
ProgressBar pb_wishlist;
|
||||
TextView tvProgress;
|
||||
TextView tvWishIndex;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mNum = (TextView) itemView.findViewById(R.id.tv_num);
|
||||
mIncrease = (TextView) itemView.findViewById(R.id.tv_increase);
|
||||
mDecrease = (TextView) itemView.findViewById(R.id.tv_decrease);
|
||||
mRlDelete = itemView.findViewById(R.id.rl_delete);
|
||||
pb_wishlist = itemView.findViewById(R.id.pb_wishlist);
|
||||
tvProgress = itemView.findViewById(R.id.tvProgress);
|
||||
tvWishIndex = itemView.findViewById(R.id.tvWishIndex);
|
||||
|
||||
itemView.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(LiveWishlistBean bean, int pos) {
|
||||
itemView.setTag(bean);
|
||||
ImgLoader.display(mContext, bean.getWishlist_icon(), mIcon);
|
||||
mName.setText(bean.getWishlist_name());
|
||||
mNum.setText(bean.getWishlist_num());
|
||||
int pro = 0;
|
||||
try {
|
||||
int num1 = Integer.parseInt(bean.getWishlist_progress());
|
||||
int num2 = Integer.parseInt(bean.getWishlist_num());
|
||||
pro = num1 * 100 / num2;
|
||||
//如果进度大于0,则不允许删除该礼物
|
||||
if (num1 > 0) {
|
||||
mRlDelete.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
mRlDelete.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
pb_wishlist.setProgress(pro);
|
||||
if (bean.getWishlist_num().isEmpty() || bean.getWishlist_progress().isEmpty()) {
|
||||
tvProgress.setText("");
|
||||
} else {
|
||||
tvProgress.setText(bean.getWishlist_progress() + "/" + bean.getWishlist_num());
|
||||
}
|
||||
if (pro >= 100) {
|
||||
tvWishIndex.setText("已达成");
|
||||
} else {
|
||||
tvWishIndex.setText("心愿" + getNameByIndex(pos));
|
||||
}
|
||||
// tvWishIndex.setText("心愿"+getNameByIndex(pos+1));
|
||||
decreaseClick(bean);
|
||||
increaseClick(bean);
|
||||
numTextClick(bean);
|
||||
mRlDeleteClick(bean, pos);
|
||||
|
||||
}
|
||||
|
||||
private String getNameByIndex(int pos) {
|
||||
String ret = "";
|
||||
String arr[] = {"一", "二", "三", "四", "五", "六", "七", "八", "九", "十"};
|
||||
try {
|
||||
ret = arr[pos];
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
private void mRlDeleteClick(final LiveWishlistBean bean, final int pos) {
|
||||
mRlDelete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
mWishList.remove(pos);
|
||||
ToastUtil.show("删除" + bean.getWishlist_name() + "成功");
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void numTextClick(final LiveWishlistBean bean) {
|
||||
mNum.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
DialogUitl.showSimpleInputDialog(mContext,
|
||||
"请输入" + bean.getWishlist_name() + "的数量",
|
||||
DialogUitl.INPUT_TYPE_NUMBER, 5,
|
||||
new DialogUitl.SimpleCallback() {
|
||||
@Override
|
||||
public void onConfirmClick(Dialog dialog, String content) {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
ToastUtil.show(R.string.live_set_wishlist_num);
|
||||
} else {
|
||||
int num;
|
||||
if (StringUtil.isInt(content)) {
|
||||
num = Integer.parseInt(content);
|
||||
if (num <= 0) {
|
||||
ToastUtil.show("数字必须大于0");
|
||||
} else {
|
||||
mNum.setText(num + "");
|
||||
bean.setWishlist_num(num + "");
|
||||
}
|
||||
}
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void increaseClick(final LiveWishlistBean bean) {
|
||||
mIncrease.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
int num = Integer.parseInt(mNum.getText().toString());
|
||||
num++;
|
||||
mNum.setText(num + "");
|
||||
bean.setWishlist_num(num + "");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void decreaseClick(final LiveWishlistBean bean) {
|
||||
mDecrease.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
try {
|
||||
int num = Integer.parseInt(mNum.getText().toString());
|
||||
if (num > 1) {
|
||||
num--;
|
||||
mNum.setText(num + "");
|
||||
bean.setWishlist_num(num + "");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
242
live/src/main/java/com/yunbao/live/adapter/RedPackAdapter.java
Normal file
242
live/src/main/java/com/yunbao/live/adapter/RedPackAdapter.java
Normal file
@@ -0,0 +1,242 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.interfaces.OnItemClickListener;
|
||||
import com.yunbao.common.utils.StringUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.RedPackBean;
|
||||
import com.yunbao.live.custom.MyImageView;
|
||||
import com.yunbao.live.interfaces.RedPackCountDownListener;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/21.
|
||||
*/
|
||||
|
||||
public class RedPackAdapter extends RecyclerView.Adapter<RedPackAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<RedPackBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
private String mTypeString1;
|
||||
private String mTypeString2;
|
||||
private View.OnClickListener mOnClickListener;
|
||||
private OnItemClickListener<RedPackBean> mOnItemClickListener;
|
||||
private MyHandler mMyHandler;
|
||||
private RedPackCountDownListener mRedPackCountDownListener;
|
||||
|
||||
public RedPackAdapter(final Context context, List<RedPackBean> list) {
|
||||
mContext=context;
|
||||
mList = list;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
mTypeString1 = WordUtil.getString(R.string.red_pack_11);
|
||||
mTypeString2 = WordUtil.getString(R.string.red_pack_12);
|
||||
mOnClickListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Object tag = v.getTag();
|
||||
if (tag == null) {
|
||||
return;
|
||||
}
|
||||
int position = (int) tag;
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(mList.get(position), position);
|
||||
}
|
||||
}
|
||||
};
|
||||
mMyHandler = new MyHandler(this);
|
||||
for (int i = 0; i < mList.size(); i++) {
|
||||
RedPackBean bean = mList.get(i);
|
||||
if (bean != null && bean.getRobTime() != 0) {
|
||||
mMyHandler.sendEmptyMessageDelayed(i, 1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setOnItemClickListener(OnItemClickListener<RedPackBean> onItemClickListener) {
|
||||
mOnItemClickListener = onItemClickListener;
|
||||
}
|
||||
|
||||
public void setRedPackCountDownListener(RedPackCountDownListener redPackCountDownListener) {
|
||||
mRedPackCountDownListener = redPackCountDownListener;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_red_pack, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh holder, int position) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position, @NonNull List<Object> payloads) {
|
||||
Object payload = payloads.size() > 0 ? payloads.get(0) : null;
|
||||
vh.setData(mList.get(position), position, payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
TextView mType;
|
||||
MyImageView mImg;
|
||||
TextView mTime;
|
||||
View mBtnRob;
|
||||
RedPackBean mRedPackBean;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mType = (TextView) itemView.findViewById(R.id.type);
|
||||
mImg = (MyImageView) itemView.findViewById(R.id.img);
|
||||
mTime = (TextView) itemView.findViewById(R.id.time);
|
||||
mBtnRob = itemView.findViewById(R.id.btn_rob);
|
||||
mBtnRob.setOnClickListener(mOnClickListener);
|
||||
}
|
||||
|
||||
void setData(RedPackBean bean, int position, Object payload) {
|
||||
mRedPackBean = bean;
|
||||
if (payload == null) {
|
||||
mBtnRob.setTag(position);
|
||||
ImgLoader.displayAvatar(mContext,bean.getAvatar(), mAvatar);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
if (bean.getSendType() == Constants.RED_PACK_SEND_TIME_DELAY) {//延时红包
|
||||
mType.setText(mTypeString2);
|
||||
} else {
|
||||
mType.setText(mTypeString1);
|
||||
}
|
||||
}
|
||||
if (bean.getRobTime() == 0) {//即使红包或者延时红包时间走完
|
||||
mTime.setTextColor(0xffff0000);
|
||||
mTime.setText(R.string.red_pack_10);
|
||||
if(bean.getIsRob() == 1){//可以抢
|
||||
mImg.startAnim();
|
||||
}else{//不能抢(已经抢过)
|
||||
mImg.stopAnim();
|
||||
}
|
||||
}else{//延时红包时间未走完,展示倒计时
|
||||
mTime.setTextColor(0xff323232);
|
||||
mTime.setText(StringUtil.getDurationText(bean.getRobTime() * 1000));
|
||||
mImg.stopAnim();
|
||||
}
|
||||
}
|
||||
|
||||
void stopAnim() {
|
||||
if (mImg != null) {
|
||||
mImg.stopAnim();
|
||||
}
|
||||
}
|
||||
|
||||
void checkStartAnim() {
|
||||
if (mRedPackBean != null && mRedPackBean.getIsRob() == 1 && mRedPackBean.getRobTime() == 0) {
|
||||
if (mImg != null) {
|
||||
mImg.startAnim();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAttachedToWindow(@NonNull Vh vh) {
|
||||
vh.checkStartAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(@NonNull Vh vh) {
|
||||
vh.stopAnim();
|
||||
}
|
||||
|
||||
public void onRobClick(int redPackId) {
|
||||
for (int i = 0, size = mList.size(); i < size; i++) {
|
||||
RedPackBean bean = mList.get(i);
|
||||
if (bean.getId() == redPackId) {
|
||||
bean.setIsRob(0);
|
||||
notifyItemChanged(i, Constants.PAYLOAD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void updateItem(int position) {
|
||||
if (position >= 0 && position < mList.size()) {
|
||||
RedPackBean bean = mList.get(position);
|
||||
if (bean != null) {
|
||||
int robTime = bean.getRobTime();
|
||||
robTime--;
|
||||
bean.setRobTime(robTime);
|
||||
notifyItemChanged(position, Constants.PAYLOAD);
|
||||
if (robTime > 0) {
|
||||
if (mMyHandler != null) {
|
||||
mMyHandler.sendEmptyMessageDelayed(position, 1000);
|
||||
}
|
||||
}
|
||||
if (mRedPackCountDownListener != null && bean.getId() == mRedPackCountDownListener.getRedPackId()) {
|
||||
mRedPackCountDownListener.onCountDown(robTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void postDelay(Runnable runnable, long delayTime) {
|
||||
if (mMyHandler != null) {
|
||||
mMyHandler.postDelayed(runnable, delayTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void release() {
|
||||
if (mList != null) {
|
||||
mList.clear();
|
||||
}
|
||||
if (mMyHandler != null) {
|
||||
mMyHandler.removeCallbacksAndMessages(null);
|
||||
mMyHandler.release();
|
||||
}
|
||||
mMyHandler = null;
|
||||
mRedPackCountDownListener = null;
|
||||
}
|
||||
|
||||
private static class MyHandler extends Handler {
|
||||
|
||||
private RedPackAdapter mRedPackAdapter;
|
||||
|
||||
public MyHandler(RedPackAdapter adapter) {
|
||||
mRedPackAdapter = new WeakReference<>(adapter).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
if (mRedPackAdapter != null) {
|
||||
mRedPackAdapter.updateItem(msg.what);
|
||||
}
|
||||
}
|
||||
|
||||
void release() {
|
||||
mRedPackAdapter = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.RedPackResultBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/21.
|
||||
*/
|
||||
|
||||
public class RedPackResultAdapter extends RecyclerView.Adapter<RedPackResultAdapter.Vh> {
|
||||
|
||||
private Context mContext;
|
||||
private List<RedPackResultBean> mList;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public RedPackResultAdapter(Context context, List<RedPackResultBean> list) {
|
||||
mContext=context;
|
||||
mList = list;
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Vh onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_red_pack_result, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull Vh vh, int position) {
|
||||
vh.setData(mList.get(position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
TextView mTime;
|
||||
TextView mWinCoin;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mTime = (TextView) itemView.findViewById(R.id.time);
|
||||
mWinCoin = (TextView) itemView.findViewById(R.id.win_coin);
|
||||
}
|
||||
|
||||
void setData(RedPackResultBean bean) {
|
||||
ImgLoader.displayAvatar(mContext,bean.getAvatar(), mAvatar);
|
||||
mName.setText(bean.getUserNiceName());
|
||||
mTime.setText(bean.getTime());
|
||||
mWinCoin.setText(bean.getWinCoin());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.cardview.widget.CardView;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.SystemMessageBean;
|
||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
import static com.blankj.utilcode.util.ActivityUtils.startActivity;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/24.
|
||||
*/
|
||||
|
||||
public class SystemMessageAdapter extends RefreshAdapter<SystemMessageBean> {
|
||||
|
||||
public SystemMessageAdapter(Context context) {
|
||||
super(context);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new Vh(mInflater.inflate(R.layout.item_sys_msg, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
((Vh) vh).setData(mList.get(position));
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
TextView mContent;
|
||||
TextView mTime, text;
|
||||
LinearLayout toView, bg;
|
||||
ImageView img_content;
|
||||
CardView cv_img_content;
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
mContent = itemView.findViewById(R.id.content);
|
||||
mTime = itemView.findViewById(R.id.time);
|
||||
toView = itemView.findViewById(R.id.to_view);
|
||||
bg = itemView.findViewById(R.id.bg);
|
||||
text = itemView.findViewById(R.id.text);
|
||||
img_content = itemView.findViewById(R.id.img_content);
|
||||
cv_img_content = itemView.findViewById(R.id.cv_img_content);
|
||||
}
|
||||
|
||||
void setData(SystemMessageBean bean) {
|
||||
bg.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (bean.getLink() != null && !bean.getLink().equals("")) {
|
||||
startActivity(new Intent(mContext, ZhuangBanActivity.class).putExtra("url", bean.getLink()+ "&uid=" + CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken()));
|
||||
}
|
||||
}
|
||||
});
|
||||
mContent.setText(bean.getContent());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
||||
Date currenTimeZone = new Date(Long.parseLong(bean.getAddtime() + "000"));
|
||||
mTime.setText(sdf.format(currenTimeZone));
|
||||
if (bean.getLink() != null && !bean.getLink().equals("")) {
|
||||
toView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
toView.setVisibility(View.GONE);
|
||||
}
|
||||
text.setText(bean.getTitle());
|
||||
if (bean.getImgBanner() != null && !"".equals(bean.getImgBanner())) {
|
||||
cv_img_content.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(mContext, bean.getImgBanner(), img_content);
|
||||
} else {
|
||||
cv_img_content.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.bean.MicUserBean;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class UserMicInfoAdapter extends RefreshAdapter<MicUserBean> {
|
||||
|
||||
private AbsDialogFragment fragments;
|
||||
public UserMicInfoAdapter(Context context, AbsDialogFragment fragment) {
|
||||
super(context);
|
||||
this.fragments = fragment;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
|
||||
return position;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
return new UserMicInfoAdapter.Vh(mInflater.inflate(R.layout.item_user_mic_info, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
// vh.setIsRecyclable(false);
|
||||
((UserMicInfoAdapter.Vh) vh).setData(mList.get(position), position);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
ImageView mAvatar;
|
||||
TextView mName;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
SVGAImageView gift_svga;
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
gift_svga = (SVGAImageView)itemView.findViewById(R.id.gift_svga);
|
||||
}
|
||||
|
||||
void setData(final MicUserBean bean,int position) {
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((LiveActivity) mContext).showUserDialog(bean.getId());
|
||||
fragments.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
ImgLoader.display(mContext, bean.getAvatar(), mAvatar);
|
||||
if(bean.getDress_avatar()!=null){
|
||||
if(bean.getDress_avatar().contains("svga")) {
|
||||
try {
|
||||
new SVGAParser(mContext).parse(new URL(bean.getDress_avatar()), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
gift_svga.setImageDrawable(drawable);
|
||||
gift_svga.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
}
|
||||
});
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
ImgLoader.display(mContext,bean.getDress_avatar(), gift_svga);
|
||||
}
|
||||
}
|
||||
|
||||
mName.setText(bean.getUserNiceName());
|
||||
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.LevelBean;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.CommonIconUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.bean.LiveUserGiftBean;
|
||||
import com.yunbao.live.dialog.LiveUserMoreDialogFragment;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class UserMoreInfoAdapter extends RefreshAdapter<LiveUserGiftBean> {
|
||||
|
||||
// private static final int HEAD = 1;
|
||||
// private static final int NORMAL = 0;
|
||||
private String mVotesName;
|
||||
public int num;
|
||||
public String type;
|
||||
private Drawable mGuardDrawable0;
|
||||
private Drawable mGuardDrawable1;
|
||||
private Drawable mGuardDrawable2;
|
||||
// private View.OnClickListener mOnClickListener;
|
||||
private LiveUserMoreDialogFragment fragments;
|
||||
public UserMoreInfoAdapter(Context context,LiveUserMoreDialogFragment fragment) {
|
||||
super(context);
|
||||
// mOnClickListener = new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// Object tag = v.getTag();
|
||||
// if (tag != null) {
|
||||
// int position = (int) tag;
|
||||
// if (mOnItemClickListener != null) {
|
||||
// mOnItemClickListener.onItemClick(mList.get(position), position);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
this.fragments = fragment;
|
||||
mVotesName = CommonAppConfig.getInstance().getVotesName();
|
||||
mGuardDrawable0 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_0);
|
||||
mGuardDrawable1 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_1);
|
||||
mGuardDrawable2 = ContextCompat.getDrawable(context, R.mipmap.icon_guard_type_2);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
// if (position == 0) {
|
||||
// return HEAD;
|
||||
// }
|
||||
// return NORMAL;
|
||||
return position;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
||||
return new Vh(mInflater.inflate(R.layout.item_user_more_info, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
// vh.setIsRecyclable(false);
|
||||
((Vh) vh).setData(mList.get(position), position);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mList.size();
|
||||
}
|
||||
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
TextView title,title1;
|
||||
ImageView mIcon;
|
||||
ImageView mAvatar;
|
||||
TextView mName,tvName;
|
||||
ImageView mNoble;
|
||||
ImageView mSex;
|
||||
ImageView mLevel;
|
||||
SVGAImageView gift_svga;
|
||||
ImageView ivIcon;
|
||||
public Vh(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
title1 = (TextView)itemView.findViewById(R.id.title1);
|
||||
title = (TextView)itemView.findViewById(R.id.title);
|
||||
mNoble = (ImageView) itemView.findViewById(R.id.noble);
|
||||
tvName = (TextView)itemView.findViewById(R.id.tvName);
|
||||
ivIcon = (ImageView) itemView.findViewById(R.id.ivIcon);
|
||||
mIcon = (ImageView) itemView.findViewById(R.id.icon);
|
||||
mAvatar = (ImageView) itemView.findViewById(R.id.avatar);
|
||||
mName = (TextView) itemView.findViewById(R.id.name);
|
||||
mSex = (ImageView) itemView.findViewById(R.id.sex);
|
||||
mLevel = (ImageView) itemView.findViewById(R.id.level);
|
||||
gift_svga = (SVGAImageView)itemView.findViewById(R.id.gift_svga);
|
||||
}
|
||||
|
||||
void setData(final LiveUserGiftBean bean,int position) {
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((LiveActivity) mContext).showUserDialog(bean.getId());
|
||||
fragments.dismiss();
|
||||
}
|
||||
});
|
||||
LevelBean levelBean = CommonAppConfig.getInstance().getLevel(bean.getLevel());
|
||||
|
||||
title.setVisibility(View.GONE);
|
||||
title1.setVisibility(View.GONE);
|
||||
Log.i("tag",""+num);
|
||||
if(position==0&&type.equals("1")){
|
||||
title1.setText(R.string.noble);
|
||||
title1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if(position== num&&type.equals("1")){
|
||||
title.setText(R.string.live_audience);
|
||||
title.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
|
||||
mIcon.setImageBitmap(null);
|
||||
ivIcon.setVisibility(View.GONE);
|
||||
tvName.setVisibility(View.GONE);
|
||||
if(type.equals("1")) {
|
||||
if (!bean.getDress().getMedal().equals("")) {
|
||||
ImgLoader.display(mContext, bean.getDress().getMedal(), mIcon);
|
||||
} else {
|
||||
int guardType = bean.getGuardType();
|
||||
if (guardType == Constants.GUARD_TYPE_NONE) {
|
||||
if (mIcon.getVisibility() != View.VISIBLE) {
|
||||
mIcon.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
} else {
|
||||
if (mIcon.getVisibility() == View.INVISIBLE) {
|
||||
mIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (guardType == Constants.GUARD_TYPE_DAY) {
|
||||
mIcon.setImageDrawable(mGuardDrawable0);
|
||||
} else if (guardType == Constants.GUARD_TYPE_MONTH) {
|
||||
mIcon.setImageDrawable(mGuardDrawable1);
|
||||
} else if (guardType == Constants.GUARD_TYPE_YEAR) {
|
||||
mIcon.setImageDrawable(mGuardDrawable2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(type.equals("2")){
|
||||
int guardType = bean.getGuardType();
|
||||
if (guardType == Constants.GUARD_TYPE_NONE) {
|
||||
if (mIcon.getVisibility() != View.VISIBLE) {
|
||||
mIcon.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
} else {
|
||||
if (mIcon.getVisibility() == View.INVISIBLE) {
|
||||
mIcon.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (guardType == Constants.GUARD_TYPE_DAY) {
|
||||
mIcon.setImageDrawable(mGuardDrawable0);
|
||||
} else if (guardType == Constants.GUARD_TYPE_MONTH) {
|
||||
mIcon.setImageDrawable(mGuardDrawable1);
|
||||
} else if (guardType == Constants.GUARD_TYPE_YEAR) {
|
||||
mIcon.setImageDrawable(mGuardDrawable2);
|
||||
}
|
||||
}
|
||||
}else if(type.equals("3")){
|
||||
ivIcon.setVisibility(View.VISIBLE);
|
||||
tvName.setVisibility(View.VISIBLE);
|
||||
|
||||
ImgLoader.displayDrawable(mContext, bean.getFans_pic(), new ImgLoader.DrawableCallback() {
|
||||
@Override
|
||||
public void onLoadSuccess(Drawable drawable) {
|
||||
ivIcon.setImageDrawable(drawable);
|
||||
tvName.setText( bean.getMedal_name());
|
||||
}
|
||||
@Override
|
||||
public void onLoadFailed() {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
ImgLoader.display(mContext, bean.getAvatar(), mAvatar);
|
||||
if(bean.getDress().getAvatar_frame()!=null){
|
||||
if(bean.getDress().getAvatar_frame().contains("svga")) {
|
||||
try {
|
||||
new SVGAParser(mContext).parse(new URL(bean.getDress().getAvatar_frame()), new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
gift_svga.setImageDrawable(drawable);
|
||||
gift_svga.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
}
|
||||
});
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}else{
|
||||
ImgLoader.display(mContext,bean.getDress().getAvatar_frame(), gift_svga);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
mNoble.setVisibility(View.GONE);
|
||||
if(bean.getDress().getMedal()!=null){
|
||||
ImgLoader.displayAvatar(mContext, bean.getDress().getMedal(), mNoble);
|
||||
}else{
|
||||
mNoble.setVisibility(View.GONE);
|
||||
}
|
||||
mName.setText(bean.getUserNiceName());
|
||||
|
||||
mSex.setImageResource(CommonIconUtil.getSexIcon(bean.getSex()));
|
||||
if (levelBean != null) {
|
||||
ImgLoader.display(mContext, levelBean.getThumb(), mLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.yunbao.live.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedImageView;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.utils.RouteUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.bean.YouLikeBean;
|
||||
|
||||
public class YouLikeMessageAdapter extends RefreshAdapter<YouLikeBean> {
|
||||
|
||||
public YouLikeMessageAdapter(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new YouLikeMessageAdapter.Vh(mInflater.inflate(R.layout.item_ylike_msg, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
((YouLikeMessageAdapter.Vh) vh).setData(mList.get(position));
|
||||
}
|
||||
|
||||
class Vh extends RecyclerView.ViewHolder {
|
||||
|
||||
private TextView btn_follow, tv_name;
|
||||
private RoundedImageView ico;
|
||||
private ImageView img_content2_pic1, img_content2_pic2, img_content_pic1, img_content_pic2, img_content_pic3;
|
||||
private RelativeLayout rt_root;
|
||||
private LinearLayout lt_pic1, lt_pic2;
|
||||
private View mBtnLive;
|
||||
|
||||
public Vh(View itemView) {
|
||||
super(itemView);
|
||||
btn_follow = itemView.findViewById(R.id.btn_follow);
|
||||
ico = itemView.findViewById(R.id.ico);
|
||||
tv_name = itemView.findViewById(R.id.tv_name);
|
||||
img_content2_pic1 = itemView.findViewById(R.id.img_content2_pic1);
|
||||
img_content2_pic2 = itemView.findViewById(R.id.img_content2_pic2);
|
||||
img_content_pic1 = itemView.findViewById(R.id.img_content_pic1);
|
||||
img_content_pic2 = itemView.findViewById(R.id.img_content_pic2);
|
||||
img_content_pic3 = itemView.findViewById(R.id.img_content_pic3);
|
||||
rt_root = itemView.findViewById(R.id.rt_root);
|
||||
lt_pic1 = itemView.findViewById(R.id.lt_pic1);
|
||||
lt_pic2 = itemView.findViewById(R.id.lt_pic2);
|
||||
|
||||
mBtnLive = itemView.findViewById(R.id.btn_live);
|
||||
}
|
||||
|
||||
void setData(YouLikeBean bean) {
|
||||
tv_name.setText(bean.getSend_user_name());
|
||||
ImgLoader.displayWithError(mContext, bean.getSend_user_avatar(), ico, R.mipmap.chat_head_mo);
|
||||
btn_follow.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
bean.setIs_attention("1");
|
||||
CommonHttpUtil.setAttention(bean.getSend_user_id(), null);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
if ("0".endsWith(bean.getIs_attention())) {
|
||||
btn_follow.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
btn_follow.setVisibility(View.GONE);
|
||||
}
|
||||
if (!"".endsWith(bean.getImg_json()) && bean.getImg_json() != null) {
|
||||
String picJson = bean.getImg_json();
|
||||
picJson = picJson.substring(0, picJson.length() - 1);
|
||||
picJson = picJson.substring(1, picJson.length());
|
||||
String[] strs = picJson.split(",");
|
||||
if (strs.length > 0) {
|
||||
for (int i = 0; i < strs.length; i++) {
|
||||
strs[i] = strs[i].substring(0, strs[i].length() - 1);
|
||||
strs[i] = strs[i].substring(1, strs[i].length());
|
||||
}
|
||||
if (strs.length > 2) {
|
||||
lt_pic1.setVisibility(View.GONE);
|
||||
lt_pic2.setVisibility(View.VISIBLE);
|
||||
ImgLoader.display(mContext, strs[0], img_content_pic1);
|
||||
ImgLoader.display(mContext, strs[1], img_content_pic2);
|
||||
ImgLoader.display(mContext, strs[2], img_content_pic3);
|
||||
img_content_pic1.setVisibility(View.VISIBLE);
|
||||
img_content_pic2.setVisibility(View.VISIBLE);
|
||||
img_content_pic3.setVisibility(View.VISIBLE);
|
||||
} else if (strs.length == 2) {
|
||||
lt_pic1.setVisibility(View.VISIBLE);
|
||||
lt_pic2.setVisibility(View.GONE);
|
||||
ImgLoader.display(mContext, strs[0], img_content2_pic1);
|
||||
ImgLoader.display(mContext, strs[1], img_content2_pic2);
|
||||
img_content2_pic1.setVisibility(View.VISIBLE);
|
||||
img_content2_pic2.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
lt_pic1.setVisibility(View.VISIBLE);
|
||||
lt_pic2.setVisibility(View.GONE);
|
||||
ImgLoader.display(mContext, strs[0], img_content2_pic1);
|
||||
img_content2_pic1.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
rt_root.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RouteUtil.forwardUserHome(mContext, bean.getSend_user_id(), 2);
|
||||
}
|
||||
});
|
||||
if ("0".equals(bean.getIs_live())) {
|
||||
mBtnLive.setVisibility(View.GONE);
|
||||
} else {
|
||||
mBtnLive.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
70
live/src/main/java/com/yunbao/live/bean/BeautyFaceBean.java
Normal file
70
live/src/main/java/com/yunbao/live/bean/BeautyFaceBean.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.cosmos.beauty.module.beauty.AutoBeautyType;
|
||||
import com.cosmos.beauty.module.beauty.SimpleBeautyType;
|
||||
|
||||
public class BeautyFaceBean {
|
||||
String title;
|
||||
SimpleBeautyType name;
|
||||
AutoBeautyType b_name;
|
||||
String paths;
|
||||
int img_id;
|
||||
int value;
|
||||
int choice;
|
||||
|
||||
public int getChoice() {
|
||||
return choice;
|
||||
}
|
||||
|
||||
public void setChoice(int choice) {
|
||||
this.choice = choice;
|
||||
}
|
||||
|
||||
public String getPaths() {
|
||||
return paths;
|
||||
}
|
||||
|
||||
public void setPaths(String paths) {
|
||||
this.paths = paths;
|
||||
}
|
||||
|
||||
public AutoBeautyType getB_name() {
|
||||
return b_name;
|
||||
}
|
||||
|
||||
public void setB_name(AutoBeautyType b_name) {
|
||||
this.b_name = b_name;
|
||||
}
|
||||
|
||||
public int getImg_id() {
|
||||
return img_id;
|
||||
}
|
||||
|
||||
public void setImg_id(int img_id) {
|
||||
this.img_id = img_id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public SimpleBeautyType getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(SimpleBeautyType name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
60
live/src/main/java/com/yunbao/live/bean/DrPkbean.java
Normal file
60
live/src/main/java/com/yunbao/live/bean/DrPkbean.java
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
public class DrPkbean {
|
||||
int id;
|
||||
int score;
|
||||
String avatar;
|
||||
String user_nicename;
|
||||
|
||||
String p;
|
||||
int paiming;
|
||||
|
||||
public int getPaiming() {
|
||||
return paiming;
|
||||
}
|
||||
|
||||
public void setPaiming(int paiming) {
|
||||
this.paiming = paiming;
|
||||
}
|
||||
|
||||
public int getScore() {
|
||||
return score;
|
||||
}
|
||||
|
||||
public void setScore(int score) {
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
public String getP() {
|
||||
return p;
|
||||
}
|
||||
|
||||
public void setP(String p) {
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getUser_nicename() {
|
||||
return user_nicename;
|
||||
}
|
||||
|
||||
public void setUser_nicename(String user_nicename) {
|
||||
this.user_nicename = user_nicename;
|
||||
}
|
||||
}
|
||||
22
live/src/main/java/com/yunbao/live/bean/GiftTopBean.java
Normal file
22
live/src/main/java/com/yunbao/live/bean/GiftTopBean.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
public class GiftTopBean {
|
||||
String name;
|
||||
int Select;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getSelect() {
|
||||
return Select;
|
||||
}
|
||||
|
||||
public void setSelect(int select) {
|
||||
Select = select;
|
||||
}
|
||||
}
|
||||
70
live/src/main/java/com/yunbao/live/bean/GuardBuyBean.java
Normal file
70
live/src/main/java/com/yunbao/live/bean/GuardBuyBean.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/6.
|
||||
* 守护商品类型
|
||||
*/
|
||||
|
||||
public class GuardBuyBean {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private int type;
|
||||
private int coin;
|
||||
private int[] privilege;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getCoin() {
|
||||
return coin;
|
||||
}
|
||||
|
||||
public void setCoin(int coin) {
|
||||
this.coin = coin;
|
||||
}
|
||||
|
||||
public int[] getPrivilege() {
|
||||
return privilege;
|
||||
}
|
||||
|
||||
public void setPrivilege(int[] privilege) {
|
||||
this.privilege = privilege;
|
||||
}
|
||||
|
||||
public String getShopName() {
|
||||
switch (this.id) {
|
||||
case 1:
|
||||
return WordUtil.getString(R.string.guard_name_1);
|
||||
case 2:
|
||||
return WordUtil.getString(R.string.guard_name_2);
|
||||
case 3:
|
||||
return WordUtil.getString(R.string.guard_name_3);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
70
live/src/main/java/com/yunbao/live/bean/GuardRightBean.java
Normal file
70
live/src/main/java/com/yunbao/live/bean/GuardRightBean.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/6.
|
||||
* 守护特权
|
||||
*/
|
||||
|
||||
public class GuardRightBean {
|
||||
|
||||
private String title;
|
||||
private String des;
|
||||
private String icon0;
|
||||
private String icon1;
|
||||
// private int iconIndex;
|
||||
private boolean mChecked;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDes() {
|
||||
return des;
|
||||
}
|
||||
|
||||
public void setDes(String des) {
|
||||
this.des = des;
|
||||
}
|
||||
|
||||
@JSONField(name = "thumb_c")
|
||||
public String getIcon1() {
|
||||
return icon1;
|
||||
}
|
||||
|
||||
@JSONField(name = "thumb_c")
|
||||
public void setIcon1(String icon1) {
|
||||
this.icon1 = icon1;
|
||||
}
|
||||
|
||||
@JSONField(name = "thumb_g")
|
||||
public String getIcon0() {
|
||||
return icon0;
|
||||
}
|
||||
|
||||
@JSONField(name = "thumb_g")
|
||||
public void setIcon0(String icon0) {
|
||||
this.icon0 = icon0;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return mChecked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
mChecked = checked;
|
||||
}
|
||||
|
||||
// public int getIconIndex() {
|
||||
// return iconIndex;
|
||||
// }
|
||||
//
|
||||
// public void setIconIndex(int iconIndex) {
|
||||
// this.iconIndex = iconIndex;
|
||||
// }
|
||||
}
|
||||
29
live/src/main/java/com/yunbao/live/bean/GuardUserBean.java
Normal file
29
live/src/main/java/com/yunbao/live/bean/GuardUserBean.java
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/7.
|
||||
*/
|
||||
|
||||
public class GuardUserBean extends UserBean {
|
||||
|
||||
private int type;//守护类型
|
||||
private String contribute;//贡献值
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getContribute() {
|
||||
return contribute;
|
||||
}
|
||||
|
||||
public void setContribute(String contribute) {
|
||||
this.contribute = contribute;
|
||||
}
|
||||
}
|
||||
31
live/src/main/java/com/yunbao/live/bean/HDBannerBean.java
Normal file
31
live/src/main/java/com/yunbao/live/bean/HDBannerBean.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
public class HDBannerBean {
|
||||
String Date;
|
||||
String Number;
|
||||
String multiple;
|
||||
|
||||
public String getDate() {
|
||||
return Date;
|
||||
}
|
||||
|
||||
public void setDate(String date) {
|
||||
Date = date;
|
||||
}
|
||||
|
||||
public String getNumber() {
|
||||
return Number;
|
||||
}
|
||||
|
||||
public void setNumber(String number) {
|
||||
Number = number;
|
||||
}
|
||||
|
||||
public String getMultiple() {
|
||||
return multiple;
|
||||
}
|
||||
|
||||
public void setMultiple(String multiple) {
|
||||
this.multiple = multiple;
|
||||
}
|
||||
}
|
||||
86
live/src/main/java/com/yunbao/live/bean/HotBean.java
Normal file
86
live/src/main/java/com/yunbao/live/bean/HotBean.java
Normal file
@@ -0,0 +1,86 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
public class HotBean {
|
||||
|
||||
private String uid;
|
||||
private String user_name;
|
||||
private String user_avatar;
|
||||
private String hot_score;//热度卡的热度分数
|
||||
private String hot_score_start_time;//热度加成开始时间
|
||||
private String hot_score_end_time;//热度加成结束时间
|
||||
private int level;
|
||||
private int sex;
|
||||
private String dress_avatar;
|
||||
|
||||
public String getDress_avatar() {
|
||||
return dress_avatar;
|
||||
}
|
||||
|
||||
public void setDress_avatar(String dress_avatar) {
|
||||
this.dress_avatar = dress_avatar;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getUser_name() {
|
||||
return user_name;
|
||||
}
|
||||
|
||||
public void setUser_name(String user_name) {
|
||||
this.user_name = user_name;
|
||||
}
|
||||
|
||||
public String getUser_avatar() {
|
||||
return user_avatar;
|
||||
}
|
||||
|
||||
public void setUser_avatar(String user_avatar) {
|
||||
this.user_avatar = user_avatar;
|
||||
}
|
||||
|
||||
public String getHot_score() {
|
||||
return hot_score;
|
||||
}
|
||||
|
||||
public void setHot_score(String hot_score) {
|
||||
this.hot_score = hot_score;
|
||||
}
|
||||
|
||||
public String getHot_score_start_time() {
|
||||
return hot_score_start_time;
|
||||
}
|
||||
|
||||
public void setHot_score_start_time(String hot_score_start_time) {
|
||||
this.hot_score_start_time = hot_score_start_time;
|
||||
}
|
||||
|
||||
public String getHot_score_end_time() {
|
||||
return hot_score_end_time;
|
||||
}
|
||||
|
||||
public void setHot_score_end_time(String hot_score_end_time) {
|
||||
this.hot_score_end_time = hot_score_end_time;
|
||||
}
|
||||
}
|
||||
115
live/src/main/java/com/yunbao/live/bean/ImUserBean.java
Normal file
115
live/src/main/java/com/yunbao/live/bean/ImUserBean.java
Normal file
@@ -0,0 +1,115 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/14.
|
||||
* IM 聊天用户 实体类
|
||||
*/
|
||||
|
||||
public class ImUserBean {
|
||||
|
||||
String title;//
|
||||
String image;//头像
|
||||
String content;//最新一条内容
|
||||
String addtime;//最后时间
|
||||
String num;//未读消息数
|
||||
String link;//跳转连接
|
||||
String type;//
|
||||
String userId;//单聊的id
|
||||
String remarks;//备注的信息
|
||||
String is_admin;
|
||||
String isDelet;
|
||||
|
||||
public String getIsDelet() {
|
||||
return isDelet;
|
||||
}
|
||||
|
||||
public void setIsDelet(String isDelet) {
|
||||
this.isDelet = isDelet;
|
||||
}
|
||||
|
||||
public String getIs_admin() {
|
||||
return is_admin;
|
||||
}
|
||||
|
||||
public void setIs_admin(String is_admin) {
|
||||
this.is_admin = is_admin;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public void setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(String image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getAddtime() {
|
||||
return addtime;
|
||||
}
|
||||
|
||||
public void setAddtime(String addtime) {
|
||||
this.addtime = addtime;
|
||||
}
|
||||
|
||||
public String getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public void setNum(String num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public void setLink(String link) {
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
}
|
||||
86
live/src/main/java/com/yunbao/live/bean/ImpressBean.java
Normal file
86
live/src/main/java/com/yunbao/live/bean/ImpressBean.java
Normal file
@@ -0,0 +1,86 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/15.
|
||||
* 印象实体类
|
||||
*/
|
||||
|
||||
public class ImpressBean {
|
||||
|
||||
private int id;
|
||||
private String name;
|
||||
private int order;
|
||||
private String color;
|
||||
private String color2;
|
||||
private int check;
|
||||
private String nums;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@JSONField(name = "orderno")
|
||||
public int getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
@JSONField(name = "orderno")
|
||||
public void setOrder(int order) {
|
||||
this.order = order;
|
||||
}
|
||||
|
||||
@JSONField(name = "colour")
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@JSONField(name = "colour")
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@JSONField(name = "colour2")
|
||||
public String getColor2() {
|
||||
return color2;
|
||||
}
|
||||
@JSONField(name = "colour2")
|
||||
public void setColor2(String color2) {
|
||||
this.color2 = color2;
|
||||
}
|
||||
|
||||
@JSONField(name = "ifcheck")
|
||||
public int getCheck() {
|
||||
return check;
|
||||
}
|
||||
|
||||
@JSONField(name = "ifcheck")
|
||||
public void setCheck(int check) {
|
||||
this.check = check;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return this.check == 1;
|
||||
}
|
||||
|
||||
public String getNums() {
|
||||
return nums;
|
||||
}
|
||||
|
||||
public void setNums(String nums) {
|
||||
this.nums = nums;
|
||||
}
|
||||
}
|
||||
120
live/src/main/java/com/yunbao/live/bean/LiveAdminRoomBean.java
Normal file
120
live/src/main/java/com/yunbao/live/bean/LiveAdminRoomBean.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
*/
|
||||
|
||||
public class LiveAdminRoomBean implements Parcelable{
|
||||
private String mLiveUid;
|
||||
private String mUserNiceName;
|
||||
private String mAvatar;
|
||||
private String mAvatarThumb;
|
||||
private int mSex;
|
||||
private int mLevel;
|
||||
|
||||
|
||||
public LiveAdminRoomBean() {
|
||||
}
|
||||
|
||||
|
||||
@JSONField(name = "liveuid")
|
||||
public String getLiveUid() {
|
||||
return mLiveUid;
|
||||
}
|
||||
|
||||
@JSONField(name = "liveuid")
|
||||
public void setLiveUid(String liveUid) {
|
||||
mLiveUid = liveUid;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public String getUserNiceName() {
|
||||
return mUserNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
mUserNiceName = userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "avatar")
|
||||
public String getAvatar() {
|
||||
return mAvatar;
|
||||
}
|
||||
|
||||
@JSONField(name = "avatar")
|
||||
public void setAvatar(String avatar) {
|
||||
mAvatar = avatar;
|
||||
}
|
||||
|
||||
@JSONField(name = "avatar_thumb")
|
||||
public String getAvatarThumb() {
|
||||
return mAvatarThumb;
|
||||
}
|
||||
|
||||
@JSONField(name = "avatar_thumb")
|
||||
public void setAvatarThumb(String avatarThumb) {
|
||||
mAvatarThumb = avatarThumb;
|
||||
}
|
||||
|
||||
@JSONField(name = "sex")
|
||||
public int getSex() {
|
||||
return mSex;
|
||||
}
|
||||
|
||||
@JSONField(name = "sex")
|
||||
public void setSex(int sex) {
|
||||
mSex = sex;
|
||||
}
|
||||
|
||||
@JSONField(name = "level")
|
||||
public int getLevel() {
|
||||
return mLevel;
|
||||
}
|
||||
|
||||
@JSONField(name = "level")
|
||||
public void setLevel(int level) {
|
||||
mLevel = level;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(mLiveUid);
|
||||
dest.writeString(mUserNiceName);
|
||||
dest.writeString(mAvatar);
|
||||
dest.writeString(mAvatarThumb);
|
||||
dest.writeInt(mSex);
|
||||
dest.writeInt(mLevel);
|
||||
}
|
||||
|
||||
public LiveAdminRoomBean(Parcel in) {
|
||||
mLiveUid = in.readString();
|
||||
mUserNiceName = in.readString();
|
||||
mAvatar = in.readString();
|
||||
mAvatarThumb = in.readString();
|
||||
mSex = in.readInt();
|
||||
mLevel = in.readInt();
|
||||
}
|
||||
|
||||
public static final Creator<LiveAdminRoomBean> CREATOR = new Creator<LiveAdminRoomBean>() {
|
||||
@Override
|
||||
public LiveAdminRoomBean createFromParcel(Parcel in) {
|
||||
return new LiveAdminRoomBean(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiveAdminRoomBean[] newArray(int size) {
|
||||
return new LiveAdminRoomBean[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
400
live/src/main/java/com/yunbao/live/bean/LiveBean.java
Normal file
400
live/src/main/java/com/yunbao/live/bean/LiveBean.java
Normal file
@@ -0,0 +1,400 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.yunbao.common.bean.WeekListBean;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/9.
|
||||
*/
|
||||
|
||||
public class LiveBean implements Parcelable {
|
||||
private String uid;
|
||||
private String avatar;
|
||||
private String avatarThumb;
|
||||
private String userNiceName;
|
||||
private String title;
|
||||
private String city;
|
||||
private String stream;
|
||||
private String pull;
|
||||
private String thumb;
|
||||
private String nums;
|
||||
private int sex;
|
||||
private String distance;
|
||||
private int levelAnchor;
|
||||
private int type;
|
||||
private String typeVal;
|
||||
private String goodNum;//主播的靓号
|
||||
private int gameAction;//正在进行的游戏的标识
|
||||
private String game;
|
||||
private String islive;//是否直播中
|
||||
private String isTop;//是否显示排行榜
|
||||
private String pk_avatar_thumb;//pk对方的头像
|
||||
private int landscape;//1h屏2s屏
|
||||
private String hot_num;//热调
|
||||
private String content_pic_size_one;//小
|
||||
private String content_pic_size_two;//中
|
||||
private String content_pic_size_three;//大
|
||||
private String is_week;
|
||||
private String img;
|
||||
private String url;
|
||||
private String drpk_status;
|
||||
private int is_rong;
|
||||
private List<WeekListBean> mWeekList = new ArrayList<>();
|
||||
|
||||
public List<WeekListBean> getmWeekList() {
|
||||
return mWeekList;
|
||||
}
|
||||
|
||||
public void setmWeekList(List<WeekListBean> mWeekList) {
|
||||
this.mWeekList = mWeekList;
|
||||
}
|
||||
|
||||
public int getIs_rong() {
|
||||
return is_rong;
|
||||
}
|
||||
|
||||
public void setIs_rong(int is_rong) {
|
||||
this.is_rong = is_rong;
|
||||
}
|
||||
|
||||
public String getDrpk_status() {
|
||||
return drpk_status;
|
||||
}
|
||||
|
||||
public void setDrpk_status(String drpk_status) {
|
||||
this.drpk_status = drpk_status;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getIs_week() {
|
||||
return is_week;
|
||||
}
|
||||
|
||||
public void setIs_week(String is_week) {
|
||||
this.is_week = is_week;
|
||||
}
|
||||
|
||||
public String getContent_pic_size_one() {
|
||||
return content_pic_size_one;
|
||||
}
|
||||
|
||||
public void setContent_pic_size_one(String content_pic_size_one) {
|
||||
this.content_pic_size_one = content_pic_size_one;
|
||||
}
|
||||
|
||||
public String getContent_pic_size_two() {
|
||||
return content_pic_size_two;
|
||||
}
|
||||
|
||||
public void setContent_pic_size_two(String content_pic_size_two) {
|
||||
this.content_pic_size_two = content_pic_size_two;
|
||||
}
|
||||
|
||||
public String getContent_pic_size_three() {
|
||||
return content_pic_size_three;
|
||||
}
|
||||
|
||||
public void setContent_pic_size_three(String content_pic_size_three) {
|
||||
this.content_pic_size_three = content_pic_size_three;
|
||||
}
|
||||
|
||||
public String getHot_num() {
|
||||
return hot_num;
|
||||
}
|
||||
|
||||
public void setHot_num(String hot_num) {
|
||||
this.hot_num = hot_num;
|
||||
}
|
||||
|
||||
public int getLandscape() {
|
||||
return landscape;
|
||||
}
|
||||
|
||||
public void setLandscape(int landscape) {
|
||||
this.landscape = landscape;
|
||||
}
|
||||
|
||||
public String getPk_avatar_thumb() {
|
||||
return pk_avatar_thumb;
|
||||
}
|
||||
|
||||
public void setPk_avatar_thumb(String pk_avatar_thumb) {
|
||||
this.pk_avatar_thumb = pk_avatar_thumb;
|
||||
}
|
||||
|
||||
public String getIsTop() {
|
||||
return isTop;
|
||||
}
|
||||
|
||||
public void setIsTop(String isTop) {
|
||||
this.isTop = isTop;
|
||||
}
|
||||
|
||||
public String getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(String distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
@JSONField(name = "avatar_thumb")
|
||||
public String getAvatarThumb() {
|
||||
return avatarThumb;
|
||||
}
|
||||
|
||||
@JSONField(name = "avatar_thumb")
|
||||
public void setAvatarThumb(String avatarThumb) {
|
||||
this.avatarThumb = avatarThumb;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public void setStream(String stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
public String getPull() {
|
||||
return pull;
|
||||
}
|
||||
|
||||
public void setPull(String pull) {
|
||||
this.pull = pull;
|
||||
}
|
||||
|
||||
public String getThumb() {
|
||||
return thumb;
|
||||
}
|
||||
|
||||
public void setThumb(String thumb) {
|
||||
this.thumb = thumb;
|
||||
}
|
||||
|
||||
|
||||
public String getNums() {
|
||||
return nums;
|
||||
}
|
||||
|
||||
public void setNums(String nums) {
|
||||
this.nums = nums;
|
||||
}
|
||||
|
||||
@JSONField(name = "level_anchor")
|
||||
public int getLevelAnchor() {
|
||||
return levelAnchor;
|
||||
}
|
||||
|
||||
@JSONField(name = "level_anchor")
|
||||
public void setLevelAnchor(int levelAnchor) {
|
||||
this.levelAnchor = levelAnchor;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@JSONField(name = "type_val")
|
||||
public String getTypeVal() {
|
||||
return typeVal;
|
||||
}
|
||||
|
||||
@JSONField(name = "type_val")
|
||||
public void setTypeVal(String typeVal) {
|
||||
this.typeVal = typeVal;
|
||||
}
|
||||
|
||||
@JSONField(name = "goodnum")
|
||||
public String getGoodNum() {
|
||||
return goodNum;
|
||||
}
|
||||
|
||||
@JSONField(name = "goodnum")
|
||||
public void setGoodNum(String goodNum) {
|
||||
this.goodNum = goodNum;
|
||||
}
|
||||
|
||||
@JSONField(name = "game_action")
|
||||
public int getGameAction() {
|
||||
return gameAction;
|
||||
}
|
||||
|
||||
@JSONField(name = "game_action")
|
||||
public void setGameAction(int gameAction) {
|
||||
this.gameAction = gameAction;
|
||||
}
|
||||
|
||||
public String getGame() {
|
||||
return game;
|
||||
}
|
||||
|
||||
public void setGame(String game) {
|
||||
this.game = game;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
@JSONField(name = "islive")
|
||||
public String getIslive() {
|
||||
return islive;
|
||||
}
|
||||
public void setIslive(String islive) {
|
||||
this.islive = islive;
|
||||
}
|
||||
|
||||
/**
|
||||
* 显示靓号
|
||||
*/
|
||||
public String getLiangNameTip() {
|
||||
if (!TextUtils.isEmpty(this.goodNum) && !"0".equals(this.goodNum)) {
|
||||
return WordUtil.getString(R.string.live_liang) + ":" + this.goodNum;
|
||||
}
|
||||
return "ID:" + this.uid;
|
||||
}
|
||||
|
||||
public LiveBean() {
|
||||
|
||||
}
|
||||
|
||||
private LiveBean(Parcel in) {
|
||||
this.uid = in.readString();
|
||||
this.avatar = in.readString();
|
||||
this.avatarThumb = in.readString();
|
||||
this.userNiceName = in.readString();
|
||||
this.sex = in.readInt();
|
||||
this.title = in.readString();
|
||||
this.city = in.readString();
|
||||
this.stream = in.readString();
|
||||
this.pull = in.readString();
|
||||
this.thumb = in.readString();
|
||||
this.nums = in.readString();
|
||||
this.distance = in.readString();
|
||||
this.levelAnchor = in.readInt();
|
||||
this.type = in.readInt();
|
||||
this.typeVal = in.readString();
|
||||
this.goodNum = in.readString();
|
||||
this.gameAction = in.readInt();
|
||||
this.game = in.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(this.uid);
|
||||
dest.writeString(this.avatar);
|
||||
dest.writeString(this.avatarThumb);
|
||||
dest.writeString(this.userNiceName);
|
||||
dest.writeInt(this.sex);
|
||||
dest.writeString(this.title);
|
||||
dest.writeString(this.city);
|
||||
dest.writeString(this.stream);
|
||||
dest.writeString(this.pull);
|
||||
dest.writeString(this.thumb);
|
||||
dest.writeString(this.nums);
|
||||
dest.writeString(this.distance);
|
||||
dest.writeInt(this.levelAnchor);
|
||||
dest.writeInt(this.type);
|
||||
dest.writeString(this.typeVal);
|
||||
dest.writeString(this.goodNum);
|
||||
dest.writeInt(this.gameAction);
|
||||
dest.writeString(this.game);
|
||||
}
|
||||
|
||||
public static final Creator<LiveBean> CREATOR = new Creator<LiveBean>() {
|
||||
@Override
|
||||
public LiveBean[] newArray(int size) {
|
||||
return new LiveBean[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiveBean createFromParcel(Parcel in) {
|
||||
return new LiveBean(in);
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "uid: " + uid + " , userNiceName: " + userNiceName + " ,playUrl: " + pull;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/15.
|
||||
* 直播间购买守护的消息
|
||||
*/
|
||||
|
||||
public class LiveBuyGuardMsgBean {
|
||||
|
||||
private String votes;
|
||||
private int guardNum;
|
||||
private String uid;
|
||||
private String userName;
|
||||
private int guardType;
|
||||
|
||||
public String getVotes() {
|
||||
return votes;
|
||||
}
|
||||
|
||||
public void setVotes(String votes) {
|
||||
this.votes = votes;
|
||||
}
|
||||
|
||||
public int getGuardNum() {
|
||||
return guardNum;
|
||||
}
|
||||
|
||||
public void setGuardNum(int guardNum) {
|
||||
this.guardNum = guardNum;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public void setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
}
|
||||
232
live/src/main/java/com/yunbao/live/bean/LiveChatBean.java
Normal file
232
live/src/main/java/com/yunbao/live/bean/LiveChatBean.java
Normal file
@@ -0,0 +1,232 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/22.
|
||||
*/
|
||||
|
||||
public class LiveChatBean {
|
||||
|
||||
public static final int NORMAL = 0;
|
||||
public static final int SYSTEM = 1;
|
||||
public static final int GIFT = 2;
|
||||
public static final int ENTER_ROOM = 3;
|
||||
public static final int LIGHT = 4;
|
||||
public static final int RED_PACK = 5;
|
||||
|
||||
private String id;
|
||||
private String userNiceName;
|
||||
private int level;
|
||||
private String content;
|
||||
private int heart;
|
||||
private int type; //0是普通消息 1是系统消息 2是礼物消息 6活动消息
|
||||
private String liangName;
|
||||
private int vipType;
|
||||
private int guardType;
|
||||
private boolean anchor;
|
||||
private boolean manager;
|
||||
private String medalNmae;//粉丝徽章名字
|
||||
private String medalLevelImageUrl;//粉丝徽章等级
|
||||
private String bubble;//气泡
|
||||
private String medal;//勋章
|
||||
private String medal_new;
|
||||
private String medal_honor;//荣誉勋章
|
||||
private String hot_num;
|
||||
private String good_nub;
|
||||
private String anchorName;
|
||||
private String prankIcon;
|
||||
private String hot_card;
|
||||
|
||||
public String getHot_card() {
|
||||
return hot_card;
|
||||
}
|
||||
|
||||
public void setHot_card(String hot_card) {
|
||||
this.hot_card = hot_card;
|
||||
}
|
||||
|
||||
public String getMedal_new() {
|
||||
return medal_new;
|
||||
}
|
||||
|
||||
public void setMedal_new(String medal_new) {
|
||||
this.medal_new = medal_new;
|
||||
}
|
||||
|
||||
public String getPrankIcon() {
|
||||
return prankIcon;
|
||||
}
|
||||
|
||||
public void setPrankIcon(String prankIcon) {
|
||||
this.prankIcon = prankIcon;
|
||||
}
|
||||
|
||||
public String getAnchorName() {
|
||||
return anchorName;
|
||||
}
|
||||
|
||||
public void setAnchorName(String anchorName) {
|
||||
this.anchorName = anchorName;
|
||||
}
|
||||
|
||||
public String getGood_nub() {
|
||||
return good_nub;
|
||||
}
|
||||
|
||||
public void setGood_nub(String good_nub) {
|
||||
this.good_nub = good_nub;
|
||||
}
|
||||
|
||||
public String getHot_num() {
|
||||
return hot_num;
|
||||
}
|
||||
|
||||
public void setHot_num(String hot_num) {
|
||||
this.hot_num = hot_num;
|
||||
}
|
||||
|
||||
public String getMedal_honor() {
|
||||
return medal_honor;
|
||||
}
|
||||
|
||||
public void setMedal_honor(String medal_honor) {
|
||||
this.medal_honor = medal_honor;
|
||||
}
|
||||
|
||||
public String getBubble() {
|
||||
return bubble;
|
||||
}
|
||||
|
||||
public void setBubble(String bubble) {
|
||||
this.bubble = bubble;
|
||||
}
|
||||
|
||||
public String getMedal() {
|
||||
return medal;
|
||||
}
|
||||
|
||||
public void setMedal(String medal) {
|
||||
this.medal = medal;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public int getHeart() {
|
||||
return heart;
|
||||
}
|
||||
|
||||
public void setHeart(int heart) {
|
||||
this.heart = heart;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@JSONField(name = "liangname")
|
||||
public String getLiangName() {
|
||||
return liangName;
|
||||
}
|
||||
|
||||
@JSONField(name = "liangname")
|
||||
public void setLiangName(String liangName) {
|
||||
if(!"0".equals(liangName)){
|
||||
this.liangName = liangName;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAnchor() {
|
||||
return anchor;
|
||||
}
|
||||
|
||||
public void setAnchor(boolean anchor) {
|
||||
this.anchor = anchor;
|
||||
}
|
||||
|
||||
@JSONField(name = "vip_type")
|
||||
public int getVipType() {
|
||||
return vipType;
|
||||
}
|
||||
|
||||
@JSONField(name = "vip_type")
|
||||
public void setVipType(int vipType) {
|
||||
this.vipType = vipType;
|
||||
}
|
||||
|
||||
public boolean isManager() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
public void setManager(boolean manager) {
|
||||
this.manager = manager;
|
||||
}
|
||||
|
||||
@JSONField(name = "guard_type")
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
@JSONField(name = "guard_type")
|
||||
public void setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@JSONField(name = "medal_name")
|
||||
public String getMedalNmae() {
|
||||
return medalNmae;
|
||||
}
|
||||
|
||||
@JSONField(name = "medal_name")
|
||||
public void setMedalNmae(String medalNmae) {
|
||||
this.medalNmae = medalNmae;
|
||||
}
|
||||
|
||||
@JSONField(name = "medal_level")
|
||||
public String getMedalLevelImageUrl() {
|
||||
return medalLevelImageUrl;
|
||||
}
|
||||
|
||||
@JSONField(name = "medal_level")
|
||||
public void setMedalLevelImageUrl(String medalLevelImageUrl) {
|
||||
this.medalLevelImageUrl = medalLevelImageUrl;
|
||||
}
|
||||
}
|
||||
67
live/src/main/java/com/yunbao/live/bean/LiveDanMuBean.java
Normal file
67
live/src/main/java/com/yunbao/live/bean/LiveDanMuBean.java
Normal file
@@ -0,0 +1,67 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/22.
|
||||
* 发弹幕的实体类
|
||||
*/
|
||||
|
||||
public class LiveDanMuBean {
|
||||
|
||||
private String uid;
|
||||
private int level;
|
||||
private String votes;
|
||||
private String userNiceName;
|
||||
private String avatar;
|
||||
private String content;
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@JSONField(name = "votestotal")
|
||||
public String getVotes() {
|
||||
return votes;
|
||||
}
|
||||
@JSONField(name = "votestotal")
|
||||
public void setVotes(String votes) {
|
||||
this.votes = votes;
|
||||
}
|
||||
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/12.
|
||||
*/
|
||||
|
||||
public class LiveEnterRoomBean {
|
||||
|
||||
private LiveUserGiftBean mUserBean;
|
||||
private LiveChatBean mLiveChatBean;
|
||||
|
||||
public LiveEnterRoomBean(LiveUserGiftBean userBean, LiveChatBean liveChatBean) {
|
||||
mUserBean = userBean;
|
||||
mLiveChatBean = liveChatBean;
|
||||
}
|
||||
|
||||
|
||||
public LiveUserGiftBean getUserBean() {
|
||||
return mUserBean;
|
||||
}
|
||||
|
||||
public void setUserBean(LiveUserGiftBean userBean) {
|
||||
mUserBean = userBean;
|
||||
}
|
||||
|
||||
public LiveChatBean getLiveChatBean() {
|
||||
return mLiveChatBean;
|
||||
}
|
||||
|
||||
public void setLiveChatBean(LiveChatBean liveChatBean) {
|
||||
mLiveChatBean = liveChatBean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/19.
|
||||
* 主播直播间 功能列表 实体类
|
||||
*/
|
||||
|
||||
public class LiveFunctionBean {
|
||||
|
||||
private int mID;
|
||||
private int mIcon;
|
||||
private int mName;
|
||||
|
||||
public LiveFunctionBean(int ID, int icon, int name) {
|
||||
mID = ID;
|
||||
mIcon = icon;
|
||||
mName = name;
|
||||
}
|
||||
|
||||
public int getID() {
|
||||
return mID;
|
||||
}
|
||||
|
||||
public void setID(int ID) {
|
||||
mID = ID;
|
||||
}
|
||||
|
||||
public int getIcon() {
|
||||
return mIcon;
|
||||
}
|
||||
|
||||
public void setIcon(int icon) {
|
||||
mIcon = icon;
|
||||
}
|
||||
|
||||
public int getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setName(int name) {
|
||||
mName = name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/29.
|
||||
*/
|
||||
|
||||
public class LiveGiftPrizePoolWinBean {
|
||||
|
||||
private String mUid;
|
||||
private String mAvatar;
|
||||
private String mName;
|
||||
private String mCoin;
|
||||
|
||||
@JSONField(name = "uid")
|
||||
public String getUid() {
|
||||
return mUid;
|
||||
}
|
||||
|
||||
@JSONField(name = "uid")
|
||||
public void setUid(String uid) {
|
||||
mUid = uid;
|
||||
}
|
||||
|
||||
@JSONField(name = "uhead")
|
||||
public String getAvatar() {
|
||||
return mAvatar;
|
||||
}
|
||||
|
||||
@JSONField(name = "uhead")
|
||||
public void setAvatar(String avatar) {
|
||||
mAvatar = avatar;
|
||||
}
|
||||
|
||||
@JSONField(name = "uname")
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
@JSONField(name = "uname")
|
||||
public void setName(String name) {
|
||||
mName = name;
|
||||
}
|
||||
|
||||
@JSONField(name = "wincoin")
|
||||
public String getCoin() {
|
||||
return mCoin;
|
||||
}
|
||||
|
||||
@JSONField(name = "wincoin")
|
||||
public void setCoin(String coin) {
|
||||
mCoin = coin;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
76
live/src/main/java/com/yunbao/live/bean/LiveGuardInfo.java
Normal file
76
live/src/main/java/com/yunbao/live/bean/LiveGuardInfo.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/14.
|
||||
*/
|
||||
|
||||
public class LiveGuardInfo implements Parcelable {
|
||||
|
||||
private int myGuardType;//自己是守护类型
|
||||
private String myGuardEndTime;//守护到期时间
|
||||
private int guardNum;//守护人数
|
||||
|
||||
public LiveGuardInfo() {
|
||||
}
|
||||
|
||||
public int getMyGuardType() {
|
||||
return myGuardType;
|
||||
}
|
||||
|
||||
public void setMyGuardType(int myGuardType) {
|
||||
this.myGuardType = myGuardType;
|
||||
}
|
||||
|
||||
public String getMyGuardEndTime() {
|
||||
return myGuardEndTime;
|
||||
}
|
||||
|
||||
public void setMyGuardEndTime(String myGuardEndTime) {
|
||||
this.myGuardEndTime = myGuardEndTime;
|
||||
}
|
||||
|
||||
public int getGuardNum() {
|
||||
return guardNum;
|
||||
}
|
||||
|
||||
public void setGuardNum(int guardNum) {
|
||||
this.guardNum = guardNum;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(this.myGuardType);
|
||||
dest.writeString(this.myGuardEndTime);
|
||||
dest.writeInt(this.guardNum);
|
||||
}
|
||||
|
||||
|
||||
protected LiveGuardInfo(Parcel in) {
|
||||
this.myGuardType = in.readInt();
|
||||
this.myGuardEndTime = in.readString();
|
||||
this.guardNum = in.readInt();
|
||||
}
|
||||
|
||||
public static final Creator<LiveGuardInfo> CREATOR = new Creator<LiveGuardInfo>() {
|
||||
@Override
|
||||
public LiveGuardInfo[] newArray(int size) {
|
||||
return new LiveGuardInfo[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiveGuardInfo createFromParcel(Parcel in) {
|
||||
return new LiveGuardInfo(in);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
153
live/src/main/java/com/yunbao/live/bean/LiveKsyConfigBean.java
Normal file
153
live/src/main/java/com/yunbao/live/bean/LiveKsyConfigBean.java
Normal file
@@ -0,0 +1,153 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/5/6.
|
||||
*/
|
||||
|
||||
public class LiveKsyConfigBean implements Parcelable{
|
||||
|
||||
private int mEncodeMethod;//编码模式
|
||||
private int mTargetResolution;////推流分辨率
|
||||
private int mTargetFps;//推流采集帧率
|
||||
private int mTargetGop;//推流采集gop
|
||||
private int mVideoKBitrate;//视频码率
|
||||
private int mVideoKBitrateMax;//最大视频码率
|
||||
private int mVideoKBitrateMin;//最小视频码率
|
||||
private int mAudioKBitrate;//音频码率
|
||||
private int mPreviewFps;//预览采集帧率
|
||||
private int mPreviewResolution;//预览分辨率
|
||||
|
||||
public LiveKsyConfigBean() {
|
||||
}
|
||||
|
||||
|
||||
@JSONField(name = "codingmode")
|
||||
public int getEncodeMethod() {
|
||||
return mEncodeMethod;
|
||||
}
|
||||
@JSONField(name = "codingmode")
|
||||
public void setEncodeMethod(int encodeMethod) {
|
||||
mEncodeMethod = encodeMethod;
|
||||
}
|
||||
@JSONField(name = "resolution")
|
||||
public int getTargetResolution() {
|
||||
return mTargetResolution;
|
||||
}
|
||||
@JSONField(name = "resolution")
|
||||
public void setTargetResolution(int targetResolution) {
|
||||
mTargetResolution = targetResolution;
|
||||
}
|
||||
@JSONField(name = "fps")
|
||||
public int getTargetFps() {
|
||||
return mTargetFps;
|
||||
}
|
||||
@JSONField(name = "fps")
|
||||
public void setTargetFps(int targetFps) {
|
||||
mTargetFps = targetFps;
|
||||
}
|
||||
@JSONField(name = "gop")
|
||||
public int getTargetGop() {
|
||||
return mTargetGop;
|
||||
}
|
||||
@JSONField(name = "gop")
|
||||
public void setTargetGop(int targetGop) {
|
||||
mTargetGop = targetGop;
|
||||
}
|
||||
@JSONField(name = "bitrate")
|
||||
public int getVideoKBitrate() {
|
||||
return mVideoKBitrate;
|
||||
}
|
||||
@JSONField(name = "bitrate")
|
||||
public void setVideoKBitrate(int videoKBitrate) {
|
||||
mVideoKBitrate = videoKBitrate;
|
||||
}
|
||||
@JSONField(name = "bitrate_max")
|
||||
public int getVideoKBitrateMax() {
|
||||
return mVideoKBitrateMax;
|
||||
}
|
||||
@JSONField(name = "bitrate_max")
|
||||
public void setVideoKBitrateMax(int videoKBitrateMax) {
|
||||
mVideoKBitrateMax = videoKBitrateMax;
|
||||
}
|
||||
@JSONField(name = "bitrate_min")
|
||||
public int getVideoKBitrateMin() {
|
||||
return mVideoKBitrateMin;
|
||||
}
|
||||
@JSONField(name = "bitrate_min")
|
||||
public void setVideoKBitrateMin(int videoKBitrateMin) {
|
||||
mVideoKBitrateMin = videoKBitrateMin;
|
||||
}
|
||||
@JSONField(name = "audiobitrate")
|
||||
public int getAudioKBitrate() {
|
||||
return mAudioKBitrate;
|
||||
}
|
||||
@JSONField(name = "audiobitrate")
|
||||
public void setAudioKBitrate(int audioKBitrate) {
|
||||
mAudioKBitrate = audioKBitrate;
|
||||
}
|
||||
@JSONField(name = "preview_fps")
|
||||
public int getPreviewFps() {
|
||||
return mPreviewFps;
|
||||
}
|
||||
@JSONField(name = "preview_fps")
|
||||
public void setPreviewFps(int previewFps) {
|
||||
mPreviewFps = previewFps;
|
||||
}
|
||||
@JSONField(name = "preview_resolution")
|
||||
public int getPreviewResolution() {
|
||||
return mPreviewResolution;
|
||||
}
|
||||
@JSONField(name = "preview_resolution")
|
||||
public void setPreviewResolution(int previewResolution) {
|
||||
mPreviewResolution = previewResolution;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(mEncodeMethod);
|
||||
dest.writeInt(mTargetResolution);
|
||||
dest.writeInt(mTargetFps);
|
||||
dest.writeInt(mTargetGop);
|
||||
dest.writeInt(mVideoKBitrate);
|
||||
dest.writeInt(mVideoKBitrateMax);
|
||||
dest.writeInt(mVideoKBitrateMin);
|
||||
dest.writeInt(mAudioKBitrate);
|
||||
dest.writeInt(mPreviewFps);
|
||||
dest.writeInt(mPreviewResolution);
|
||||
}
|
||||
|
||||
public LiveKsyConfigBean(Parcel in) {
|
||||
mEncodeMethod = in.readInt();
|
||||
mTargetResolution = in.readInt();
|
||||
mTargetFps = in.readInt();
|
||||
mTargetGop = in.readInt();
|
||||
mVideoKBitrate = in.readInt();
|
||||
mVideoKBitrateMax = in.readInt();
|
||||
mVideoKBitrateMin = in.readInt();
|
||||
mAudioKBitrate = in.readInt();
|
||||
mPreviewFps = in.readInt();
|
||||
mPreviewResolution = in.readInt();
|
||||
}
|
||||
|
||||
public static final Creator<LiveKsyConfigBean> CREATOR = new Creator<LiveKsyConfigBean>() {
|
||||
@Override
|
||||
public LiveKsyConfigBean createFromParcel(Parcel in) {
|
||||
return new LiveKsyConfigBean(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LiveKsyConfigBean[] newArray(int size) {
|
||||
return new LiveKsyConfigBean[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/29.
|
||||
*/
|
||||
|
||||
public class LiveLuckGiftWinBean {
|
||||
|
||||
private String mUid;
|
||||
private String mUserNiceName;
|
||||
private String mAvatar;
|
||||
private String mGiftId;
|
||||
private String mGiftName;
|
||||
private String mLuckTime;
|
||||
|
||||
@JSONField(name = "uid")
|
||||
public String getUid() {
|
||||
return mUid;
|
||||
}
|
||||
@JSONField(name = "uid")
|
||||
public void setUid(String uid) {
|
||||
mUid = uid;
|
||||
}
|
||||
@JSONField(name = "uname")
|
||||
public String getUserNiceName() {
|
||||
return mUserNiceName;
|
||||
}
|
||||
@JSONField(name = "uname")
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
mUserNiceName = userNiceName;
|
||||
}
|
||||
@JSONField(name = "uhead")
|
||||
public String getAvatar() {
|
||||
return mAvatar;
|
||||
}
|
||||
@JSONField(name = "uhead")
|
||||
public void setAvatar(String avatar) {
|
||||
mAvatar = avatar;
|
||||
}
|
||||
@JSONField(name = "giftid")
|
||||
public String getGiftId() {
|
||||
return mGiftId;
|
||||
}
|
||||
@JSONField(name = "giftid")
|
||||
public void setGiftId(String giftId) {
|
||||
mGiftId = giftId;
|
||||
}
|
||||
@JSONField(name = "giftname")
|
||||
public String getGiftName() {
|
||||
return mGiftName;
|
||||
}
|
||||
@JSONField(name = "giftname")
|
||||
public void setGiftName(String giftName) {
|
||||
mGiftName = giftName;
|
||||
}
|
||||
@JSONField(name = "lucktimes")
|
||||
public String getLuckTime() {
|
||||
return mLuckTime;
|
||||
}
|
||||
@JSONField(name = "lucktimes")
|
||||
public void setLuckTime(String luckTime) {
|
||||
mLuckTime = luckTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Chen Haoxuan on 2022/1/15.
|
||||
* pk前三名
|
||||
*/
|
||||
public class LivePKUserListBean {
|
||||
|
||||
public DataPkUserList red_one;
|
||||
public DataPkUserList red_two;
|
||||
public DataPkUserList red_three;
|
||||
public DataPkUserList blue_one;
|
||||
public DataPkUserList blue_two;
|
||||
public DataPkUserList blue_three;
|
||||
|
||||
public DataPkUserList getRed_one() {
|
||||
return red_one;
|
||||
}
|
||||
|
||||
public void setRed_one(DataPkUserList red_one) {
|
||||
this.red_one = red_one;
|
||||
}
|
||||
|
||||
public DataPkUserList getRed_two() {
|
||||
return red_two;
|
||||
}
|
||||
|
||||
public void setRed_two(DataPkUserList red_two) {
|
||||
this.red_two = red_two;
|
||||
}
|
||||
|
||||
public DataPkUserList getRed_three() {
|
||||
return red_three;
|
||||
}
|
||||
|
||||
public void setRed_three(DataPkUserList red_three) {
|
||||
this.red_three = red_three;
|
||||
}
|
||||
|
||||
public DataPkUserList getBlue_one() {
|
||||
return blue_one;
|
||||
}
|
||||
|
||||
public void setBlue_one(DataPkUserList blue_one) {
|
||||
this.blue_one = blue_one;
|
||||
}
|
||||
|
||||
public DataPkUserList getBlue_two() {
|
||||
return blue_two;
|
||||
}
|
||||
|
||||
public void setBlue_two(DataPkUserList blue_two) {
|
||||
this.blue_two = blue_two;
|
||||
}
|
||||
|
||||
public DataPkUserList getBlue_three() {
|
||||
return blue_three;
|
||||
}
|
||||
|
||||
public void setBlue_three(DataPkUserList blue_three) {
|
||||
this.blue_three = blue_three;
|
||||
}
|
||||
|
||||
public class DataPkUserList {
|
||||
public String uid;
|
||||
public String img;
|
||||
public String liveuid;
|
||||
|
||||
public String getLiveuid() {
|
||||
return liveuid;
|
||||
}
|
||||
|
||||
public void setLiveuid(String liveuid) {
|
||||
this.liveuid = liveuid;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getImg() {
|
||||
return img;
|
||||
}
|
||||
|
||||
public void setImg(String img) {
|
||||
this.img = img;
|
||||
}
|
||||
}
|
||||
}
|
||||
100
live/src/main/java/com/yunbao/live/bean/LivePkBean.java
Normal file
100
live/src/main/java/com/yunbao/live/bean/LivePkBean.java
Normal file
@@ -0,0 +1,100 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/15.
|
||||
* 连麦pk实体类
|
||||
*/
|
||||
|
||||
public class LivePkBean {
|
||||
|
||||
private String uid;
|
||||
private String userNiceName;
|
||||
private String avatar;
|
||||
private String stream;
|
||||
private String pkUid;
|
||||
private int level;
|
||||
private int levelAnchor;
|
||||
private int sex;
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public void setStream(String stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
@JSONField(name = "pkuid")
|
||||
public String getPkUid() {
|
||||
return pkUid;
|
||||
}
|
||||
|
||||
@JSONField(name = "pkuid")
|
||||
public void setPkUid(String pkUid) {
|
||||
this.pkUid = pkUid;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@JSONField(name = "level_anchor")
|
||||
public int getLevelAnchor() {
|
||||
return levelAnchor;
|
||||
}
|
||||
|
||||
@JSONField(name = "level_anchor")
|
||||
public void setLevelAnchor(int levelAnchor) {
|
||||
this.levelAnchor = levelAnchor;
|
||||
}
|
||||
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否在连麦中
|
||||
*/
|
||||
public boolean isLinkMic() {
|
||||
return !TextUtils.isEmpty(pkUid) && !"0".equals(pkUid);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
public class LivePromotionBean {
|
||||
String active_name, active_img, active_src,active_id;
|
||||
|
||||
public String getActive_id() {
|
||||
return active_id;
|
||||
}
|
||||
|
||||
public void setActive_id(String active_id) {
|
||||
this.active_id = active_id;
|
||||
}
|
||||
|
||||
public String getActive_name() {
|
||||
return active_name;
|
||||
}
|
||||
|
||||
public void setActive_name(String active_name) {
|
||||
this.active_name = active_name;
|
||||
}
|
||||
|
||||
public String getActive_img() {
|
||||
return active_img;
|
||||
}
|
||||
|
||||
public void setActive_img(String active_img) {
|
||||
this.active_img = active_img;
|
||||
}
|
||||
|
||||
public String getActive_src() {
|
||||
return active_src;
|
||||
}
|
||||
|
||||
public void setActive_src(String active_src) {
|
||||
this.active_src = active_src;
|
||||
}
|
||||
}
|
||||
394
live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java
Normal file
394
live/src/main/java/com/yunbao/live/bean/LiveReceiveGiftBean.java
Normal file
@@ -0,0 +1,394 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/22.
|
||||
* 收到送礼物消息的实体类
|
||||
*/
|
||||
|
||||
public class LiveReceiveGiftBean {
|
||||
|
||||
private String uid;
|
||||
private String avatar;
|
||||
private String userNiceName;
|
||||
private int level;
|
||||
private String giftId;
|
||||
private int giftCount;
|
||||
private String giftName;
|
||||
private String giftIcon;
|
||||
private String votes;
|
||||
private String medalRankNum;
|
||||
private String medalFirstGet;
|
||||
private LiveChatBean mLiveChatBean;
|
||||
private int lianCount = 1;
|
||||
private int gif;//是否是gif礼物 1是 0不是
|
||||
private int gitType;//豪华礼物类型 0是gif 1是svga
|
||||
private String gifUrl;
|
||||
private String mKey;
|
||||
private int mMark;//礼物标记 // 0 普通 1热门 2守护 3幸运
|
||||
private int mLuck;//幸运礼物中奖了
|
||||
private String mLuckTime;//中奖倍数
|
||||
|
||||
private boolean isAllServerNotify;
|
||||
private String ancherName;
|
||||
private String roomnum;
|
||||
private String mLiveUId;
|
||||
private boolean mTypeBuyGuard;
|
||||
|
||||
private String carName;//坐骑名称
|
||||
private String liangName;//靓号名称
|
||||
private String vipName;//vip名称
|
||||
private String vipTime;//vip时长
|
||||
private String guardType;//守护等级
|
||||
private String hot_num;//热度
|
||||
private String drpk_status;
|
||||
private String giftnameen;
|
||||
private String pk_top_users;
|
||||
private String nobilityid;
|
||||
private String nobilityname;
|
||||
private String opentype;
|
||||
|
||||
private int sendtype;
|
||||
|
||||
public int getSendtype() {
|
||||
return sendtype;
|
||||
}
|
||||
|
||||
public void setSendtype(int sendtype) {
|
||||
this.sendtype = sendtype;
|
||||
}
|
||||
|
||||
public String getGiftnameen() {
|
||||
return giftnameen;
|
||||
}
|
||||
|
||||
public void setGiftnameen(String giftnameen) {
|
||||
this.giftnameen = giftnameen;
|
||||
}
|
||||
|
||||
public String getDrpk_status() {
|
||||
return drpk_status;
|
||||
}
|
||||
|
||||
public void setDrpk_status(String drpk_status) {
|
||||
this.drpk_status = drpk_status;
|
||||
}
|
||||
|
||||
public String getHot_num() {
|
||||
return hot_num;
|
||||
}
|
||||
|
||||
public void setHot_num(String hot_num) {
|
||||
this.hot_num = hot_num;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
if (!TextUtils.isEmpty(userNiceName) && userNiceName.length() > 7) {
|
||||
userNiceName = userNiceName.substring(0, 7) + "...";
|
||||
}
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
public boolean isAllServerNotify() {
|
||||
return isAllServerNotify;
|
||||
}
|
||||
|
||||
public void setAllServerNotify(boolean allServerNotify) {
|
||||
isAllServerNotify = allServerNotify;
|
||||
}
|
||||
|
||||
public String getAncherName() {
|
||||
return ancherName;
|
||||
}
|
||||
|
||||
public void setAncherName(String ancherName) {
|
||||
this.ancherName = ancherName;
|
||||
}
|
||||
|
||||
public String getRoomnum() {
|
||||
return roomnum;
|
||||
}
|
||||
|
||||
public void setRoomnum(String roomnum) {
|
||||
this.roomnum = roomnum;
|
||||
}
|
||||
|
||||
public String getmLiveUId() {
|
||||
return mLiveUId;
|
||||
}
|
||||
|
||||
public void setmLiveUId(String mLiveUId) {
|
||||
this.mLiveUId = mLiveUId;
|
||||
}
|
||||
|
||||
public boolean ismTypeBuyGuard() {
|
||||
return mTypeBuyGuard;
|
||||
}
|
||||
|
||||
public void setmTypeBuyGuard(boolean mTypeBuyGuard) {
|
||||
this.mTypeBuyGuard = mTypeBuyGuard;
|
||||
}
|
||||
|
||||
public String getCarName() {
|
||||
return carName;
|
||||
}
|
||||
|
||||
public void setCarName(String carName) {
|
||||
this.carName = carName;
|
||||
}
|
||||
|
||||
public String getLiangName() {
|
||||
return liangName;
|
||||
}
|
||||
|
||||
public void setLiangName(String liangName) {
|
||||
this.liangName = liangName;
|
||||
}
|
||||
|
||||
public String getVipName() {
|
||||
return vipName;
|
||||
}
|
||||
|
||||
public void setVipName(String vipName) {
|
||||
this.vipName = vipName;
|
||||
}
|
||||
|
||||
public String getVipTime() {
|
||||
return vipTime;
|
||||
}
|
||||
|
||||
public void setVipTime(String vipTime) {
|
||||
this.vipTime = vipTime;
|
||||
}
|
||||
|
||||
public String getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
public void setGuardType(String guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
|
||||
|
||||
@JSONField(name = "pk_top_users")
|
||||
public void setPkTopUsers(String pk_top_users) {
|
||||
this.pk_top_users = pk_top_users;
|
||||
}
|
||||
|
||||
@JSONField(name = "pk_top_users")
|
||||
public String getPkTopUsers() {
|
||||
return pk_top_users;
|
||||
}
|
||||
|
||||
@JSONField(name = "level")
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
@JSONField(name = "level")
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
@JSONField(name = "giftid")
|
||||
public String getGiftId() {
|
||||
return giftId;
|
||||
}
|
||||
|
||||
@JSONField(name = "giftid")
|
||||
public void setGiftId(String giftId) {
|
||||
this.giftId = giftId;
|
||||
}
|
||||
|
||||
@JSONField(name = "giftcount")
|
||||
public int getGiftCount() {
|
||||
return giftCount;
|
||||
}
|
||||
|
||||
@JSONField(name = "giftcount")
|
||||
public void setGiftCount(int giftCount) {
|
||||
this.giftCount = giftCount;
|
||||
}
|
||||
|
||||
@JSONField(name = "giftname")
|
||||
public String getGiftName() {
|
||||
return giftName;
|
||||
}
|
||||
|
||||
@JSONField(name = "giftname")
|
||||
public void setGiftName(String giftName) {
|
||||
this.giftName = giftName;
|
||||
}
|
||||
|
||||
@JSONField(name = "gifticon")
|
||||
public String getGiftIcon() {
|
||||
return giftIcon;
|
||||
}
|
||||
|
||||
@JSONField(name = "gifticon")
|
||||
public void setGiftIcon(String giftIcon) {
|
||||
this.giftIcon = giftIcon;
|
||||
}
|
||||
|
||||
@JSONField(name = "votestotal")
|
||||
public String getVotes() {
|
||||
return votes;
|
||||
}
|
||||
|
||||
@JSONField(name = "votestotal")
|
||||
public void setVotes(String votes) {
|
||||
this.votes = votes;
|
||||
}
|
||||
|
||||
|
||||
@JSONField(name = "medalRankNum")
|
||||
public String getMedalRankNum() {
|
||||
return medalRankNum;
|
||||
}
|
||||
|
||||
@JSONField(name = "medalRankNum")
|
||||
public void setMedalRankNum(String medalRankNum) {
|
||||
this.medalRankNum = medalRankNum;
|
||||
}
|
||||
|
||||
@JSONField(name = "medalFirstGet")
|
||||
public String getMedalFirstGet() {
|
||||
return medalFirstGet;
|
||||
}
|
||||
|
||||
@JSONField(name = "medalFirstGet")
|
||||
public void setMedalFirstGet(String medalFirstGet) {
|
||||
this.medalFirstGet = medalFirstGet;
|
||||
}
|
||||
|
||||
@JSONField(name = "type")
|
||||
public int getGif() {
|
||||
return gif;
|
||||
}
|
||||
|
||||
@JSONField(name = "type")
|
||||
public void setGif(int gif) {
|
||||
this.gif = gif;
|
||||
}
|
||||
|
||||
@JSONField(name = "swf")
|
||||
public String getGifUrl() {
|
||||
return gifUrl;
|
||||
}
|
||||
|
||||
@JSONField(name = "swf")
|
||||
public void setGifUrl(String gifUrl) {
|
||||
this.gifUrl = gifUrl;
|
||||
}
|
||||
|
||||
@JSONField(name = "swftype")
|
||||
public int getGitType() {
|
||||
return gitType;
|
||||
}
|
||||
|
||||
@JSONField(name = "swftype")
|
||||
public void setGitType(int gitType) {
|
||||
this.gitType = gitType;
|
||||
}
|
||||
|
||||
public LiveChatBean getLiveChatBean() {
|
||||
return mLiveChatBean;
|
||||
}
|
||||
|
||||
public void setLiveChatBean(LiveChatBean liveChatBean) {
|
||||
mLiveChatBean = liveChatBean;
|
||||
}
|
||||
|
||||
public int getLianCount() {
|
||||
return lianCount;
|
||||
}
|
||||
|
||||
public void setLianCount(int lianCount) {
|
||||
this.lianCount = lianCount;
|
||||
}
|
||||
|
||||
@JSONField(name = "mark")
|
||||
public int getMark() {
|
||||
return mMark;
|
||||
}
|
||||
|
||||
@JSONField(name = "mark")
|
||||
public void setMark(int mark) {
|
||||
mMark = mark;
|
||||
}
|
||||
|
||||
@JSONField(name = "isluck")
|
||||
public int getLuck() {
|
||||
return mLuck;
|
||||
}
|
||||
|
||||
@JSONField(name = "isluck")
|
||||
public void setLuck(int luck) {
|
||||
mLuck = luck;
|
||||
}
|
||||
|
||||
@JSONField(name = "lucktimes")
|
||||
public String getLuckTime() {
|
||||
return mLuckTime;
|
||||
}
|
||||
|
||||
@JSONField(name = "lucktimes")
|
||||
public void setLuckTime(String luckTime) {
|
||||
mLuckTime = luckTime;
|
||||
}
|
||||
|
||||
public String getNobilityid() {
|
||||
return nobilityid;
|
||||
}
|
||||
|
||||
public void setNobilityid(String nobilityid) {
|
||||
this.nobilityid = nobilityid;
|
||||
}
|
||||
|
||||
public String getNobilityname() {
|
||||
return nobilityname;
|
||||
}
|
||||
|
||||
public void setNobilityname(String nobilityname) {
|
||||
this.nobilityname = nobilityname;
|
||||
}
|
||||
|
||||
public String getOpentype() {
|
||||
return opentype;
|
||||
}
|
||||
|
||||
public void setOpentype(String opentype) {
|
||||
this.opentype = opentype;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
if (TextUtils.isEmpty(mKey)) {
|
||||
mKey = this.uid + this.giftId + this.giftCount;
|
||||
}
|
||||
return mKey;
|
||||
}
|
||||
|
||||
}
|
||||
99
live/src/main/java/com/yunbao/live/bean/LiveRecordBean.java
Normal file
99
live/src/main/java/com/yunbao/live/bean/LiveRecordBean.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/9/30.
|
||||
*/
|
||||
|
||||
public class LiveRecordBean {
|
||||
private String id;
|
||||
private String uid;
|
||||
private int nums;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private String title;
|
||||
private String city;
|
||||
private String dateStartTime;
|
||||
private String dateEndTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
public int getNums() {
|
||||
return nums;
|
||||
}
|
||||
|
||||
public void setNums(int nums) {
|
||||
this.nums = nums;
|
||||
}
|
||||
|
||||
@JSONField(name = "starttime")
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
@JSONField(name = "starttime")
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
@JSONField(name = "endtime")
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
@JSONField(name = "endtime")
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@JSONField(name = "datestarttime")
|
||||
public String getDateStartTime() {
|
||||
return dateStartTime;
|
||||
}
|
||||
|
||||
@JSONField(name = "datestarttime")
|
||||
public void setDateStartTime(String dateStartTime) {
|
||||
this.dateStartTime = dateStartTime;
|
||||
}
|
||||
|
||||
@JSONField(name = "dateendtime")
|
||||
public String getDateEndTime() {
|
||||
return dateEndTime;
|
||||
}
|
||||
|
||||
@JSONField(name = "dateendtime")
|
||||
public void setDateEndTime(String dateEndTime) {
|
||||
this.dateEndTime = dateEndTime;
|
||||
}
|
||||
}
|
||||
44
live/src/main/java/com/yunbao/live/bean/LiveReportBean.java
Normal file
44
live/src/main/java/com/yunbao/live/bean/LiveReportBean.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/12/15.
|
||||
*/
|
||||
|
||||
public class LiveReportBean {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private boolean checked;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return checked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
this.checked = checked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VideoReportBean{" +
|
||||
"id='" + id + '\'' +
|
||||
", name='" + name + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
105
live/src/main/java/com/yunbao/live/bean/LiveRoomTypeBean.java
Normal file
105
live/src/main/java/com/yunbao/live/bean/LiveRoomTypeBean.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.live.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/8.
|
||||
* 直播房间类型
|
||||
*/
|
||||
|
||||
public class LiveRoomTypeBean {
|
||||
|
||||
private int mId;
|
||||
private String mName;
|
||||
private int mCheckedIcon;
|
||||
private int mUnCheckedIcon;
|
||||
private boolean mChecked;
|
||||
|
||||
public LiveRoomTypeBean() {
|
||||
}
|
||||
|
||||
public LiveRoomTypeBean(int id, String name) {
|
||||
mId = id;
|
||||
mName = name;
|
||||
}
|
||||
|
||||
public LiveRoomTypeBean(int id, String name, int checkedIcon, int unCheckedIcon) {
|
||||
mId = id;
|
||||
mName = name;
|
||||
mCheckedIcon = checkedIcon;
|
||||
mUnCheckedIcon = unCheckedIcon;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return mId;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
mId = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return mName;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
mName = name;
|
||||
}
|
||||
|
||||
public int getCheckedIcon() {
|
||||
return mCheckedIcon;
|
||||
}
|
||||
|
||||
public void setCheckedIcon(int checkedIcon) {
|
||||
mCheckedIcon = checkedIcon;
|
||||
}
|
||||
|
||||
public int getUnCheckedIcon() {
|
||||
return mUnCheckedIcon;
|
||||
}
|
||||
|
||||
public void setUnCheckedIcon(int unCheckedIcon) {
|
||||
mUnCheckedIcon = unCheckedIcon;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return mChecked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
mChecked = checked;
|
||||
}
|
||||
|
||||
public static List<LiveRoomTypeBean> getLiveTypeList(String[][] liveTypes) {
|
||||
List<LiveRoomTypeBean> list = new ArrayList<>();
|
||||
if (liveTypes != null) {
|
||||
for (String[] arr : liveTypes) {
|
||||
LiveRoomTypeBean bean = new LiveRoomTypeBean(Integer.parseInt(arr[0]), arr[1]);
|
||||
switch (bean.getId()) {
|
||||
case Constants.LIVE_TYPE_NORMAL:
|
||||
bean.setCheckedIcon(R.mipmap.icon_live_type_normal_1);
|
||||
bean.setUnCheckedIcon(R.mipmap.icon_live_type_normal_2);
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PWD:
|
||||
bean.setCheckedIcon(R.mipmap.icon_live_type_pwd_1);
|
||||
bean.setUnCheckedIcon(R.mipmap.icon_live_type_pwd_2);
|
||||
break;
|
||||
case Constants.LIVE_TYPE_PAY:
|
||||
bean.setCheckedIcon(R.mipmap.icon_live_type_pay_1);
|
||||
bean.setUnCheckedIcon(R.mipmap.icon_live_type_pay_2);
|
||||
break;
|
||||
case Constants.LIVE_TYPE_TIME:
|
||||
bean.setCheckedIcon(R.mipmap.icon_live_type_time_1);
|
||||
bean.setUnCheckedIcon(R.mipmap.icon_live_type_time_2);
|
||||
break;
|
||||
}
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
20
live/src/main/java/com/yunbao/live/bean/LiveShutUpBean.java
Normal file
20
live/src/main/java/com/yunbao/live/bean/LiveShutUpBean.java
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2019/4/27.
|
||||
*/
|
||||
|
||||
public class LiveShutUpBean extends UserBean {
|
||||
private String uid;
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
this.id = uid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/8.
|
||||
*/
|
||||
|
||||
public class LiveTimeChargeBean {
|
||||
private int mCoin;
|
||||
private boolean mChecked;
|
||||
|
||||
public LiveTimeChargeBean() {
|
||||
}
|
||||
|
||||
public LiveTimeChargeBean(int coin) {
|
||||
mCoin = coin;
|
||||
}
|
||||
|
||||
public LiveTimeChargeBean(int coin, boolean checked) {
|
||||
mCoin = coin;
|
||||
mChecked = checked;
|
||||
}
|
||||
|
||||
public int getCoin() {
|
||||
return mCoin;
|
||||
}
|
||||
|
||||
public void setCoin(int coin) {
|
||||
mCoin = coin;
|
||||
}
|
||||
|
||||
public boolean isChecked() {
|
||||
return mChecked;
|
||||
}
|
||||
|
||||
public void setChecked(boolean checked) {
|
||||
mChecked = checked;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/27.
|
||||
* 直播间用户列表实体类
|
||||
*/
|
||||
|
||||
public class LiveUserGiftBean extends UserBean {
|
||||
|
||||
private String contribution;
|
||||
private int guardType;
|
||||
private int nub;
|
||||
|
||||
|
||||
|
||||
public int getNub() {
|
||||
return nub;
|
||||
}
|
||||
|
||||
public void setNub(int nub) {
|
||||
this.nub = nub;
|
||||
}
|
||||
|
||||
public String getContribution() {
|
||||
return contribution;
|
||||
}
|
||||
|
||||
public void setContribution(String contribution) {
|
||||
this.contribution = contribution;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否送过礼物
|
||||
*/
|
||||
public boolean hasContribution() {
|
||||
return !TextUtils.isEmpty(this.contribution) && !"0".equals(this.contribution);
|
||||
}
|
||||
|
||||
@JSONField(name = "guard_type")
|
||||
public int getGuardType() {
|
||||
return guardType;
|
||||
}
|
||||
|
||||
@JSONField(name = "guard_type")
|
||||
public void setGuardType(int guardType) {
|
||||
this.guardType = guardType;
|
||||
}
|
||||
}
|
||||
112
live/src/main/java/com/yunbao/live/bean/LiveWishlistBean.java
Normal file
112
live/src/main/java/com/yunbao/live/bean/LiveWishlistBean.java
Normal file
@@ -0,0 +1,112 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/12.
|
||||
* "id": "2",
|
||||
* "dtime": "20200112",
|
||||
* "luid": "38601",
|
||||
* "lid": "63",
|
||||
* "wishlist_icon": "http:\/\/img.aiwanwu.com\/20191211\/5df062b482dc0.png",
|
||||
* "wishlist_num": "20",
|
||||
* "wishlist_progress": "0",
|
||||
* "wishlist_name": null
|
||||
*/
|
||||
|
||||
public class LiveWishlistBean {
|
||||
|
||||
private String id;
|
||||
private String dtime;//0 普通礼物 1是豪华礼物
|
||||
private String luid;// 0 普通 1热门 2守护 3幸运
|
||||
private String lid;
|
||||
private String wishlist_icon;
|
||||
private String wishlist_num;
|
||||
private String wishlist_progress;
|
||||
private String wishlist_name;
|
||||
|
||||
@JSONField(name = "id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@JSONField(name = "id")
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@JSONField(name = "dtime")
|
||||
public String getDtime() {
|
||||
return dtime;
|
||||
}
|
||||
|
||||
@JSONField(name = "dtime")
|
||||
public void setDtime(String dtime) {
|
||||
this.dtime = dtime;
|
||||
}
|
||||
|
||||
@JSONField(name = "luid")
|
||||
public String getLuid() {
|
||||
return luid;
|
||||
}
|
||||
|
||||
@JSONField(name = "luid")
|
||||
public void setLuid(String luid) {
|
||||
this.luid = luid;
|
||||
}
|
||||
|
||||
@JSONField(name = "lid")
|
||||
public String getLid() {
|
||||
return lid;
|
||||
}
|
||||
|
||||
@JSONField(name = "lid")
|
||||
public void setLid(String lid) {
|
||||
this.lid = lid;
|
||||
}
|
||||
|
||||
@JSONField(name = "wishlist_icon")
|
||||
public String getWishlist_icon() {
|
||||
return wishlist_icon;
|
||||
}
|
||||
|
||||
@JSONField(name = "wishlist_icon")
|
||||
public void setWishlist_icon(String wishlist_icon) {
|
||||
this.wishlist_icon = wishlist_icon;
|
||||
}
|
||||
|
||||
@JSONField(name = "wishlist_num")
|
||||
public String getWishlist_num() {
|
||||
return wishlist_num;
|
||||
}
|
||||
|
||||
@JSONField(name = "wishlist_num")
|
||||
public void setWishlist_num(String wishlist_num) {
|
||||
this.wishlist_num = wishlist_num;
|
||||
}
|
||||
|
||||
@JSONField(name = "wishlist_progress")
|
||||
public String getWishlist_progress() {
|
||||
return wishlist_progress;
|
||||
}
|
||||
|
||||
@JSONField(name = "wishlist_progress")
|
||||
public void setWishlist_progress(String wishlist_progress) {
|
||||
this.wishlist_progress = wishlist_progress;
|
||||
}
|
||||
|
||||
@JSONField(name = "wishlist_name")
|
||||
public String getWishlist_name() {
|
||||
return wishlist_name;
|
||||
}
|
||||
|
||||
@JSONField(name = "wishlist_name")
|
||||
public void setWishlist_name(String wishlist_name) {
|
||||
this.wishlist_name = wishlist_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
68
live/src/main/java/com/yunbao/live/bean/MicUserBean.java
Normal file
68
live/src/main/java/com/yunbao/live/bean/MicUserBean.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
public class MicUserBean {
|
||||
protected String id;
|
||||
protected String userNiceName;
|
||||
protected String avatar;
|
||||
protected int level;
|
||||
protected int sex;
|
||||
protected String dress_avatar;
|
||||
|
||||
@JSONField(name = "dress_avatar")
|
||||
public String getDress_avatar() {
|
||||
return dress_avatar;
|
||||
}
|
||||
@JSONField(name = "dress_avatar")
|
||||
public void setDress_avatar(String dress_avatar) {
|
||||
this.dress_avatar = dress_avatar;
|
||||
}
|
||||
|
||||
@JSONField(name = "level")
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
@JSONField(name = "level")
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
@JSONField(name = "sex")
|
||||
public int getSex() {
|
||||
return sex;
|
||||
}
|
||||
@JSONField(name = "sex")
|
||||
public void setSex(int sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@JSONField(name = "id")
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@JSONField(name = "avatar")
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
@JSONField(name = "avatar")
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
}
|
||||
190
live/src/main/java/com/yunbao/live/bean/RedPackBean.java
Normal file
190
live/src/main/java/com/yunbao/live/bean/RedPackBean.java
Normal file
@@ -0,0 +1,190 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/21.
|
||||
*/
|
||||
|
||||
public class RedPackBean implements Parcelable {
|
||||
|
||||
private int id;
|
||||
private String uid;
|
||||
private String liveUid;
|
||||
private int type;
|
||||
private int sendType;
|
||||
private int coin;
|
||||
private int count;
|
||||
private String title;
|
||||
private String userNiceName;
|
||||
private String avatar;
|
||||
private int isRob;
|
||||
private int robTime;
|
||||
|
||||
public RedPackBean() {
|
||||
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
@JSONField(name = "liveuid")
|
||||
public String getLiveUid() {
|
||||
return liveUid;
|
||||
}
|
||||
|
||||
@JSONField(name = "liveuid")
|
||||
public void setLiveUid(String liveUid) {
|
||||
this.liveUid = liveUid;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@JSONField(name = "type_grant")
|
||||
public int getSendType() {
|
||||
return sendType;
|
||||
}
|
||||
|
||||
@JSONField(name = "type_grant")
|
||||
public void setSendType(int sendType) {
|
||||
this.sendType = sendType;
|
||||
}
|
||||
|
||||
public int getCoin() {
|
||||
return coin;
|
||||
}
|
||||
|
||||
public void setCoin(int coin) {
|
||||
this.coin = coin;
|
||||
}
|
||||
|
||||
@JSONField(name = "nums")
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
@JSONField(name = "nums")
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@JSONField(name = "des")
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
@JSONField(name = "des")
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
@JSONField(name = "isrob")
|
||||
public int getIsRob() {
|
||||
return isRob;
|
||||
}
|
||||
|
||||
@JSONField(name = "isrob")
|
||||
public void setIsRob(int isRob) {
|
||||
this.isRob = isRob;
|
||||
}
|
||||
|
||||
@JSONField(name = "second")
|
||||
public int getRobTime() {
|
||||
return robTime;
|
||||
}
|
||||
|
||||
@JSONField(name = "second")
|
||||
public void setRobTime(int robTime) {
|
||||
this.robTime = robTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public RedPackBean(Parcel in) {
|
||||
this.id = in.readInt();
|
||||
this.uid = in.readString();
|
||||
this.liveUid = in.readString();
|
||||
this.type = in.readInt();
|
||||
this.sendType = in.readInt();
|
||||
this.coin = in.readInt();
|
||||
this.count = in.readInt();
|
||||
this.title = in.readString();
|
||||
this.userNiceName = in.readString();
|
||||
this.avatar = in.readString();
|
||||
this.isRob = in.readInt();
|
||||
this.robTime = in.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeInt(this.id);
|
||||
dest.writeString(this.uid);
|
||||
dest.writeString(this.liveUid);
|
||||
dest.writeInt(this.type);
|
||||
dest.writeInt(this.sendType);
|
||||
dest.writeInt(this.coin);
|
||||
dest.writeInt(this.count);
|
||||
dest.writeString(this.title);
|
||||
dest.writeString(this.userNiceName);
|
||||
dest.writeString(this.avatar);
|
||||
dest.writeInt(this.isRob);
|
||||
dest.writeInt(this.robTime);
|
||||
}
|
||||
|
||||
public static final Creator<RedPackBean> CREATOR = new Creator<RedPackBean>() {
|
||||
@Override
|
||||
public RedPackBean[] newArray(int size) {
|
||||
return new RedPackBean[size];
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedPackBean createFromParcel(Parcel in) {
|
||||
return new RedPackBean(in);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/11/21.
|
||||
*/
|
||||
|
||||
public class RedPackResultBean {
|
||||
|
||||
private String avatar;
|
||||
private String time;
|
||||
private String uid;
|
||||
private String userNiceName;
|
||||
private String winCoin;
|
||||
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getUid() {
|
||||
return uid;
|
||||
}
|
||||
|
||||
public void setUid(String uid) {
|
||||
this.uid = uid;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public String getUserNiceName() {
|
||||
return userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "user_nicename")
|
||||
public void setUserNiceName(String userNiceName) {
|
||||
this.userNiceName = userNiceName;
|
||||
}
|
||||
|
||||
@JSONField(name = "win")
|
||||
public String getWinCoin() {
|
||||
return winCoin;
|
||||
}
|
||||
|
||||
@JSONField(name = "win")
|
||||
public void setWinCoin(String winCoin) {
|
||||
this.winCoin = winCoin;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.yunbao.live.bean;
|
||||
|
||||
public class ReportCommunityBean {
|
||||
String dynamic_id;
|
||||
String community_type;
|
||||
String comment_id;
|
||||
|
||||
public String getDynamic_id() {
|
||||
return dynamic_id;
|
||||
}
|
||||
|
||||
public void setDynamic_id(String dynamic_id) {
|
||||
this.dynamic_id = dynamic_id;
|
||||
}
|
||||
|
||||
public String getCommunity_type() {
|
||||
return community_type;
|
||||
}
|
||||
|
||||
public void setCommunity_type(String community_type) {
|
||||
this.community_type = community_type;
|
||||
}
|
||||
|
||||
public String getComment_id() {
|
||||
return comment_id;
|
||||
}
|
||||
|
||||
public void setComment_id(String comment_id) {
|
||||
this.comment_id = comment_id;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user