111
This commit is contained in:
@@ -647,7 +647,7 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
mLiveRoomViewHolder.showPrizePoolLevel(String.valueOf(giftPrizePoolLevel));
|
||||
}
|
||||
}
|
||||
Constants.isSend = obj.getString("front_task");
|
||||
// Constants.isSend = obj.getString("front_task");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
151
live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java
Normal file
151
live/src/main/java/com/yunbao/live/dialog/NewUserDialog.java
Normal file
@@ -0,0 +1,151 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.DialogFragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.http.LiveHttpUtil;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import static com.yunbao.live.activity.LiveAudienceActivity.countDownTimer;
|
||||
import static com.yunbao.live.views.LiveRoomViewHolder.follow;
|
||||
import static com.yunbao.live.views.LiveRoomViewHolder.mLiveUid;
|
||||
|
||||
public class NewUserDialog extends AbsDialogFragment {
|
||||
int gif = 0;
|
||||
int gif_id = 1093;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.dialog_live_new_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 主要时这个方法。上面两个方法只是获取布局用的,可以不要
|
||||
*
|
||||
* @param manager
|
||||
* @param tag
|
||||
*/
|
||||
@Override
|
||||
public void show(FragmentManager manager, String tag) {
|
||||
try {
|
||||
Field dismissed = DialogFragment.class.getDeclaredField("mDismissed");
|
||||
dismissed.setAccessible(true);
|
||||
dismissed.set(this, false);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
Field showByMe = DialogFragment.class.getDeclaredField("mShownByMe");
|
||||
showByMe.setAccessible(true);
|
||||
showByMe.set(this, true);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
FragmentTransaction ft = manager.beginTransaction();
|
||||
ft.add(this, tag);
|
||||
ft.commitAllowingStateLoss();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.gravity = Gravity.CENTER;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
ImageView btn_close = (ImageView) mRootView.findViewById(R.id.btn_close);
|
||||
btn_close.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
RelativeLayout btn_rose = (RelativeLayout) mRootView.findViewById(R.id.btn_rose);
|
||||
RelativeLayout btn_roses = (RelativeLayout) mRootView.findViewById(R.id.btn_roses);
|
||||
RelativeLayout btn_lollipop = (RelativeLayout) mRootView.findViewById(R.id.btn_lollipop);
|
||||
TextView btn_confirm = (TextView) mRootView.findViewById(R.id.btn_confirm);
|
||||
btn_rose.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
gif = 1;
|
||||
gif_id = 210;
|
||||
btn_rose.setBackgroundResource(R.drawable.button_ffb6c4);
|
||||
btn_roses.setBackgroundResource(R.drawable.button_fff8f6f8);
|
||||
btn_lollipop.setBackgroundResource(R.drawable.button_fff8f6f8);
|
||||
}
|
||||
});
|
||||
|
||||
btn_roses.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
gif = 2;
|
||||
gif_id = 224;
|
||||
btn_rose.setBackgroundResource(R.drawable.button_fff8f6f8);
|
||||
btn_roses.setBackgroundResource(R.drawable.button_ffb6c4);
|
||||
btn_lollipop.setBackgroundResource(R.drawable.button_fff8f6f8);
|
||||
}
|
||||
});
|
||||
|
||||
btn_lollipop.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
gif = 0;
|
||||
gif_id = 1093;
|
||||
btn_rose.setBackgroundResource(R.drawable.button_fff8f6f8);
|
||||
btn_roses.setBackgroundResource(R.drawable.button_fff8f6f8);
|
||||
btn_lollipop.setBackgroundResource(R.drawable.button_ffb6c4);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
btn_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
follow();
|
||||
LiveHttpUtil.sendGift("0", mLiveUid, LiveActivity.mStream, gif_id, "1", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
ToastUtil.show(msg);
|
||||
}
|
||||
});
|
||||
countDownTimer.cancel();
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,10 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.event.MessageIMEvent;
|
||||
@@ -35,6 +39,9 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2018/10/9.
|
||||
* 观众直播间逻辑
|
||||
@@ -49,6 +56,7 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
private TextView tv_trickery_time;
|
||||
private View v_msg_redpoint;
|
||||
private Activity context;
|
||||
private SVGAImageView svga_new_user_gif;
|
||||
|
||||
public LiveAudienceViewHolder(Context context, ViewGroup parentView) {
|
||||
super(context, parentView);
|
||||
@@ -68,6 +76,22 @@ public class LiveAudienceViewHolder extends AbsLiveViewHolder {
|
||||
findViewById(R.id.btn_red_pack).setOnClickListener(this);
|
||||
findViewById(R.id.btn_gift).setOnClickListener(this);
|
||||
findViewById(R.id.btn_zg).setOnClickListener(this);
|
||||
svga_new_user_gif = (SVGAImageView)findViewById(R.id.svga_new_user_gif);
|
||||
new SVGAParser(context).decodeFromAssets("free_gift_tip.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
ToastUtil.show("1212");
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
svga_new_user_gif.setImageDrawable(drawable);
|
||||
svga_new_user_gif.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Log.e("errqs","errl");
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btn_mic).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
@@ -218,7 +218,6 @@ public class LiveRoomViewHolder extends AbsViewHolder implements View.OnClickLis
|
||||
|
||||
public WindowManager windowManager;
|
||||
public boolean isRy = false;
|
||||
|
||||
public LiveRoomViewHolder(boolean isRys, int forActivity, Context context, ViewGroup parentView, GifImageView gifImageView, SVGAImageView svgaImageView, ViewGroup liveGiftPrizePoolContainer, WindowManager windowManager) {
|
||||
super(context, parentView);
|
||||
Contexts = context;
|
||||
|
||||
Reference in New Issue
Block a user