Commit 907cc3f4 authored by mengcuiguang's avatar mengcuiguang

大转盘优化 代码合并

parent de5584d9
...@@ -181,8 +181,6 @@ dependencies { ...@@ -181,8 +181,6 @@ dependencies {
implementation 'com.github.SheHuan:NiceImageView:1.0.5' implementation 'com.github.SheHuan:NiceImageView:1.0.5'
// 跑马灯 // 跑马灯
implementation 'com.sunfusheng:marqueeview:1.2.0' implementation 'com.sunfusheng:marqueeview:1.2.0'
// 转盘
implementation project(':wheelsruflibrary')
// 工具类 // 工具类
...@@ -286,7 +284,6 @@ dependencies { ...@@ -286,7 +284,6 @@ dependencies {
// 激励视频RTA // 激励视频RTA
implementation(name: 'taskwake1.0', ext: 'aar') implementation(name: 'taskwake1.0', ext: 'aar')
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
// testImplementation 'junit:junit:4.13' // testImplementation 'junit:junit:4.13'
// androidTestImplementation 'androidx.test.ext:junit:1.1.2' // androidTestImplementation 'androidx.test.ext:junit:1.1.2'
......
...@@ -90,7 +90,7 @@ object BannerManager { ...@@ -90,7 +90,7 @@ object BannerManager {
} }
override fun onAdShow(p0: View?, p1: Int) { override fun onAdShow(p0: View?, p1: Int) {
LogUtil.d("BannerManager","onAdShow")
} }
override fun onRenderSuccess(view: View, p1: Float, p2: Float) { override fun onRenderSuccess(view: View, p1: Float, p2: Float) {
......
package com.mints.goodmoney.mvp.presenters package com.mints.goodmoney.mvp.presenters
import android.text.TextUtils import android.text.TextUtils
import com.google.gson.Gson
import com.google.gson.JsonObject
import com.google.gson.reflect.TypeToken
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.DeviceInfo import com.mints.goodmoney.common.DeviceInfo
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import com.mints.goodmoney.manager.AppHttpManager import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.manager.ShumeiManager import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.UserManager import com.mints.goodmoney.manager.UserManager
...@@ -12,11 +13,13 @@ import com.mints.goodmoney.mvp.model.BaseResponse ...@@ -12,11 +13,13 @@ import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.ClickTurnBean import com.mints.goodmoney.mvp.model.ClickTurnBean
import com.mints.goodmoney.mvp.model.TurnBean import com.mints.goodmoney.mvp.model.TurnBean
import com.mints.goodmoney.mvp.model.UserBean import com.mints.goodmoney.mvp.model.UserBean
import com.mints.goodmoney.mvp.views.PanView
import com.mints.goodmoney.mvp.views.TurnTableView import com.mints.goodmoney.mvp.views.TurnTableView
import com.mints.goodmoney.utils.DeviceUuidFactory import com.mints.goodmoney.utils.DeviceUuidFactory
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import java.util.* import java.util.*
class TurnTablePresenter : BasePresenter<TurnTableView>() { class TurnTablePresenter : BasePresenter<TurnTableView>() {
fun getTurnMsg() { fun getTurnMsg() {
...@@ -75,22 +78,25 @@ class TurnTablePresenter : BasePresenter<TurnTableView>() { ...@@ -75,22 +78,25 @@ class TurnTablePresenter : BasePresenter<TurnTableView>() {
fun cashoutLeaders() { fun cashoutLeaders() {
AppHttpManager.getInstance(loanApplication) AppHttpManager.getInstance(loanApplication)
.call(loanService.cashoutLeaders(), .call(loanService.cashoutLeaders(),
object : BaseSubscriber<BaseResponse<Any>>() { object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() { override fun onCompleted() {
} }
override fun onError(e: Throwable) { override fun onError(e: Throwable) {
if (isLinkView) return
view.showToast(e.message)
} }
override fun onNext(baseResponse: BaseResponse<Any>) { override fun onNext(baseResponse: BaseResponse<JsonObject>) {
if (isLinkView) return if (isLinkView) return
val code = baseResponse.getStatus() val code = baseResponse.getStatus()
val message = baseResponse.getMessage() val message = baseResponse.getMessage()
when (code) { when (code) {
200 -> { 200 -> {
view.cashoutLeadersSuc() val data = baseResponse.data
if (data.get("list") != null) {
val listArray = Gson().fromJson(data.get("list"),
object : TypeToken<ArrayList<String>>() {}.type) as ArrayList<String>
view.cashoutLeadersSuc(listArray)
}
} }
else -> view.showToast(message) else -> view.showToast(message)
} }
......
...@@ -5,6 +5,6 @@ import com.mints.goodmoney.mvp.model.TurnBean ...@@ -5,6 +5,6 @@ import com.mints.goodmoney.mvp.model.TurnBean
interface TurnTableView : BaseView { interface TurnTableView : BaseView {
fun getTurnTableSuc(data: TurnBean) fun getTurnTableSuc(data: TurnBean)
fun cashoutLeadersSuc() fun cashoutLeadersSuc(data:ArrayList<String>)
fun clickForTurnSuc(data: ClickTurnBean) fun clickForTurnSuc(data: ClickTurnBean)
} }
\ No newline at end of file
...@@ -32,6 +32,7 @@ import com.mints.goodmoney.mvp.model.XmlyUnlockBean; ...@@ -32,6 +32,7 @@ import com.mints.goodmoney.mvp.model.XmlyUnlockBean;
import com.mints.goodmoney.utils.AESUtils; import com.mints.goodmoney.utils.AESUtils;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -602,8 +603,8 @@ public interface LoanService { ...@@ -602,8 +603,8 @@ public interface LoanService {
* *
* @return * @return
*/ */
@POST("common/cashoutLeaders") @POST("common/cashoutLeadersForApp")
Observable<BaseResponse<Object>> cashoutLeaders(); Observable<BaseResponse<JsonObject>> cashoutLeaders();
/** /**
* 大转盘点击入口 * 大转盘点击入口
...@@ -635,29 +636,29 @@ public interface LoanService { ...@@ -635,29 +636,29 @@ public interface LoanService {
builder.readTimeout(20, TimeUnit.SECONDS); builder.readTimeout(20, TimeUnit.SECONDS);
builder.writeTimeout(20, TimeUnit.SECONDS); builder.writeTimeout(20, TimeUnit.SECONDS);
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.interceptors().add(logging);
}
// if (BuildConfig.DEBUG) { // if (BuildConfig.DEBUG) {
// HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> { // HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
// if (TextUtils.isEmpty(message)) return;
// String s = message.substring(0, 1);
// String request = message.substring(0, 4);
// if ("{".equals(s) || "[".equals(s)) {
// Logger.json(message);
// } else if (request.contains("-->") || request.contains("<--")) {
// Logger.d("Method" + message);
// } else {
// Logger.d("params:" + message);
// }
// });
// logging.setLevel(HttpLoggingInterceptor.Level.BODY); // logging.setLevel(HttpLoggingInterceptor.Level.BODY);
// builder.interceptors().add(logging); // builder.interceptors().add(logging);
// } // }
if (BuildConfig.DEBUG) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor(message -> {
if (TextUtils.isEmpty(message)) return;
String s = message.substring(0, 1);
String request = message.substring(0, 4);
if ("{".equals(s) || "[".equals(s)) {
Logger.json(message);
} else if (request.contains("-->") || request.contains("<--")) {
Logger.d("Method" + message);
} else {
Logger.d("params:" + message);
}
});
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
builder.interceptors().add(logging);
}
OkHttpInterceptor okHttpInterceptor = new OkHttpInterceptor(AESUtils.getDefaultKey()); OkHttpInterceptor okHttpInterceptor = new OkHttpInterceptor(AESUtils.getDefaultKey());
// builder.interceptors().add(domainInterceptor); // builder.interceptors().add(domainInterceptor);
builder.interceptors().add(okHttpInterceptor); builder.interceptors().add(okHttpInterceptor);
......
...@@ -2,6 +2,8 @@ package com.mints.goodmoney.ui.adapter; ...@@ -2,6 +2,8 @@ package com.mints.goodmoney.ui.adapter;
import android.content.Context; import android.content.Context;
import android.view.View; import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -9,6 +11,7 @@ import com.mints.goodmoney.R; ...@@ -9,6 +11,7 @@ import com.mints.goodmoney.R;
import com.mints.goodmoney.ad.banner.BannerManager; import com.mints.goodmoney.ad.banner.BannerManager;
import com.mints.goodmoney.manager.TtCsjAdManager; import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.mvp.model.RotationChartBean; import com.mints.goodmoney.mvp.model.RotationChartBean;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.library.utils.GlideUtils; import com.mints.library.utils.GlideUtils;
...@@ -23,9 +26,13 @@ public class AdBannerAdapter extends BannerBaseAdapter<RotationChartBean.ListBea ...@@ -23,9 +26,13 @@ public class AdBannerAdapter extends BannerBaseAdapter<RotationChartBean.ListBea
private Context mContext; private Context mContext;
private int mCurrentPostion = 0; private int mCurrentPostion = 0;
// private FrameLayout frameLayout;
public AdBannerAdapter(Context context) { public AdBannerAdapter(Context context) {
super(context); super(context);
this.mContext = context; this.mContext = context;
// frameLayout = new FrameLayout(context);
} }
public void setAdPosition(int position) { public void setAdPosition(int position) {
...@@ -41,8 +48,20 @@ public class AdBannerAdapter extends BannerBaseAdapter<RotationChartBean.ListBea ...@@ -41,8 +48,20 @@ public class AdBannerAdapter extends BannerBaseAdapter<RotationChartBean.ListBea
protected void convert(View convertView, RotationChartBean.ListBean listBean, int currentPostion) { protected void convert(View convertView, RotationChartBean.ListBean listBean, int currentPostion) {
FrameLayout container = getView(R.id.ad_container); FrameLayout container = getView(R.id.ad_container);
if (currentPostion == mCurrentPostion) { // mCurrentPostion = 1
// if (currentPostion == 0) {
// BannerManager.INSTANCE.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, frameLayout);
// }
if (currentPostion == mCurrentPostion && mCurrentPostion != -1) {
BannerManager.INSTANCE.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, container); BannerManager.INSTANCE.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, container);
// final ViewParent customParent = frameLayout.getParent();
// if (customParent != this) {
// if (customParent != null) {
// ((ViewGroup) customParent).removeAllViews();
// }
// container.addView(frameLayout);
// }
} else { } else {
ImageView iv = getView(R.id.iv_banner_ad); ImageView iv = getView(R.id.iv_banner_ad);
iv.setVisibility(View.VISIBLE); iv.setVisibility(View.VISIBLE);
......
...@@ -27,7 +27,7 @@ import java.util.List; ...@@ -27,7 +27,7 @@ import java.util.List;
public abstract class BannerBaseAdapter<T> extends PagerAdapter { public abstract class BannerBaseAdapter<T> extends PagerAdapter {
private Context mContext; private Context mContext;
private List<T> mDatas = new ArrayList<>(); public List<T> mDatas = new ArrayList<>();
private OnPageTouchListener mListener; private OnPageTouchListener mListener;
private long mDownTime; private long mDownTime;
private View mConvertView; private View mConvertView;
...@@ -40,8 +40,11 @@ public abstract class BannerBaseAdapter<T> extends PagerAdapter { ...@@ -40,8 +40,11 @@ public abstract class BannerBaseAdapter<T> extends PagerAdapter {
} }
@Override @Override
// public int getCount() {
// return mDatas == null || mDatas.size() == 0 ? 0 : mDatas.size();
// }
public int getCount() { public int getCount() {
return mDatas == null || mDatas.size() == 0 ? 0 : mDatas.size(); return mDatas == null || mDatas.size() == 0 ? 0 :Integer.MAX_VALUE;
} }
@Override @Override
......
...@@ -7,29 +7,37 @@ import android.text.TextUtils; ...@@ -7,29 +7,37 @@ import android.text.TextUtils;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.widget.BaseAdapter; import android.widget.BaseAdapter;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import com.daimajia.androidanimations.library.Techniques;
import com.daimajia.androidanimations.library.YoYo;
import com.mints.goodmoney.R; import com.mints.goodmoney.R;
import com.mints.goodmoney.common.Constant; import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.BxmManager; import com.mints.goodmoney.manager.BxmManager;
import com.mints.goodmoney.manager.UserManager; import com.mints.goodmoney.manager.UserManager;
import com.mints.goodmoney.mvp.model.BannerBean; import com.mints.goodmoney.mvp.model.BannerBean;
import com.mints.goodmoney.mvp.model.TurnBean; import com.mints.goodmoney.mvp.model.TurnBean;
import com.mints.goodmoney.utils.rxutil.CommonRxTask;
import com.mints.goodmoney.utils.rxutil.RxjavaUtil;
import com.mints.library.utils.GlideUtils; import com.mints.library.utils.GlideUtils;
import java.util.List; import java.util.List;
import java.util.Timer;
public class TurnTableAdapter extends BaseAdapter { public class TurnTableAdapter extends BaseAdapter {
private List<TurnBean.BottomsBean> orders; private List<TurnBean.BottomsBean> orders;
private Activity activity; private Activity activity;
private YoYo.AnimationComposer rope;
public TurnTableAdapter(Activity activity, List<TurnBean.BottomsBean> orders) { public TurnTableAdapter(Activity activity, List<TurnBean.BottomsBean> orders) {
this.orders = orders; this.orders = orders;
this.activity = activity; this.activity = activity;
rope = YoYo.with(Techniques.Pulse).duration(1000).repeat(0);
} }
@Override @Override
...@@ -74,6 +82,23 @@ public class TurnTableAdapter extends BaseAdapter { ...@@ -74,6 +82,23 @@ public class TurnTableAdapter extends BaseAdapter {
viewHolder.tv_turn_top.setText(TextUtils.isEmpty(data.getRewardTitle()) ? "" : data.getRewardTitle()); viewHolder.tv_turn_top.setText(TextUtils.isEmpty(data.getRewardTitle()) ? "" : data.getRewardTitle());
viewHolder.tv_turn_bottom.setText(data.getTitle()); viewHolder.tv_turn_bottom.setText(data.getTitle());
if (!TextUtils.isEmpty(data.getRewardTitle())) {
RxjavaUtil.executeRxTask(new CommonRxTask<String>("") {
@Override
public void doInIOThread() {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Override
public void doInUIThread() {
rope.playOn(viewHolder.ic_turn_icon);
}
});
}
} }
return convertView; return convertView;
} }
......
...@@ -11,8 +11,6 @@ import android.view.View ...@@ -11,8 +11,6 @@ import android.view.View
import android.widget.AdapterView import android.widget.AdapterView
import android.widget.ImageView import android.widget.ImageView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import com.cretin.www.wheelsruflibrary.listener.RotateListener
import com.cretin.www.wheelsruflibrary.view.WheelSurfView
import com.daimajia.androidanimations.library.Techniques import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo import com.daimajia.androidanimations.library.YoYo
import com.mints.goodmoney.MintsApplication import com.mints.goodmoney.MintsApplication
...@@ -29,6 +27,9 @@ import com.mints.goodmoney.ui.activitys.* ...@@ -29,6 +27,9 @@ import com.mints.goodmoney.ui.activitys.*
import com.mints.goodmoney.ui.adapter.TurnTableAdapter import com.mints.goodmoney.ui.adapter.TurnTableAdapter
import com.mints.goodmoney.ui.fragment.base.BaseFragment import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils import com.mints.goodmoney.ui.widgets.seekbar.BubbleUtils
import com.mints.goodmoney.ui.widgets.wheelsruf.listener.RotateListener
import com.mints.goodmoney.ui.widgets.wheelsruf.view.WheelSurfView
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.SpanUtils import com.mints.goodmoney.utils.SpanUtils
import com.mints.library.net.netstatus.NetUtils import com.mints.library.net.netstatus.NetUtils
import com.tbruyelle.rxpermissions.RxPermissions import com.tbruyelle.rxpermissions.RxPermissions
...@@ -62,6 +63,9 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -62,6 +63,9 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
private var clickTurnData: ClickTurnBean? = null private var clickTurnData: ClickTurnBean? = null
private var turnTableData: TurnBean? = null private var turnTableData: TurnBean? = null
// 第一次拉取的转盘size 若size被改变 需要重置转盘
private var firstPanSize = 0
// 提现列表展示 // 提现列表展示
private var drawcashList: MutableList<String> = mutableListOf() private var drawcashList: MutableList<String> = mutableListOf()
...@@ -101,7 +105,6 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -101,7 +105,6 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
// 游客登录 // 游客登录
turnTablePresenter.userLogin() turnTablePresenter.userLogin()
} }
marqueeView.startFlipping() marqueeView.startFlipping()
} }
} }
...@@ -126,6 +129,11 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -126,6 +129,11 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
} }
override fun getTurnTableSuc(data: TurnBean) { override fun getTurnTableSuc(data: TurnBean) {
if (AppConfig.fragmentClickFlag != Constant.FRAGMENT_CLICK_THREE ||
activity == null || requireActivity().isFinishing) {
return
}
if (drawcashList.size == 0) { if (drawcashList.size == 0) {
turnTablePresenter.cashoutLeaders() turnTablePresenter.cashoutLeaders()
} }
...@@ -133,12 +141,14 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -133,12 +141,14 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
initTurnView(data) initTurnView(data)
} }
override fun cashoutLeadersSuc() { override fun cashoutLeadersSuc(data: ArrayList<String>) {
drawcashList = data
initMarqueeView() initMarqueeView()
} }
override fun clickForTurnSuc(data: ClickTurnBean) { override fun clickForTurnSuc(data: ClickTurnBean) {
if (activity == null || requireActivity().isFinishing) { if (AppConfig.fragmentClickFlag != Constant.FRAGMENT_CLICK_THREE ||
activity == null || requireActivity().isFinishing) {
return return
} }
...@@ -148,10 +158,13 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -148,10 +158,13 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
} }
private fun initTurnView(data: TurnBean) { private fun initTurnView(data: TurnBean) {
if (activity == null || requireActivity().isFinishing) { if (AppConfig.fragmentClickFlag != Constant.FRAGMENT_CLICK_THREE ||
activity == null || requireActivity().isFinishing) {
return return
} }
LogUtil.d("initTurnView", "initTurnView")
turnTableData = data turnTableData = data
if (data.configs.size == 0) { if (data.configs.size == 0) {
...@@ -159,6 +172,15 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -159,6 +172,15 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
return return
} }
// 大转盘异常校验
if (firstPanSize == 0) {
firstPanSize = data.configs.size
}
if (firstPanSize != data.configs.size) {
showToast("大转盘异常,请退出应用,重新进入")
return
}
colorsArray.clear() colorsArray.clear()
desList.clear() desList.clear()
bitmapList.clear() bitmapList.clear()
...@@ -195,6 +217,7 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -195,6 +217,7 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
turnTableView.setRotateListener(object : RotateListener { turnTableView.setRotateListener(object : RotateListener {
override fun rotateEnd(position: Int, des: String) { override fun rotateEnd(position: Int, des: String) {
isTurnTable = true isTurnTable = true
clickTurnData?.let { clickTurnData?.let {
val bundle = Bundle() val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, it.config.count) bundle.putInt(Constant.MAIN_CUR_COIN, it.config.count)
...@@ -211,6 +234,10 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -211,6 +234,10 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
return return
} }
if (data.surplus <= 0) {
showToast("抽奖次数已用完")
return
}
if (isTurnTable) { if (isTurnTable) {
isTurnTable = false isTurnTable = false
turnTablePresenter.clickForTurn() turnTablePresenter.clickForTurn()
...@@ -218,7 +245,7 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -218,7 +245,7 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
} }
}) })
tvHintTurnTable.text=data.titleMsg tvHintTurnTable.text = data.titleMsg
tvTurnTimes.text = SpanUtils() tvTurnTimes.text = SpanUtils()
.append("本轮抽奖将剩余").setForegroundColor(ContextCompat.getColor(mContext, R.color.black)) .append("本轮抽奖将剩余").setForegroundColor(ContextCompat.getColor(mContext, R.color.black))
.append(data.surplus.toString()).setFontSize(BubbleUtils.dp2px(28)).setForegroundColor(ContextCompat.getColor(mContext, R.color.color_E72C2B)) .append(data.surplus.toString()).setFontSize(BubbleUtils.dp2px(28)).setForegroundColor(ContextCompat.getColor(mContext, R.color.color_E72C2B))
...@@ -234,30 +261,20 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick ...@@ -234,30 +261,20 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
} }
private fun actionPageForType(toOtherKey: String, position: Int) { private fun actionPageForType(toOtherKey: String, position: Int) {
//0-微转,1-珊瑚下载,2-分红,3-鱼丸盒子,4-每日任务
when (toOtherKey) {
"0" -> {
if (!userManager.userIsLogin()) { if (!userManager.userIsLogin()) {
readyGo(WxLoginActivity::class.java) readyGo(WxLoginActivity::class.java)
return return
} }
//0-微转,1-珊瑚下载,2-分红,3-鱼丸盒子,4-每日任务
when (toOtherKey) {
"0" -> {
shareArticle() shareArticle()
} }
"1" -> { "1" -> {
if (!userManager.userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
readyGo(TaskCpdActivity::class.java) readyGo(TaskCpdActivity::class.java)
} }
"2" -> { "2" -> {
if (!userManager.userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
val bundle = Bundle() val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_FRIENDS) bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_FRIENDS)
readyGo(WrapperActivity::class.java, bundle) readyGo(WrapperActivity::class.java, bundle)
......
...@@ -58,7 +58,7 @@ public class BannerView extends FrameLayout { ...@@ -58,7 +58,7 @@ public class BannerView extends FrameLayout {
private float alphaMin = 0.8f; private float alphaMin = 0.8f;
// 自动轮播间隔时长 // 自动轮播间隔时长
private long mScrollDuration = 4000; private long mScrollDuration = 5000;
private long mAnimDuration = 1200; private long mAnimDuration = 1200;
// 是否是动画滚动 // 是否是动画滚动
private boolean isAnimScroll; private boolean isAnimScroll;
......
package com.cretin.www.wheelsruflibrary.listener; package com.mints.goodmoney.ui.widgets.wheelsruf.listener;
import android.animation.ValueAnimator; import android.animation.ValueAnimator;
import android.widget.ImageView; import android.widget.ImageView;
......
package com.cretin.www.wheelsruflibrary.view; package com.mints.goodmoney.ui.widgets.wheelsruf.view;
import android.animation.Animator; import android.animation.Animator;
import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorListenerAdapter;
...@@ -21,8 +21,8 @@ import android.util.Log; ...@@ -21,8 +21,8 @@ import android.util.Log;
import android.view.View; import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import com.cretin.www.wheelsruflibrary.R; import com.mints.goodmoney.R;
import com.cretin.www.wheelsruflibrary.listener.RotateListener; import com.mints.goodmoney.ui.widgets.wheelsruf.listener.RotateListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
......
package com.cretin.www.wheelsruflibrary.view; package com.mints.goodmoney.ui.widgets.wheelsruf.view;
import android.annotation.TargetApi; import android.annotation.TargetApi;
import android.content.Context; import android.content.Context;
...@@ -13,8 +13,8 @@ import android.view.ViewTreeObserver; ...@@ -13,8 +13,8 @@ import android.view.ViewTreeObserver;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import com.cretin.www.wheelsruflibrary.R; import com.mints.goodmoney.R;
import com.cretin.www.wheelsruflibrary.listener.RotateListener; import com.mints.goodmoney.ui.widgets.wheelsruf.listener.RotateListener;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -70,8 +70,8 @@ public class WheelSurfView extends RelativeLayout { ...@@ -70,8 +70,8 @@ public class WheelSurfView extends RelativeLayout {
//添加圆盘视图 //添加圆盘视图
mWheelSurfPanView = new WheelSurfPanView(mContext, attrs); mWheelSurfPanView = new WheelSurfPanView(mContext, attrs);
RelativeLayout.LayoutParams layoutParams = LayoutParams layoutParams =
new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
mWheelSurfPanView.setLayoutParams(layoutParams); mWheelSurfPanView.setLayoutParams(layoutParams);
addView(mWheelSurfPanView); addView(mWheelSurfPanView);
...@@ -85,8 +85,8 @@ public class WheelSurfView extends RelativeLayout { ...@@ -85,8 +85,8 @@ public class WheelSurfView extends RelativeLayout {
mStart.setImageResource(mGoImgRes); mStart.setImageResource(mGoImgRes);
} }
//给图片设置LayoutParams //给图片设置LayoutParams
RelativeLayout.LayoutParams llStart = LayoutParams llStart =
new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
llStart.addRule(RelativeLayout.CENTER_IN_PARENT); llStart.addRule(RelativeLayout.CENTER_IN_PARENT);
mStart.setLayoutParams(llStart); mStart.setLayoutParams(llStart);
addView(mStart); addView(mStart);
......
...@@ -56,10 +56,13 @@ ...@@ -56,10 +56,13 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="150dp" android:layout_height="150dp"
android:visibility="gone" android:visibility="gone"
app:bannerAnimScroll="false" app:bannerAnimDuration="1500"
app:bannerAnimScroll="true"
app:bannerAutoScroll="true" app:bannerAutoScroll="true"
app:bannerPageAlpha="0"
app:bannerPageMargin="0dp" app:bannerPageMargin="0dp"
app:bannerPagePercent="1" /> app:bannerPagePercent="1"
app:bannerScrollDuration="5000"/>
<include layout="@layout/view_title" /> <include layout="@layout/view_title" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
xmlns:wheelSurfView="http://schemas.android.com/apk/res-auto" xmlns:wheelSurfView="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools" android:background="@mipmap/bg_turn"
android:overScrollMode="never"> android:overScrollMode="never">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@mipmap/bg_turntable"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="30dp" android:layout_height="30dp"
android:layout_marginTop="30dp" android:layout_marginTop="40dp"
android:gravity="center_vertical"> android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -38,17 +39,24 @@ ...@@ -38,17 +39,24 @@
app:mvTextSize="15sp" /> app:mvTextSize="15sp" />
</LinearLayout> </LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:src="@mipmap/bg_turn_font" />
<TextView <TextView
android:id="@+id/tvHintTurnTable" android:id="@+id/tvHintTurnTable"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="120dp" android:layout_marginTop="20dp"
tools:text="每日0点重置抽奖次数"
android:textColor="@color/red" android:textColor="@color/red"
android:textSize="18sp" /> android:textSize="18sp"
tools:text="每日0点重置抽奖次数" />
<com.cretin.www.wheelsruflibrary.view.WheelSurfView <com.mints.goodmoney.ui.widgets.wheelsruf.view.WheelSurfView
android:id="@+id/turnTableView" android:id="@+id/turnTableView"
android:layout_width="330dp" android:layout_width="330dp"
android:layout_height="330dp" android:layout_height="330dp"
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ad_container" android:id="@+id/ad_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="150dp" android:layout_height="140dp"
android:background="@color/color_0000"> android:background="@color/color_0000">
<ImageView <ImageView
android:visibility="gone" android:visibility="gone"
android:id="@+id/iv_banner_ad" android:id="@+id/iv_banner_ad"
android:scaleType="fitXY"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"/>
......
...@@ -180,4 +180,32 @@ ...@@ -180,4 +180,32 @@
<attr name="text" format="string" /> <attr name="text" format="string" />
<attr name="radius" format="integer" /> <attr name="radius" format="integer" />
</declare-styleable> </declare-styleable>
<declare-styleable name="wheelSurfView">
<!--类型 根据类型来加载资源 1 默认类型 用户需要提供文字和图片 2 暴力模式 用户只需要提供一张圆形的用来旋转的图片-->
<attr name="type" format="integer"/>
<!--最低圈数 默认值3 也就是说每次旋转都会最少转3圈-->
<attr name="minTimes" format="integer"/>
<!--扇形的数量 也就是奖品的份数-->
<attr name="typenum" format="integer"/>
<!--每一个扇形旋转消耗的时间-->
<attr name="vartime" format="integer"/>
<!--类型为1的时候 需要提供每个扇形上面的文字描述 长度必须和typenum一致-->
<attr name="deses" format="reference"/>
<!--类型为1的时候 需要提供每个扇形上面的图片展示 长度必须和typenum一致-->
<attr name="icons" format="reference"/>
<!--类型为1的时候 需要提供每个扇形背景颜色 长度必须和typenum一致-->
<attr name="colors" format="reference"/>
<!--中间图片的引用 有默认值 不填则使用默认值-->
<attr name="goImg" format="reference"/>
<!--圆环的图片引用 有默认值 不填则使用默认值-->
<attr name="huanImg" format="reference"/>
<!--如果类型为2 此值必填-->
<attr name="mainImg" format="reference"/>
<!--文字大小-->
<attr name="textSize" format="dimension"/>
<!--文字颜色-->
<attr name="textColor" format="reference|color"/>
</declare-styleable>
</resources> </resources>
\ No newline at end of file
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
<color name="color_600c224b">#600c224b</color> <color name="color_600c224b">#600c224b</color>
<color name="color_fcf16e">#fcf16e</color> <color name="color_fcf16e">#fcf16e</color>
<color name="color_F18542">#F18542</color> <color name="color_F18542">#F18542</color>
<color name="color_FEEBC8">#FEEBC8</color>
<color name="color_63A0B9">#63A0B9</color> <color name="color_63A0B9">#63A0B9</color>
<color name="color_7EE2FF">#7EE2FF</color> <color name="color_7EE2FF">#7EE2FF</color>
<color name="color_255186">#255186</color> <color name="color_255186">#255186</color>
......
include ':demo' include ':demo'
include ':app' include ':app'
include ':shareSdkLib' include ':shareSdkLib'
include ':wheelsruflibrary'
\ No newline at end of file
apply plugin: 'com.android.library'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
package com.cretin.www.wheelsruflibrary;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith( AndroidJUnit4.class )
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.cretin.www.wheelsruflibrary.test", appContext.getPackageName());
}
}
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cretin.www.wheelsruflibrary"/>
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="wheelSurfView">
<!--类型 根据类型来加载资源 1 默认类型 用户需要提供文字和图片 2 暴力模式 用户只需要提供一张圆形的用来旋转的图片-->
<attr name="type" format="integer"/>
<!--最低圈数 默认值3 也就是说每次旋转都会最少转3圈-->
<attr name="minTimes" format="integer"/>
<!--扇形的数量 也就是奖品的份数-->
<attr name="typenum" format="integer"/>
<!--每一个扇形旋转消耗的时间-->
<attr name="vartime" format="integer"/>
<!--类型为1的时候 需要提供每个扇形上面的文字描述 长度必须和typenum一致-->
<attr name="deses" format="reference"/>
<!--类型为1的时候 需要提供每个扇形上面的图片展示 长度必须和typenum一致-->
<attr name="icons" format="reference"/>
<!--类型为1的时候 需要提供每个扇形背景颜色 长度必须和typenum一致-->
<attr name="colors" format="reference"/>
<!--中间图片的引用 有默认值 不填则使用默认值-->
<attr name="goImg" format="reference"/>
<!--圆环的图片引用 有默认值 不填则使用默认值-->
<attr name="huanImg" format="reference"/>
<!--如果类型为2 此值必填-->
<attr name="mainImg" format="reference"/>
<!--文字大小-->
<attr name="textSize" format="dimension"/>
<!--文字颜色-->
<attr name="textColor" format="reference|color"/>
</declare-styleable>
</resources>
\ No newline at end of file
<resources>
<string name="app_name">WheelSrufLibrary</string>
</resources>
package com.cretin.www.wheelsruflibrary;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
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