This commit is contained in:
18142669586 2022-08-26 15:58:31 +08:00
parent 3b8f0466a0
commit 49ef55bfee
6 changed files with 45 additions and 14 deletions

View File

@ -13,6 +13,7 @@ import com.yunbao.common.http.API;
import com.yunbao.common.http.ResponseData; import com.yunbao.common.http.ResponseData;
import com.yunbao.common.http.ResponseModel; import com.yunbao.common.http.ResponseModel;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.utils.ToastUtil;
import java.util.List; import java.util.List;
@ -193,12 +194,12 @@ public class MainNetManager {
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(slideInBannerModelResponseModel -> { .subscribe(slideInBannerModelResponseModel -> {
if (!mContext.isFinishing() && callback != null) { if (callback != null) {
List<SlideInfoModel> slideInfoModels = slideInBannerModelResponseModel.getData().getInfo().get(0).getSlide(); List<SlideInfoModel> slideInfoModels = slideInBannerModelResponseModel.getData().getInfo().get(0).getSlide();
callback.onSuccess(slideInfoModels); callback.onSuccess(slideInfoModels);
} }
}, throwable -> { }, throwable -> {
if (!mContext.isFinishing() && callback != null) { if (callback != null) {
callback.onError(throwable.getMessage()); callback.onError(throwable.getMessage());
} }
}).isDisposed(); }).isDisposed();
@ -213,12 +214,12 @@ public class MainNetManager {
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(msgSwitchDetailModelResponseModel -> { .subscribe(msgSwitchDetailModelResponseModel -> {
if (!mContext.isFinishing() && callback != null) { if (callback != null) {
MsgSwitchDetailModel msgSwitchDetailModel = msgSwitchDetailModelResponseModel.getData().getInfo(); MsgSwitchDetailModel msgSwitchDetailModel = msgSwitchDetailModelResponseModel.getData().getInfo();
callback.onSuccess(msgSwitchDetailModel); callback.onSuccess(msgSwitchDetailModel);
} }
}, throwable -> { }, throwable -> {
if (!mContext.isFinishing() && callback != null) { if (callback != null) {
callback.onError(throwable.getMessage()); callback.onError(throwable.getMessage());
} }
}).isDisposed(); }).isDisposed();
@ -233,12 +234,12 @@ public class MainNetManager {
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseModel -> { .subscribe(BaseModel -> {
if (!mContext.isFinishing() && callback != null) { if (callback != null) {
ResponseData responseData = BaseModel.getData(); ResponseData responseData = BaseModel.getData();
callback.onSuccess(responseData); callback.onSuccess(responseData);
} }
}, throwable -> { }, throwable -> {
if (!mContext.isFinishing() && callback != null) { if (callback != null) {
callback.onError(throwable.getMessage()); callback.onError(throwable.getMessage());
} }
}).isDisposed(); }).isDisposed();
@ -253,12 +254,12 @@ public class MainNetManager {
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(BaseModel -> { .subscribe(BaseModel -> {
if (!mContext.isFinishing() && callback != null) { if (callback != null) {
ResponseData responseData = BaseModel.getData(); ResponseData responseData = BaseModel.getData();
callback.onSuccess(responseData); callback.onSuccess(responseData);
} }
}, throwable -> { }, throwable -> {
if (!mContext.isFinishing() && callback != null) { if (callback != null) {
callback.onError(throwable.getMessage()); callback.onError(throwable.getMessage());
} }
}).isDisposed(); }).isDisposed();

View File

@ -32,9 +32,9 @@ import static com.yunbao.common.CommonAppContext.isReady;
*/ */
public class RongcloudIMManager { public class RongcloudIMManager {
//融云开发者平台注册app唯一识别符 //融云开发者平台注册app唯一识别符
public static final String RONG_IM_KEY = "uwd1c0sxu1p71"; // public static final String RONG_IM_KEY = "uwd1c0sxu1p71";
//测试环境 //测试环境
// public static final String RONG_IM_KEY = "pvxdm17jpd3hr"; public static final String RONG_IM_KEY = "pvxdm17jpd3hr";
private static final String CLASSNAME = "RongcloudIMManager"; private static final String CLASSNAME = "RongcloudIMManager";

View File

@ -36,7 +36,7 @@ public class LoadingView extends FrameLayout {
private void init(Context context) { private void init(Context context) {
this.mContext = context; this.mContext = context;
View view = LayoutInflater.from(mContext).inflate(R.layout.layout_portrait_live_item, this, true); View view = LayoutInflater.from(mContext).inflate(R.layout.layout_portrait_comm_item, this, true);
mIvLoading = view.findViewById(R.id.iv_loading); mIvLoading = view.findViewById(R.id.iv_loading);
} }
@ -46,7 +46,6 @@ public class LoadingView extends FrameLayout {
ImageView ivLoading = mIvLoading.findViewById(R.id.iv_loading); ImageView ivLoading = mIvLoading.findViewById(R.id.iv_loading);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground(); AnimationDrawable frameAnimation = (AnimationDrawable) ivLoading.getBackground();
frameAnimation.start(); frameAnimation.start();
setVisibility(VISIBLE); setVisibility(VISIBLE);
} }

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_bg"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"/>
<ImageView
android:id="@+id/iv_loading"
android:layout_width="150dp"
android:layout_height="188dp"
android:layout_centerInParent="true"
android:background="@drawable/loading_animation" />
</RelativeLayout>

View File

@ -17,6 +17,7 @@ import com.yunbao.common.http.ResponseData;
import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.base.HttpCallback;
import com.yunbao.common.http.main.MainNetManager; import com.yunbao.common.http.main.MainNetManager;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.live.views.LoadingView;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.adapter.MainHomeLivesClassAdapter; import com.yunbao.main.adapter.MainHomeLivesClassAdapter;
import com.yunbao.main.adapter.MsgFollowAdapter; import com.yunbao.main.adapter.MsgFollowAdapter;
@ -43,7 +44,7 @@ public class MsgSettActivity extends AbsActivity {
lt_switch = (ImageView) findViewById(R.id.lt_switch); lt_switch = (ImageView) findViewById(R.id.lt_switch);
xt_switch= (ImageView) findViewById(R.id.xt_switch); xt_switch= (ImageView) findViewById(R.id.xt_switch);
kb_switch= (ImageView) findViewById(R.id.kb_switch); kb_switch= (ImageView) findViewById(R.id.kb_switch);
getData();
dt_switch.setOnClickListener(new View.OnClickListener() { dt_switch.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
@ -148,7 +149,7 @@ public class MsgSettActivity extends AbsActivity {
follow_list.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false)); follow_list.setLayoutManager(new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false));
follow_list.setHasFixedSize(true); follow_list.setHasFixedSize(true);
follow_list.setNestedScrollingEnabled(true); follow_list.setNestedScrollingEnabled(true);
getData();
} }
public void getData(){ public void getData(){
@ -156,6 +157,7 @@ public class MsgSettActivity extends AbsActivity {
.getMsgSwitchDetail(new HttpCallback<MsgSwitchDetailModel>() { .getMsgSwitchDetail(new HttpCallback<MsgSwitchDetailModel>() {
@Override @Override
public void onSuccess(MsgSwitchDetailModel data) { public void onSuccess(MsgSwitchDetailModel data) {
if(data.getDynamic_msg_switch().equals("2")){ if(data.getDynamic_msg_switch().equals("2")){
dt_switch.setImageResource(R.mipmap.special_icon_off); dt_switch.setImageResource(R.mipmap.special_icon_off);
}else{ }else{

View File

@ -4,6 +4,7 @@ import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Handler; import android.os.Handler;
@ -22,6 +23,7 @@ import android.webkit.WebChromeClient;
import android.webkit.WebSettings; import android.webkit.WebSettings;
import android.webkit.WebView; import android.webkit.WebView;
import android.webkit.WebViewClient; import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
@ -47,6 +49,7 @@ import com.yunbao.live.bean.LiveBean;
import com.yunbao.live.bean.ReportCommunityBean; import com.yunbao.live.bean.ReportCommunityBean;
import com.yunbao.live.http.LiveHttpUtil; import com.yunbao.live.http.LiveHttpUtil;
import com.yunbao.live.presenter.LiveRoomCheckLivePresenter; import com.yunbao.live.presenter.LiveRoomCheckLivePresenter;
import com.yunbao.live.views.LoadingView;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.activity.FansActivity; import com.yunbao.main.activity.FansActivity;
import com.yunbao.main.activity.MainActivity; import com.yunbao.main.activity.MainActivity;
@ -106,6 +109,11 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
mWebView.setLayoutParams(params); mWebView.setLayoutParams(params);
mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER); mWebView.setOverScrollMode(View.OVER_SCROLL_NEVER);
LoadingView loadingView = new LoadingView(mContext);
loadingView.show();
rootView.addView(loadingView);
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true); mWebView.getSettings().setDomStorageEnabled(true);
String appCachePath = mContext.getCacheDir().getAbsolutePath(); String appCachePath = mContext.getCacheDir().getAbsolutePath();
@ -158,8 +166,10 @@ public class MainHomeCommunityViewHolder extends AbsMainHomeChildViewHolder impl
@Override @Override
public void onProgressChanged(WebView view, int newProgress) { public void onProgressChanged(WebView view, int newProgress) {
if (newProgress == 100) { if (newProgress == 100) {
loadingView.hide();
mProgressBar.setVisibility(View.GONE); mProgressBar.setVisibility(View.GONE);
} else { } else {
loadingView.show();
mProgressBar.setProgress(newProgress); mProgressBar.setProgress(newProgress);
} }
} }