Commit af033f95 authored by 代凡's avatar 代凡
Browse files

CASE-33818 【rn-云课堂】升级rn项目到最新版本

parent 5496796f
......@@ -108,18 +108,34 @@ android {
abiFilters "armeabi-v7a", "x86"
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
signingConfigs {
release {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86"
include "armeabi-v7a", "x86", "arm64-v8a"
}
}
buildTypes {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
......
......@@ -5,7 +5,6 @@ import android.content.DialogInterface;
import android.text.TextUtils;
import android.util.Log;
import com.blankj.utilcode.util.ToastUtils;
import com.easefun.polyv.businesssdk.PolyvChatDomainManager;
import com.easefun.polyv.businesssdk.model.chat.PolyvChatDomain;
import com.easefun.polyv.businesssdk.model.video.PolyvPlayBackVO;
......@@ -20,6 +19,7 @@ import com.easefun.polyv.foundationsdk.net.PolyvResponseBean;
import com.easefun.polyv.foundationsdk.net.PolyvResponseExcutor;
import com.easefun.polyv.foundationsdk.net.PolyvrResponseCallback;
import com.easefun.polyv.linkmic.PolyvLinkMicClient;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ToastUtils;
import com.easefun.polyvsdk.cloudclass.R;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.Promise;
......
......@@ -31,7 +31,7 @@ allprojects {
maven {
url 'http://maven.aliyun.com/nexus/content/repositories/releases/'
}
maven { url 'https://dl.bintray.com/polyv/abn' }
maven { url 'https://dl.bintray.com/polyv/android' }
}
}
ext {
......@@ -39,6 +39,6 @@ ext {
compileSdkVersion = 27
minSdkVersion = 16
targetSdkVersion = 27
versionCode = 8202
versionName = "0.8.2.02"
versionCode = 80
versionName = "0.8.0"
}
......@@ -8,15 +8,14 @@ android {
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles "proguard-rules.pro"
}
buildTypes {
release {
minifyEnabled false
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
qatest {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
......@@ -34,9 +33,13 @@ dependencies {
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
api 'com.android.support:design:27.1.1'
api 'com.easefun.polyv:polyvSDKCloudClass:0.8.2.02'
api 'com.easefun.polyv:polyvSDKCloudClass:0.8.0'
//glide
api 'jp.wasabeef:glide-transformations:3.3.0'
api "com.github.bumptech.glide:okhttp3-integration:4.7.1"
api ('jp.wasabeef:glide-transformations:3.3.0'){
// exclude group:'com.github.bumptech.glide',module:'glide'
}
api ("com.github.bumptech.glide:okhttp3-integration:4.7.1"){
// exclude group:'com.github.bumptech.glide',module:'glide'
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
}
......@@ -9,7 +9,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.animation.LinearInterpolator;
import com.blankj.utilcode.util.ScreenUtils;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ScreenUtils;
import com.easefun.polyv.businesssdk.api.auxiliary.PolyvAuxiliaryVideoview;
import com.easefun.polyv.businesssdk.api.common.player.PolyvBaseVideoView;
import com.easefun.polyv.businesssdk.api.common.player.microplayer.PolyvCommonVideoView;
......
......@@ -5,9 +5,8 @@ import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import com.bumptech.glide.request.RequestOptions;
import com.easefun.polyv.commonui.adapter.viewholder.ClickableViewHolder;
import com.easefun.polyv.commonui.utils.glide.progress.PolyvMyProgressManager;
import com.easefun.polyv.commonui.utils.imageloader.glide.progress.PolyvMyProgressManager;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -23,8 +22,6 @@ public abstract class PolyvBaseRecyclerViewAdapter extends
private List<RecyclerView.OnScrollListener> mListeners = new ArrayList<>();
protected RequestOptions requestOptions_t;
protected RequestOptions requestOptions_s;
protected Map<String, List<Integer>> loadImgMap = new HashMap<>();
public PolyvBaseRecyclerViewAdapter(RecyclerView recyclerView) {
......@@ -62,15 +59,6 @@ public abstract class PolyvBaseRecyclerViewAdapter extends
return loadImgMap;
}
public RequestOptions getRequestOptions_t() {
return requestOptions_t;
}
public RequestOptions getRequestOptions_s() {
return requestOptions_s;
}
public void onDestory(){
if (getLoadImgMap() != null) {
for (String key : getLoadImgMap().keySet()) {
......
......@@ -11,19 +11,13 @@ import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.ProgressBar;
import com.blankj.utilcode.util.ConvertUtils;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.Target;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ConvertUtils;
import com.easefun.polyv.cloudclass.chat.send.custom.PolyvCustomEvent;
import com.easefun.polyv.commonui.R;
import com.easefun.polyv.commonui.adapter.PolyvBaseRecyclerViewAdapter;
import com.easefun.polyv.commonui.adapter.itemview.IPolyvCustomMessageBaseItemView;
import com.easefun.polyv.commonui.utils.glide.progress.PolyvMyProgressManager;
import com.easefun.polyv.commonui.utils.glide.progress.PolyvOnProgressListener;
import com.easefun.polyv.commonui.utils.imageloader.IPolyvProgressListener;
import com.easefun.polyv.commonui.utils.imageloader.PolyvImageLoader;
import com.easefun.polyv.foundationsdk.log.PolyvCommonLog;
import java.util.ArrayList;
......@@ -68,26 +62,26 @@ public abstract class ClickableViewHolder<M, Q extends PolyvBaseRecyclerViewAdap
public abstract void processNormalMessage(M item, int position);
//处理自定义消息
public abstract void processCustomMessage(PolyvCustomEvent item, int position);
public abstract void processCustomMessage(PolyvCustomEvent item, int position);
//创建itemview
public abstract <T> IPolyvCustomMessageBaseItemView createItemView(PolyvCustomEvent<T> baseCustomEvent) ;
public abstract <T> IPolyvCustomMessageBaseItemView createItemView(PolyvCustomEvent<T> baseCustomEvent);
// </editor-fold>
//是否需要复用container里的childview
public int findReuseChildIndex(String type){
int childIndex = -1;
public int findReuseChildIndex(String type) {
int childIndex = -1;
int count = contentContainer.getChildCount();
for (int i = 0; i < count; i++) {
View child = contentContainer.getChildAt(i);
if(type.equals(child.getTag())){
PolyvCommonLog.d(TAG,"findReuseChildIndex");
if(child.getVisibility() != View.VISIBLE){
if (type.equals(child.getTag())) {
PolyvCommonLog.d(TAG, "findReuseChildIndex");
if (child.getVisibility() != View.VISIBLE) {
child.setVisibility(View.VISIBLE);
}
childIndex = i;
}else {
if(child.getVisibility() != View.GONE){
} else {
if (child.getVisibility() != View.GONE) {
child.setVisibility(View.GONE);
}
}
......@@ -123,44 +117,53 @@ public abstract class ClickableViewHolder<M, Q extends PolyvBaseRecyclerViewAdap
// <editor-fold defaultstate="collapsed" desc="图片处理方法">
protected void loadNetImg(String chatImg, final int position, final ProgressBar imgLoading, final ImageView imageView) {
PolyvMyProgressManager.removeListener(chatImg, position);
final PolyvOnProgressListener onProgressListener = new PolyvOnProgressListener() {
@Override
public void onStart(String url) {//后台回来会重新开始
if ((int) imgLoading.getTag() != position)
return;
if (imgLoading.getProgress() == 0 && imgLoading.getVisibility() != View.VISIBLE) {
imgLoading.setVisibility(View.VISIBLE);
imageView.setImageDrawable(null);
}
}
@Override
public void onProgress(String url, boolean isComplete, int percentage, long bytesRead, long totalBytes) {
if ((int) imgLoading.getTag() != position)
return;
if (isComplete) {
imgLoading.setVisibility(View.GONE);
imgLoading.setProgress(100);
} else if (imageView.getDrawable() == null) {//onFailed之后可能触发onProgress
imgLoading.setVisibility(View.VISIBLE);
imgLoading.setProgress(percentage);
}
}
protected void loadNetImg(final String chatImg, final int position, final ProgressBar imgLoading, final ImageView imageView) {
PolyvImageLoader.getInstance()
.loadImage(parentView.getContext(),
chatImg,
position,
R.drawable.polyv_image_load_err,
new IPolyvProgressListener() {
@Override
public void onStart(String url) {
if ((int) imgLoading.getTag() != position)
return;
if (imgLoading.getProgress() == 0 && imgLoading.getVisibility() != View.VISIBLE) {
imgLoading.setVisibility(View.VISIBLE);
imageView.setImageDrawable(null);
}
}
@Override
public void onProgress(String url, boolean isComplete, int percentage, long bytesRead, long totalBytes) {
if ((int) imgLoading.getTag() != position)
return;
if (isComplete) {
imgLoading.setVisibility(View.GONE);
imgLoading.setProgress(100);
} else if (imageView.getDrawable() == null) {//onFailed之后可能触发onProgress
imgLoading.setVisibility(View.VISIBLE);
imgLoading.setProgress(percentage);
}
}
@Override
public void onResourceReady(Drawable drawable) {
removeImgUrl(chatImg, position);
imageView.setImageDrawable(drawable);
}
@Override
public void onFailed(@Nullable Exception e, Object model) {
if ((int) imgLoading.getTag() != position)
return;
imgLoading.setVisibility(View.GONE);
imgLoading.setProgress(0);
}
});
@Override
public void onFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
if ((int) imgLoading.getTag() != position)
return;
imgLoading.setVisibility(View.GONE);
imgLoading.setProgress(0);
}
};
PolyvMyProgressManager.addListener(chatImg, position, onProgressListener);
putImgUrl(chatImg, position);
loadChatImg(chatImg, onProgressListener, imageView, position);
}
protected void putImgUrl(String imgUrl, int position) {
......@@ -202,27 +205,5 @@ public abstract class ClickableViewHolder<M, Q extends PolyvBaseRecyclerViewAdap
}
}
}
private void loadChatImg(final String chatImg, final PolyvOnProgressListener onProgressListener, final ImageView view, final int position) {
Glide.with(parentView.getContext())
.load(chatImg)
.apply(new RequestOptions().error(com.easefun.polyv.commonui.R.drawable.polyv_image_load_err))//dontAnimate,不显示gif
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
onProgressListener.onFailed(e, model, target, isFirstResource);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
PolyvMyProgressManager.removeListener(chatImg, position);
removeImgUrl(chatImg, position);
onProgressListener.onProgress(chatImg, true, 100, 0, 0);
return false;
}
})
.into(view);
}
// </editor-fold>
}
......@@ -16,9 +16,7 @@ import android.view.View;
import com.easefun.polyv.foundationsdk.permission.PolyvPermissionListener;
import com.easefun.polyv.foundationsdk.permission.PolyvPermissionManager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import io.reactivex.disposables.CompositeDisposable;
......@@ -30,44 +28,26 @@ public class PolyvBaseActivity extends AppCompatActivity implements PolyvPermiss
private final static int APP_STATUS_KILLED = 0; // 表示应用是被杀死后在启动的
private final static int APP_STATUS_RUNNING = 1; // 表示应用时正常的启动流程
private static int APP_STATUS = APP_STATUS_KILLED; // 记录App的启动状态
protected boolean isCreateSuccess, isKick;
//静态变量记录学员是否被踢,如果被踢后,需要结束应用后才能再次进来观看直播,这个逻辑可以更改
private static Map<String, Boolean> kickMap = new HashMap<>();
protected boolean isCreateSuccess;
// </editor-fold>
// <editor-fold defaultstate="collapsed" desc="处理聊天室用户被踢的相关方法">
public boolean isInitialize() {
return isCreateSuccess && !isKick;
}
public static void setKickValue(String channelId, boolean isKick) {
kickMap.put(channelId, isKick);
}
public static boolean checkKick(String channelId) {
return kickMap.containsKey(channelId) && kickMap.get(channelId);
}
public static boolean checkKickTips(final Activity activity, String channelId, String... message) {
if (checkKick(channelId)) {
new AlertDialog.Builder(activity)
.setTitle("温馨提示")
.setMessage(message != null && message.length > 0 ? message[0] : "您未被授权观看本直播!")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.finish();
}
})
.setCancelable(false)
.show();
return true;
}
return false;
}
public boolean checkKickTips(String channelId, String... message) {
return isKick = checkKickTips(this, channelId, message);
return isCreateSuccess;
}
public static void showKickTips(final Activity activity, String... message) {
new AlertDialog.Builder(activity)
.setTitle("温馨提示")
.setMessage(message != null && message.length > 0 ? message[0] : "您未被授权观看本直播!")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
activity.finish();
}
})
.setCancelable(false)
.show();
}
// </editor-fold>
......@@ -122,7 +102,6 @@ public class PolyvBaseActivity extends AppCompatActivity implements PolyvPermiss
}
super.onCreate(savedInstanceState);
isCreateSuccess = false;
isKick = false;
boolean launchActivityItBaseActivity = false;
try {
launchActivityItBaseActivity = getLaunchActivityName() != null && PolyvBaseActivity.class.isAssignableFrom(Class.forName(getLaunchActivityName()));//父/等
......
package com.easefun.polyv.commonui.player.widget;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.easefun.polyv.businesssdk.api.common.player.IPolyvBaseVideoView;
import com.easefun.polyv.businesssdk.vodplayer.PolyvPlayType;
import com.easefun.polyv.cloudclass.playback.video.PolyvPlaybackVideoView;
import com.easefun.polyv.cloudclass.video.PolyvCloudClassVideoView;
import com.easefun.polyv.commonui.R;
import java.util.Locale;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;
public class PolyvLoadingLayout extends FrameLayout {
private ProgressBar loadingProgress;
private TextView loadingSpeed;
private IPolyvBaseVideoView videoView;
private Handler handler = new Handler(Looper.getMainLooper()) {
@Override
public void handleMessage(Message msg) {
if (msg.what == 1) {
if (videoView instanceof PolyvCloudClassVideoView ||
(videoView instanceof PolyvPlaybackVideoView && ((PolyvPlaybackVideoView) videoView).getPlayType() == PolyvPlayType.ONLINE_PLAY)) {
IjkMediaPlayer mp = videoView.getIjkMediaPlayer();
if (mp != null) {
long tcpSpeed = mp.getTcpSpeed();
loadingSpeed.setVisibility(View.VISIBLE);
loadingSpeed.setText(formatedSpeed(tcpSpeed, 1000));
handler.sendEmptyMessageDelayed(1, 500);
}
}
}
}
};
private static String formatedSpeed(long bytes, long elapsed_milli) {
if (elapsed_milli <= 0) {
return "0 B/S";
}
if (bytes <= 0) {
return "0 B/S";
}
float bytes_per_sec = ((float) bytes) * 1000.f / elapsed_milli;
if (bytes_per_sec >= 1000 * 1000) {
return String.format(Locale.US, "%.2f MB/S", ((float) bytes_per_sec) / 1000 / 1000);
} else if (bytes_per_sec >= 1000) {
return String.format(Locale.US, "%.2f KB/S", ((float) bytes_per_sec) / 1000);
} else {
return String.format(Locale.US, "%d B/S", (long) bytes_per_sec);
}
}
public PolyvLoadingLayout(@NonNull Context context) {
this(context, null);
}
public PolyvLoadingLayout(@NonNull Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public PolyvLoadingLayout(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
LayoutInflater.from(context).inflate(R.layout.polyv_loading_layout, this);
initView();
}
private void initView() {
loadingProgress = (ProgressBar) findViewById(R.id.loading_progress);
loadingSpeed = (TextView) findViewById(R.id.loading_speed);
}
public void bindVideoView(IPolyvBaseVideoView videoView) {
this.videoView = videoView;
}
public void destroy() {
handler.removeCallbacksAndMessages(null);
}
@Override
public void setVisibility(int visibility) {
super.setVisibility(visibility);
acceptVisibilityChange(visibility);
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
handler.removeCallbacksAndMessages(null);
}
@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
acceptVisibilityChange(getVisibility());
}
private void acceptVisibilityChange(int visibility) {
handler.removeCallbacksAndMessages(null);
if (visibility == View.VISIBLE) {
handler.sendEmptyMessage(1);
} else {
loadingSpeed.setVisibility(View.GONE);
}
}
}
......@@ -15,7 +15,7 @@ import android.widget.RelativeLayout;
import android.widget.SeekBar;
import android.widget.TextView;
import com.blankj.utilcode.util.ScreenUtils;
import com.easefun.polyv.thirdpart.blankj.utilcode.util.ScreenUtils;