Commit b238fd85 authored by jyx's avatar jyx

添加Banner指示器,任务接口联调

parent cc15d588
......@@ -84,6 +84,15 @@ public class MyInfo implements Serializable {
private int max;
private String carrierType;
private int complete;
private int status;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getMax() {
return max;
......
......@@ -2,8 +2,10 @@ package com.mints.goodmoney.ui.adapter;
import android.content.Context;
import android.graphics.Bitmap;
import androidx.annotation.IdRes;
import androidx.viewpager.widget.PagerAdapter;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
......@@ -39,7 +41,7 @@ public abstract class BannerBaseAdapter<T> extends PagerAdapter {
@Override
public int getCount() {
return mDatas == null || mDatas.size() == 0 ? 0 : Integer.MAX_VALUE;
return mDatas == null || mDatas.size() == 0 ? 0 : mDatas.size();
}
@Override
......@@ -49,7 +51,7 @@ public abstract class BannerBaseAdapter<T> extends PagerAdapter {
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
if (mIv != null){
if (mIv != null) {
mIv.setImageDrawable(null);
mIv = null;
}
......
......@@ -10,9 +10,6 @@ import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mints.goodmoney.R
import com.mints.goodmoney.mvp.model.TaskBean
import com.mints.goodmoney.ui.widgets.countdowntimer.CountDownTimerSupport
import com.mints.goodmoney.ui.widgets.countdowntimer.OnCountDownTimerListener
import com.mints.goodmoney.utils.TimeRender
class MainMyAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder> {
......@@ -67,12 +64,19 @@ class MainMyAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder> {
} else {
holder.itemTaskClick.visibility = View.VISIBLE
holder.itemTaskClick.text = taskBean.btnStr
if (taskBean.btnStr == "立即领取") {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange_complete)
holder.itemTaskClick.setTextColor(Color.WHITE)
} else {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange)
holder.itemTaskClick.setTextColor(mContext.resources.getColor(R.color.my_color_orange))
when (taskBean.btnStr) {
"立即领取" -> {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange_complete)
holder.itemTaskClick.setTextColor(Color.WHITE)
}
"已完成" -> {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_gury)
holder.itemTaskClick.setTextColor(Color.WHITE)
}
else -> {
holder.itemTaskClick.setBackgroundResource(R.drawable.shape_btn_orange)
holder.itemTaskClick.setTextColor(mContext.resources.getColor(R.color.my_color_orange))
}
}
}
if (taskBean.progressStr.isEmpty()) {
......
......@@ -2,10 +2,12 @@ package com.mints.goodmoney.ui.fragment
import android.graphics.Typeface
import android.os.Bundle
import android.view.View
import android.widget.LinearLayout
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.viewpager.widget.ViewPager
import cn.sharesdk.framework.Platform
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
......@@ -26,7 +28,6 @@ import com.mints.goodmoney.utils.ImageUtil
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshListener
import kotlinx.android.synthetic.main.fragment_main_friends.*
import kotlinx.android.synthetic.main.fragment_main_friends.srl_my
import kotlinx.android.synthetic.main.header_layout.*
/**
......@@ -124,8 +125,21 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener {
}
override fun onPageDown() {}
override fun onPageUp() {}
})
// 滚动到边缘无阴影
bv_friends_task.overScrollMode = View.OVER_SCROLL_NEVER
pageIndicatorView.setViewPager(bv_friends_task.viewPager)
bv_friends_task.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {}
override fun onPageSelected(position: Int) {
pageIndicatorView.selection = position
}
override fun onPageScrollStateChanged(state: Int) {}
})
bv_friends_task.setAdapter(bannerTaskAdapter)
......@@ -196,6 +210,8 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener {
bvTaskData = data.challenge.list
bannerTaskAdapter?.setData(bvTaskData)
pageIndicatorView.count = bvTaskData.size
// 跳转当前完成的页面
var currentPosition = 0
for (i in 0 until bvTaskData.size) {
......
......@@ -6,8 +6,6 @@ import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.View
import android.widget.AdapterView
......@@ -128,12 +126,12 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MY) {
// if (!TextUtils.isEmpty(userManager.userID)) {
// myPresenter.getUserHallBaseMsg()
// } else {
// // 游客登录
// myPresenter.userLogin(ps)
// }
if (!TextUtils.isEmpty(userManager.userID)) {
myPresenter.getUserHallBaseMsg()
} else {
// 游客登录
myPresenter.userLogin(ps)
}
}
}
......@@ -370,10 +368,16 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
val task1 = TaskBean(R.mipmap.icon_my_coin, "分分钟赚金币,翻倍还能赚更多", "", "去赚钱", 1)
// 邀好友赚金币
var progressStrInvited = ""
var btnStr = ""
if (userConfig != null) {
progressStrInvited = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
if (userConfig!!.taskShareFriend.complete == userConfig!!.taskShareFriend.max) {
btnStr = "已完成"
} else {
btnStr = if (userConfig!!.taskShareFriend.status == 0) "去邀请" else "立即领取"
}
}
val task2 = TaskBean(R.mipmap.icon_my_invite, "邀好友,赚金币", progressStrInvited, "去邀请", 2)
val task2 = TaskBean(R.mipmap.icon_my_invite, "邀好友,赚金币", progressStrInvited, btnStr, 2)
// // 看福利视频赚金币
// var progressStrVideo = ""
// if (userConfig != null) {
......@@ -420,17 +424,17 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
return
}
if (TextUtils.equals(taskBean.btnStr, "立即领取")) {
if (taskBean.btnStr == "立即领取") {
if (userConfig!!.taskShareFriend!!.complete < userConfig!!.taskShareFriend!!.max) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, 50)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CHALLENGE_SHAREFRIEND)
readyGo(AwardActivity::class.java, bundle)
userConfig?.taskShareFriend!!.complete += 1
dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
dataList[1].btnStr = "去邀请"
mainMyAdapter?.notifyItemChanged(1)
// userConfig?.taskShareFriend!!.complete += 1
// dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
// dataList[1].btnStr = "去邀请"
// mainMyAdapter?.notifyItemChanged(1)
}
} else {
val wechatSp = ShareParams()
......@@ -445,13 +449,13 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
// 执行图文分享
wechat.share(wechatSp)
Handler(Looper.getMainLooper())
.postDelayed({
userConfig?.taskShareFriend!!.complete
dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
dataList[1].btnStr = "立即领取"
mainMyAdapter?.notifyItemChanged(1)
}, 1000)
// Handler(Looper.getMainLooper())
// .postDelayed({
// userConfig?.taskShareFriend!!.complete
// dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
// dataList[1].btnStr = "立即领取"
// mainMyAdapter?.notifyItemChanged(1)
// }, 1000)
} else {
showToast("请先安装微信")
......
......@@ -196,7 +196,7 @@ public class SignView extends LinearLayout implements View.OnClickListener {
if (isCurFlag) {
tvContent.setText("");
tvContent.setTextColor(resources.getColor(R.color.graya));
tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_vedio));
tvContent.setBackground(resources.getDrawable(R.mipmap.ic_sign_video));
tvDay.setTextColor(resources.getColor(R.color.black));
tvDay.setText("可翻倍");
} else {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="@color/grayc" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="20dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:attrs="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
......@@ -47,16 +48,30 @@
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
app:bannerAnimDuration="1500"
app:bannerAnimScroll="true"
app:bannerAnimScroll="false"
app:bannerAutoScroll="false"
app:bannerPageAlpha="0"
app:bannerPageMargin="8dp"
app:bannerPagePercent="0.9"
app:bannerPageScale="0.8"
app:bannerPageScale="1"
app:bannerScrollDuration="4000" />
<com.rd.PageIndicatorView
android:id="@+id/pageIndicatorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="10dp"
app:piv_animationType="worm"
app:piv_dynamicCount="true"
app:piv_interactiveAnimation="true"
app:piv_selectedColor="@color/main_mints"
app:piv_unselectedColor="@color/ban_transparent"
app:piv_viewPager="@id/bv_friends_task"
attrs:piv_padding="10dp"
attrs:piv_radius="8dp" />
<include layout="@layout/item_divider_gray" />
<ImageView
......@@ -101,6 +116,7 @@
android:layout_height="match_parent"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:overScrollMode="never"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item name="id_stickynavlayout_topview" type="id"/>
<item name="id_stickynavlayout_viewpager" type="id"/>
<item name="id_stickynavlayout_indicator" type="id"/>
<item name="id_stickynavlayout_innerscrollview" type="id"/>
</resources>
\ 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