diff --git a/app/build.gradle b/app/build.gradle index 5be59f995..6011ca6ec 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -252,11 +252,13 @@ android { String tskReqStr = gradle.getStartParameter().getTaskRequests().args.toString() println("处理ndk 版本 = " + tskReqStr) def isLink = tskReqStr.contains("Link") - if (isLink) { + if (isLink) {//移除32位so库可以有效降低包体大小,等需要时再弄 abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64" + //abiFilters "arm64-v8a", "x86_64" println("打包ndk 链接") } else { abiFilters "armeabi-v7a", "arm64-v8a" + //abiFilters "arm64-v8a" println("打包ndk其他") } } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 009b58ea4..5b4fce0f3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -96,6 +96,9 @@ + + + = Build.VERSION_CODES.P) { + WindowInsets windowInsets = ((Activity) context).getWindow().getDecorView().getRootWindowInsets(); + if (windowInsets != null) { + DisplayCutout displayCutout = windowInsets.getDisplayCutout(); + if (displayCutout != null) { + notchHeight = displayCutout.getSafeInsetTop(); + } + } + } + if (notchHeight != 0) { + return notchHeight; + } + Rect rect = new Rect(); + ((Activity) context).getWindow().getDecorView().getWindowVisibleDisplayFrame(rect); + return rect.top; + } + /** * 全面屏(是否开启全面屏开关 0 关闭 1 开启) * diff --git a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java index e01cf045d..946591739 100644 --- a/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java +++ b/common/src/main/java/com/yunbao/common/activity/WebViewActivity.java @@ -88,6 +88,7 @@ public class WebViewActivity extends AbsActivity { @Override public void setStatusBar() { + super.setStatusBar(); // getWindow().setStatusBarColor(Color.parseColor("#FFFFFF")); // getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); // getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); @@ -147,8 +148,7 @@ public class WebViewActivity extends AbsActivity { if (url.contains("for")) { mWebView.loadUrl("javascript:goAnchorTab()"); } - - + view.loadUrl("javascript:setTop(" + DpUtil.dp2px(15) + ")"); if(url.startsWith(HtmlConfig.SHOP)){ //商店页不做动态变换 return; diff --git a/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java b/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java index b22fd85d5..425fdc1c6 100644 --- a/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java +++ b/common/src/main/java/com/yunbao/common/adapter/GiftWallGiftInfoListItemAdapter.java @@ -107,12 +107,12 @@ public class GiftWallGiftInfoListItemAdapter extends RecyclerView.Adapter list) { if (list == null) { list = new ArrayList<>(); @@ -118,7 +123,7 @@ public class GiftWallMainTab1List2Adapter extends RecyclerView.Adapter(); } - int index=list.size()-1; + int index = list.size() - 1; list.addAll(gifts); notifyItemRangeChanged(index, gifts.size()); } @@ -172,6 +177,7 @@ public class GiftWallMainTab1List2Adapter extends RecyclerView.Adapter list; boolean isStar; String toUid; + String anchorId; boolean isAnchor; private boolean isLiveRoom; boolean isNowRank; @@ -71,6 +73,10 @@ public class GiftWallMainTab2ListAdapter extends RecyclerView.Adapter list) { if (list == null) { list = new ArrayList<>(); @@ -169,11 +175,21 @@ public class GiftWallMainTab2ListAdapter extends RecyclerView.Adapter { if (isStar) { if (isNowRank) { - if (StringUtil.isEmpty(giftData.getNamingLiveNicename(), giftData.getNamingUserNicename())&&isLiveRoom) { + if (StringUtil.isEmpty(giftData.getNamingLiveNicename(), giftData.getNamingUserNicename()) && isLiveRoom) { Bus.get().post(new JsWishBean(giftData.getGiftId() + "")); Bus.get().post(new ClosePopupDialogEvent()); } else { new GiftWallGiftInfoDialog(mContext, giftData.getGiftId() + "", toUid, isAnchor) .setFullWindows(!isLiveRoom) + .setAnchorId(anchorId) + .setTab2Enter(true) .setLiveRoom(isLiveRoom) .setStar(isStar) .showDialog(); @@ -201,7 +219,17 @@ public class GiftWallMainTab2ListAdapter extends RecyclerView.Adapter data = new ArrayList<>(); public void setData(List data) { - if (data == null) { + if (data == null || data.isEmpty()) { data = new ArrayList<>(); + GiftWallMainTab2ClassicInfoBean.GiftData giftData=new GiftWallMainTab2ClassicInfoBean.GiftData(); + giftData.setUserId("-1"); + data.add(giftData); } this.data = data; notifyDataSetChanged(); @@ -72,6 +77,14 @@ public class GiftWallTab2GiftInfoListItemAdapter extends RecyclerView.Adapter99999){ - return "99999+"; + if(gift_hall_send_num>999999){ + return "999999+"; }else{ return String.valueOf(gift_hall_send_num); } @@ -283,12 +299,12 @@ public class GiftWallInfoBean extends BaseModel { this.id = id; } - public int getActive_rank_hide() { - return active_rank_hide; + public int getGift_hall_rank_hide() { + return gift_hall_rank_hide; } - public void setActive_rank_hide(int active_rank_hide) { - this.active_rank_hide = active_rank_hide; + public void setGift_hall_rank_hide(int gift_hall_rank_hide) { + this.gift_hall_rank_hide = gift_hall_rank_hide; } public String getCreate_time() { diff --git a/common/src/main/java/com/yunbao/common/bean/GiftWallMainTab2ClassicInfoBean.java b/common/src/main/java/com/yunbao/common/bean/GiftWallMainTab2ClassicInfoBean.java index 4f33fae33..cb9d06457 100644 --- a/common/src/main/java/com/yunbao/common/bean/GiftWallMainTab2ClassicInfoBean.java +++ b/common/src/main/java/com/yunbao/common/bean/GiftWallMainTab2ClassicInfoBean.java @@ -103,7 +103,7 @@ public class GiftWallMainTab2ClassicInfoBean extends BaseModel{ @SerializedName("naming_live_avatar") private String namingLiveAvatar; - @SerializedName("naming_live_active_rank_hide") + @SerializedName("naming_live_gift_hall_rank_hide") private int namingLiveActiveRankHide; @SerializedName("naming_user_id") @@ -115,7 +115,7 @@ public class GiftWallMainTab2ClassicInfoBean extends BaseModel{ @SerializedName("naming_user_avatar") private String namingUserAvatar; - @SerializedName("naming_user_active_rank_hide") + @SerializedName("naming_user_gift_hall_rank_hide") private int namingUserActiveRankHide; // 如果需要,可以添加无参构造器、getter和setter(这里省略) diff --git a/common/src/main/java/com/yunbao/common/bean/GiftWallTab2Bean.java b/common/src/main/java/com/yunbao/common/bean/GiftWallTab2Bean.java index f46f12e83..151f1ba59 100644 --- a/common/src/main/java/com/yunbao/common/bean/GiftWallTab2Bean.java +++ b/common/src/main/java/com/yunbao/common/bean/GiftWallTab2Bean.java @@ -127,11 +127,11 @@ public class GiftWallTab2Bean extends BaseModel{ @SerializedName("naming_user_avatar") public String namingUserAvatar; - @SerializedName("naming_user_active_rank_hide") + @SerializedName("naming_user_gift_hall_rank_hide") public int namingUserActiveRankHide; @SerializedName("needcoin_total") - public int needCoinTotal; + public long needCoinTotal; public int getGiftId() { return giftId; @@ -301,11 +301,11 @@ public class GiftWallTab2Bean extends BaseModel{ this.namingUserActiveRankHide = namingUserActiveRankHide; } - public int getNeedCoinTotal() { + public long getNeedCoinTotal() { return needCoinTotal; } - public void setNeedCoinTotal(int needCoinTotal) { + public void setNeedCoinTotal(long needCoinTotal) { this.needCoinTotal = needCoinTotal; } } diff --git a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java index ee8b51204..4153dbb86 100644 --- a/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java +++ b/common/src/main/java/com/yunbao/common/bean/LiveGiftBean.java @@ -74,6 +74,28 @@ public class LiveGiftBean { private int blindBoxTicket; @JSONField(name = "blind_box_ticket_id") private int blindBoxTicketId; + @JSONField(name = "naming_user_gift_hall_rank_hide") + @SerializedName("naming_user_gift_hall_rank_hide") + private int naming_user_gift_hall_rank_hide; + @JSONField(name = "naming_live_gift_hall_rank_hide") + @SerializedName("naming_live_gift_hall_rank_hide") + private int naming_live_gift_hall_rank_hide; + + public int getNaming_user_gift_hall_rank_hide() { + return naming_user_gift_hall_rank_hide; + } + + public void setNaming_user_gift_hall_rank_hide(int naming_user_gift_hall_rank_hide) { + this.naming_user_gift_hall_rank_hide = naming_user_gift_hall_rank_hide; + } + + public int getNaming_live_gift_hall_rank_hide() { + return naming_live_gift_hall_rank_hide; + } + + public void setNaming_live_gift_hall_rank_hide(int naming_live_gift_hall_rank_hide) { + this.naming_live_gift_hall_rank_hide = naming_live_gift_hall_rank_hide; + } public boolean isPageGift() { return isPageGift; diff --git a/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java b/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java index 638334d48..1131cc919 100644 --- a/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java +++ b/common/src/main/java/com/yunbao/common/bean/OpenAdModel.java @@ -3,6 +3,7 @@ package com.yunbao.common.bean; import com.google.gson.annotations.SerializedName; import com.yunbao.common.CommonAppConfig; import com.yunbao.common.utils.StringUtil; +import com.yunbao.common.utils.WordUtil; import java.text.ParseException; import java.text.SimpleDateFormat; @@ -122,7 +123,7 @@ public class OpenAdModel extends BaseModel { if (!url.startsWith("http://") && !url.startsWith("https://")) { url = CommonAppConfig.HOST + (url.startsWith("/") ? url : "/" + url); } - return url; + return url+"&isZh=" + (WordUtil.isNewZh() ? "1" : "0"); } public String getOriginalUrl() { diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java index f34733efc..493fa136d 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallDialog.java @@ -48,17 +48,19 @@ public class GiftWallDialog extends AbsDialogPopupWindow { private ViewPager2 mViewPager; private LinearLayout mIvTabsLayout; private List fragments = new ArrayList<>(); + private String anchorId; private boolean isFullWindows; String toUserId; String userName; boolean isAnchor; - public GiftWallDialog(@NonNull Context context, String toUserId, String userName, boolean isAnchor) { + public GiftWallDialog(@NonNull Context context, String toUserId, String userName, String anchorId, boolean isAnchor) { super(context); this.toUserId = toUserId; this.isAnchor = isAnchor; this.userName = userName; + this.anchorId=anchorId; } public GiftWallDialog setFullWindows(boolean fullWindows) { @@ -101,7 +103,7 @@ public class GiftWallDialog extends AbsDialogPopupWindow { WordUtil.isNewZh() ? "的禮物展館" : "'s Gift Hall" )); - fragments.add(new GiftWallMainTab1Fragment().setToUserId(toUserId).setAnchor(isAnchor).setLiveRoom(!isFullWindows).setOnItemClickListener(new OnItemClickListener() { + fragments.add(new GiftWallMainTab1Fragment().setToUserId(toUserId).setAnchor(isAnchor).setAnchorId(anchorId).setLiveRoom(!isFullWindows).setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(GiftWallBean bean, int position) { if (position == 1) { @@ -115,7 +117,7 @@ public class GiftWallDialog extends AbsDialogPopupWindow { } } })); - fragments.add(new GiftWallMainTab2Fragment().setToUserId(toUserId).setAnchor(isAnchor).setLiveRoom(!isFullWindows)); + fragments.add(new GiftWallMainTab2Fragment().setToUserId(toUserId).setAnchorId(anchorId).setAnchor(isAnchor).setLiveRoom(!isFullWindows)); mViewPager.setAdapter(new FragmentStateAdapter((FragmentActivity) mContext) { @NonNull @Override diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java index c2627d991..823cbd416 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallGiftInfoDialog.java @@ -72,12 +72,14 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { String giftId; String toUserId; + String anchorId; boolean isAnchor; int gift_hall_type = 1; int list_type = 2; private boolean isLiveRoom; String time; private boolean isStar; + private boolean isTab2Enter = false; public GiftWallGiftInfoDialog(Context context, String giftId, String toUserId, boolean isAnchor) { @@ -92,6 +94,15 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { return this; } + public GiftWallGiftInfoDialog setTab2Enter(boolean tab2Enter) { + isTab2Enter = tab2Enter; + return this; + } + + public GiftWallGiftInfoDialog setAnchorId(String anchorId) { + this.anchorId = anchorId; + return this; + } public GiftWallGiftInfoDialog setLiveRoom(boolean isLiveRoom) { this.isLiveRoom = isLiveRoom; @@ -161,17 +172,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { recyclerView.setAdapter(adapter); recyclerView.addItemDecoration(new ItemDecoration(mContext, 0x00000000, 0, 10)); - if (isStar) { - tab2.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_title_star)); - ((TextView) findViewById(R.id.user_name)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename1)); - ((TextView) findViewById(R.id.tv_rename)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename_value1)); - tv_list_title.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_title_star)); - } else { - tab2.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_title_champion)); - tv_list_title.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_title_champion)); - ((TextView) findViewById(R.id.user_name)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename)); - ((TextView) findViewById(R.id.tv_rename)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename_value)); - } + initTabText(); findViewById(R.id.item_anchor_name).setVisibility(View.GONE); ViewClicksAntiShake.clicksAntiShake(tab1, () -> { @@ -185,7 +186,7 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { tab2.setBackgroundResource(R.drawable.gift_wall_gift_info_list_btn_down); tab2.setTextColor(Color.parseColor("#FFFFFF")); list_type = 1; - + adapter.setList_type(list_type); ((TextView) findViewById(R.id.user_name)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_assistance_user)); ((TextView) findViewById(R.id.tv_rename)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_assistance_star)); initData(); @@ -200,6 +201,8 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { tab1.setBackgroundResource(R.drawable.gift_wall_gift_info_list_btn_down); tab1.setTextColor(Color.parseColor("#FFFFFF")); list_type = 2; + adapter.setList_type(list_type); + initTabText(); initData(); }); XPopup.Builder builder = new XPopup.Builder(getContext()) @@ -248,6 +251,20 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { resetWindows(); } + private void initTabText() { + if (isStar) { + tab2.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_title_star)); + ((TextView) findViewById(R.id.user_name)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename1)); + ((TextView) findViewById(R.id.tv_rename)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename_value1)); + tv_list_title.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_title_star)); + } else { + tab2.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_title_champion)); + tv_list_title.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_title_champion)); + ((TextView) findViewById(R.id.user_name)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename)); + ((TextView) findViewById(R.id.tv_rename)).setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_list_header_rename_value)); + } + } + private void resetWindows() { if (isFullWindows) { ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) findViewById(R.id.gift_name).getLayoutParams(); @@ -300,8 +317,8 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { diamond_text.setText(String.format(Locale.getDefault(), "%d", giftBean.getGift_info().getNeedcoin())); gift_tv_max.setText(String.format(Locale.getDefault(), "/%s", giftBean.getGift_info().getIlluminate_num())); gift_tv_progress.setText(String.format(Locale.getDefault(), "%s", giftBean.getGift_info().getGift_hall_send_num())); - gift_progress.setMax(Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num())); - gift_progress.setProgress(giftBean.getGift_info().getNeedcoin_total()); + gift_progress.setMax(giftBean.getGift_info().getIlluminate_num()); + gift_progress.setProgress(Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num())); if (giftBean.getGift_info().getIlluminate_status() == 1) { gift_btn.setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_info_top_btn_continue)); btn_lighten.setText(WordUtil.getNewString(R.string.dialog_gift_wall_list_spinner_up)); @@ -316,6 +333,12 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { tab_layout.setVisibility(View.VISIBLE); bottom_layout.setVisibility(View.VISIBLE); tv_list_title.setVisibility(View.GONE); + if (isTab2Enter) { + tab_layout.setVisibility(View.GONE); + bottom_layout.setVisibility(View.GONE); + tv_list_title.setVisibility(View.VISIBLE); + gift_progress.setVisibility(View.GONE); + } } else { tab_layout.setVisibility(View.GONE); bottom_layout.setVisibility(View.GONE); @@ -326,20 +349,20 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { gift_progress.setVisibility(View.GONE); } } - if (!isLiveRoom || (IMLoginManager.get(mContext).getUserInfo().getId() + "").equals(toUserId) && isAnchor) { + if (!isLiveRoom || giftBean.getGift_info().getGift_status() == 0) { gift_btn.setEnabled(false); btn_one.setEnabled(false); gift_btn.setBackgroundResource(R.drawable.gift_wall_gift_info_btn_un); btn_one.setBackgroundResource(R.drawable.gift_wall_gift_info_btn_un); } adapter.setData(giftBean.getData()); - time = (WordUtil.isNewZh() ? "榜單結算時間" : "Settlement time") + giftBean.getGift_info().getGift_hall_start() + " - " + giftBean.getGift_info().getGift_hall_end(); + time = (WordUtil.isNewZh() ? "榜單結算時間:" : "Settlement time:") + giftBean.getGift_info().getGift_hall_start() + " - " + giftBean.getGift_info().getGift_hall_end(); ImgLoader.display(mContext, IMLoginManager.get(mContext).getUserInfo().getAvatar(), avatar); user_name.setText(IMLoginManager.get(mContext).getUserInfo().getUserNicename()); send_num.setText(String.format(Locale.getDefault(), "%s", giftBean.getGift_info().getUser_gift_hall_send_num())); String tmp = ""; - if (giftBean.getGift_info().getIlluminate_status() == 0) {//未點亮 + if (giftBean.getGift_info().getIlluminate_status() != 1) {//未點亮 btn_one.setText(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_light); tmp = String.format(Locale.getDefault(), "%s", (giftBean.getGift_info().getIlluminate_num() - Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num()))); setTips(tmp); @@ -350,7 +373,10 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { loadChampion(giftBean); } } - + if (!isAnchor) { + gift_schedule.setVisibility(View.GONE); + gift_progress.setVisibility(View.GONE); + } initAnim(); } @@ -364,31 +390,31 @@ public class GiftWallGiftInfoDialog extends AbsDialogPopupWindow { private void loadChampion(GiftWallInfoBean giftBean) { int tmp = 0; - int mySend = Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num()); + int mySend = giftBean.getGift_info().getUser_gift_hall_send_num(); if (giftBean.getData() != null && !giftBean.getData().isEmpty()) { - tmp = giftBean.getData().get(0).getGift_hall_send_num() - Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num()) + 1; + tmp = giftBean.getData().get(0).getGift_hall_send_num() - giftBean.getGift_info().getUser_gift_hall_send_num() + 1; } - if (mySend > tmp) { + if (mySend > tmp || giftBean.getData().get(0).getUser_id().equals(IMLoginManager.get(mContext).getUserInfo().getId() + "")) { btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_champion_get)); btn_one_tips.setVisibility(View.GONE); } else { btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_champion)); - setTips(String.valueOf(tmp + 1)); + setTips(String.valueOf(tmp)); } } private void loadStar(GiftWallInfoBean giftBean) { int tmp = 0; - int mySend = Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num()); + int mySend = giftBean.getGift_info().getUser_gift_hall_send_num(); if (giftBean.getData() != null && !giftBean.getData().isEmpty()) { - tmp = giftBean.getData().get(0).getGift_hall_send_num() - Integer.parseInt(giftBean.getGift_info().getGift_hall_send_num()) + 1; + tmp = giftBean.getData().get(0).getGift_hall_send_num() - giftBean.getGift_info().getUser_gift_hall_send_num() + 1; } - if (mySend > tmp) { + if (mySend > tmp || giftBean.getData().get(0).getUser_id().equals(IMLoginManager.get(mContext).getUserInfo().getId() + "")) { btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_star_get)); btn_one_tips.setVisibility(View.GONE); } else { btn_one.setText(WordUtil.getNewString(R.string.dialog_gift_wall_gfit_info_list_bottom_btn_one_star)); - setTips(String.valueOf(tmp + 1)); + setTips(String.valueOf(tmp)); } } diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java index dacce94ac..7cf18387b 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallMainTab2ClassicInfoDialog.java @@ -30,7 +30,9 @@ import com.yunbao.common.fragment.GiftWallMainTab2Fragment; import com.yunbao.common.glide.ImgLoader; import com.yunbao.common.http.base.HttpCallback; import com.yunbao.common.http.live.LiveNetManager; +import com.yunbao.common.manager.IMLoginManager; import com.yunbao.common.utils.DpUtil; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.ScreenDimenUtil; import com.yunbao.common.utils.ToastUtil; import com.yunbao.common.utils.WordUtil; @@ -113,10 +115,14 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { void initData(GiftWallMainTab2ClassicInfoBean data) { ImgLoader.display(mContext, data.getGiftInfo().getGiftIcon(), mIvGift); - ImgLoader.display(mContext, data.getGiftInfo().getNamingLiveAvatar(), user_avatar); + if (data.getGiftInfo().getNamingLiveActiveRankHide() == 0 || data.getGiftInfo().getNamingUserId() == IMLoginManager.get(mContext).getUserInfo().getId()) { + ImgLoader.display(mContext, data.getGiftInfo().getNamingLiveAvatar(), user_avatar); + } else { + user_avatar.setImageResource(R.mipmap.hide); + } gift_name.setText(WordUtil.isNewZh() ? data.getGiftInfo().getGiftName() : data.getGiftInfo().getGiftNameEn()); mTvUserName.setText(data.getGiftInfo().getNamingLiveNicename()); - star_value.setText(String.format(Locale.getDefault(), "%d", data.getGiftInfo().getNeedcoinTotal())); + star_value.setText(String.format(Locale.getDefault(), "%d", data.getGiftInfo().getGiftHallSendNum())); int max = data.getData().size() > 3 ? 3 : 0; if (max != 0) { adapter.setData(data.getData().subList(max, data.getData().size())); @@ -134,13 +140,28 @@ public class GiftWallMainTab2ClassicInfoDialog extends AbsDialogPopupWindow { break; } } - + ViewClicksAntiShake.clicksAntiShake(user_avatar, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (data.getGiftInfo().getNamingLiveActiveRankHide() == 0) { + RouteUtil.forwardUserHome(mContext, String.valueOf(data.getGiftInfo().getNamingLiveId()), 0); + } + } + }); } void setTopData(GiftWallMainTab2ClassicInfoBean.GiftData data, ImageView avatar, TextView name, TextView value) { ImgLoader.display(mContext, data.getAvatar(), avatar); name.setText(data.getUserName()); value.setText(String.format(Locale.getDefault(), "%d", data.getGiftHallSendNum())); + ViewClicksAntiShake.clicksAntiShake(avatar, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (data.getActiveRankHide() == 0) { + RouteUtil.forwardUserHome(mContext, String.valueOf(data.getUserId()), 0); + } + } + }); } void initView() { diff --git a/common/src/main/java/com/yunbao/common/dialog/GiftWallTab2List2Dialog.java b/common/src/main/java/com/yunbao/common/dialog/GiftWallTab2List2Dialog.java index 1c6772b89..cb04987b6 100644 --- a/common/src/main/java/com/yunbao/common/dialog/GiftWallTab2List2Dialog.java +++ b/common/src/main/java/com/yunbao/common/dialog/GiftWallTab2List2Dialog.java @@ -11,7 +11,9 @@ import com.makeramen.roundedimageview.RoundedImageView; import com.yunbao.common.R; import com.yunbao.common.bean.GiftWallTab2Bean; import com.yunbao.common.glide.ImgLoader; +import com.yunbao.common.utils.RouteUtil; import com.yunbao.common.utils.WordUtil; +import com.yunbao.common.views.weight.ViewClicksAntiShake; import java.util.Locale; @@ -55,11 +57,41 @@ public class GiftWallTab2List2Dialog extends AbsDialogCenterPopupWindow { giftName = findViewById(R.id.gift_name); ImgLoader.display(mContext, gift.getGiftIcon(), giftImage); - ImgLoader.display(mContext, gift.getNamingUserAvatar(), user1Avatar); - ImgLoader.display(mContext, gift.getNamingLiveAvatar(), user2Avatar); - user1Name.setText(gift.getNamingUserNicename()); - user2Name.setText(gift.getNamingLiveNicename()); + if (gift.getNamingLiveActiveRankHide() == 0) { + ImgLoader.display(mContext, gift.getNamingLiveAvatar(), user2Avatar); + user2Name.setText(gift.getNamingLiveNicename()); + } else { + user2Avatar.setImageResource(R.mipmap.hide); + user2Name.setText(WordUtil.getNewString(R.string.mystery_man)); + } + if (gift.getNamingUserActiveRankHide() == 0) { + ImgLoader.display(mContext, gift.getNamingUserAvatar(), user1Avatar); + user1Name.setText(gift.getNamingUserNicename()); + } else { + user1Avatar.setImageResource(R.mipmap.hide); + user1Name.setText(WordUtil.getNewString(R.string.mystery_man)); + } + + giftName.setText(WordUtil.isNewZh() ? gift.getGiftName() : gift.getGiftNameEn()); - titleValue.setText(String.format(Locale.getDefault(), "%s", gift.getNeedCoinTotal())); + titleValue.setText(String.format(Locale.getDefault(), "%d", gift.getGiftHallSendNum())); + + ViewClicksAntiShake.clicksAntiShake(user1Avatar, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (gift.getNamingUserActiveRankHide() == 0) { + RouteUtil.forwardUserHome(mContext, String.valueOf(gift.getNamingUserId()), 0); + } + } + }); + ViewClicksAntiShake.clicksAntiShake(user2Avatar, new ViewClicksAntiShake.ViewClicksCallBack() { + @Override + public void onViewClicks() { + if (gift.getNamingLiveActiveRankHide() == 0) { + RouteUtil.forwardUserHome(mContext, String.valueOf(gift.getNamingLiveId()), 0); + } + + } + }); } } diff --git a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java index 9ded18aba..4a6f130db 100644 --- a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab1Fragment.java @@ -43,6 +43,7 @@ public class GiftWallMainTab1Fragment extends BaseFragment { int screen; String toUserId; + String anchorId; boolean isAnchor; boolean isLiveRoom; SVGAVideoEntity drawable; @@ -69,6 +70,11 @@ public class GiftWallMainTab1Fragment extends BaseFragment { return this; } + public GiftWallMainTab1Fragment setAnchorId(String anchorId) { + this.anchorId = anchorId; + return this; + } + public GiftWallMainTab1Fragment setAnchor(boolean anchor) { isAnchor = anchor; return this; @@ -123,8 +129,8 @@ public class GiftWallMainTab1Fragment extends BaseFragment { } private void initData(GiftWallBean bean) { - onItemClickListener.onItemClick(bean, bean.getActive_rank_hide()); - if (bean.getActive_rank_hide() == 1 && !toUserId.equals(IMLoginManager.get(getContext()).getUserInfo().getId() + "")) { + onItemClickListener.onItemClick(bean, bean.getGift_hall_rank_hide()); + if (bean.getGift_hall_rank_hide() == 1 && !toUserId.equals(IMLoginManager.get(getContext()).getUserInfo().getId() + "")) { hideLayout.setVisibility(View.VISIBLE); appbar.setVisibility(View.GONE); classic_layout.setVisibility(View.GONE); @@ -183,13 +189,15 @@ public class GiftWallMainTab1Fragment extends BaseFragment { list2Adapter.setToUid(toUserId); list1Adapter.setAnchor(isAnchor); list2Adapter.setAnchor(isAnchor); + list1Adapter.setAnchorId(anchorId); + list2Adapter.setAnchorId(anchorId); list1Adapter.setStar(true); recyclerView1.setAdapter(list1Adapter); recyclerView2.setAdapter(list2Adapter); - recyclerView1.addItemDecoration(new ItemDecoration(getContext(), 0x00000000, DpUtil.dp2px(10), DpUtil.dp2px(11))); - recyclerView2.addItemDecoration(new ItemDecoration(getContext(), 0x00000000, DpUtil.dp2px(2), DpUtil.dp2px(11))); + recyclerView1.addItemDecoration(new ItemDecoration(getContext(), 0x00000000, DpUtil.dp2px(10), DpUtil.dp2px(5))); + recyclerView2.addItemDecoration(new ItemDecoration(getContext(), 0x00000000, DpUtil.dp2px(2), DpUtil.dp2px(5))); starGiftsTitle.getPaint().setShader(new LinearGradient(0, 0, 0, classicGiftsTitle.getPaint().getTextSize(), Color.parseColor("#FEE8C6"), Color.parseColor("#FFD5A3"), Shader.TileMode.CLAMP)); diff --git a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java index 560dd45ad..881c94774 100644 --- a/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java +++ b/common/src/main/java/com/yunbao/common/fragment/GiftWallMainTab2Fragment.java @@ -50,6 +50,7 @@ public class GiftWallMainTab2Fragment extends BaseFragment { int screen; int type = 1; String toUserId; + String anchorId; boolean isAnchor; private boolean isLiveRoom; @@ -58,6 +59,11 @@ public class GiftWallMainTab2Fragment extends BaseFragment { return this; } + public GiftWallMainTab2Fragment setAnchorId(String anchorId) { + this.anchorId = anchorId; + return this; + } + public GiftWallMainTab2Fragment setAnchor(boolean anchor) { isAnchor = anchor; return this; @@ -99,6 +105,8 @@ public class GiftWallMainTab2Fragment extends BaseFragment { list2Adapter.setToUid(toUserId); list1Adapter.setAnchor(isAnchor); list2Adapter.setAnchor(isAnchor); + list1Adapter.setAnchorId(anchorId); + list2Adapter.setAnchorId(anchorId); list1Adapter.setLiveRoom(isLiveRoom); list2Adapter.setLiveRoom(isLiveRoom); list1Adapter.setStar(true); @@ -107,8 +115,8 @@ public class GiftWallMainTab2Fragment extends BaseFragment { recyclerView2.setAdapter(list2Adapter); - recyclerView1.addItemDecoration(new ItemDecoration(getContext(), 0x00000000, DpUtil.dp2px(1), DpUtil.dp2px(5))); - recyclerView2.addItemDecoration(new ItemDecoration(getContext(), 0x00000000, DpUtil.dp2px(1), DpUtil.dp2px(5))); + //recyclerView1.addItemDecoration(new ItemDecoration(getContext(), 0x00000000, DpUtil.dp2px(3), DpUtil.dp2px(5))); + //recyclerView2.addItemDecoration(new ItemDecoration(getContext(), 0x00000000, DpUtil.dp2px(3), DpUtil.dp2px(5))); starGiftsTitle.getPaint().setShader(new LinearGradient(0, 0, 0, classicGiftsTitle.getPaint().getTextSize(), Color.parseColor("#FEE8C6"), Color.parseColor("#FFD5A3"), Shader.TileMode.CLAMP)); @@ -151,6 +159,7 @@ public class GiftWallMainTab2Fragment extends BaseFragment { setDslTabColor(fromIndex == 0 ? dslTab1 : dslTab2, fromIndex == 1 ? dslTab1 : dslTab2); type = (fromIndex + 1); list1Adapter.setNowRank(fromIndex == 0); + list2Adapter.setNowRank(fromIndex == 0); screen = 0; spinnerText.setText(R.string.dialog_gift_wall_list_spinner_all); initData(); @@ -207,6 +216,11 @@ public class GiftWallMainTab2Fragment extends BaseFragment { void initData() { list1Adapter.clear(); list2Adapter.clear(); + if(type==2){ + spinner.setVisibility(View.INVISIBLE); + }else { + spinner.setVisibility(View.VISIBLE); + } LiveNetManager.get(getContext()) .allGiftHall(String.valueOf(type), new HttpCallback() { @Override diff --git a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java index 29c9817d1..b85878b8f 100644 --- a/common/src/main/java/com/yunbao/common/http/PDLiveApi.java +++ b/common/src/main/java/com/yunbao/common/http/PDLiveApi.java @@ -1291,8 +1291,8 @@ public interface PDLiveApi { @GET("/api/public/?service=Gift.getGiftHallMedalList") Observable> getGiftHallMedalList(@Query("to_uid") String liveUid,@Query("type")String type); - @GET("/api/public/?service=Dress.userUseDress") - Observable>> userUseDress(@Query("users_dress_id")String users_dress_id); + @GET("/api/public/?service=Gift.useMedal") + Observable>> userUseDress(@Query("users_dress_id")String users_dress_id,@Query("dress_type")int dress_type); /** * 个人展馆 diff --git a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java index cc5c69ce6..5e5e61785 100644 --- a/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java +++ b/common/src/main/java/com/yunbao/common/http/live/LiveNetManager.java @@ -3574,7 +3574,7 @@ public class LiveNetManager { public void userUseDress( String usersDressId, HttpCallback callback) { API.get().pdLiveApi(mContext) - .userUseDress(usersDressId) + .userUseDress(usersDressId,3) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Consumer>>() { diff --git a/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java b/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java index ef2fb8c84..741c8d9eb 100644 --- a/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java +++ b/common/src/main/java/com/yunbao/common/utils/AndroidBug5497Workaround.java @@ -39,7 +39,6 @@ public class AndroidBug5497Workaround { public void onGlobalLayout() { possiblyResizeChildOfContent(); int heightDiff = mChildOfContent.getRootView().getHeight() - mChildOfContent.getHeight(); - System.out.println("heightDiff = " + heightDiff); if (heightDiff < 100) { frameLayoutParams.height = defHeight; mChildOfContent.requestLayout(); diff --git a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java index c7d3c486d..4660abed4 100644 --- a/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java +++ b/common/src/main/java/com/yunbao/common/utils/JavascriptInterfaceUtils.java @@ -651,7 +651,7 @@ public class JavascriptInterfaceUtils { @JavascriptInterface public void toGiftNamingAlertAllPageView(String mAnchorName, String mLiveUid, String mAvatarUrl, int isAnchor) { // RouteUtil.forwardGiftWallActivity("", mAnchorName, mLiveUid, mAvatarUrl, 0, isAnchor == 1); - new com.yunbao.common.dialog.GiftWallDialog(mContext, mLiveUid,mAnchorName, isAnchor==1).setFullWindows(true).showDialog(); + new com.yunbao.common.dialog.GiftWallDialog(mContext, mLiveUid,mAnchorName, null,isAnchor==1).setFullWindows(true).showDialog(); } @JavascriptInterface diff --git a/common/src/main/res/layout/dialog_gift_wall_gift_info.xml b/common/src/main/res/layout/dialog_gift_wall_gift_info.xml index 05e1dd297..c73f8a27a 100644 --- a/common/src/main/res/layout/dialog_gift_wall_gift_info.xml +++ b/common/src/main/res/layout/dialog_gift_wall_gift_info.xml @@ -198,6 +198,7 @@ android:layout_marginTop="10dp" android:layout_marginEnd="17dp" android:layout_marginBottom="58dp" + android:paddingBottom="32dp" android:background="@mipmap/gift_wall_gift_info_list" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" diff --git a/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml b/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml index f19144b32..c74b45780 100644 --- a/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml +++ b/common/src/main/res/layout/dialog_gift_wall_tab2_classic_info.xml @@ -61,7 +61,6 @@ android:textColor="#FFD3A4" android:textSize="16sp" app:layout_constraintEnd_toEndOf="@+id/gift" - app:layout_constraintHorizontal_bias="1.0" app:layout_constraintStart_toStartOf="@+id/gift" app:layout_constraintTop_toBottomOf="@+id/gift" /> @@ -81,11 +80,10 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="16dp" - android:text="TextView" + tools:text="TextView" android:textColor="#FFD3A4" android:textSize="16sp" app:layout_constraintEnd_toEndOf="@+id/user_avatar_container" - app:layout_constraintHorizontal_bias="1.0" app:layout_constraintStart_toStartOf="@+id/user_avatar_container" app:layout_constraintTop_toBottomOf="@+id/user_avatar_container" /> @@ -208,7 +206,7 @@ android:id="@+id/user_avatar_2" android:layout_width="0dp" android:layout_height="0dp" - android:src="@mipmap/icon_avatar_placeholder" + tools:src="@mipmap/icon_avatar_placeholder" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -233,7 +231,7 @@ android:ellipsize="end" android:gravity="center" android:maxLines="1" - android:text="TextView" + tools:text="TextView" android:textColor="#FFFFFF" android:textSize="14sp" app:layout_constraintBottom_toTopOf="@+id/user_value_2" @@ -245,7 +243,7 @@ android:layout_width="wrap_content" android:layout_height="0dp" android:layout_marginBottom="5dp" - android:text="TextView" + tools:text="TextView" android:textColor="#FFFFFF" android:textSize="20sp" app:layout_constraintBottom_toBottomOf="@+id/imageView17" @@ -295,7 +293,7 @@ android:id="@+id/user_avatar_1" android:layout_width="0dp" android:layout_height="0dp" - android:src="@mipmap/icon_avatar_placeholder" + tools:src="@mipmap/icon_avatar_placeholder" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -325,7 +323,7 @@ android:ellipsize="end" android:gravity="center" android:maxLines="1" - android:text="TextView" + tools:text="TextView" android:textColor="#FFFFFF" android:textSize="14sp" app:layout_constraintBottom_toTopOf="@+id/user_value_1" @@ -337,7 +335,7 @@ android:layout_width="wrap_content" android:layout_height="0dp" android:layout_marginBottom="5dp" - android:text="TextView" + tools:text="TextView" android:textColor="#FFFFFF" android:textSize="20sp" app:layout_constraintBottom_toBottomOf="@+id/imageView9" @@ -386,7 +384,7 @@ android:id="@+id/user_avatar_3" android:layout_width="0dp" android:layout_height="0dp" - android:src="@mipmap/icon_avatar_placeholder" + tools:src="@mipmap/icon_avatar_placeholder" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" @@ -411,7 +409,7 @@ android:ellipsize="end" android:gravity="center" android:maxLines="1" - android:text="TextView" + tools:text="TextView" android:textColor="#FFFFFF" android:textSize="14sp" app:layout_constraintBottom_toTopOf="@+id/user_value_3" @@ -423,7 +421,7 @@ android:layout_width="wrap_content" android:layout_height="0dp" android:layout_marginBottom="5dp" - android:text="TextView" + tools:text="TextView" android:textColor="#FFFFFF" android:textSize="20sp" app:layout_constraintBottom_toBottomOf="parent" diff --git a/common/src/main/res/layout/fragment_gift_wall_man_tab_1.xml b/common/src/main/res/layout/fragment_gift_wall_man_tab_1.xml index 105ca5fc0..6abef27cd 100644 --- a/common/src/main/res/layout/fragment_gift_wall_man_tab_1.xml +++ b/common/src/main/res/layout/fragment_gift_wall_man_tab_1.xml @@ -67,17 +67,17 @@ + android:layout_height="match_parent" + > - + - + + + + + + + + + + tools:text="本期展館時間 :000000" /> - - - - - - + + + + + + + + + + - - - - - - - - - - - + app:layout_constraintTop_toTopOf="parent" + app:spanCount="3" + tools:itemCount="6" + tools:listitem="@layout/item_gift_wall_man_tab2_list_1" /> + - - - - - + @@ -149,24 +148,22 @@ android:id="@+id/classic_layout" android:layout_width="match_parent" android:layout_height="match_parent" - app:layout_behavior="@string/appbar_scrolling_view_behavior"> + app:layout_behavior="@string/appbar_scrolling_view_behavior" + tools:visibility="visible"> + + diff --git a/common/src/main/res/layout/item_gift_wall_man_tab2_list_1.xml b/common/src/main/res/layout/item_gift_wall_man_tab2_list_1.xml index 3e66bf49a..c003e49ae 100644 --- a/common/src/main/res/layout/item_gift_wall_man_tab2_list_1.xml +++ b/common/src/main/res/layout/item_gift_wall_man_tab2_list_1.xml @@ -118,7 +118,7 @@ android:layout_marginStart="20dp" android:gravity="center" android:layout_marginEnd="20dp" - android:text="@string/dialog_gift_wall_tab2_list_wait" + android:text="@string/dialog_gift_wall_classic_wait" android:textColor="#A2A2A2" android:textSize="14sp" android:visibility="gone" diff --git a/common/src/main/res/layout/view_gift_wall_achieve_item.xml b/common/src/main/res/layout/view_gift_wall_achieve_item.xml index cb60b5eed..a4ec78501 100644 --- a/common/src/main/res/layout/view_gift_wall_achieve_item.xml +++ b/common/src/main/res/layout/view_gift_wall_achieve_item.xml @@ -1,7 +1,7 @@ @@ -21,7 +21,7 @@ HTTP_SCHEMES = Arrays.asList("http", "https"); + @Override public void setStatusBar() { + super.setStatusBar(); // getWindow().setStatusBarColor(Color.parseColor("#FFFFFF")); // getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); // getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); @@ -94,6 +101,12 @@ public class ZhuangBanActivity extends AbsActivity { return R.layout.activity_zhuang_ban; } + @Override + protected void create() { + super.create(); + + } + @Override protected void main() { Bus.getOn(this); @@ -154,6 +167,7 @@ public class ZhuangBanActivity extends AbsActivity { } int height = view.getMeasuredHeight(); Log.e("网页高度", height + ""); + view.loadUrl("javascript:setTop(" + DpUtil.dp2px(15) + ")"); } @Override @@ -439,37 +453,38 @@ public class ZhuangBanActivity extends AbsActivity { }); } + /** * Parse the url and open it by system function. - * case 1: deal "intent://xxxx" url. - * case 2: deal custom scheme. url + * case 1: deal "intent://xxxx" url. + * case 2: deal custom scheme. url + * * @param view: WebView * @param url * @return */ private boolean shouldOverrideUrlLoadingInner(WebView view, String url) { - if(!TextUtils.isEmpty(url)) { + if (!TextUtils.isEmpty(url)) { Uri uri = Uri.parse(url); - if(uri != null) { + if (uri != null) { if ("intent".equals(uri.getScheme())) { try { Intent intent = Intent.parseUri(uri.toString(), Intent.URI_INTENT_SCHEME); - if(intent != null) { + if (intent != null) { PackageManager pm = mContext.getPackageManager(); ResolveInfo info = pm.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); - if(info != null) { + if (info != null) { mContext.startActivity(Intent.parseUri(uri.toString(), Intent.URI_INTENT_SCHEME)); return true; - } - else { + } else { String fallbackUrl = intent.getStringExtra("browser_fallback_url"); if (!TextUtils.isEmpty(fallbackUrl)) { - if(fallbackUrl.startsWith("market://")) + if (fallbackUrl.startsWith("market://")) startAppMarketWithUrl(mContext, fallbackUrl, false); else view.loadUrl(fallbackUrl); return true; - }else{ + } else { mContext.startActivity(new Intent(Intent.ACTION_VIEW, uri)); } } @@ -485,6 +500,7 @@ public class ZhuangBanActivity extends AbsActivity { } return false; } + public static void startAppMarketWithUrl(Activity context, String url, boolean forceUseGoogle) { try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); @@ -495,9 +511,11 @@ public class ZhuangBanActivity extends AbsActivity { } catch (Exception e) { try { startUrl(context, url, true); - } catch (Exception e1) {} + } catch (Exception e1) { + } } } + public static boolean hasActivity(Context context, Intent intent, String packageName) { PackageManager pm = context.getPackageManager(); List appList = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); @@ -507,11 +525,12 @@ public class ZhuangBanActivity extends AbsActivity { } return false; } + public static void startUrl(Context context, String url, boolean isNewTask) { - if(context != null && !TextUtils.isEmpty(url)) { + if (context != null && !TextUtils.isEmpty(url)) { try { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); - if(isNewTask) { + if (isNewTask) { intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); } context.startActivity(intent); diff --git a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java index 85de4e099..e6723a38c 100644 --- a/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java +++ b/main/src/main/java/com/yunbao/main/views/MainHomeViewHolder.java @@ -69,7 +69,7 @@ public class MainHomeViewHolder extends AbsMainHomeParentViewHolder { @Override public void run() { new GiftWallDialog(mContext, IMLoginManager.get(mContext).getUserInfo().getId() + "", - IMLoginManager.get(mContext).getUserInfo().getUserNicename() + IMLoginManager.get(mContext).getUserInfo().getUserNicename(),null , false).setFullWindows(true).showDialog(); } }); diff --git a/main/src/main/java/com/yunbao/main/views/TestWebViewClient.java b/main/src/main/java/com/yunbao/main/views/TestWebViewClient.java index 8aace0418..baea72a41 100644 --- a/main/src/main/java/com/yunbao/main/views/TestWebViewClient.java +++ b/main/src/main/java/com/yunbao/main/views/TestWebViewClient.java @@ -23,6 +23,11 @@ public class TestWebViewClient extends WebViewClient { private List HTTP_SCHEMES = Arrays.asList("http", "https"); public TestWebViewClient(Activity context, WebView webView) { this.mContext = context; + webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true); + webView.getSettings().setJavaScriptEnabled(true); + webView.getSettings().setDomStorageEnabled(true); + webView.getSettings().setUseWideViewPort(true); + webView.getSettings().setLoadWithOverviewMode(true); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) {