|
|
@@ -0,0 +1,203 @@
|
|
|
+package com.sheep.gamegroup.view.activity;
|
|
|
+
|
|
|
+import android.graphics.Paint;
|
|
|
+import android.support.v7.widget.GridLayoutManager;
|
|
|
+import android.support.v7.widget.LinearLayoutManager;
|
|
|
+import android.support.v7.widget.RecyclerView;
|
|
|
+import android.view.Gravity;
|
|
|
+import android.view.View;
|
|
|
+import android.widget.ImageView;
|
|
|
+import android.widget.TextView;
|
|
|
+
|
|
|
+import com.kfzs.duanduan.data.graph.provider.player.User;
|
|
|
+import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
+import com.sheep.gamegroup.model.entity.BaseMessage;
|
|
|
+import com.sheep.gamegroup.model.entity.DialogConfig;
|
|
|
+import com.sheep.gamegroup.model.util.SheepSubscriber;
|
|
|
+import com.sheep.gamegroup.util.DataUtil;
|
|
|
+import com.sheep.gamegroup.util.Jump2View;
|
|
|
+import com.sheep.gamegroup.util.ListUtil;
|
|
|
+import com.sheep.gamegroup.util.ViewHolder;
|
|
|
+import com.sheep.gamegroup.util.ViewUtil;
|
|
|
+import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
|
|
|
+import com.sheep.jiuyan.samllsheep.R;
|
|
|
+import com.sheep.jiuyan.samllsheep.SheepApp;
|
|
|
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import butterknife.BindView;
|
|
|
+import butterknife.OnClick;
|
|
|
+import rx.android.schedulers.AndroidSchedulers;
|
|
|
+import rx.schedulers.Schedulers;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by realicing on 2018/9/11.
|
|
|
+ * realicing@sina.com
|
|
|
+ */
|
|
|
+public class ActSignCard extends BaseActivity {
|
|
|
+ @BindView(R.id.sign_card_tip)
|
|
|
+ TextView sign_card_tip;
|
|
|
+ @BindView(R.id.sign_card_total_bonus)
|
|
|
+ TextView sign_card_total_bonus;
|
|
|
+ @BindView(R.id.sign_card_total_people)
|
|
|
+ TextView sign_card_total_people;
|
|
|
+ @BindView(R.id.sign_card_users)
|
|
|
+ RecyclerView sign_card_users;
|
|
|
+ @BindView(R.id.sign_card_super_users)
|
|
|
+ RecyclerView sign_card_super_users;
|
|
|
+ private ActSignCard activity;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ protected int getLayoutId() {
|
|
|
+ return R.layout.act_sign_card;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initView() {
|
|
|
+ activity = this;
|
|
|
+ TitleBarUtils
|
|
|
+ .getInstance()
|
|
|
+ .setTitle(activity, "打卡挑战")
|
|
|
+ .setTitleFinish(activity)
|
|
|
+ .setRightSecondBtn(activity, R.mipmap.question_black_img, new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View view) {
|
|
|
+ ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("温馨提示").setBtnLeftText("我知道了")
|
|
|
+ .setMsg("该栏目为日常活跃活动,收益可提现。"));
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .setRightBotton(activity, "战绩", 0, new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ Jump2View.getInstance().goSignRecordAct(activity, null);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //加下划线
|
|
|
+ sign_card_tip.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
|
|
|
+ if(DataUtil.getAsBoolean("isNotShowDialogSignCard", true)) {//没有记录显示过该对话框,就显示之
|
|
|
+ DataUtil.putAsBoolean("isNotShowDialogSignCard", false);
|
|
|
+ ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("活动说明").setBtnLeftText("我知道了")
|
|
|
+ .setMsgGravity(Gravity.START).setMsg("支付1元参与次日早起打卡挑战\n\n" +
|
|
|
+ "次日早起打卡成功瓜分奖池奖金\n\n" +
|
|
|
+ "次日未打卡或超过规定打卡时间则不可参与奖金瓜分\n\n" +
|
|
|
+ "早起打卡时间:7:00-9:00"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void initListener() {
|
|
|
+ sign_card_users.setLayoutManager(new LinearLayoutManager(sign_card_users.getContext(), LinearLayoutManager.HORIZONTAL, false));
|
|
|
+ sign_card_users.setNestedScrollingEnabled(false);
|
|
|
+ sign_card_users.setAdapter(new AdbCommonRecycler<User>(SheepApp.getInstance(), userList) {
|
|
|
+ @Override
|
|
|
+ public int getViewIdByType(int type) {
|
|
|
+ return R.layout.item_user;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void convert(ViewHolder holder, User user) {
|
|
|
+ ImageView item_user_iv = holder.getView(R.id.item_user_iv);
|
|
|
+ TextView item_user_tv = holder.getView(R.id.item_user_tv);
|
|
|
+ ViewUtil.setDefaultText(item_user_tv);
|
|
|
+ //TODO
|
|
|
+ }
|
|
|
+ });
|
|
|
+ sign_card_super_users.setLayoutManager(new GridLayoutManager(SheepApp.getInstance(), 3));
|
|
|
+ sign_card_super_users.setHasFixedSize(true);
|
|
|
+ sign_card_super_users.setNestedScrollingEnabled(false);
|
|
|
+ sign_card_super_users.setAdapter(new AdbCommonRecycler<User>(SheepApp.getInstance(), superUserList) {
|
|
|
+ @Override
|
|
|
+ public int getViewIdByType(int type) {
|
|
|
+ return R.layout.item_super_user;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void convert(ViewHolder holder, User user) {
|
|
|
+ int position = holder.getAdapterPosition();
|
|
|
+ ImageView item_super_user_bg1 = (ImageView)holder.itemView.findViewById(R.id.item_super_user_bg1);
|
|
|
+ ImageView item_super_user_iv = (ImageView)holder.itemView.findViewById(R.id.item_super_user_iv);
|
|
|
+ ImageView item_super_user_bg2 = (ImageView)holder.itemView.findViewById(R.id.item_super_user_bg2);
|
|
|
+ TextView item_super_user_tv1 = (TextView)holder.itemView.findViewById(R.id.item_super_user_tv1);
|
|
|
+ TextView item_super_user_tv2 = (TextView)holder.itemView.findViewById(R.id.item_super_user_tv2);
|
|
|
+ TextView item_super_user_tv3 = (TextView)holder.itemView.findViewById(R.id.item_super_user_tv3);
|
|
|
+ ViewUtil.setText(item_super_user_tv1, XING_TEXTS[position]);
|
|
|
+ ViewUtil.setDefaultText(item_super_user_tv2);
|
|
|
+ ViewUtil.setDefaultText(item_super_user_tv3);
|
|
|
+ //TODO
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ private final static String[] XING_TEXTS = {"早起之星", "挑战之星", "毅力之星"};
|
|
|
+ private List<User> userList = ListUtil.emptyList();
|
|
|
+ private List<User> superUserList = ListUtil.emptyList();
|
|
|
+ @Override
|
|
|
+ public void initData() {
|
|
|
+
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getFindTagList()
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ List<User> newList = baseMessage.getDatas(User.class);
|
|
|
+ ListUtil.addAll(userList, newList);
|
|
|
+ sign_card_users.setLayoutManager(new GridLayoutManager(SheepApp.getInstance(), userList.size()));
|
|
|
+ sign_card_users.getAdapter().notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ SheepApp.getInstance().getNetComponent().getApiService().getFindTagList()
|
|
|
+ .subscribeOn(Schedulers.io())
|
|
|
+ .observeOn(AndroidSchedulers.mainThread())
|
|
|
+ .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
|
|
|
+ @Override
|
|
|
+ public void onNext(BaseMessage baseMessage) {
|
|
|
+ List<User> newList = baseMessage.getDatas(User.class);
|
|
|
+ ListUtil.addAll(superUserList, newList);
|
|
|
+ int size;
|
|
|
+ while((size =superUserList.size()) > 3){
|
|
|
+ superUserList.remove(size - 1);
|
|
|
+ }
|
|
|
+ sign_card_super_users.getAdapter().notifyDataSetChanged();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(BaseMessage baseMessage) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ @OnClick({R.id.sign_card_join, R.id.sign_card_tip, R.id.sign_card_look_more})
|
|
|
+ public void onViewClicked(View view) {
|
|
|
+ switch (view.getId()) {
|
|
|
+ case R.id.sign_card_join:
|
|
|
+ 参加打卡挑战();
|
|
|
+ break;
|
|
|
+ case R.id.sign_card_tip:
|
|
|
+ 显示活动说明();
|
|
|
+ break;
|
|
|
+ case R.id.sign_card_look_more:
|
|
|
+ 查看详细榜单();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void 查看详细榜单() {
|
|
|
+ //TODO
|
|
|
+ }
|
|
|
+ private void 显示活动说明() {
|
|
|
+ ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("早起也能赚钱了").setBtnLeftText("我知道了")
|
|
|
+ .setMsgGravity(Gravity.START).setMsg("1、支付1元作为早起动力金参与早起打卡,放入早起打卡挑战奖池内。\n" +
|
|
|
+ "2、次日早上7:00-9:00时段为早起打卡时间,用户在此期间进入小绵羊点击打卡按钮则成功打卡成功打卡不仅能拿回您原来投入的1元动力金,还能瓜分当天所有打卡失败者的全部动力金。\n" +
|
|
|
+ "3、未在次日早上7:00-9:00内进行打卡视为打卡失败,打卡失败后您所投入的1元动力金将不予以退回,也不参与瓜分当天所有打卡失败者的全部动力金。\n" +
|
|
|
+ "4、奖金将会在当天9:00进行结算,于12小时内发放至你的账户。由于网络原因,部分用户可能出现到账不及时的情况,请与我们的客服联系(客服电话:4008-698-576)\n" +
|
|
|
+ "本活动最终解释权归橙风有量科技有限公司所有"));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void 参加打卡挑战() {
|
|
|
+ //TODO
|
|
|
+ }
|
|
|
+}
|