声网SDK升级,首页聊天交友滚动
This commit is contained in:
@@ -664,7 +664,6 @@ public class GameHomeFragment extends BaseMvpFragment<IMainFragmentView, MainFra
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getRoomShortcut(String data) {
|
public void getRoomShortcut(String data) {
|
||||||
LogUtils.e("data:"+data);
|
|
||||||
if (TextUtils.isEmptyText(data)){
|
if (TextUtils.isEmptyText(data)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -1,21 +1,27 @@
|
|||||||
package com.yizhuan.erban.home.fragment;
|
package com.yizhuan.erban.home.fragment;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import com.coorchice.library.utils.LogUtils;
|
||||||
import com.yizhuan.erban.R;
|
import com.yizhuan.erban.R;
|
||||||
import com.yizhuan.erban.base.BaseFragment;
|
import com.yizhuan.erban.base.BaseFragment;
|
||||||
import com.yizhuan.erban.home.adapter.HomePlayAdapter;
|
import com.yizhuan.erban.home.adapter.HomePlayAdapter;
|
||||||
import com.yizhuan.erban.home.event.HomeScrollEvent;
|
import com.yizhuan.erban.home.event.HomeScrollEvent;
|
||||||
import com.yizhuan.xchat_android_core.home.bean.HomePlayInfo;
|
import com.yizhuan.xchat_android_core.home.bean.HomePlayInfo;
|
||||||
|
import com.yizhuan.xchat_android_core.home.event.HomeDynamicEvent;
|
||||||
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent;
|
import com.yizhuan.xchat_android_core.home.event.RefreshHomeDataEvent;
|
||||||
import com.yizhuan.xchat_android_core.home.model.GameHomeModel;
|
import com.yizhuan.xchat_android_core.home.model.GameHomeModel;
|
||||||
|
import com.yizhuan.xchat_android_core.initial.InitialModel;
|
||||||
import com.yizhuan.xchat_android_core.user.event.LoadLoginUserInfoEvent;
|
import com.yizhuan.xchat_android_core.user.event.LoadLoginUserInfoEvent;
|
||||||
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
import com.yizhuan.xchat_android_library.utils.ListUtils;
|
||||||
import com.yizhuan.xchat_android_library.utils.SizeUtils;
|
import com.yizhuan.xchat_android_library.utils.SizeUtils;
|
||||||
@@ -42,7 +48,9 @@ public class HomePlayFragment extends BaseFragment{
|
|||||||
RecyclerView recyclerView;
|
RecyclerView recyclerView;
|
||||||
// @BindView(R.id.refresh_layout)
|
// @BindView(R.id.refresh_layout)
|
||||||
// SwipeRefreshLayout refreshLayout;
|
// SwipeRefreshLayout refreshLayout;
|
||||||
|
private Handler handler = new Handler();
|
||||||
|
private Runnable runnable;
|
||||||
|
private List<HomePlayInfo> homePlayList;
|
||||||
private boolean isLoading = false;
|
private boolean isLoading = false;
|
||||||
|
|
||||||
private HomePlayAdapter playAdapter;
|
private HomePlayAdapter playAdapter;
|
||||||
@@ -101,24 +109,54 @@ public class HomePlayFragment extends BaseFragment{
|
|||||||
getHomPlay();
|
getHomPlay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("CheckResult")
|
||||||
private void getHomPlay(){
|
private void getHomPlay(){
|
||||||
GameHomeModel.get().getHomePlay().subscribe((serviceResult, throwable) -> {
|
GameHomeModel.get().getHomePlay().subscribe((serviceResult, throwable) -> {
|
||||||
if (throwable != null) {
|
if (throwable != null) {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
} else {
|
} else {
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
List<HomePlayInfo> info = serviceResult;
|
homePlayList = serviceResult;
|
||||||
if (ListUtils.isListEmpty(info)) {
|
if (ListUtils.isListEmpty(homePlayList)) {
|
||||||
showNoData(R.drawable.icon_common_failure, "这里什么都没有");
|
showNoData(R.drawable.icon_common_failure, "这里什么都没有");
|
||||||
}else {
|
}else {
|
||||||
hideStatus();
|
hideStatus();
|
||||||
|
playAdapter.setNewData(homePlayList);
|
||||||
|
refreshData();
|
||||||
}
|
}
|
||||||
playAdapter.setNewData(info);
|
|
||||||
playAdapter.notifyDataSetChanged();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void refreshData(){
|
||||||
|
int REFRESH_SPEED = InitialModel.get().getDynamicRefresh() > 0?InitialModel.get().getDynamicRefresh()*1000:3000;//默认3秒
|
||||||
|
|
||||||
|
LogUtils.e("REFRESH_SPEED"+REFRESH_SPEED);
|
||||||
|
if (ListUtils.isListEmpty(homePlayList) || runnable != null){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
runnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (getActivity() != null) {
|
||||||
|
playAdapter.addData(0,homePlayList.get(homePlayList.size()-1));
|
||||||
|
playAdapter.remove(homePlayList.size()-1);
|
||||||
|
handler.postDelayed(this, REFRESH_SPEED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
handler.postDelayed(runnable,REFRESH_SPEED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
public void onAutoRunningEvent(HomeDynamicEvent event) {
|
||||||
|
if (event.isRunning()){
|
||||||
|
stopTimer();
|
||||||
|
}else {
|
||||||
|
refreshData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReloadData() {
|
public void onReloadData() {
|
||||||
loadData();
|
loadData();
|
||||||
@@ -151,4 +189,20 @@ public class HomePlayFragment extends BaseFragment{
|
|||||||
unbinder.unbind();
|
unbinder.unbind();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void stopTimer(){
|
||||||
|
handler.removeCallbacks(runnable);
|
||||||
|
runnable = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
stopTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
stopTimer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -98,7 +98,7 @@ dependencies {
|
|||||||
api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.1.6'
|
api 'com.tencent.mm.opensdk:wechat-sdk-android-with-mta:5.1.6'
|
||||||
|
|
||||||
// 声网
|
// 声网
|
||||||
api 'io.agora.rtc:full-sdk:3.0.0'
|
api 'io.agora.rtc:full-sdk:3.0.1'
|
||||||
|
|
||||||
// 易盾
|
// 易盾
|
||||||
api 'com.netease.mobsec:netmobsecLib:4.2.4.1@aar'
|
api 'com.netease.mobsec:netmobsecLib:4.2.4.1@aar'
|
||||||
|
@@ -21,5 +21,5 @@ with_jenkins=false
|
|||||||
#\u6253\u652F\u6301x86\u7684\u6A21\u62DF\u5668\u5305\u4F7F\u7528
|
#\u6253\u652F\u6301x86\u7684\u6A21\u62DF\u5668\u5305\u4F7F\u7528
|
||||||
ndk_abi_filters=arm
|
ndk_abi_filters=arm
|
||||||
|
|
||||||
version_name=1.0.4
|
version_name=1.0.5
|
||||||
version_code=104
|
version_code=105
|
Reference in New Issue
Block a user