Commit 8c7ded89 authored by jyx's avatar jyx

更新正式环境珊瑚配置,热门活动页样式修改

parent 994f9525
...@@ -36,12 +36,12 @@ public final class CoralDownload { ...@@ -36,12 +36,12 @@ public final class CoralDownload {
public void pull() { public void pull() {
int type; int type;
if (BuildConfig.DEBUG) { // if (BuildConfig.DEBUG) {
type = RELEASE_TASK_TYPE_DEBUG; // type = RELEASE_TASK_TYPE_DEBUG;
} else { // } else {
type = RELEASE_TASK_TYPE_RELEASE; // type = RELEASE_TASK_TYPE_RELEASE;
} // }
// type = RELEASE_TASK_TYPE_RELEASE; type = RELEASE_TASK_TYPE_RELEASE;
new ADLoader(MintsApplication.getContext()) new ADLoader(MintsApplication.getContext())
.get(ADType.APP_DOWNLOAD) .get(ADType.APP_DOWNLOAD)
......
...@@ -32,6 +32,8 @@ object KsPreLoadExpressManager { ...@@ -32,6 +32,8 @@ object KsPreLoadExpressManager {
} }
fun loadKsFrameLayout(parent: ViewGroup) { fun loadKsFrameLayout(parent: ViewGroup) {
parent.removeAllViews()
try { try {
var ksNativeAd: KsNativeAd? var ksNativeAd: KsNativeAd?
val scene = KsScene val scene = KsScene
...@@ -95,13 +97,14 @@ object KsPreLoadExpressManager { ...@@ -95,13 +97,14 @@ object KsPreLoadExpressManager {
} }
override fun onVideoPlayError(what: Int, extra: Int) { override fun onVideoPlayError(what: Int, extra: Int) {
LogUtil.d(what)
} }
}) })
// SDK默认渲染的视频view // SDK默认渲染的视频view
val videoPlayConfig = KsAdVideoPlayConfig.Builder() val videoPlayConfig = KsAdVideoPlayConfig.Builder()
.videoSoundEnable(true) // 有声播放 .videoSoundEnable(true) // 有声播放
.dataFlowAutoStart(false) // 流量下自动播放 .dataFlowAutoStart(true) // 流量下自动播放
.build() .build()
val videoView = ksNativeAd.getVideoView(mContext, videoPlayConfig) val videoView = ksNativeAd.getVideoView(mContext, videoPlayConfig)
if (videoView != null && videoView.parent == null) { if (videoView != null && videoView.parent == null) {
......
...@@ -47,7 +47,6 @@ class KsVideoAdManager private constructor() : ...@@ -47,7 +47,6 @@ class KsVideoAdManager private constructor() :
videoAdStatusListener?.adFail() videoAdStatusListener?.adFail()
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, p0.toString(), p1) TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_KS, Constant.EVENT_TYPE_ONE, p0.toString(), p1)
LogUtil.d(p1)
} }
override fun onRewardVideoAdLoad(p0: MutableList<KsRewardVideoAd>?) { override fun onRewardVideoAdLoad(p0: MutableList<KsRewardVideoAd>?) {
...@@ -105,8 +104,10 @@ class KsVideoAdManager private constructor() : ...@@ -105,8 +104,10 @@ class KsVideoAdManager private constructor() :
} }
}) })
videoAdStatusListener?.adSuccess()
// PlayConfig默认竖屏播放,传null // PlayConfig默认竖屏播放,传null
mRewardVideoAd!!.showRewardVideoAd(activity, null) // mRewardVideoAd!!.showRewardVideoAd(activity, null)
} }
} }
......
...@@ -3,7 +3,6 @@ package com.mints.goldspace.ad.video ...@@ -3,7 +3,6 @@ package com.mints.goldspace.ad.video
import android.app.Activity import android.app.Activity
import android.text.TextUtils import android.text.TextUtils
import androidx.annotation.Nullable import androidx.annotation.Nullable
import com.mints.goldspace.BuildConfig
import com.mints.goldspace.ad.video.base.BaseVideoAd import com.mints.goldspace.ad.video.base.BaseVideoAd
import com.mints.goldspace.ad.video.base.VideoAdStatusListener import com.mints.goldspace.ad.video.base.VideoAdStatusListener
import com.mints.goldspace.common.AppConfig import com.mints.goldspace.common.AppConfig
......
package com.mints.goldspace.manager
import com.mints.goldspace.MintsApplication
import com.mints.goldspace.common.Constant
import com.mints.goldspace.common.DeviceInfo
import com.mints.goldspace.net.CpdService
import com.mints.goldspace.utils.MD5
import com.mints.library.net.netstatus.NetUtils
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import org.json.JSONException
import org.json.JSONObject
/**
* 圣于地Cpd下载
*/
object CpdSydManager {
const val BUSINESS_ID = "m8909"
const val KEY = "KVPCQQsS9AV68y9DA2S4gIk2orHY4xz6"
fun getCpdUrl(): String {
val currentTimeMillis = System.currentTimeMillis().toString()
val token = MD5.GetMD5Code(BUSINESS_ID + KEY + currentTimeMillis)
// token=MD5(id + apikey+ timestamp)
return CpdService.CPD_IP + "?businessId=" + BUSINESS_ID +
"&token=" + token +
"&timestamp=" + currentTimeMillis
}
fun getCpdBody(ip: String): RequestBody {
val deviceInfo = DeviceInfo.instance
val param = JSONObject()
val application = JSONObject()
val equipment = JSONObject()
try {
application.put("app_pkg_name", Constant.MINTS_PKG_NAME)
application.put("app_ver_code", deviceInfo.versionCode)
application.put("app_ver_name", deviceInfo.versionName)
// 设备类型 4-手机
equipment.put("type", "4")
// 系统类型 1:android
equipment.put("os_type", "1")
equipment.put("android_id", deviceInfo.androidId)
equipment.put("imei", deviceInfo.iMEI)
equipment.put("mac", deviceInfo.getMacAddress())
equipment.put("net_type", NetUtils.getNetworkStateForCpd(MintsApplication.getContext()))
equipment.put("ip", ip)
equipment.put("brand", deviceInfo.brand)
equipment.put("model", deviceInfo.mobileModel)
param.put("application", application)
param.put("equipment", equipment)
} catch (e: JSONException) {
e.printStackTrace()
}
return RequestBody.create("application/json".toMediaTypeOrNull(), param.toString())
}
}
\ No newline at end of file
...@@ -24,9 +24,9 @@ object TzManager { ...@@ -24,9 +24,9 @@ object TzManager {
.appKey(APP_KEY) .appKey(APP_KEY)
.appSecret(APP_SECRET) .appSecret(APP_SECRET)
.appChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")) .appChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"))
.forTest(true) .forTest(false)
.log(true) .log(false)
.verbose(true) .verbose(false)
.build(), .build(),
object : IADEngineState { object : IADEngineState {
override fun onIdle() {} override fun onIdle() {}
......
...@@ -7,7 +7,6 @@ import com.mints.goldspace.BuildConfig ...@@ -7,7 +7,6 @@ import com.mints.goldspace.BuildConfig
import com.mints.goldspace.common.DeviceInfo import com.mints.goldspace.common.DeviceInfo
import com.mints.goldspace.manager.AppHttpManager import com.mints.goldspace.manager.AppHttpManager
import com.mints.goldspace.manager.CpdManager import com.mints.goldspace.manager.CpdManager
import com.mints.goldspace.manager.CpdSydManager
import com.mints.goldspace.mvp.model.BaseResponse import com.mints.goldspace.mvp.model.BaseResponse
import com.mints.goldspace.mvp.model.CpdModelBean import com.mints.goldspace.mvp.model.CpdModelBean
import com.mints.goldspace.mvp.model.SydCpdListBean import com.mints.goldspace.mvp.model.SydCpdListBean
......
...@@ -20,7 +20,7 @@ import java.util.* ...@@ -20,7 +20,7 @@ import java.util.*
class GuideActivity : BaseActivity() { class GuideActivity : BaseActivity() {
private val animatorSet by lazy { AnimatorSet() } private val animatorSet by lazy { AnimatorSet() }
private var mImageViews = ArrayList<ImageView>() private var mViews = ArrayList<View>()
private val guideImgs = intArrayOf(R.mipmap.bg_guide1, R.mipmap.bg_guide2, R.mipmap.bg_guide3, R.mipmap.bg_guide4) private val guideImgs = intArrayOf(R.mipmap.bg_guide1, R.mipmap.bg_guide2, R.mipmap.bg_guide3, R.mipmap.bg_guide4)
override fun getContentViewLayoutID() = R.layout.activity_guide override fun getContentViewLayoutID() = R.layout.activity_guide
...@@ -54,14 +54,14 @@ class GuideActivity : BaseActivity() { ...@@ -54,14 +54,14 @@ class GuideActivity : BaseActivity() {
} }
private fun initView() { private fun initView() {
mImageViews.clear() mViews.clear()
for (i in guideImgs.indices) { for (i in guideImgs.indices) {
val imageView = ImageView(this) val imageView = ImageView(this)
imageView.setBackgroundResource(guideImgs[i]) imageView.setBackgroundResource(guideImgs[i])
//把imageView添加到集合中 //把imageView添加到集合中
mImageViews.add(imageView) mViews.add(imageView)
} }
val viewPagerAdapter = ViewPagerAdapter(mImageViews) val viewPagerAdapter = ViewPagerAdapter(mViews)
vp_guide_viewpager.adapter = viewPagerAdapter vp_guide_viewpager.adapter = viewPagerAdapter
vp_guide_viewpager.setOnPageChangeListener(mOnPagerChangeListener) vp_guide_viewpager.setOnPageChangeListener(mOnPagerChangeListener)
} }
...@@ -73,7 +73,7 @@ class GuideActivity : BaseActivity() { ...@@ -73,7 +73,7 @@ class GuideActivity : BaseActivity() {
//当界面切换完成的时候调用的方法 //当界面切换完成的时候调用的方法
override fun onPageSelected(position: Int) { override fun onPageSelected(position: Int) {
pageIndicatorView.selection = position pageIndicatorView.selection = position
if (position == mImageViews.size - 1) { if (position == mViews.size - 1) {
val alphaAnimator = ObjectAnimator.ofFloat(btn_guide_start, "alpha", 0f, 1f) val alphaAnimator = ObjectAnimator.ofFloat(btn_guide_start, "alpha", 0f, 1f)
alphaAnimator.repeatCount = 0 alphaAnimator.repeatCount = 0
animatorSet.play(alphaAnimator) animatorSet.play(alphaAnimator)
......
...@@ -3,7 +3,6 @@ package com.mints.goldspace.ui.adapter; ...@@ -3,7 +3,6 @@ package com.mints.goldspace.ui.adapter;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
...@@ -18,7 +17,6 @@ import com.mints.goldspace.common.Constant; ...@@ -18,7 +17,6 @@ import com.mints.goldspace.common.Constant;
import com.mints.goldspace.manager.BxmManager; import com.mints.goldspace.manager.BxmManager;
import com.mints.goldspace.manager.UserManager; import com.mints.goldspace.manager.UserManager;
import com.mints.goldspace.mvp.model.BannerBean; import com.mints.goldspace.mvp.model.BannerBean;
import com.mints.goldspace.utils.ForegroundOrBackground;
import com.mints.library.utils.GlideUtils; import com.mints.library.utils.GlideUtils;
import java.util.List; import java.util.List;
...@@ -32,28 +30,35 @@ import java.util.List; ...@@ -32,28 +30,35 @@ import java.util.List;
public class GvMyAdapter extends BaseAdapter { public class GvMyAdapter extends BaseAdapter {
private List<BannerBean.ListBean> orders; private List<BannerBean.ListBean> orders;
private Context context;
private Activity activity; private Activity activity;
public GvMyAdapter(Context context, Activity activity, List<BannerBean.ListBean> orders) { private int mCurrentIndex;
private int mPageSize;
public GvMyAdapter(Activity activity, List<BannerBean.ListBean> orders, int currentIndex, int pageSize) {
this.orders = orders; this.orders = orders;
this.context = context;
this.activity = activity; this.activity = activity;
this.mCurrentIndex = currentIndex;
this.mPageSize = pageSize;
} }
@Override @Override
public int getCount() { public int getCount() {
return orders == null ? 0 : orders.size(); // return orders == null ? 0 : orders.size();
return orders.size() > (mCurrentIndex + 1) * mPageSize ? mPageSize : (orders.size() - mCurrentIndex * mPageSize);
} }
@Override @Override
public Object getItem(int position) { public Object getItem(int position) {
return orders.get(position); // return orders.get(position);
return orders.get(position + mCurrentIndex * mPageSize);
} }
@Override @Override
public long getItemId(int position) { public long getItemId(int position) {
return position; // return position;
return position + mCurrentIndex * mPageSize;
} }
@SuppressLint("WrongViewCast") @SuppressLint("WrongViewCast")
...@@ -63,7 +68,7 @@ public class GvMyAdapter extends BaseAdapter { ...@@ -63,7 +68,7 @@ public class GvMyAdapter extends BaseAdapter {
ViewHolder viewHolder; ViewHolder viewHolder;
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(context); LayoutInflater inflater = LayoutInflater.from(activity);
convertView = inflater.inflate(R.layout.item_list_my, null); convertView = inflater.inflate(R.layout.item_list_my, null);
viewHolder = new ViewHolder(); viewHolder = new ViewHolder();
...@@ -75,9 +80,15 @@ public class GvMyAdapter extends BaseAdapter { ...@@ -75,9 +80,15 @@ public class GvMyAdapter extends BaseAdapter {
} else { } else {
viewHolder = (ViewHolder) convertView.getTag(); viewHolder = (ViewHolder) convertView.getTag();
} }
BannerBean.ListBean data = orders.get(position);
/**
* 在给View绑定显示的数据时,计算正确的position = position + curIndex * pageSize
*/
int pos = position + mCurrentIndex * mPageSize;
BannerBean.ListBean data = orders.get(pos);
if (data != null) { if (data != null) {
GlideUtils.loadImageView(context, data.getImgUrl(), viewHolder.ic_my_icon); GlideUtils.loadImageView(activity, data.getImgUrl(), viewHolder.ic_my_icon);
viewHolder.tv_my_title.setText(data.getTitle()); viewHolder.tv_my_title.setText(data.getTitle());
if (TextUtils.equals(data.getToUrl(), Constant.HOT_ACTIVITY_BXM) && UserManager.getInstance().userIsLogin()) { if (TextUtils.equals(data.getToUrl(), Constant.HOT_ACTIVITY_BXM) && UserManager.getInstance().userIsLogin()) {
...@@ -92,5 +103,4 @@ public class GvMyAdapter extends BaseAdapter { ...@@ -92,5 +103,4 @@ public class GvMyAdapter extends BaseAdapter {
public FrameLayout fl_my_icon; public FrameLayout fl_my_icon;
public TextView tv_my_title; public TextView tv_my_title;
} }
} }
\ No newline at end of file
package com.mints.goldspace.ui.adapter; package com.mints.goldspace.ui.adapter;
import androidx.viewpager.widget.PagerAdapter; import androidx.viewpager.widget.PagerAdapter;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -15,16 +16,16 @@ import java.util.List; ...@@ -15,16 +16,16 @@ import java.util.List;
*/ */
public class ViewPagerAdapter extends PagerAdapter { public class ViewPagerAdapter extends PagerAdapter {
private List<ImageView> mImageViews; private List<View> mViews;
public ViewPagerAdapter(List<ImageView> mImageViews) { public ViewPagerAdapter(List<View> views) {
this.mImageViews = mImageViews; this.mViews = views;
} }
//设置viewpager条目的个数 //设置viewpager条目的个数
@Override @Override
public int getCount() { public int getCount() {
return mImageViews.size(); return mViews.size();
} }
//判断Viewpager的页面的view对象是否和instantiateItem返回的object一致 //判断Viewpager的页面的view对象是否和instantiateItem返回的object一致
...@@ -36,8 +37,8 @@ public class ViewPagerAdapter extends PagerAdapter { ...@@ -36,8 +37,8 @@ public class ViewPagerAdapter extends PagerAdapter {
//添加viewpager条目的方法 //添加viewpager条目的方法
@Override @Override
public Object instantiateItem(ViewGroup container, int position) { public Object instantiateItem(ViewGroup container, int position) {
ImageView imageView = mImageViews.get(position); View imageView = mViews.get(position);
//将imageview添加给viewpager //将view添加给viewpager
container.addView(imageView); container.addView(imageView);
return imageView; return imageView;
} }
...@@ -48,4 +49,4 @@ public class ViewPagerAdapter extends PagerAdapter { ...@@ -48,4 +49,4 @@ public class ViewPagerAdapter extends PagerAdapter {
//super.destroyItem(container, position, object); //super.destroyItem(container, position, object);
container.removeView((View) object); container.removeView((View) object);
} }
} }
\ No newline at end of file
...@@ -6,8 +6,10 @@ import android.content.* ...@@ -6,8 +6,10 @@ import android.content.*
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater
import android.view.View import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import android.widget.GridView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open import com.component.dly.xzzq_ywsdk.YwSDK_WebActivity.Companion.open
...@@ -29,6 +31,7 @@ import com.mints.goldspace.service.AppInstallService ...@@ -29,6 +31,7 @@ import com.mints.goldspace.service.AppInstallService
import com.mints.goldspace.ui.activitys.* import com.mints.goldspace.ui.activitys.*
import com.mints.goldspace.ui.adapter.GvMyAdapter import com.mints.goldspace.ui.adapter.GvMyAdapter
import com.mints.goldspace.ui.adapter.MainMyAdapter import com.mints.goldspace.ui.adapter.MainMyAdapter
import com.mints.goldspace.ui.adapter.ViewPagerAdapter
import com.mints.goldspace.ui.adapter.listener.OnItemChildClickListener import com.mints.goldspace.ui.adapter.listener.OnItemChildClickListener
import com.mints.goldspace.ui.fragment.base.BaseFragment import com.mints.goldspace.ui.fragment.base.BaseFragment
import com.mints.goldspace.ui.widgets.CustomDialogAsApple import com.mints.goldspace.ui.widgets.CustomDialogAsApple
...@@ -43,6 +46,7 @@ import com.mints.library.net.netstatus.NetUtils ...@@ -43,6 +46,7 @@ import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.CommonUtils import com.mints.library.utils.CommonUtils
import com.mints.library.utils.GlideUtils import com.mints.library.utils.GlideUtils
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import com.rd.animation.type.AnimationType
import com.scwang.smartrefresh.layout.api.RefreshLayout import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshListener import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import com.tbruyelle.rxpermissions.RxPermissions import com.tbruyelle.rxpermissions.RxPermissions
...@@ -57,6 +61,7 @@ import net.grandcentrix.tray.AppPreferences ...@@ -57,6 +61,7 @@ import net.grandcentrix.tray.AppPreferences
import java.math.BigDecimal import java.math.BigDecimal
import java.util.* import java.util.*
import kotlin.concurrent.schedule import kotlin.concurrent.schedule
import kotlin.math.ceil
private val TAG = MyFragment::class.java.simpleName private val TAG = MyFragment::class.java.simpleName
...@@ -79,8 +84,16 @@ class MyFragment : BaseFragment(), ...@@ -79,8 +84,16 @@ class MyFragment : BaseFragment(),
private lateinit var vedioAdingManager: VideoAdingManager private lateinit var vedioAdingManager: VideoAdingManager
private var loadVedioFailCount = 0 private var loadVedioFailCount = 0
companion object {
// 热门活动每页展示数据
const val HOT_PAGE_SIZE = 8
}
// 热门活动下标
private var mCurrentIndex = 0
private var userConfig: MyInfo? = null private var userConfig: MyInfo? = null
private var hotList: List<BannerBean.ListBean>? = arrayListOf() private val hotList: MutableList<BannerBean.ListBean> = mutableListOf()
// 当天签到金币 // 当天签到金币
private var carrierType = "" private var carrierType = ""
...@@ -204,20 +217,66 @@ class MyFragment : BaseFragment(), ...@@ -204,20 +217,66 @@ class MyFragment : BaseFragment(),
srl_my.finishRefresh(false) srl_my.finishRefresh(false)
userConfig = null userConfig = null
item_promotions_egv.visibility = View.GONE vp_grid.visibility = View.GONE
setUserLoginStatus() setUserLoginStatus()
} }
override fun getMyHotActivitySuc(data: BannerBean?) { override fun getMyHotActivitySuc(data: BannerBean?) {
if (activity != null && !requireActivity().isFinishing) { if (activity != null && !requireActivity().isFinishing) {
data?.let { data?.let {
item_promotions_egv.visibility = View.VISIBLE vp_grid.visibility = View.VISIBLE
hotList = it.list hotList.clear()
item_promotions_egv.adapter = GvMyAdapter(mContext, requireActivity(), hotList) hotList.addAll(it.list)
generateGridData(hotList)
} }
} }
} }
// 生成热门活动数据
private fun generateGridData(data: List<BannerBean.ListBean>) {
val inflater = LayoutInflater.from(mContext)
val pageCount = ceil(data.size * 1.0 / HOT_PAGE_SIZE).toInt()
val pagerList = arrayListOf<View>()
for (i in 0 until pageCount) {
val gridView = inflater.inflate(R.layout.item_fragment_main_my_promotions_gv,
vp_grid, false) as GridView
gridView.adapter = GvMyAdapter(requireActivity(), data, i, HOT_PAGE_SIZE)
pagerList.add(gridView)
gridView.onItemClickListener = this
}
if (pageCount <= 1) {
piv_grid.visibility = View.GONE
} else {
piv_grid.visibility = View.VISIBLE
piv_grid.count = pageCount
}
mCurrentIndex = 0
piv_grid.count = pageCount
piv_grid.setAnimationType(AnimationType.THIN_WORM)
vp_grid.adapter = ViewPagerAdapter(pagerList)
// vp_grid.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
// override fun onPageScrollStateChanged(state: Int) {
// }
//
// override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
// }
//
// override fun onPageSelected(position: Int) {
// mCurrentIndex = position
//
// piv_grid.selection = position
// }
//
// })
}
override fun getSignInHomePageMsgSuc(signBean: SignCardBean?) { override fun getSignInHomePageMsgSuc(signBean: SignCardBean?) {
if (signBean == null) { if (signBean == null) {
signCardBean = null signCardBean = null
...@@ -1075,8 +1134,6 @@ class MyFragment : BaseFragment(), ...@@ -1075,8 +1134,6 @@ class MyFragment : BaseFragment(),
item_title_friends.setOnClickListener(this) item_title_friends.setOnClickListener(this)
ll_my_login.setOnClickListener(this) ll_my_login.setOnClickListener(this)
item_customer_service.setOnClickListener(this) item_customer_service.setOnClickListener(this)
item_promotions_egv.onItemClickListener = this
} }
/** /**
......
package com.mints.goldspace.ui.widgets;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import androidx.viewpager.widget.ViewPager;
public class WrapViewPager extends ViewPager {
public WrapViewPager(Context context) {
super(context);
}
public WrapViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = 0;
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = child.getMeasuredHeight();
if (h > height)
height = h;
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.mints.goldspace.ui.widgets.ExpandableGridView xmlns:android="http://schemas.android.com/apk/res/android" <merge xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_promotions_egv" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" xmlns:attrs="http://schemas.android.com/tools">
android:layout_height="wrap_content"
android:visibility="gone" <com.mints.goldspace.ui.widgets.WrapViewPager
android:layout_marginTop="2dp" android:id="@+id/vp_grid"
android:layout_marginBottom="16dp" android:layout_width="match_parent"
android:columnWidth="85dp" android:layout_height="wrap_content" />
android:divider="@null"
android:dividerHeight="10dp" <com.rd.PageIndicatorView
android:listSelector="@color/color_0000" android:id="@+id/piv_grid"
android:numColumns="4" android:layout_width="wrap_content"
android:scrollbars="none" android:layout_height="wrap_content"
android:stretchMode="spacingWidthUniform" /> android:layout_gravity="center_horizontal"
\ No newline at end of file android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:visibility="gone"
app:piv_count="2"
app:piv_selectedColor="@color/color_FF9837"
app:piv_unselectedColor="@color/color_20000000"
app:piv_viewPager="@id/vp_grid"
attrs:piv_padding="2dp"
attrs:piv_radius="4dp" />
</merge>
<?xml version="1.0" encoding="utf-8"?>
<com.mints.goldspace.ui.widgets.ExpandableGridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/item_promotions_egv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginBottom="16dp"
android:columnWidth="85dp"
android:divider="@null"
android:dividerHeight="10dp"
android:listSelector="@color/color_0000"
android:numColumns="4"
android:scrollbars="none"
android:stretchMode="spacingWidthUniform" />
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/ad_score_color"
android:orientation="vertical" android:orientation="vertical"
tools:ignore="ContentDescription,SpUsage,RtlHardcoded"> tools:ignore="ContentDescription,SpUsage,RtlHardcoded">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment