新贵族喇叭
@ -126,9 +126,12 @@ public class IMLoginModel extends BaseModel {
|
||||
//
|
||||
@SerializedName("medal_name")
|
||||
private String medalName = "";
|
||||
//
|
||||
//贵族id
|
||||
@SerializedName("noble_id")
|
||||
private long nobleId = 0;
|
||||
//贵族到期时间
|
||||
@SerializedName("noble_end_time")
|
||||
private String nobleEndTime = "";
|
||||
//
|
||||
@SerializedName("province")
|
||||
private String province = "";
|
||||
@ -190,6 +193,7 @@ public class IMLoginModel extends BaseModel {
|
||||
private String medalNoDisplaySrc = "";
|
||||
@SerializedName("mobile")
|
||||
private String mobile = "";
|
||||
//贵族等级
|
||||
@SerializedName("noble_name")
|
||||
private String nobleName = "";
|
||||
@SerializedName("users_type")
|
||||
|
@ -0,0 +1,38 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* 直播全站喇叭数据类
|
||||
*/
|
||||
public class NobleTrumpetModel extends BaseModel {
|
||||
|
||||
|
||||
/**
|
||||
* noble_id : 1
|
||||
* trumpet_num : 0
|
||||
*/
|
||||
|
||||
@SerializedName("noble_id")
|
||||
private long nobleId;
|
||||
@SerializedName("trumpet_num")
|
||||
private long trumpetNum;
|
||||
|
||||
public long getNobleId() {
|
||||
return nobleId;
|
||||
}
|
||||
|
||||
public NobleTrumpetModel setNobleId(long nobleId) {
|
||||
this.nobleId = nobleId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getTrumpetNum() {
|
||||
return trumpetNum;
|
||||
}
|
||||
|
||||
public NobleTrumpetModel setTrumpetNum(long trumpetNum) {
|
||||
this.trumpetNum = trumpetNum;
|
||||
return this;
|
||||
}
|
||||
}
|
@ -6,11 +6,17 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.internal.bind.DateTypeAdapter;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.http.base.BaseApi;
|
||||
import com.yunbao.common.http.base.ParamsContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
@ -43,10 +49,24 @@ public class API extends BaseApi {
|
||||
.create();
|
||||
OkHttpClient.Builder builder = new OkHttpClient()
|
||||
.newBuilder()
|
||||
.addInterceptor(new PDLiveInterceptor(context));
|
||||
.addInterceptor(initQuery(CommonAppContext.sInstance.getApplicationContext()));
|
||||
pdLiveApi = create(builder.build(),
|
||||
GsonConverterFactory.create(gson), RxJava2CallAdapterFactory.create(), CommonAppConfig.HOST, PDLiveApi.class);
|
||||
}
|
||||
return pdLiveApi;
|
||||
}
|
||||
|
||||
//公共参数
|
||||
public Interceptor initQuery(final Context context) {
|
||||
Interceptor addQueryParameterInterceptor = new Interceptor() {
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
Request request = chain.request();
|
||||
//配置公共参数
|
||||
request = new ParamsContext(request, context).getInRequest();
|
||||
return chain.proceed(request);
|
||||
}
|
||||
};
|
||||
return addQueryParameterInterceptor;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
package com.yunbao.common.http;
|
||||
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Field;
|
||||
import retrofit2.http.FormUrlEncoded;
|
||||
import retrofit2.http.GET;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
@ -30,4 +32,12 @@ public interface PDLiveApi {
|
||||
@Field("pushid") String pushid,
|
||||
@Field("lastlogindevice") String lastlogindevice
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取用户贵族喇叭的数量 参数 uid token
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET("/api/public/?service=Noble.getNobleTrumpetNum")
|
||||
Observable<ResponseModel<NobleTrumpetModel>> getNobleTrumpetNum();
|
||||
}
|
||||
|
@ -1,41 +0,0 @@
|
||||
package com.yunbao.common.http;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
* PDlLive通用拦截器
|
||||
*/
|
||||
public class PDLiveInterceptor implements Interceptor {
|
||||
private Context context;
|
||||
|
||||
PDLiveInterceptor(Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException {
|
||||
//拼接请求,添加头
|
||||
Request request = chain.request();
|
||||
Request.Builder builder = request.newBuilder();
|
||||
Log.e("TAG", "Request: " + request.toString());
|
||||
//已登录则添加全局参数
|
||||
if (IMLoginManager.isLogin(context)) {
|
||||
IMLoginModel model = IMLoginManager.get(context).getUserInfo();
|
||||
builder.addHeader("userid", String.valueOf(model.getId()));
|
||||
builder.addHeader("token", model.getToken());
|
||||
}
|
||||
Response response = chain.proceed(builder.build());
|
||||
Log.e("TAG", "Request: " + response.toString());
|
||||
return response;
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.yunbao.common.http.base;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Request;
|
||||
|
||||
public class GetRequestParams implements IRequestParam {
|
||||
@Override
|
||||
public Request getRequest(Request request, Context context) {
|
||||
//添加公共参数
|
||||
if (IMLoginManager.isLogin(context)) {
|
||||
IMLoginModel model = IMLoginManager.get(context).getUserInfo();
|
||||
HttpUrl modifiedUrl = request.url().newBuilder()
|
||||
.addQueryParameter("uid", String.valueOf(model.getId()))
|
||||
.addQueryParameter("token", model.getToken())
|
||||
.build();
|
||||
return request.newBuilder().url(modifiedUrl).build();
|
||||
|
||||
}
|
||||
|
||||
return request;
|
||||
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.yunbao.common.http.main;
|
||||
package com.yunbao.common.http.base;
|
||||
|
||||
/**
|
||||
* maim的请求回调接口
|
@ -0,0 +1,9 @@
|
||||
package com.yunbao.common.http.base;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import okhttp3.Request;
|
||||
|
||||
public interface IRequestParam {
|
||||
Request getRequest(Request request, Context context);
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.yunbao.common.http.base;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import okhttp3.Request;
|
||||
|
||||
public class ParamsContext {
|
||||
private IRequestParam iRequestParam;
|
||||
private Context context;
|
||||
private Request request;
|
||||
|
||||
public ParamsContext(Request request, Context context) {
|
||||
this.context = context;
|
||||
this.request = request;
|
||||
}
|
||||
|
||||
public Request getInRequest() {
|
||||
switch (request.method()) {
|
||||
case "GET":
|
||||
iRequestParam = new GetRequestParams();
|
||||
break;
|
||||
case "POST":
|
||||
iRequestParam = new PostRequestParams();
|
||||
break;
|
||||
}
|
||||
return iRequestParam.getRequest(request, context);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.yunbao.common.http.base;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
|
||||
import okhttp3.FormBody;
|
||||
import okhttp3.Request;
|
||||
|
||||
public class PostRequestParams implements IRequestParam {
|
||||
@Override
|
||||
public Request getRequest(Request request, Context context) {
|
||||
if (request.body() instanceof FormBody) {
|
||||
FormBody.Builder bodyBuilder = new FormBody.Builder();
|
||||
|
||||
FormBody formBody = (FormBody) request.body();
|
||||
|
||||
for (int i = 0; i < formBody.size(); i++) {
|
||||
bodyBuilder.addEncoded(formBody.encodedName(i), formBody.encodedValue(i));
|
||||
}
|
||||
if (IMLoginManager.isLogin(context)) {
|
||||
IMLoginModel model = IMLoginManager.get(context).getUserInfo();
|
||||
formBody = bodyBuilder.addEncoded("uid", String.valueOf(model.getId()))
|
||||
.addEncoded("token", model.getToken())
|
||||
.build();
|
||||
|
||||
}
|
||||
request = request.newBuilder().post(formBody).build();
|
||||
}
|
||||
return request;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.yunbao.common.http.live;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* 直播网络请求整合
|
||||
*/
|
||||
public class LiveNetManager {
|
||||
private Activity mContext;
|
||||
private static LiveNetManager manager;
|
||||
|
||||
public LiveNetManager(Activity context) {
|
||||
this.mContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单利
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static LiveNetManager get(Activity context) {
|
||||
if (null == manager) {
|
||||
manager = new LiveNetManager(context);
|
||||
}
|
||||
return manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户贵族喇叭的数量
|
||||
*
|
||||
* @param callback 回调
|
||||
*/
|
||||
public void getNobleTrumpetNum(HttpCallback<NobleTrumpetModel> callback) {
|
||||
API.get().pdLiveApi(mContext).getNobleTrumpetNum()
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(nobleTrumpetModelResponseModel -> {
|
||||
if (callback != null)
|
||||
callback.onSuccess(nobleTrumpetModelResponseModel.getData().getInfo());
|
||||
}, throwable -> {
|
||||
if (callback != null)
|
||||
callback.onError(throwable.getMessage());
|
||||
}).isDisposed();
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import android.app.Activity;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.http.API;
|
||||
import com.yunbao.common.http.ResponseModel;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.functions.Consumer;
|
||||
|
@ -214,6 +214,7 @@ public class IMLoginManager extends BaseCacheManager {
|
||||
} else {
|
||||
EventBus.getDefault().post(new DataUserInfoEvent().setUpDataSuccess(false));
|
||||
}
|
||||
put(KEY_USER_INFO, new Gson().toJson(userInfo));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
15
common/src/main/res/drawable/bg_btn_common.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="true">
|
||||
<shape>
|
||||
<corners android:radius="22dp"/>
|
||||
<solid android:color="@color/global"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_enabled="false">
|
||||
<shape>
|
||||
<corners android:radius="22dp"/>
|
||||
<solid android:color="@color/gray3"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
10
common/src/main/res/drawable/bg_btn_common_shape.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>
|
||||
<corners android:radius="22dp"/>
|
||||
<solid android:color="@color/gray3"/>
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
BIN
common/src/main/res/mipmap-xxhdpi/icon_general_message.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_general_message_p.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_popup_screen.png
Normal file
After Width: | Height: | Size: 1004 B |
BIN
common/src/main/res/mipmap-xxhdpi/icon_popup_screen_p.png
Normal file
After Width: | Height: | Size: 921 B |
BIN
common/src/main/res/mipmap-xxhdpi/icon_world_horn.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
common/src/main/res/mipmap-xxhdpi/icon_world_horn_p.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
@ -839,4 +839,10 @@
|
||||
<string name="exclusive_instructor1">Contact your dedicated mentor to We can</string>
|
||||
<string name="exclusive_instructor2">match you with more styles of anchor!</string>
|
||||
<string name="hurry_contact">Contact a mentor now!</string>
|
||||
<string name="withdraw_success">Withdrawal succeeded</string>
|
||||
<string name="normal_barrage">normal barrage</string>
|
||||
<string name="floating_screen">floating screen</string>
|
||||
<string name="whole_station_horn">Whole station horn</string>
|
||||
<string name="quote">quote</string>
|
||||
<string name="whole_station_horn_hint">Available times: %s Note: Update times at 4:00 am on the 1st of each month</string>
|
||||
</resources>
|
||||
|
@ -854,4 +854,14 @@
|
||||
<string name="exclusive_instructor2">給您匹配更多風格的主播唷!</string>
|
||||
<string name="hurry_contact">趕快聯系他/她吧!</string>
|
||||
<string name="withdraw_success">撤回成功</string>
|
||||
<string name="normal_barrage">普通彈幕</string>
|
||||
<string name="floating_screen">飄屏彈幕</string>
|
||||
<string name="whole_station_horn">全站喇叭</string>
|
||||
<string name="whole_station_horn_hint">可用次數:%s 注:每月1日凌晨4點更新次數</string>
|
||||
<string name="cannot_be_empty">内容不可为空</string>
|
||||
<string name="site_wide_news">貴族專屬全站消息</string>
|
||||
<string name="site_wide_news_hint1">全站顯示消息並可跳轉到當前直播間</string>
|
||||
<string name="site_wide_news_hint2">开通贵族国王、皇帝、超级皇帝免费获得</string>
|
||||
<string name="back">返回</string>
|
||||
<string name="go_nobility">前往贵族</string>
|
||||
</resources>
|
||||
|
@ -9,9 +9,9 @@ ext {
|
||||
]
|
||||
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",
|
||||
|
@ -0,0 +1,67 @@
|
||||
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 androidx.annotation.Nullable;
|
||||
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||
|
||||
/**
|
||||
* 开通更高级贵族的提醒弹窗
|
||||
*/
|
||||
public class HighNobilityDialog extends AbsDialogFragment {
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.view_hight_nobility;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setWindowAttributes(Window window) {
|
||||
window.setWindowAnimations(R.style.bottomToTopAnim);
|
||||
WindowManager.LayoutParams params = window.getAttributes();
|
||||
params.width = DpUtil.dp2px(340);
|
||||
params.height = DpUtil.dp2px(360);
|
||||
params.gravity = Gravity.CENTER;
|
||||
window.setAttributes(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDialogStyle() {
|
||||
return R.style.dialog2;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canCancel() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
findViewById(R.id.back_bt).setOnClickListener(v -> backClick());
|
||||
findViewById(R.id.go_nobility).setOnClickListener(v -> {
|
||||
Constants.isTitle = true;
|
||||
UserBean u = CommonAppConfig.getInstance().getUserBean();
|
||||
String url = CommonAppConfig.HOST + "/h5/Nobility.html?nickname="
|
||||
+ u.getUserNiceName() + "&usernobId=" + u.getNoble_id() + "&uid="
|
||||
+ CommonAppConfig.getInstance().getUid() + "&token=" + CommonAppConfig.getInstance().getToken();
|
||||
ZhuangBanActivity.forward(mContext, url, false);
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void backClick() {
|
||||
dismiss();
|
||||
}
|
||||
}
|
@ -1,10 +1,15 @@
|
||||
package com.yunbao.live.dialog;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
import android.text.TextUtils;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
import android.view.Gravity;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
@ -15,16 +20,29 @@ import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.NobleTrumpetModel;
|
||||
import com.yunbao.common.custom.MyRadioButton;
|
||||
import com.yunbao.common.dialog.AbsDialogFragment;
|
||||
import com.yunbao.common.http.base.HttpCallback;
|
||||
import com.yunbao.common.http.live.LiveNetManager;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||
|
||||
/**
|
||||
* Created by cxf on 2017/8/21.
|
||||
* 直播间发言框
|
||||
@ -38,6 +56,16 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
|
||||
private MyRadioButton mMyRadioButton;
|
||||
private String mHint1;
|
||||
private String mHint2;
|
||||
private RadioGroup radioHornType;
|
||||
private int[] radioList = {R.id.btn_0, R.id.btn_1, R.id.btn_2};
|
||||
private List<RadioButton> radioHornTypes = new ArrayList<>();
|
||||
//发送弹幕类型
|
||||
private SendMessageType messageType = SendMessageType.GENERALMESSAGE;
|
||||
//请求网络
|
||||
private Handler netHandler = new Handler();
|
||||
|
||||
private long nobleId;//贵族等级
|
||||
private long trumpetNum;//喇叭数量
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
@ -67,8 +95,13 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm = (InputMethodManager) mContext.getSystemService(INPUT_METHOD_SERVICE);
|
||||
mInput = (EditText) mRootView.findViewById(R.id.input);
|
||||
radioHornType = mRootView.findViewById(R.id.radio_horn_type);
|
||||
for (int id : radioList) {
|
||||
RadioButton radioButton = mRootView.findViewById(id);
|
||||
radioHornTypes.add(radioButton);
|
||||
}
|
||||
mInput.setFocusable(true);
|
||||
mInput.setFocusableInTouchMode(true);
|
||||
mInput.requestFocus();
|
||||
@ -132,23 +165,36 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
|
||||
}
|
||||
}
|
||||
});
|
||||
//单选选中监听
|
||||
radioHornType.setOnCheckedChangeListener(changeListener);
|
||||
radioHornType.getCheckedRadioButtonId();
|
||||
netHandler.post(getNobleTrumpetNumRunnable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
sendMessage();
|
||||
}
|
||||
|
||||
//高级贵族
|
||||
private void sendMessage() {
|
||||
String content = mInput.getText().toString().trim();
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
if (mCheckBox.isChecked()) {
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
ToastUtil.show(R.string.cannot_be_empty);
|
||||
return;
|
||||
}
|
||||
switch (messageType) {
|
||||
case WORLDHORN:
|
||||
|
||||
break;
|
||||
case POPUPSCREEN:
|
||||
((LiveActivity) mContext).sendDanmuMessage(content);
|
||||
} else {
|
||||
break;
|
||||
case GENERALMESSAGE:
|
||||
((LiveActivity) mContext).sendChatMessage(content);
|
||||
break;
|
||||
}
|
||||
mInput.setText("");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -165,4 +211,108 @@ public class LiveInputDialogFragment extends AbsDialogFragment implements View.O
|
||||
super.onDestroy();
|
||||
mContext = null;
|
||||
}
|
||||
|
||||
RadioGroup.OnCheckedChangeListener changeListener = new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup group, int checkedId) {
|
||||
changeCheckState(checkedId);
|
||||
if (checkedId==R.id.btn_2) {
|
||||
if (nobleId<5){
|
||||
imm.hideSoftInputFromWindow(mInput.getWindowToken(), 0);
|
||||
HighNobilityDialog fragment = new HighNobilityDialog();
|
||||
fragment.show(((FragmentActivity)mContext).getSupportFragmentManager(), "HighNobilityDialog");
|
||||
dismiss();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 更改选中view的样式
|
||||
*
|
||||
* @param checkedId 选中id
|
||||
*/
|
||||
private void changeCheckState(int checkedId) {
|
||||
Drawable generalMessage = getResources().getDrawable(R.mipmap.icon_general_message);
|
||||
Drawable generalMessageP = getResources().getDrawable(R.mipmap.icon_general_message_p);
|
||||
Drawable popupScreen = getResources().getDrawable(R.mipmap.icon_popup_screen);
|
||||
Drawable popupScreenP = getResources().getDrawable(R.mipmap.icon_popup_screen_p);
|
||||
Drawable worldHorn = getResources().getDrawable(R.mipmap.icon_world_horn);
|
||||
Drawable worldHornP = getResources().getDrawable(R.mipmap.icon_world_horn_p);
|
||||
for (RadioButton radioButton : radioHornTypes) {
|
||||
if (radioButton.getId() == checkedId) {
|
||||
radioButton.setTextColor(Color.parseColor("#ffffff"));
|
||||
if (radioButton.getId() == R.id.btn_0) {
|
||||
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(generalMessageP, null, null, null);
|
||||
mInput.setHint(mHint2);
|
||||
messageType = SendMessageType.GENERALMESSAGE;
|
||||
} else if (radioButton.getId() == R.id.btn_1) {
|
||||
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(popupScreenP, null, null, null);
|
||||
mInput.setHint(mHint1);
|
||||
messageType = SendMessageType.POPUPSCREEN;
|
||||
} else {
|
||||
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(worldHornP, null, null, null);
|
||||
mInput.setHint(String.format(WordUtil.getString(R.string.whole_station_horn_hint), trumpetNum));
|
||||
messageType = SendMessageType.WORLDHORN;
|
||||
}
|
||||
} else {
|
||||
radioButton.setTextColor(Color.parseColor("#FFB1B6C7"));
|
||||
if (radioButton.getId() == R.id.btn_0) {
|
||||
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(generalMessage, null, null, null);
|
||||
} else if (radioButton.getId() == R.id.btn_1) {
|
||||
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(popupScreen, null, null, null);
|
||||
} else {
|
||||
radioButton.setCompoundDrawablesRelativeWithIntrinsicBounds(worldHorn, null, null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum SendMessageType {
|
||||
GENERALMESSAGE("普通彈幕", 0),
|
||||
POPUPSCREEN("飄屏彈幕", 1),
|
||||
WORLDHORN("全站喇叭", 2);
|
||||
private String name;
|
||||
private int index;
|
||||
|
||||
SendMessageType(String name, int index) {
|
||||
this.name = name;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
//自写方法获取对应的值,不需要就不用写
|
||||
public String getStr() {
|
||||
return name;
|
||||
}
|
||||
|
||||
//自写方法获取对应的值,不需要就不用写
|
||||
public int getNumber() {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
|
||||
//获取喇叭数量
|
||||
private Runnable getNobleTrumpetNumRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LiveNetManager.get((Activity) mContext)
|
||||
.getNobleTrumpetNum(new HttpCallback<NobleTrumpetModel>() {
|
||||
@Override
|
||||
public void onSuccess(NobleTrumpetModel data) {
|
||||
nobleId = data.getNobleId();
|
||||
trumpetNum = data.getTrumpetNum();
|
||||
Log.e("LiveInputDialogFragment","贵族等级:"+nobleId);
|
||||
Log.e("LiveInputDialogFragment","喇叭数量:"+trumpetNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String error) {
|
||||
ToastUtil.show(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -879,4 +879,12 @@ public class LiveHttpUtil {
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户贵族喇叭的数量
|
||||
*/
|
||||
public static void getNobleTrumpetNum( HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Noble.getNobleTrumpetNum", "getNobleTrumpetNum")
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import android.Manifest;
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Outline;
|
||||
import android.graphics.drawable.ColorDrawable;
|
||||
import android.os.Bundle;
|
||||
@ -23,8 +22,6 @@ import android.widget.PopupWindow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.cardview.widget.CardView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ms.banner.Banner;
|
||||
@ -53,6 +50,7 @@ import com.yunbao.live.R;
|
||||
import com.yunbao.live.activity.LiveActivity;
|
||||
import com.yunbao.live.activity.LiveAnchorActivity;
|
||||
import com.yunbao.live.activity.LiveAudienceActivity;
|
||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||
import com.yunbao.live.bean.LiveWishlistBean;
|
||||
import com.yunbao.live.dialog.LiveHDDialogFragment;
|
||||
import com.yunbao.live.dialog.LiveOneDialogFragment;
|
||||
@ -72,7 +70,6 @@ import com.yunbao.live.views.AbsLiveLinkMicPushViewHolder;
|
||||
import com.yunbao.live.views.CustomViewHolder;
|
||||
import com.yunbao.live.views.LiveLinkMicPlayTxViewHolder;
|
||||
import com.yunbao.live.views.LiveLinkMicPushTxViewHolder;
|
||||
import com.yunbao.live.activity.ZhuangBanActivity;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
@ -138,7 +135,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
public void onUpdata(String str) {
|
||||
if ("showBanner".equals(str)) {
|
||||
showBanner3();
|
||||
} else if ("stop_svga_new_user_double".equals(str)) {
|
||||
} else if ("stop_svga_new_user_double".equals(str) && mBannerList3.size() > 3) {
|
||||
mBannerList3.get(2).setLink("1");
|
||||
mBanner3.update(mBannerList3);
|
||||
if (mBannerList3.get(0).getLink().equals("1")) {
|
||||
@ -148,7 +145,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("stop_svga_new_user_follow".equals(str)) {
|
||||
} else if ("stop_svga_new_user_follow".equals(str)&& mBannerList3.size() > 2) {
|
||||
mBannerList3.get(1).setLink("1");
|
||||
mBanner3.update(mBannerList3);
|
||||
if (mBannerList3.get(0).getLink().equals("1")) {
|
||||
@ -158,7 +155,7 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if ("stop_new_user_gif".equals(str)) {
|
||||
} else if ("stop_new_user_gif".equals(str)&& mBannerList3.size() > 1) {
|
||||
IMLoginManager.get(mContext).setNewUserGif(false);
|
||||
mBannerList3.get(0).setLink("1");
|
||||
mBanner3.update(mBannerList3);
|
||||
@ -347,7 +344,6 @@ public class LiveLinkMicPresenter implements View.OnClickListener {
|
||||
});
|
||||
|
||||
|
||||
|
||||
btn_onecz_event = root.findViewById(R.id.btn_onecz_event);
|
||||
btn_onecz_event.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
17
live/src/main/res/drawable/radio_horn_type.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_checked="false">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="14dp" />
|
||||
<solid android:color="#FFF4F8FB" />
|
||||
<padding android:bottom="7dp" android:left="9dp" android:right="9dp" android:top="7dp" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_checked="true">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="14dp" />
|
||||
<solid android:color="#FFFFBE41" />
|
||||
<padding android:bottom="7dp" android:left="9dp" android:right="9dp" android:top="7dp" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
@ -8,9 +8,63 @@
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
android:layout_height="50dp">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radio_horn_type"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/btn_0"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/radio_horn_type"
|
||||
android:button="@null"
|
||||
android:checked="true"
|
||||
android:gravity="center"
|
||||
android:text="@string/normal_barrage"
|
||||
android:textColor="@color/white"
|
||||
android:drawableLeft="@mipmap/icon_general_message_p"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/btn_1"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/radio_horn_type"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:drawableLeft="@mipmap/icon_popup_screen"
|
||||
android:text="@string/floating_screen"
|
||||
android:textColor="#FFB1B6C7"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/btn_2"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="9dp"
|
||||
android:layout_weight="1"
|
||||
android:background="@drawable/radio_horn_type"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:drawableStart="@mipmap/icon_world_horn"
|
||||
android:text="@string/whole_station_horn"
|
||||
android:textColor="#FFB1B6C7"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1" />
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
|
||||
<CheckBox
|
||||
@ -19,9 +73,9 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:visibility="gone"
|
||||
android:background="@drawable/bg_input_danmu_switch"
|
||||
android:button="@null" />
|
||||
android:button="@null"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
72
live/src/main/res/layout/view_hight_nobility.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="350dp"
|
||||
android:layout_height="370dp"
|
||||
android:background="@mipmap/viptip_box"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="174dp"
|
||||
android:text="@string/site_wide_news"
|
||||
android:textColor="#FF313131"
|
||||
android:textSize="20sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="14dp"
|
||||
android:text="@string/site_wide_news_hint1"
|
||||
android:textColor="#FFAAAAAA"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/site_wide_news_hint2"
|
||||
android:textColor="#FFAAAAAA"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="22dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:gravity="center_horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/back_bt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_btn_common_shape"
|
||||
android:paddingStart="48dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingEnd="48dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:text="@string/back"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/go_nobility"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:background="@drawable/bg_btn_common"
|
||||
android:enabled="true"
|
||||
android:paddingStart="48dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingEnd="48dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:text="@string/go_nobility"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="16sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
BIN
live/src/main/res/mipmap-xxxhdpi/viptip_box.png
Normal file
After Width: | Height: | Size: 447 KiB |
@ -471,7 +471,7 @@
|
||||
<LinearLayout
|
||||
android:id="@+id/lt_noble"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="78dp"
|
||||
android:layout_height="81dp"
|
||||
android:layout_marginLeft="15dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:layout_marginRight="15dp"
|
||||
|