直播间开通贵族
@ -171,7 +171,7 @@ dependencies {
|
|||||||
api 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
api 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
|
||||||
//gson解析
|
//gson解析
|
||||||
api 'com.squareup.retrofit2:converter-gson:2.3.0'
|
api 'com.squareup.retrofit2:converter-gson:2.3.0'
|
||||||
implementation "io.reactivex.rxjava3:rxjava:3.0.0-RC5"
|
implementation "io.reactivex.rxjava2:rxjava:2.2.3"
|
||||||
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
|
||||||
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
api 'com.jakewharton.rxbinding3:rxbinding:3.1.0'
|
||||||
//loading样式库
|
//loading样式库
|
||||||
|
BIN
common/src/main/assets/icon_noble_chaohuang.svga
Normal file
BIN
common/src/main/assets/icon_noble_gongjue.svga
Normal file
BIN
common/src/main/assets/icon_noble_guowang.svga
Normal file
BIN
common/src/main/assets/icon_noble_houjue.svga
Normal file
BIN
common/src/main/assets/icon_noble_huangdi.svga
Normal file
BIN
common/src/main/assets/icon_noble_nanjue.svga
Normal file
BIN
common/src/main/assets/icon_noble_zijue.svga
Normal file
@ -5,8 +5,13 @@ import android.content.Context;
|
|||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.BitmapFactory;
|
import android.graphics.BitmapFactory;
|
||||||
|
import android.graphics.Canvas;
|
||||||
|
import android.graphics.Paint;
|
||||||
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.PorterDuffXfermode;
|
||||||
import android.provider.MediaStore;
|
import android.provider.MediaStore;
|
||||||
|
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
import com.yunbao.common.CommonAppConfig;
|
import com.yunbao.common.CommonAppConfig;
|
||||||
import com.yunbao.common.CommonAppContext;
|
import com.yunbao.common.CommonAppContext;
|
||||||
|
|
||||||
@ -16,6 +21,7 @@ import java.io.File;
|
|||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.ref.SoftReference;
|
import java.lang.ref.SoftReference;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by cxf on 2018/6/22.
|
* Created by cxf on 2018/6/22.
|
||||||
@ -138,4 +144,55 @@ public class BitmapUtil {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转圆形图片
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* @param url
|
||||||
|
* @param width
|
||||||
|
* @param height
|
||||||
|
* @param radius
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Bitmap getBitmap(Context context, String url, int width, int height, int radius) {
|
||||||
|
Bitmap myBitmap = null;
|
||||||
|
try {
|
||||||
|
myBitmap = Glide.with(context)
|
||||||
|
.asBitmap()
|
||||||
|
.load(url)
|
||||||
|
.submit(width, height).get();
|
||||||
|
Bitmap bitmap = Bitmap.createBitmap(myBitmap, 0, 0, myBitmap.getWidth(), myBitmap.getHeight());
|
||||||
|
return toRoundBitmap(bitmap, width, height, radius);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} catch (ExecutionException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* 转圆形图片
|
||||||
|
* @param bitmap
|
||||||
|
* @param width
|
||||||
|
* @param height
|
||||||
|
* @param radius
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Bitmap toRoundBitmap(Bitmap bitmap, int width, int height, int radius) {
|
||||||
|
// 前面同上,绘制图像分别需要bitmap,canvas,paint对象
|
||||||
|
bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true);
|
||||||
|
Bitmap bm = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||||
|
Canvas canvas = new Canvas(bm);
|
||||||
|
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||||
|
// 这里需要先画出一个圆
|
||||||
|
canvas.drawCircle(width / 2, height / 2, radius, paint);
|
||||||
|
// 圆画好之后将画笔重置一下
|
||||||
|
paint.reset();
|
||||||
|
// 设置图像合成模式,该模式为只在源图像和目标图像相交的地方绘制源图像
|
||||||
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
|
||||||
|
canvas.drawBitmap(bitmap, 0, 0, paint);
|
||||||
|
return bm;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,6 @@ public class FullServiceNotificationView extends FrameLayout {
|
|||||||
|
|
||||||
private void setFullServiceStart(String svgaName) {
|
private void setFullServiceStart(String svgaName) {
|
||||||
svagaBc.setCallback(svgaCallback);
|
svagaBc.setCallback(svgaCallback);
|
||||||
svagaBc.setLoops(1);
|
|
||||||
svagaBc.startAnimation();
|
|
||||||
new SVGAParser(mContext)
|
new SVGAParser(mContext)
|
||||||
.decodeFromAssets(svgaName, new SVGAParser.ParseCompletion() {
|
.decodeFromAssets(svgaName, new SVGAParser.ParseCompletion() {
|
||||||
@Override
|
@Override
|
||||||
@ -138,6 +136,7 @@ public class FullServiceNotificationView extends FrameLayout {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
svagaBc.setLoops(1);
|
||||||
svagaBc.startAnimation();
|
svagaBc.startAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,402 @@
|
|||||||
|
package com.yunbao.common.views.weight;
|
||||||
|
|
||||||
|
import android.animation.ValueAnimator;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.animation.Animation;
|
||||||
|
import android.view.animation.AnimationSet;
|
||||||
|
import android.view.animation.TranslateAnimation;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
import android.widget.HorizontalScrollView;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.opensource.svgaplayer.SVGACallback;
|
||||||
|
import com.opensource.svgaplayer.SVGADrawable;
|
||||||
|
import com.opensource.svgaplayer.SVGADynamicEntity;
|
||||||
|
import com.opensource.svgaplayer.SVGAImageView;
|
||||||
|
import com.opensource.svgaplayer.SVGAParser;
|
||||||
|
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||||
|
import com.yunbao.common.R;
|
||||||
|
import com.yunbao.common.glide.ImgLoader;
|
||||||
|
import com.yunbao.common.utils.BitmapUtil;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import io.reactivex.ObservableEmitter;
|
||||||
|
import io.reactivex.ObservableOnSubscribe;
|
||||||
|
import io.reactivex.Observer;
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
|
import io.reactivex.disposables.Disposable;
|
||||||
|
import io.reactivex.schedulers.Schedulers;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开通贵族的通知
|
||||||
|
*/
|
||||||
|
public class NobleNoticeView extends FrameLayout {
|
||||||
|
|
||||||
|
private Context mContext;
|
||||||
|
private View rootView;
|
||||||
|
private SVGAImageView svagaBc;
|
||||||
|
private RelativeLayout rootLayout;
|
||||||
|
private long animationTime = 8000;
|
||||||
|
private TextView gotoRoomView, nobleNickname;
|
||||||
|
private String mSvgaName;
|
||||||
|
private RoleType roleType;
|
||||||
|
private HorizontalScrollView contextLayout;
|
||||||
|
private RelativeLayout scrollLayout;
|
||||||
|
private ImageView nobleIcon;
|
||||||
|
|
||||||
|
public NobleNoticeView(@NonNull Context context) {
|
||||||
|
super(context);
|
||||||
|
init(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NobleNoticeView(@NonNull Context context, @Nullable AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
init(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NobleNoticeView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
init(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void init(Context context) {
|
||||||
|
mContext = context;
|
||||||
|
rootView = LayoutInflater.from(mContext).inflate(R.layout.view_noble_notice, this, true);
|
||||||
|
svagaBc = rootView.findViewById(R.id.svaga_bc);
|
||||||
|
rootLayout = rootView.findViewById(R.id.root_layout);
|
||||||
|
gotoRoomView = rootView.findViewById(R.id.goto_room_view);
|
||||||
|
contextLayout = rootView.findViewById(R.id.context_layout);
|
||||||
|
scrollLayout = rootView.findViewById(R.id.scroll_layout);
|
||||||
|
nobleIcon = rootView.findViewById(R.id.noble_icon);
|
||||||
|
nobleNickname = rootView.findViewById(R.id.noble_nickname);
|
||||||
|
contextLayout.setVisibility(GONE);
|
||||||
|
gotoRoomView.setVisibility(GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置展示的类型
|
||||||
|
*
|
||||||
|
* @param roleType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public NobleNoticeView setRoleType(RoleType roleType) {
|
||||||
|
this.roleType = roleType;
|
||||||
|
// setButtonPosition(roleType);
|
||||||
|
switch (roleType) {
|
||||||
|
//男爵
|
||||||
|
case BARON:
|
||||||
|
nobleNoticeStart("icon_noble_nanjue.svga");
|
||||||
|
break;
|
||||||
|
//子爵
|
||||||
|
case VISCOUNT:
|
||||||
|
nobleNoticeStart("icon_noble_zijue.svga");
|
||||||
|
break;
|
||||||
|
//侯爵
|
||||||
|
case MARQUIS:
|
||||||
|
nobleNoticeStart("icon_noble_houjue.svga");
|
||||||
|
break;
|
||||||
|
//公爵
|
||||||
|
case DUKE:
|
||||||
|
nobleNoticeStart("icon_noble_gongjue.svga");
|
||||||
|
break;
|
||||||
|
//国王
|
||||||
|
case KING:
|
||||||
|
nobleNoticeStart("icon_noble_guowang.svga");
|
||||||
|
break;
|
||||||
|
//皇帝
|
||||||
|
case EMPEROR:
|
||||||
|
nobleNoticeStart("icon_noble_huangdi.svga");
|
||||||
|
break;
|
||||||
|
//超皇
|
||||||
|
case BETTER_EMPEROR:
|
||||||
|
nobleNoticeStart("icon_noble_chaohuang.svga");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void nobleNoticeStart(String svgaName) {
|
||||||
|
svagaBc.setCallback(svgaCallback);
|
||||||
|
mSvgaName = svgaName;
|
||||||
|
observable.subscribeOn(Schedulers.newThread())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(observer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子线程处理用户头像
|
||||||
|
*/
|
||||||
|
private Observable<Bitmap> observable = Observable.create(new ObservableOnSubscribe<Bitmap>() {
|
||||||
|
@Override
|
||||||
|
public void subscribe(ObservableEmitter<Bitmap> emitter) throws Exception {
|
||||||
|
Bitmap bitmap = BitmapUtil.getInstance()
|
||||||
|
.getBitmap(mContext,
|
||||||
|
"https://downs.yaoulive.com/20220818/372776fa38774814d601e68fcfc70f35.jpeg?imageView2/2/w/600/h/600",
|
||||||
|
174,
|
||||||
|
174,
|
||||||
|
87);
|
||||||
|
emitter.onNext(bitmap);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 线程调度展示SVGA
|
||||||
|
*/
|
||||||
|
private Observer<Bitmap> observer = new Observer<Bitmap>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSubscribe(Disposable d) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNext(Bitmap bitmap) {
|
||||||
|
new SVGAParser(mContext)
|
||||||
|
.decodeFromAssets(mSvgaName, new SVGAParser.ParseCompletion() {
|
||||||
|
@Override
|
||||||
|
public void onComplete(@NotNull SVGAVideoEntity svgaVideoEntity) {
|
||||||
|
svagaBc.setVisibility(VISIBLE);
|
||||||
|
SVGADynamicEntity dynamicEntity = new SVGADynamicEntity();
|
||||||
|
dynamicEntity.setDynamicImage(bitmap, "psd_31");
|
||||||
|
SVGADrawable imageView = new SVGADrawable(svgaVideoEntity, dynamicEntity);
|
||||||
|
svagaBc.setImageDrawable(imageView);
|
||||||
|
try {
|
||||||
|
Field mAnimator = svagaBc.getClass().getDeclaredField("mAnimator");
|
||||||
|
mAnimator.setAccessible(true);
|
||||||
|
ValueAnimator animator = (ValueAnimator) mAnimator.get(svagaBc);
|
||||||
|
animationTime = animator.getDuration();
|
||||||
|
System.out.println("播放时间 = " + animator.getDuration());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
svagaBc.setLoops(1);
|
||||||
|
svagaBc.startAnimation();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Throwable e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SVGA播放监听
|
||||||
|
*/
|
||||||
|
private SVGACallback svgaCallback = new SVGACallback() {
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFinished() {
|
||||||
|
svagaBc.clear();
|
||||||
|
svagaBc.setVisibility(GONE);
|
||||||
|
contextLayout.setVisibility(GONE);
|
||||||
|
gotoRoomView.setVisibility(GONE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRepeat() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStep(int frame, double v) {
|
||||||
|
System.out.println("frame = " + frame);
|
||||||
|
if (frame == 10) {
|
||||||
|
setButtonPosition(roleType);
|
||||||
|
observable.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.subscribe(bitmap -> {
|
||||||
|
TranslateAnimation animationTranslate = new TranslateAnimation(0, -scrollLayout.getMeasuredWidth(), 0, 0);
|
||||||
|
AnimationSet animationSet1 = new AnimationSet(true);
|
||||||
|
animationSet1.addAnimation(animationTranslate);
|
||||||
|
animationSet1.setFillAfter(true);
|
||||||
|
animationSet1.setDuration((animationTime - 1000) / 2);
|
||||||
|
animationSet1.setAnimationListener(animationListener);
|
||||||
|
scrollLayout.startAnimation(animationSet1);
|
||||||
|
}, throwable -> {
|
||||||
|
|
||||||
|
}).isDisposed();
|
||||||
|
|
||||||
|
}
|
||||||
|
if (frame == 150) {
|
||||||
|
contextLayout.setVisibility(GONE);
|
||||||
|
gotoRoomView.setVisibility(GONE);
|
||||||
|
scrollLayout.clearAnimation();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//设置围观按钮/文字內容位置
|
||||||
|
private void setButtonPosition(RoleType roleType) {
|
||||||
|
rootLayout.post(() -> {
|
||||||
|
int measuredHeight = rootLayout.getMeasuredHeight();
|
||||||
|
int measuredWidth = rootLayout.getMeasuredWidth();
|
||||||
|
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) gotoRoomView.getLayoutParams();
|
||||||
|
RelativeLayout.LayoutParams contextLayoutParams = (RelativeLayout.LayoutParams) contextLayout.getLayoutParams();
|
||||||
|
switch (roleType) {
|
||||||
|
case BARON:
|
||||||
|
layoutParams.rightMargin = measuredWidth / 7;
|
||||||
|
layoutParams.topMargin = measuredHeight / 12 * 5;
|
||||||
|
contextLayoutParams.leftMargin = (int) (measuredWidth / 13 * 3.5);
|
||||||
|
contextLayoutParams.topMargin = measuredHeight / 12 * 5;
|
||||||
|
gotoRoomView.setBackgroundResource(R.drawable.background_baron_station_horn);
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_open_nanjue, nobleIcon);
|
||||||
|
nobleNickname.setText(R.string.baron);
|
||||||
|
break;
|
||||||
|
case VISCOUNT:
|
||||||
|
layoutParams.rightMargin = measuredWidth / 7;
|
||||||
|
layoutParams.topMargin = measuredHeight / 15 * 6;
|
||||||
|
contextLayoutParams.leftMargin = measuredWidth / 15 * 4;
|
||||||
|
contextLayoutParams.topMargin = measuredHeight / 15 * 6;
|
||||||
|
gotoRoomView.setBackgroundResource(R.drawable.background_viscount_station_horn);
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_open_zijue, nobleIcon);
|
||||||
|
nobleNickname.setText(R.string.viscount);
|
||||||
|
break;
|
||||||
|
case MARQUIS:
|
||||||
|
layoutParams.rightMargin = measuredWidth / 6;
|
||||||
|
layoutParams.topMargin = measuredHeight / 15 * 6;
|
||||||
|
contextLayoutParams.leftMargin = measuredWidth / 15 * 4;
|
||||||
|
contextLayoutParams.topMargin = measuredHeight / 15 * 6;
|
||||||
|
gotoRoomView.setBackgroundResource(R.drawable.background_marquis_station_horn);
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_open_houjue, nobleIcon);
|
||||||
|
nobleNickname.setText(R.string.marquis);
|
||||||
|
break;
|
||||||
|
case DUKE:
|
||||||
|
layoutParams.rightMargin = measuredWidth / 6;
|
||||||
|
layoutParams.topMargin = measuredHeight / 15 * 6;
|
||||||
|
contextLayoutParams.leftMargin = measuredWidth / 15 * 4;
|
||||||
|
contextLayoutParams.topMargin = measuredHeight / 15 * 6;
|
||||||
|
gotoRoomView.setBackgroundResource(R.drawable.background_duke_station_horn);
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_open_gongjue, nobleIcon);
|
||||||
|
nobleNickname.setText(R.string.duke);
|
||||||
|
break;
|
||||||
|
case KING:
|
||||||
|
layoutParams.rightMargin = measuredWidth / 6;
|
||||||
|
layoutParams.topMargin = measuredHeight / 15 * 6;
|
||||||
|
contextLayoutParams.leftMargin = (int) (measuredWidth / 15 * 4.2);
|
||||||
|
contextLayoutParams.topMargin = measuredHeight / 15 * 6;
|
||||||
|
gotoRoomView.setBackgroundResource(R.drawable.background_duke_king_horn);
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_open_guowang, nobleIcon);
|
||||||
|
nobleNickname.setText(R.string.king);
|
||||||
|
break;
|
||||||
|
case EMPEROR:
|
||||||
|
layoutParams.rightMargin = measuredWidth / 5;
|
||||||
|
layoutParams.topMargin = measuredHeight / 15 * 7;
|
||||||
|
contextLayoutParams.leftMargin = (int) (measuredWidth / 15 * 4.2);
|
||||||
|
contextLayoutParams.topMargin = measuredHeight / 15 * 7;
|
||||||
|
gotoRoomView.setBackgroundResource(R.drawable.background_duke_king_horn);
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_open_huangdi, nobleIcon);
|
||||||
|
nobleNickname.setText(R.string.emperor);
|
||||||
|
break;
|
||||||
|
case BETTER_EMPEROR:
|
||||||
|
layoutParams.rightMargin = measuredWidth / 5;
|
||||||
|
layoutParams.topMargin = (int) (measuredHeight / 15 * 6.7);
|
||||||
|
contextLayoutParams.leftMargin = (int) (measuredWidth / 15 * 4.5);
|
||||||
|
contextLayoutParams.topMargin = (int) (measuredHeight / 15 * 6.5);
|
||||||
|
gotoRoomView.setBackgroundResource(R.drawable.background_duke_king_horn);
|
||||||
|
ImgLoader.display(mContext, R.mipmap.icon_open_chaohuang, nobleIcon);
|
||||||
|
nobleNickname.setText(R.string.better_emperor);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
gotoRoomView.setLayoutParams(layoutParams);
|
||||||
|
contextLayout.setLayoutParams(contextLayoutParams);
|
||||||
|
contextLayout.setVisibility(VISIBLE);
|
||||||
|
gotoRoomView.setVisibility(VISIBLE);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Animation.AnimationListener animationListener = new Animation.AnimationListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animation animation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animation animation) {
|
||||||
|
|
||||||
|
scrollLayout.clearAnimation();
|
||||||
|
if (svagaBc.isAnimating()) {
|
||||||
|
TranslateAnimation animationTranslate = new TranslateAnimation(0, -scrollLayout.getMeasuredWidth(), 0, 0);
|
||||||
|
AnimationSet animationSet1 = new AnimationSet(true);
|
||||||
|
animationSet1.addAnimation(animationTranslate);
|
||||||
|
animationSet1.setFillAfter(true);
|
||||||
|
animationSet1.setDuration((animationTime - 600) / 2);
|
||||||
|
animationSet1.setAnimationListener(animationListener);
|
||||||
|
scrollLayout.startAnimation(animationSet1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animation animation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public enum RoleType {
|
||||||
|
BARON("男爵", 1),
|
||||||
|
VISCOUNT("子爵", 2),
|
||||||
|
MARQUIS("侯爵", 3),
|
||||||
|
DUKE("公爵", 4),
|
||||||
|
KING("国王", 5),
|
||||||
|
EMPEROR("皇帝", 6),
|
||||||
|
BETTER_EMPEROR("超皇", 7);
|
||||||
|
private String name;
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
|
||||||
|
RoleType(String name, int type) {
|
||||||
|
this.name = name;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleType setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoleType setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="11dp" />
|
||||||
|
<stroke android:width="1dp" android:color="@color/white" />
|
||||||
|
<gradient android:angle="360" android:endColor="#D8A0FE" android:startColor="#7683D9" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
10
common/src/main/res/drawable/background_duke_king_horn.xml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="11dp" />
|
||||||
|
<stroke android:width="1dp" android:color="@color/white" />
|
||||||
|
<gradient android:angle="360" android:endColor="#FF544F" android:startColor="#FAD126" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="11dp" />
|
||||||
|
<stroke android:width="1dp" android:color="@color/white" />
|
||||||
|
<gradient android:angle="360" android:endColor="#18A86B" android:startColor="#2FB383" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="11dp" />
|
||||||
|
<stroke android:width="1dp" android:color="@color/white" />
|
||||||
|
<gradient android:angle="360" android:endColor="#4760FF" android:startColor="#0DCCFF" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item>
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<corners android:radius="11dp" />
|
||||||
|
<stroke android:width="1dp" android:color="@color/white" />
|
||||||
|
<gradient android:angle="360" android:endColor="#0DE3AC" android:startColor="#98E05F" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</selector>
|
107
common/src/main/res/layout/view_noble_notice.xml
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/root_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="120dp"
|
||||||
|
android:animateLayoutChanges="true">
|
||||||
|
|
||||||
|
<com.opensource.svgaplayer.SVGAImageView
|
||||||
|
android:id="@+id/svaga_bc"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent" />
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/goto_room_view"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentEnd="true"
|
||||||
|
android:layout_marginTop="42dp"
|
||||||
|
android:layout_marginEnd="19dp"
|
||||||
|
android:background="@drawable/background_baron_station_horn"
|
||||||
|
android:paddingLeft="7dp"
|
||||||
|
android:paddingTop="3dp"
|
||||||
|
android:paddingRight="7dp"
|
||||||
|
android:paddingBottom="3dp"
|
||||||
|
android:text="@string/onlookers"
|
||||||
|
android:textColor="#FFFEFEFE"
|
||||||
|
android:textSize="10dp" />
|
||||||
|
|
||||||
|
<HorizontalScrollView
|
||||||
|
android:id="@+id/context_layout"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="42dp"
|
||||||
|
android:layout_marginEnd="10dp"
|
||||||
|
android:layout_toStartOf="@id/goto_room_view"
|
||||||
|
android:scrollbars="none">
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/scroll_layout"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/user_name"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:text="用户昵称"
|
||||||
|
android:textColor="#F7FF74"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/in"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="7.5dp"
|
||||||
|
android:layout_toEndOf="@id/user_name"
|
||||||
|
android:text="@string/in"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/anchor_nickname"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="6.5dp"
|
||||||
|
android:layout_toEndOf="@id/in"
|
||||||
|
android:text="主播昵称"
|
||||||
|
android:textColor="#F7FF74"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/open_noble"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="4.5dp"
|
||||||
|
android:layout_toEndOf="@id/anchor_nickname"
|
||||||
|
android:text="@string/open_noble"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/noble_icon"
|
||||||
|
android:layout_width="25dp"
|
||||||
|
android:layout_height="24dp"
|
||||||
|
android:layout_marginStart="4.5dp"
|
||||||
|
android:layout_toEndOf="@id/open_noble"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@mipmap/icon_open_chaohuang" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/noble_nickname"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_marginStart="4.5dp"
|
||||||
|
android:layout_toEndOf="@id/noble_icon"
|
||||||
|
android:text="主播昵称"
|
||||||
|
android:textColor="#F7FF74"
|
||||||
|
android:textSize="14sp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
</HorizontalScrollView>
|
||||||
|
</RelativeLayout>
|
BIN
common/src/main/res/mipmap-xxhdpi/icon_open_chaohuang.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_open_gongjue.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_open_guowang.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_open_houjue.png
Normal file
After Width: | Height: | Size: 5.6 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_open_huangdi.png
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_open_nanjue.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_open_zijue.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
@ -892,4 +892,14 @@
|
|||||||
<string name="bonus_message">向你發送了一個獎勵,快來領取吧!</string>
|
<string name="bonus_message">向你發送了一個獎勵,快來領取吧!</string>
|
||||||
<string name="live_anchor_send">和大家說些什麼</string>
|
<string name="live_anchor_send">和大家說些什麼</string>
|
||||||
<string name="live_config">直播設置</string>
|
<string name="live_config">直播設置</string>
|
||||||
|
<string name="onlookers">圍觀</string>
|
||||||
|
<string name="open_noble">的直播間開通了</string>
|
||||||
|
<string name="baron">男爵</string>
|
||||||
|
<string name="viscount">子爵</string>
|
||||||
|
<string name="marquis">侯爵</string>
|
||||||
|
<string name="duke">公爵</string>
|
||||||
|
<string name="king">国王</string>
|
||||||
|
<string name="emperor">皇帝</string>
|
||||||
|
<string name="better_emperor">超皇</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -10,9 +10,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",
|
||||||
|
@ -13,7 +13,6 @@ import android.net.Uri;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.os.Message;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Base64;
|
import android.util.Base64;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@ -67,46 +66,33 @@ import com.yunbao.common.CommonAppConfig;
|
|||||||
import com.yunbao.common.Constants;
|
import com.yunbao.common.Constants;
|
||||||
import com.yunbao.common.HtmlConfig;
|
import com.yunbao.common.HtmlConfig;
|
||||||
import com.yunbao.common.activity.WebViewActivity;
|
import com.yunbao.common.activity.WebViewActivity;
|
||||||
import com.yunbao.common.bean.BaseModel;
|
|
||||||
import com.yunbao.common.bean.FaceBookUpModel;
|
|
||||||
import com.yunbao.common.bean.IMLoginModel;
|
import com.yunbao.common.bean.IMLoginModel;
|
||||||
import com.yunbao.common.bean.LoginData;
|
import com.yunbao.common.bean.LoginData;
|
||||||
import com.yunbao.common.bean.UserBean;
|
import com.yunbao.common.bean.UserBean;
|
||||||
import com.yunbao.common.http.CommonHttpUtil;
|
import com.yunbao.common.http.CommonHttpUtil;
|
||||||
import com.yunbao.common.http.HttpCallback;
|
import com.yunbao.common.http.HttpCallback;
|
||||||
import com.yunbao.common.http.HttpClient;
|
import com.yunbao.common.http.HttpClient;
|
||||||
import com.yunbao.common.http.live.LiveNetManager;
|
|
||||||
import com.yunbao.common.http.main.MainNetManager;
|
|
||||||
import com.yunbao.common.interfaces.CommonCallback;
|
import com.yunbao.common.interfaces.CommonCallback;
|
||||||
import com.yunbao.common.manager.IMLoginManager;
|
import com.yunbao.common.manager.IMLoginManager;
|
||||||
import com.yunbao.common.manager.NoviceInstructorManager;
|
import com.yunbao.common.manager.NoviceInstructorManager;
|
||||||
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
import com.yunbao.common.manager.imrongcloud.RongcloudIMManager;
|
||||||
import com.yunbao.common.utils.RouteUtil;
|
|
||||||
import com.yunbao.common.utils.ToastUtil;
|
import com.yunbao.common.utils.ToastUtil;
|
||||||
|
import com.yunbao.common.views.weight.NobleNoticeView;
|
||||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||||
import com.yunbao.live.bean.LiveBean;
|
import com.yunbao.live.bean.LiveBean;
|
||||||
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.socket.SocketRyClient;
|
|
||||||
import com.yunbao.main.R;
|
import com.yunbao.main.R;
|
||||||
import com.yunbao.main.dialog.LoginTipsDialog;
|
|
||||||
import com.yunbao.main.event.RegSuccessEvent;
|
|
||||||
import com.yunbao.main.http.MainHttpUtil;
|
import com.yunbao.main.http.MainHttpUtil;
|
||||||
|
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
import org.greenrobot.eventbus.Subscribe;
|
import org.greenrobot.eventbus.Subscribe;
|
||||||
import org.greenrobot.eventbus.ThreadMode;
|
import org.greenrobot.eventbus.ThreadMode;
|
||||||
import org.json.JSONException;
|
|
||||||
|
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import io.rong.imlib.RongIMClient;
|
|
||||||
import io.rong.message.TextMessage;
|
|
||||||
|
|
||||||
import static com.blankj.utilcode.util.SnackbarUtils.dismiss;
|
|
||||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
import static com.yunbao.common.CommonAppContext.home_zdy_img_cn;
|
||||||
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
import static com.yunbao.common.CommonAppContext.home_zdy_img_us;
|
||||||
import static com.yunbao.common.CommonAppContext.logger;
|
import static com.yunbao.common.CommonAppContext.logger;
|
||||||
@ -133,6 +119,7 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
private GoogleSignInClient mGoogleSignInClient;
|
private GoogleSignInClient mGoogleSignInClient;
|
||||||
private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer;
|
private LinearLayout lt_btn_twitter, lt_btn_facebook, lt_customer;
|
||||||
private String kefuUrl = "";
|
private String kefuUrl = "";
|
||||||
|
private NobleNoticeView noble;
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void close(String str) {
|
public void close(String str) {
|
||||||
@ -200,6 +187,7 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
btn_phone = findViewById(R.id.btn_phone);
|
btn_phone = findViewById(R.id.btn_phone);
|
||||||
btn_line = findViewById(R.id.btn_line);
|
btn_line = findViewById(R.id.btn_line);
|
||||||
lt_customer = findViewById(R.id.lt_customer);
|
lt_customer = findViewById(R.id.lt_customer);
|
||||||
|
noble = findViewById(R.id.noble);
|
||||||
|
|
||||||
btn_tip.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
|
btn_tip.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
|
||||||
btn_tip.getPaint().setAntiAlias(true);
|
btn_tip.getPaint().setAntiAlias(true);
|
||||||
@ -226,8 +214,9 @@ public class EntryActivity extends AppCompatActivity {
|
|||||||
btn_phone.setOnClickListener(new View.OnClickListener() {
|
btn_phone.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
LoginTipsDialog loginTipsDialog = new LoginTipsDialog();
|
// LoginTipsDialog loginTipsDialog = new LoginTipsDialog();
|
||||||
loginTipsDialog.show(getSupportFragmentManager(), "LoginTipsDialog");
|
// loginTipsDialog.show(getSupportFragmentManager(), "LoginTipsDialog");
|
||||||
|
noble.setRoleType(NobleNoticeView.RoleType.BETTER_EMPEROR);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@
|
|||||||
android:id="@+id/tt_login_button"
|
android:id="@+id/tt_login_button"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="54dp"
|
android:layout_height="54dp"
|
||||||
android:visibility="invisible"
|
|
||||||
android:layout_marginLeft="42dp"
|
android:layout_marginLeft="42dp"
|
||||||
android:layout_marginRight="42dp" />
|
android:layout_marginRight="42dp"
|
||||||
|
android:visibility="invisible" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/lt_btn_twitter"
|
android:id="@+id/lt_btn_twitter"
|
||||||
@ -241,4 +241,9 @@
|
|||||||
android:layout_marginTop="80dp"
|
android:layout_marginTop="80dp"
|
||||||
android:src="@mipmap/white_logo" />
|
android:src="@mipmap/white_logo" />
|
||||||
|
|
||||||
|
<com.yunbao.common.views.weight.NobleNoticeView
|
||||||
|
android:id="@+id/noble"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="200dp" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|