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;
|
||||
|
||||
251
live/src/main/res/layout/dialog_live_new_user.xml
Normal file
251
live/src/main/res/layout/dialog_live_new_user.xml
Normal file
@@ -0,0 +1,251 @@
|
||||
<?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"
|
||||
android:paddingLeft="40dp"
|
||||
android:paddingRight="40dp">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_dialog"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="50dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/live_blowkiss"
|
||||
android:textColor="#ff161616"
|
||||
android:layout_marginTop="50dp"
|
||||
android:textStyle="bold"
|
||||
android:textSize="14sp"
|
||||
/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/live_blowkiss_reply"
|
||||
android:textColor="#ffb1b1b1"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<RelativeLayout android:id="@+id/btn_rose"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginLeft="13dp"
|
||||
android:layout_marginRight="13dp"
|
||||
android:background="@drawable/button_fff8f6f8">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="16dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/gif_rose"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/live_blowkiss_rose"
|
||||
android:gravity="center"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:textColor="#ff565252"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_alignParentRight="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="20"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="#ff565252"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/icon_diamond"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout android:id="@+id/btn_roses"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginLeft="13dp"
|
||||
android:layout_marginRight="13dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:background="@drawable/button_fff8f6f8">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="16dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/icon_rosebouquet"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/live_blowkiss_roses"
|
||||
android:gravity="center"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:textColor="#ff565252"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_alignParentRight="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="500"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="#ff565252"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/icon_diamond"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
||||
<RelativeLayout android:id="@+id/btn_lollipop"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginLeft="13dp"
|
||||
android:layout_marginRight="13dp"
|
||||
android:background="@drawable/button_ffb6c4">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="16dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/icon_lollipop"/>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:text="@string/live_blowkiss_lollipop"
|
||||
android:gravity="center"
|
||||
android:layout_marginLeft="16dp"
|
||||
android:textColor="#ff565252"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_alignParentRight="true">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/live_blowkiss_time"
|
||||
android:layout_gravity="center"
|
||||
android:textColor="#ff565252"
|
||||
android:textSize="12sp"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_gravity="center"
|
||||
android:src="@mipmap/icon_diamond"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<TextView android:id="@+id/btn_confirm"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginRight="30dp"
|
||||
android:layout_marginLeft="30dp"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="@string/live_blowkiss_follow"
|
||||
android:textColor="#ffffffff"
|
||||
android:textSize="13sp"
|
||||
android:gravity="center"
|
||||
android:layout_marginBottom="30dp"
|
||||
android:background="@drawable/button_ffffbf2f"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true">
|
||||
<ImageView
|
||||
android:layout_width="90dp"
|
||||
android:layout_height="90dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:src="@mipmap/icon_love"/>
|
||||
|
||||
<ImageView android:id="@+id/btn_close"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_marginRight="20dp"
|
||||
android:layout_marginTop="70dp"
|
||||
android:src="@mipmap/icon_live_user_5"/>
|
||||
</RelativeLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -2,10 +2,20 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_turntable"
|
||||
android:layout_width="76dp"
|
||||
@@ -167,6 +177,7 @@
|
||||
android:visibility="gone" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/btn_link_mic2"
|
||||
android:layout_width="50dp"
|
||||
@@ -397,6 +408,23 @@
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<com.opensource.svgaplayer.SVGAImageView
|
||||
android:id="@+id/svga_new_user_gif"
|
||||
android:layout_width="116dp"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginBottom="50dp"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/red"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:autoPlay="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_alignParentRight="true" />
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@@ -1709,10 +1709,10 @@
|
||||
android:layout_width="18dp"
|
||||
android:layout_height="18dp"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:src="@mipmap/voice"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</RelativeLayout>
|
||||
BIN
live/src/main/res/mipmap-xhdpi/live_new_tip.png
Normal file
BIN
live/src/main/res/mipmap-xhdpi/live_new_tip.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 361 KiB |
Reference in New Issue
Block a user