暂存方案1

This commit is contained in:
zlzw 2023-04-18 11:03:07 +08:00
parent 32e3584fef
commit f913248fa1
10 changed files with 149 additions and 20 deletions

View File

@ -1,6 +1,7 @@
package com.shayu.phonelive.activity; package com.shayu.phonelive.activity;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Build; import android.os.Build;
@ -19,6 +20,8 @@ import android.widget.ImageView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.app.ActivityOptionsCompat;
import androidx.core.app.NotificationManagerCompat; import androidx.core.app.NotificationManagerCompat;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
@ -45,6 +48,7 @@ import com.yunbao.common.interfaces.CommonCallback;
import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.manager.IMLoginManager;
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager; import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
import com.yunbao.common.utils.DownloadUtil; import com.yunbao.common.utils.DownloadUtil;
import com.yunbao.common.utils.DpUtil;
import com.yunbao.common.utils.L; import com.yunbao.common.utils.L;
import com.yunbao.common.utils.LogUtil; import com.yunbao.common.utils.LogUtil;
import com.yunbao.common.utils.MD5Util; import com.yunbao.common.utils.MD5Util;
@ -100,6 +104,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
setStatusBar(); setStatusBar();
@ -184,6 +189,8 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
String adInfo = bean.getAdInfo(); String adInfo = bean.getAdInfo();
if (!TextUtils.isEmpty(adInfo)) { if (!TextUtils.isEmpty(adInfo)) {
JSONObject obj = JSON.parseObject(adInfo); JSONObject obj = JSON.parseObject(adInfo);
Log.i(TAG, "callback: " + adInfo);
obj.put("switch", 1);
if (obj.getIntValue("switch") == 1) { if (obj.getIntValue("switch") == 1) {
List<AdBean> list = JSON.parseArray(obj.getString("list"), AdBean.class); List<AdBean> list = JSON.parseArray(obj.getString("list"), AdBean.class);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
@ -268,8 +275,15 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
if (getIntent().getStringExtra("activityUrl") != null) { if (getIntent().getStringExtra("activityUrl") != null) {
intent.putExtra("activityUrl", getIntent().getStringExtra("activityUrl")); intent.putExtra("activityUrl", getIntent().getStringExtra("activityUrl"));
} }
if (mImageViewList != null && mImageViewList.size() > 0) {
Log.i(TAG, "forwardMainActivity: " + mImageViewList.size());
intent.putExtra("ad_url", mAdList.get(0).getUrl());
Bundle bundle = ActivityOptionsCompat.makeSceneTransitionAnimation(LauncherActivity.this, mImageViewList.get(0), "ad_img_0").toBundle();
//Bundle bundle = ActivityOptionsCompat.makeScaleUpAnimation(mImageViewList.get(0),100,100, DpUtil.dp2px(400),DpUtil.dp2px(200)).toBundle();
LauncherActivity.this.startActivity(intent, bundle);
} else {
LauncherActivity.this.startActivity(intent); LauncherActivity.this.startActivity(intent);
}
finish(); finish();
} }
@ -369,7 +383,13 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
if (mContainer == null) { if (mContainer == null) {
return; return;
} }
isImage = true;
if (isImage) { if (isImage) {
mAdList = new ArrayList<>();
AdBean adBean = new AdBean();
adBean.setUrl("https://downs.yaoulive.com/20230411/af6596ffcc35349adbae44dfb9c23a96.jpg");
adBean.setLink("https://downs.yaoulive.com/20230411/af6596ffcc35349adbae44dfb9c23a96.jpg");
mAdList.add(adBean);
int imgSize = mAdList.size(); int imgSize = mAdList.size();
if (imgSize > 0) { if (imgSize > 0) {
mImageViewList = new ArrayList<>(); mImageViewList = new ArrayList<>();
@ -378,6 +398,7 @@ public class LauncherActivity extends AppCompatActivity implements View.OnClickL
imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); imageView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
imageView.setScaleType(ImageView.ScaleType.CENTER_CROP); imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
imageView.setBackgroundColor(0xffffffff); imageView.setBackgroundColor(0xffffffff);
imageView.setTransitionName("ad_img_" + i);
mImageViewList.add(imageView); mImageViewList.add(imageView);
ImgLoader.display(mContext, mAdList.get(i).getUrl(), imageView); ImgLoader.display(mContext, mAdList.get(i).getUrl(), imageView);
} }

View File

@ -55,6 +55,7 @@ public abstract class AbsActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(@Nullable Bundle savedInstanceState) { protected void onCreate(@Nullable Bundle savedInstanceState) {
create();
Intent intent = getIntent(); Intent intent = getIntent();
if (intent != null) { if (intent != null) {
isFullWindow = getIntent().getBooleanExtra("isFull", false); isFullWindow = getIntent().getBooleanExtra("isFull", false);
@ -86,6 +87,9 @@ public abstract class AbsActivity extends AppCompatActivity {
protected void main() { protected void main() {
}
protected void create(){
} }
protected boolean isStatusBarWhite() { protected boolean isStatusBarWhite() {

View File

@ -223,6 +223,7 @@ public class CommonHttpUtil {
IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl")); IMLoginManager.get(context).setDefaultBubbleUrl(obj.getString("defaultBubbleUrl"));
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage(); String error = "info[0]:" + info[0] + "\n\n\n" + "Exception:" + e.getClass() + "---message--->" + e.getMessage();
ErrorActivity.forward("GetConfig接口返回数据异常", error); ErrorActivity.forward("GetConfig接口返回数据异常", error);
} }

View File

@ -62,6 +62,7 @@ public abstract class HttpCallback extends AbsCallback<JsonBean> {
@Override @Override
public void onError(Response<JsonBean> response) { public void onError(Response<JsonBean> response) {
Throwable t = response.getException(); Throwable t = response.getException();
t.printStackTrace();
L.e("网络请求错误---->" + t.getClass() + " : " + t.getMessage()); L.e("网络请求错误---->" + t.getClass() + " : " + t.getMessage());
if (t instanceof SocketTimeoutException || t instanceof ConnectException || t instanceof UnknownHostException || t instanceof UnknownServiceException || t instanceof SocketException) { if (t instanceof SocketTimeoutException || t instanceof ConnectException || t instanceof UnknownHostException || t instanceof UnknownServiceException || t instanceof SocketException) {
ToastUtil.show(R.string.load_failure); ToastUtil.show(R.string.load_failure);

View File

@ -9,9 +9,9 @@ ext {
] ]
manifestPlaceholders = [ manifestPlaceholders = [
// //
serverHost : "https://napi.yaoulive.com", // serverHost : "https://napi.yaoulive.com",
// //
// serverHost : "https ://ceshi.yaoulive.com", serverHost : "https://ceshi.yaoulive.com",
// //
txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB", txMapAppKey : "EOZBZ-ASLCU-4XPV3-BDCHZ-4E3Q7-H4BWB",

View File

@ -7,6 +7,7 @@ import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.app.NotificationChannel; import android.app.NotificationChannel;
import android.app.PendingIntent; import android.app.PendingIntent;
@ -17,11 +18,14 @@ import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils; import android.text.TextUtils;
import android.transition.ChangeBounds;
import android.util.Log; import android.util.Log;
import android.view.Display; import android.view.Display;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
@ -29,6 +33,7 @@ import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi; import androidx.annotation.RequiresApi;
import androidx.core.app.ActivityCompat;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import com.alibaba.android.arouter.facade.annotation.Route; import com.alibaba.android.arouter.facade.annotation.Route;
@ -70,6 +75,7 @@ import com.yunbao.common.event.MessageIMEvent;
import com.yunbao.common.event.NoviceInstructorEvent; import com.yunbao.common.event.NoviceInstructorEvent;
import com.yunbao.common.event.RongIMConnectionStatusEvent; import com.yunbao.common.event.RongIMConnectionStatusEvent;
import com.yunbao.common.event.UpdateTablePointMe; import com.yunbao.common.event.UpdateTablePointMe;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.CommonHttpConsts; import com.yunbao.common.http.CommonHttpConsts;
import com.yunbao.common.http.CommonHttpUtil; import com.yunbao.common.http.CommonHttpUtil;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
@ -86,6 +92,7 @@ import com.yunbao.common.utils.LocationUtil;
import com.yunbao.common.utils.ProcessResultUtil; import com.yunbao.common.utils.ProcessResultUtil;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.SpUtil; import com.yunbao.common.utils.SpUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.utils.ToastUtils; import com.yunbao.common.utils.ToastUtils;
import com.yunbao.common.utils.VersionUtil; import com.yunbao.common.utils.VersionUtil;
@ -193,9 +200,18 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
return R.layout.activity_main; return R.layout.activity_main;
} }
@Override
protected void create() {
super.create();
getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
ChangeBounds bounds = new ChangeBounds();
bounds.setDuration(1000);
getWindow().setSharedElementEnterTransition(bounds);
}
@Override @Override
protected void main() { protected void main() {
ActivityCompat.postponeEnterTransition(this);
ConversationIMListManager.get(this); ConversationIMListManager.get(this);
//在请求一下这个接口给我后台版本号 //在请求一下这个接口给我后台版本号
CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() { CommonHttpUtil.getConfig(mContext, new CommonCallback<ConfigBean>() {
@ -990,6 +1006,7 @@ public class MainActivity extends AbsActivity implements MainAppBarLayoutListene
private void loadPageData(int position, boolean needlLoadData) { private void loadPageData(int position, boolean needlLoadData) {
if (mViewHolders == null) { if (mViewHolders == null) {
ToastUtil.showDebug("Holders为空");
return; return;
} }

View File

@ -1,12 +1,16 @@
package com.yunbao.main.views; package com.yunbao.main.views;
import android.animation.ObjectAnimator; import android.animation.ObjectAnimator;
import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.graphics.Outline; import android.graphics.Outline;
import android.graphics.drawable.Drawable;
import android.net.Uri; import android.net.Uri;
import android.os.Environment; import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View; import android.view.View;
@ -14,6 +18,8 @@ import android.view.ViewGroup;
import android.view.ViewOutlineProvider; import android.view.ViewOutlineProvider;
import android.widget.ImageView; import android.widget.ImageView;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
@ -21,6 +27,13 @@ import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.DrawableImageViewTarget;
import com.bumptech.glide.request.target.Target;
import com.ms.banner.Banner; import com.ms.banner.Banner;
import com.ms.banner.listener.OnBannerClickListener; import com.ms.banner.listener.OnBannerClickListener;
import com.yunbao.common.CommonAppConfig; import com.yunbao.common.CommonAppConfig;
@ -35,12 +48,14 @@ import com.yunbao.common.bean.LiveClassBean;
import com.yunbao.common.bean.WeekListBean; import com.yunbao.common.bean.WeekListBean;
import com.yunbao.common.custom.CommonRefreshView; import com.yunbao.common.custom.CommonRefreshView;
import com.yunbao.common.custom.ItemDecoration; import com.yunbao.common.custom.ItemDecoration;
import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.http.HttpCallback; import com.yunbao.common.http.HttpCallback;
import com.yunbao.common.interfaces.OnItemClickListener; import com.yunbao.common.interfaces.OnItemClickListener;
import com.yunbao.common.utils.DialogUitl; import com.yunbao.common.utils.DialogUitl;
import com.yunbao.common.utils.MicStatusManager; import com.yunbao.common.utils.MicStatusManager;
import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.RouteUtil;
import com.yunbao.common.utils.ShareUtil; import com.yunbao.common.utils.ShareUtil;
import com.yunbao.common.utils.StringUtil;
import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.ToastUtil;
import com.yunbao.common.views.CustomViewHolder; import com.yunbao.common.views.CustomViewHolder;
import com.yunbao.live.event.LiveRoomChangeEvent; import com.yunbao.live.event.LiveRoomChangeEvent;
@ -315,7 +330,47 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
} }
}); });
mBanner.setClipToOutline(true); mBanner.setClipToOutline(true);
String adUrl = ((Activity) mContext).getIntent().getStringExtra("ad_url");
ImageView ad = headView.findViewById(R.id.ad_img);
ToastUtil.showDebug(adUrl);
if (StringUtil.isEmpty(adUrl)) {
ad.setVisibility(View.GONE);
} else {
//ImgLoader.display(mContext, adUrl, ad);
Glide.with(mContext)
.load(adUrl)
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
ToastUtil.showDebug("加载失败");
ActivityCompat.startPostponedEnterTransition((Activity) mContext);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
ToastUtil.showDebug("加载完成");
ActivityCompat.startPostponedEnterTransition((Activity) mContext);
return false;
}
})
/* .addListener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
ActivityCompat.startPostponedEnterTransition((Activity) mContext);
return false;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
ActivityCompat.startPostponedEnterTransition((Activity) mContext);
return false;
}
})*/
.error(R.mipmap.ic_launcher)
.into(new DrawableImageViewTarget(ad));
}
} }
@ -361,6 +416,9 @@ public class MainHomeLiveViewHolder extends AbsMainHomeChildViewHolder implement
return; return;
} }
mBannerShowed = true; mBannerShowed = true;
BannerBean tmp = mBannerList.get(0);
mBannerList.set(0, mBannerList.get(2));
mBannerList.set(2, tmp);
mBanner.setAutoPlay(true) mBanner.setAutoPlay(true)
.setPages(mBannerList, new CustomViewHolder()) .setPages(mBannerList, new CustomViewHolder())
.setDelayTime(3000) .setDelayTime(3000)

View File

@ -1,19 +1,13 @@
package com.yunbao.main.views; package com.yunbao.main.views;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.glide.ImgLoader;
import com.yunbao.common.utils.WordUtil; import com.yunbao.common.utils.WordUtil;
import com.yunbao.live.dialog.LiveAnchorSayPopDialog;
import com.yunbao.live.dialog.LiveRobotSettingDialogFragment;
import com.yunbao.main.R; import com.yunbao.main.R;
import com.yunbao.main.activity.MainActivity;
import com.yunbao.main.activity.TestActivity;
/** /**
* Created by cxf on 2018/9/22. * Created by cxf on 2018/9/22.

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/mainSlideMenu" android:id="@+id/mainSlideMenu"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -10,6 +11,23 @@
app:slideMode="left" app:slideMode="left"
app:slidePadding="60dp"> app:slidePadding="60dp">
<include layout="@layout/view_homemain" /> <include
android:id="@+id/include2"
layout="@layout/view_homemain"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</LinearLayout> <ImageView
android:id="@+id/imageView9"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@tools:sample/avatars" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/top_group" android:id="@+id/top_group"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="135dp" android:layout_height="135dp"
@ -9,21 +10,35 @@
<RelativeLayout <RelativeLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="3dp"> >
<com.ms.banner.Banner <com.ms.banner.Banner
android:id="@+id/banner" android:id="@+id/banner"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:layout_marginLeft="3dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
app:delay_time="3000" app:delay_time="3000"
app:indicator_drawable_selected="@drawable/bg_home_indicator_selected" app:indicator_drawable_selected="@drawable/bg_home_indicator_selected"
app:indicator_drawable_unselected="@drawable/bg_home_indicator_unselected" app:indicator_drawable_unselected="@drawable/bg_home_indicator_unselected"
app:indicator_height="8dp" app:indicator_height="8dp"
app:indicator_margin="6dp" app:indicator_margin="6dp"
app:indicator_width="8dp" /> app:indicator_width="8dp">
</com.ms.banner.Banner>
<ImageView
android:id="@+id/ad_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="110dp"
android:layout_marginBottom="5dp"
android:layout_marginTop="5dp"
android:scaleType="centerCrop"
android:src="@drawable/bg_tmp_s"
android:transitionName="ad_img_0" />
</RelativeLayout> </RelativeLayout>