1
This commit is contained in:
parent
d150d8d599
commit
31cf3c4e71
@ -26,6 +26,8 @@ import com.tencent.imsdk.v2.V2TIMUserInfo;
|
||||
import com.yunbao.common.BuildConfig;
|
||||
import com.yunbao.common.CommonAppContext;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.L;
|
||||
import com.yunbao.live.socket.SocketRyClient;
|
||||
import com.yunbao.live.utils.LiveImDeletUtil;
|
||||
@ -134,11 +136,18 @@ public class AppContext extends CommonAppContext {
|
||||
|
||||
AdjustEvent adjustEvent2 = new AdjustEvent("p7igfz");
|
||||
Adjust.trackEvent(adjustEvent2);
|
||||
CommonHttpUtil.setAdvertisingChannels("p7igfz", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
//谷歌激活
|
||||
mFirebaseAnalytics.logEvent("FS_complete_1st_loading", null);
|
||||
|
||||
//FB激活
|
||||
logger.logEvent("FB_complete_1st_loading");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//初始化 AndroidUtilCode
|
||||
Utils.init(this);
|
||||
liveImDeletUtil = new LiveImDeletUtil();
|
||||
|
@ -10,6 +10,16 @@ public class WeekListBean {
|
||||
private String anchor_name;
|
||||
private String anchor_avatar;
|
||||
private String seconds;
|
||||
private String content="";
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public WeekListBean setContent(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAnchor_id() {
|
||||
return anchor_id;
|
||||
|
@ -430,6 +430,13 @@ public class CommonHttpUtil {
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
//埋点唯一性
|
||||
public static void setAdvertisingChannels(String operation, HttpCallback callback) {
|
||||
HttpClient.getInstance().get("Tx.setAdvertisingChannels&marking=safasf", CommonHttpConsts.GET_USER_BASEINFO)
|
||||
.params("operation", operation)
|
||||
.execute(callback);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,6 +61,5 @@
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:progressDrawable="@drawable/bg_horizontal_progressbar"
|
||||
android:visibility="gone" />
|
||||
android:progressDrawable="@drawable/bg_horizontal_progressbar"/>
|
||||
</LinearLayout>
|
@ -474,17 +474,30 @@ public class LiveAudienceActivity extends LiveActivity {
|
||||
if(obj.getIntValue("see_time")>=600&&obj.getIntValue("un_charge")==1){
|
||||
AdjustEvent good_user = new AdjustEvent("val8lv");
|
||||
Adjust.trackEvent(good_user);
|
||||
|
||||
CommonHttpUtil.setAdvertisingChannels("val8lv", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_good_user", null);
|
||||
logger.logEvent("FB_good_user", null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//有效用户
|
||||
}else if(obj.getIntValue("see_time")>=600){
|
||||
AdjustEvent valid_user = new AdjustEvent("xuf8ep");
|
||||
Adjust.trackEvent(valid_user);
|
||||
|
||||
CommonHttpUtil.setAdvertisingChannels("xuf8ep", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_Valid_user", null);
|
||||
logger.logEvent("FB_Valid_user", null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//连接socket
|
||||
LiveHttpUtil.enterBackRoom(mLiveUid, mStream, new HttpCallback() {
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import com.adjust.sdk.AdjustEvent;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.live.R;
|
||||
@ -115,9 +116,18 @@ public class SocketRyChatUtil {
|
||||
@Override
|
||||
public void onSuccess(Message message) {
|
||||
Log.i("tx", "发送成功"+mLiveUid);
|
||||
//发言成功
|
||||
//首发言成功
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("j7isvr");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
CommonHttpUtil.setAdvertisingChannels("j7isvr", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_liveinteraction", null);
|
||||
logger.logEvent("FB_liveinteraction ");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mFirebaseAnalytics.logEvent("FS_type_interaction", null);
|
||||
logger.logEvent("FB_type_interaction");
|
||||
|
@ -14,7 +14,6 @@ import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.provider.Settings;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -25,6 +24,8 @@ import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.VideoView;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@ -66,6 +67,7 @@ import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.LoginData;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
@ -300,6 +302,15 @@ public class EntryActivity extends AppCompatActivity {
|
||||
getUuidDevice();
|
||||
AdjustEvent adjustEvent2 = new AdjustEvent("tyqsyf");
|
||||
Adjust.trackEvent(adjustEvent2);
|
||||
CommonHttpUtil.setAdvertisingChannels("tyqsyf", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_registration", null);
|
||||
logger.logEvent("FB_registration");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
video_view = findViewById(R.id.video_view);
|
||||
video_view.setVideoPath(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.login_video) + "");
|
||||
@ -535,7 +546,7 @@ public class EntryActivity extends AppCompatActivity {
|
||||
re_data.setAvatar("" + result.getLineProfile().getPictureUrl().toString());
|
||||
}
|
||||
re_data.setNickName(result.getLineProfile().getDisplayName());
|
||||
re_data.setType("LINE");
|
||||
re_data.setType("line");
|
||||
loginBuyThird(re_data);
|
||||
break;
|
||||
case CANCEL:
|
||||
@ -665,18 +676,26 @@ public class EntryActivity extends AppCompatActivity {
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
mFirebaseAnalytics.logEvent("FS_log_google", null);
|
||||
logger.logEvent("FB_log_google");
|
||||
}else if(mLoginType.equals("LINE")){
|
||||
}else if(mLoginType.equals("line")){
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("71p74r");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
mFirebaseAnalytics.logEvent("FS_log_line", null);
|
||||
logger.logEvent("FB_log_line");
|
||||
}
|
||||
}
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("1com4k");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
CommonHttpUtil.setAdvertisingChannels("1com4k", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_createdRole", null);
|
||||
logger.logEvent("FB_createdRole");
|
||||
}
|
||||
}
|
||||
});
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("1com4k");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -715,28 +734,57 @@ public class EntryActivity extends AppCompatActivity {
|
||||
if(mLoginType.equals("twitter")){
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("ea6lld");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
|
||||
CommonHttpUtil.setAdvertisingChannels("ea6lld", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_reg_twitter", null);
|
||||
logger.logEvent("FB_reg_twitter");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}else if(mLoginType.equals("facebook")){
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("5jbk95");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
|
||||
CommonHttpUtil.setAdvertisingChannels("5jbk95", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_reg_fb", null);
|
||||
logger.logEvent("FB_reg_fb");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}else if(mLoginType.equals("google")){
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("krap47");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
|
||||
CommonHttpUtil.setAdvertisingChannels("krap47", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_reg_google", null);
|
||||
logger.logEvent("FB_reg_google");
|
||||
}else if(mLoginType.equals("LINE")){
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}else if(mLoginType.equals("line")){
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("uaacbn");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
|
||||
CommonHttpUtil.setAdvertisingChannels("uaacbn", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_reg_line", null);
|
||||
logger.logEvent("FB_reg_line");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
// RecommendActivity.forward(Contexts, mShowInvite);
|
||||
if (CommonAppConfig.IS_GOOGLE_PLAY == true) {
|
||||
EntryActivity.this.startActivity(new Intent(EntryActivity.this, OneLoginActivity.class));
|
||||
|
@ -3,30 +3,48 @@ package com.yunbao.main.activity;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.adjust.sdk.Adjust;
|
||||
import com.adjust.sdk.AdjustEvent;
|
||||
import com.android.billingclient.api.Purchase;
|
||||
import com.android.billingclient.api.SkuDetails;
|
||||
import com.facebook.appevents.AppEventsConstants;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.yunbao.common.CommonAppConfig;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.utils.GoogleBillingUtil;
|
||||
import com.yunbao.common.utils.OnGoogleBillingListener;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
import com.yunbao.common.utils.WordUtil;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.utils.HXLinePagerIndicator;
|
||||
import com.yunbao.main.views.TestWebViewClient;
|
||||
|
||||
import net.lucode.hackware.magicindicator.MagicIndicator;
|
||||
import net.lucode.hackware.magicindicator.buildins.UIUtil;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.CommonNavigator;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.CommonNavigatorAdapter;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerIndicator;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.abs.IPagerTitleView;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.indicators.LinePagerIndicator;
|
||||
import net.lucode.hackware.magicindicator.buildins.commonnavigator.titles.ColorTransitionPagerTitleView;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@ -164,16 +182,15 @@ public class GoogleFragment extends Fragment {
|
||||
// String r_url = CommonAppConfig.HOST +"?g=Appapi&m=Mall&a=paysuss&status=1";
|
||||
// rlWebview.loadUrl(r_url);
|
||||
Bundle params = new Bundle();
|
||||
params.putString("currency", "USD");
|
||||
params.putString("currency", "HKD");
|
||||
params.putString("money", MoneyUsds);
|
||||
logger.logEvent("FB_iap_Play", params);
|
||||
|
||||
logger.logEvent("FB_iap_users", params);
|
||||
|
||||
logger.logEvent("FB_iap_events", params);
|
||||
|
||||
Bundle fb_params = new Bundle();
|
||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "USD");
|
||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
|
||||
fb_params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID,mProductId);
|
||||
|
||||
//fb官方事件记录充值
|
||||
@ -183,7 +200,7 @@ public class GoogleFragment extends Fragment {
|
||||
|
||||
//Google官方充值通知
|
||||
Bundle google_params = new Bundle();
|
||||
google_params.putString("currency", "USD");
|
||||
google_params.putString("currency", "HKD");
|
||||
google_params.putString("product_id",mProductId);
|
||||
google_params.putString("transaction_id",mOrderid);
|
||||
google_params.putString("value",MoneyUsds);
|
||||
@ -192,19 +209,27 @@ public class GoogleFragment extends Fragment {
|
||||
|
||||
|
||||
mFirebaseAnalytics.logEvent("FS_iap_Play", google_params);
|
||||
mFirebaseAnalytics.logEvent("FS_iap_users", null);
|
||||
mFirebaseAnalytics.logEvent("FS_iap_events", google_params);
|
||||
|
||||
//AD官方通知充值
|
||||
AdjustEvent adjustEvent = new AdjustEvent("z8v726");
|
||||
adjustEvent.setRevenue(Double.parseDouble(MoneyUsds),"USD");
|
||||
adjustEvent.setOrderId(mOrderid);
|
||||
adjustEvent.setRevenue(Double.parseDouble(MoneyUsds),"HKD");
|
||||
// adjustEvent.setOrderId(mOrderid);
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("cgssol");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
CommonHttpUtil.setAdvertisingChannels("cgssol", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
logger.logEvent("FB_iap_users", null);
|
||||
mFirebaseAnalytics.logEvent("FS_iap_users", null);
|
||||
}
|
||||
}
|
||||
});
|
||||
AdjustEvent adjustEvent2 = new AdjustEvent("tr8lb9");
|
||||
adjustEvent2.setRevenue(Double.parseDouble(MoneyUsds),"USD");
|
||||
adjustEvent2.setRevenue(Double.parseDouble(MoneyUsds),"HKD");
|
||||
adjustEvent2.setOrderId(mOrderid);
|
||||
Adjust.trackEvent(adjustEvent2);
|
||||
|
||||
@ -301,7 +326,7 @@ public class GoogleFragment extends Fragment {
|
||||
//下单
|
||||
Bundle params = new Bundle();
|
||||
params.putString(AppEventsConstants.EVENT_PARAM_CONTENT_ID, mProductId);
|
||||
params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "USD");
|
||||
params.putString(AppEventsConstants.EVENT_PARAM_CURRENCY, "HKD");
|
||||
logger.logEvent(AppEventsConstants.EVENT_NAME_INITIATED_CHECKOUT,Double.parseDouble(MoneyUsds),
|
||||
params);
|
||||
|
||||
@ -328,5 +353,4 @@ public class GoogleFragment extends Fragment {
|
||||
GoogleBillingUtil.endConnection();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -173,8 +173,7 @@ public class LoginActivity extends AbsActivity {
|
||||
//去手机注册
|
||||
AdjustEvent adjustEvent1 = new AdjustEvent("orgi58");
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
AdjustEvent adjustEvent2 = new AdjustEvent("tyqsyf");
|
||||
Adjust.trackEvent(adjustEvent2);
|
||||
|
||||
|
||||
mFirebaseAnalytics.logEvent("FS_phone_click", null);
|
||||
logger.logEvent("FB_phone_click");
|
||||
|
@ -35,6 +35,7 @@ import com.yunbao.common.HtmlConfig;
|
||||
import com.yunbao.common.activity.AbsActivity;
|
||||
import com.yunbao.common.activity.WebViewActivity;
|
||||
import com.yunbao.common.bean.UserBean;
|
||||
import com.yunbao.common.http.CommonHttpUtil;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.interfaces.CommonCallback;
|
||||
import com.yunbao.common.utils.DialogUitl;
|
||||
@ -96,12 +97,19 @@ public class RegisterActivity extends AbsActivity {
|
||||
@Override
|
||||
protected void main() {
|
||||
// setTitle(WordUtil.getString(R.string.reg_register));
|
||||
|
||||
AdjustEvent adjustEvent = new AdjustEvent("pooqmz");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
CommonHttpUtil.setAdvertisingChannels("pooqmz", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
//谷歌
|
||||
mFirebaseAnalytics.logEvent("FS_complete_2nd_loading", null);
|
||||
logger.logEvent("FB_complete_2nd_loading");
|
||||
AdjustEvent adjustEvent = new AdjustEvent("pooqmz");
|
||||
Adjust.trackEvent(adjustEvent);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
mEditPhone = (EditText) findViewById(R.id.edit_phone);
|
||||
webview = (WebView) findViewById(R.id.webview);
|
||||
initView();
|
||||
@ -398,9 +406,16 @@ public class RegisterActivity extends AbsActivity {
|
||||
Adjust.trackEvent(adjustEvent1);
|
||||
Bundle params = new Bundle();
|
||||
|
||||
|
||||
CommonHttpUtil.setAdvertisingChannels("fhqx62", new HttpCallback() {
|
||||
@Override
|
||||
public void onSuccess(int code, String msg, String[] info) {
|
||||
if(code == 0) {
|
||||
mFirebaseAnalytics.logEvent("FS_reg_phone", null);
|
||||
logger.logEvent("FB_reg_phone");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Bundle params1 = new Bundle();
|
||||
params1.putString(AppEventsConstants.EVENT_PARAM_REGISTRATION_METHOD, "Phone number");
|
||||
logger.logEvent(AppEventsConstants.EVENT_NAME_COMPLETED_REGISTRATION,
|
||||
|
@ -6,8 +6,6 @@ import android.animation.ObjectAnimator;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.os.CountDownTimer;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@ -18,19 +16,28 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
import com.opensource.svgaplayer.SVGAVideoEntity;
|
||||
import com.squareup.picasso.Picasso;
|
||||
import com.xj.marqueeview.MarqueeView;
|
||||
import com.yunbao.common.Constants;
|
||||
import com.yunbao.common.adapter.RefreshAdapter;
|
||||
import com.yunbao.common.bean.WeekListBean;
|
||||
import com.yunbao.common.custom.RatioRoundImageView;
|
||||
import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.common.utils.DpUtil;
|
||||
import com.yunbao.common.utils.formatBigNum;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.main.R;
|
||||
import com.yunbao.main.bean.HomeTopBean;
|
||||
import com.yunbao.main.utils.MainIconUtil;
|
||||
import com.yunbao.main.views.MainHomeLiveItemViewHolder;
|
||||
import com.yunbao.main.views.MainHomeLiveViewHolder;
|
||||
import com.yunbao.main.views.MainHomeLiveWeekItemViewHolder;
|
||||
|
||||
import java.util.List;
|
||||
@ -122,6 +129,26 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewDetachedFromWindow(@NonNull RecyclerView.ViewHolder holder) {
|
||||
//局部刷新周星榜svaga
|
||||
if (holder instanceof MainHomeLiveWeekItemViewHolder) {
|
||||
((MainHomeLiveWeekItemViewHolder) holder).upSvga();
|
||||
}
|
||||
super.onViewDetachedFromWindow(holder);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public void onViewRecycled(@NonNull RecyclerView.ViewHolder holder) {
|
||||
// //局部刷新周星榜svaga
|
||||
// if (holder instanceof MainHomeLiveWeekItemViewHolder) {
|
||||
// if (((MainHomeLiveWeekItemViewHolder) holder).weekSvga.isAnimating()) {
|
||||
// ((MainHomeLiveWeekItemViewHolder) holder).weekSvga.stopAnimation();
|
||||
// }
|
||||
// }
|
||||
// super.onViewRecycled(holder);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder vh, int position) {
|
||||
if (vh instanceof MainHomeLiveWeekItemViewHolder) {
|
||||
@ -129,16 +156,16 @@ public class MainHomeLiveAdapter extends RefreshAdapter<LiveBean> {
|
||||
@Override
|
||||
public void onItemClick(LiveBean bean, int position) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean,position);
|
||||
mOnItemClickListener.onItemClick(bean, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (vh instanceof MainHomeLiveItemViewHolder){
|
||||
} else if (vh instanceof MainHomeLiveItemViewHolder) {
|
||||
((MainHomeLiveItemViewHolder) vh).loadViewDate(mList.get(position - 1), position - 1, Height, new MainHomeLiveItemViewHolder.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(LiveBean bean, int position) {
|
||||
if (mOnItemClickListener != null) {
|
||||
mOnItemClickListener.onItemClick(bean,position);
|
||||
mOnItemClickListener.onItemClick(bean, position);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1,14 +1,17 @@
|
||||
package com.yunbao.main.views;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import android.os.Handler;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ViewFlipper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.opensource.svgaplayer.SVGADrawable;
|
||||
import com.opensource.svgaplayer.SVGAImageView;
|
||||
import com.opensource.svgaplayer.SVGAParser;
|
||||
@ -18,6 +21,7 @@ import com.yunbao.common.glide.ImgLoader;
|
||||
import com.yunbao.live.bean.LiveBean;
|
||||
import com.yunbao.main.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -25,8 +29,17 @@ import java.util.List;
|
||||
*/
|
||||
public class MainHomeLiveWeekItemViewHolder<T> extends RecyclerView.ViewHolder {
|
||||
private ImageView imgWeekHead;
|
||||
private SVGAImageView weekSvga;
|
||||
public SVGAImageView weekSvga;
|
||||
private ViewFlipper viewflipperBanner;
|
||||
private final int bannerNextShow = 1003;
|
||||
//Handler定时加载下一张的数据
|
||||
private Handler bannerHandler = new Handler();
|
||||
//默认定时器时间
|
||||
private int delayMillis = 3000;
|
||||
//周星榜列表
|
||||
private List<WeekListBean> weekList = new ArrayList<>();
|
||||
//轮询周星榜的下标
|
||||
private int index = 0;
|
||||
|
||||
public MainHomeLiveWeekItemViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
@ -39,6 +52,25 @@ public class MainHomeLiveWeekItemViewHolder<T> extends RecyclerView.ViewHolder {
|
||||
imgWeekHead.setVisibility(View.GONE);
|
||||
viewflipperBanner.setVisibility(View.VISIBLE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void upSvga(){
|
||||
new SVGAParser(itemView.getContext()).decodeFromAssets("week_bg.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
weekSvga.setImageDrawable(drawable);
|
||||
weekSvga.startAnimation();
|
||||
weekSvga.setClearsAfterStop(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
Log.e("errqs","errl");
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -48,42 +80,44 @@ public class MainHomeLiveWeekItemViewHolder<T> extends RecyclerView.ViewHolder {
|
||||
* @param position 下标
|
||||
*/
|
||||
public void loadViewDate(LiveBean bean, int position, int height, OnItemClickListener listener) {
|
||||
Log.e("loadView", "loadView");
|
||||
index = 0;
|
||||
List<WeekListBean> mWeekList = bean.getmWeekList();
|
||||
if (mWeekList!=null&&mWeekList.size() > 0) {
|
||||
if (mWeekList != null && mWeekList.size() > 0) {
|
||||
viewflipperBanner.removeAllViews();
|
||||
}
|
||||
weekList.clear();
|
||||
weekList.addAll(mWeekList);
|
||||
itemView.setTag(position);
|
||||
try {
|
||||
upSvga();
|
||||
//设置周榜边框动图
|
||||
new SVGAParser(itemView.getContext()).decodeFromAssets("week_bg.svga", new SVGAParser.ParseCompletion() {
|
||||
@Override
|
||||
public void onComplete(SVGAVideoEntity videoItem) {
|
||||
SVGADrawable drawable = new SVGADrawable(videoItem);
|
||||
weekSvga.setImageDrawable(drawable);
|
||||
weekSvga.startAnimation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError() {
|
||||
}
|
||||
});
|
||||
for (WeekListBean model : mWeekList) {
|
||||
View rootView = LayoutInflater.from(itemView.getContext()).inflate(R.layout.view_live_week_item, null, false);
|
||||
TextView textView = rootView.findViewById(R.id.name2);
|
||||
TextView title = rootView.findViewById(R.id.title);
|
||||
ImageView imageView = rootView.findViewById(R.id.week_live);
|
||||
ImgLoader.display2(itemView.getContext(), model.getAnchor_avatar(), imageView);
|
||||
textView.setText(model.getAnchor_name());
|
||||
title.setText(model.getContent());
|
||||
viewflipperBanner.addView(rootView);
|
||||
}
|
||||
viewflipperBanner.setAutoStart(true);
|
||||
viewflipperBanner.setFlipInterval(3000);//切换的时间间隔,单位毫秒
|
||||
WeekListBean weekModel = weekList.get(index);
|
||||
try {
|
||||
String seconds = weekModel.getSeconds();
|
||||
delayMillis = Integer.parseInt(seconds) * 1000;
|
||||
} catch (NumberFormatException e) {
|
||||
delayMillis = 3000;
|
||||
}
|
||||
bannerHandler.removeCallbacks(mFlipRunnable);
|
||||
bannerHandler.postDelayed(mFlipRunnable, delayMillis);
|
||||
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (listener != null) {
|
||||
listener.onItemClick(bean, position);
|
||||
}
|
||||
// onItemClickListener.onItemClick(bean,position);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
@ -91,6 +125,36 @@ public class MainHomeLiveWeekItemViewHolder<T> extends RecyclerView.ViewHolder {
|
||||
}
|
||||
}
|
||||
|
||||
private final Runnable mFlipRunnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
viewflipperBanner.showNext();
|
||||
if ((weekList.size() - 1) > index) {
|
||||
index = index + 1;
|
||||
WeekListBean weekModel = weekList.get(index);
|
||||
try {
|
||||
String seconds = weekModel.getSeconds();
|
||||
delayMillis = Integer.parseInt(seconds) * 1000;
|
||||
} catch (NumberFormatException e) {
|
||||
delayMillis = 3000;
|
||||
}
|
||||
} else {
|
||||
index = 0;
|
||||
if (weekList.size() > 0) {
|
||||
WeekListBean weekModel = weekList.get(index);
|
||||
try {
|
||||
String seconds = weekModel.getSeconds();
|
||||
delayMillis = Integer.parseInt(seconds) * 1000;
|
||||
} catch (NumberFormatException e) {
|
||||
delayMillis = 3000;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
bannerHandler.postDelayed(mFlipRunnable, delayMillis);
|
||||
}
|
||||
};
|
||||
|
||||
public interface OnItemClickListener {
|
||||
void onItemClick(LiveBean bean, int position);
|
||||
}
|
||||
|
@ -1,16 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="36dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rootView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="36dp"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"/>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dp"
|
||||
android:visibility="gone"
|
||||
android:progressDrawable="@drawable/bg_horizontal_progressbar" />
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
Loading…
Reference in New Issue
Block a user