yuanshenglan лет назад: 7
Родитель
Сommit
b594095cdd

+ 4 - 5
app/src/main/java/com/kfzs/duanduan/fragment/FgtPersonalCenter.java

@@ -182,11 +182,11 @@ public class FgtPersonalCenter extends BaseCompatFragment {
      * @return 是否显示红包
      */
     private void isShowRedPackage() {
-      //  DataUtil.getInstance().是官方包吗();
+        //  DataUtil.getInstance().是官方包吗();
         if (userEntity == null) {
             userEntity = DataUtil.getInstance().getUserEntity();
         }
-        if ((userEntity.getParent_code().equals("") || (userEntity.getCreate_time_line() < 2) || (userEntity.getPackage_cate() != 1))) {
+        if (!(userEntity.getParent_code().equals("") || (userEntity.getCreate_time_line() < 2) || (userEntity.getPackage_cate() == 1))) {
             ivRedpackage.setVisibility(View.GONE);
         } else {
             ivRedpackage.setVisibility(View.VISIBLE);
@@ -199,9 +199,7 @@ public class FgtPersonalCenter extends BaseCompatFragment {
      * @param code ,邀请码
      */
     public void getRedPackage(String code, final PopupWindow popupWindow) {
-        JSONObject j = new JSONObject();
-        j.put("invitation_code", code);
-        SheepApp.getInstance().getNetComponent().getApiService().exchangeRedPackage(j)
+        SheepApp.getInstance().getNetComponent().getApiService().exchangeRedPackage(code)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
@@ -260,6 +258,7 @@ public class FgtPersonalCenter extends BaseCompatFragment {
             @Override
             public void onClick(View view) {
                 popupWindow.dismiss();
+                ivRedpackage.setVisibility(View.GONE);
             }
         });
 

+ 4 - 0
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -248,6 +248,10 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
         }
     };
 
+    /**
+     * 新手任务对话框中,注册账号并登录得红包,这里判断是否已经领取过了,如果领取过了就不显示,不然就显示
+     * @param obj     ,Context对象
+     */
     public void isShowRedPackages(Context obj) {
         if (userEntity == null) {
             userEntity = DataUtil.getInstance().getUserEntity();

+ 9 - 0
app/src/main/java/com/kfzs/duanduan/mine/GiftpackListAdapter.java

@@ -1,9 +1,16 @@
 package com.kfzs.duanduan.mine;
 
+import android.annotation.SuppressLint;
 import android.content.Context;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentPagerAdapter;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.sheep.jiuyan.samllsheep.R;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -47,4 +54,6 @@ public class GiftpackListAdapter extends FragmentPagerAdapter {
     public CharSequence getPageTitle(int position) {
         return (CharSequence) mTitles.get(position);
     }
+
+
 }

+ 82 - 0
app/src/main/java/com/kfzs/duanduan/mine/ShenheAdapter.java

@@ -0,0 +1,82 @@
+package com.kfzs.duanduan.mine;
+
+import android.content.Context;
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentManager;
+import android.support.v4.app.FragmentPagerAdapter;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.sheep.gamegroup.view.fragment.FgtAudit;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * created on:2018/8/22 on 4:57
+ * created by: Administrator
+ * 描述:
+ */
+public class ShenheAdapter extends FragmentPagerAdapter {
+    private Context mContext;
+    private List<Object> mListFragment = new ArrayList<>();
+    private List<Object> mTitles = new ArrayList<>();
+
+    public ShenheAdapter(FragmentManager fm, Context mContext) {
+        super(fm);
+        this.mContext = mContext;
+    }
+
+    public void add(Fragment fragment, String title) {
+        mListFragment.add(fragment);
+        mTitles.add(title);
+    }
+
+    @Override
+    public Fragment getItem(int position) {
+        return (Fragment) mListFragment.get(position);
+    }
+
+    @Override
+    public int getCount() {
+        return mListFragment.size();
+    }
+
+    @Override
+    public int getItemPosition(Object object) {
+        return super.getItemPosition(object);
+    }
+
+    @Override
+    public CharSequence getPageTitle(int position) {
+        return (CharSequence) mTitles.get(position);
+    }
+
+    public View getTabView(int position) {
+        View v = LayoutInflater.from(mContext).inflate(R.layout.view_add_fgtmainaudit, null);
+        ImageView imageView = v.findViewById(R.id.iv_img);
+        TextView textView1 = v.findViewById(R.id.tv_text);
+        if (position == 0) {
+            textView1.setText("审核中");
+        } else if (position == 1) {
+            textView1.setText("审核成功");
+        } else if (position == 2) {
+            textView1.setText("审核失败");
+            if (FgtAudit.newInstance(3).type == 3) {
+                if (FgtAudit.newInstance(3).etyList != null) {
+                    if (FgtAudit.newInstance(3).etyList.get(0).getStatus() == 6) {
+                        imageView.setVisibility(View.VISIBLE);
+                    } else {
+                        imageView.setVisibility(View.GONE);
+                    }
+                }
+            }
+        }
+
+        return v;
+    }
+}

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -202,7 +202,7 @@ public interface ApiService {
      * @return   领红包
      */
     @POST("app/user/receive_red_packet")
-    Observable<BaseMessage> exchangeRedPackage(@Body JSONObject jsonObject);
+    Observable<BaseMessage> exchangeRedPackage(@Query("invitation_code") String jsonObject);
 
     /**新手红包
      * @return  .

+ 12 - 5
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -29,7 +29,9 @@ import android.view.LayoutInflater;
 import android.view.View;
 import android.view.Window;
 import android.view.WindowManager;
+
 import com.tencent.smtt.sdk.WebView;
+
 import android.widget.CheckBox;
 import android.widget.CompoundButton;
 import android.widget.EditText;
@@ -265,6 +267,7 @@ public class ViewUtil {
             @Override
             public void onClick(View v) {
                 mRobTask = getTask(ivIcon, tvTitel, tvDutyMoney);
+                LogUtil.logI("抢任务---"+new Gson().toJson(mRobTask));
 
             }
         });
@@ -280,7 +283,7 @@ public class ViewUtil {
                 Intent intent = new Intent(mActivity, TaskDetailAct.class);
                 intent.putExtra("btn_show", true);
                 intent.putExtra("is_from_task_list", true);
-                intent.putExtra("task_id", mRobTask.getM().getTask().getId());
+                intent.putExtra("task_id", mRobTask.getM().getId());
                 mActivity.startActivity(intent);
 
             }
@@ -321,8 +324,12 @@ public class ViewUtil {
         tvGetRedPackage.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                fgtPersonalCenter.getRedPackage(edInvitationCode.getText().toString(), popupWindow);
-                popupWindow.dismiss();
+                if (TextUtils.isEmpty(edInvitationCode.getText())) {
+                    G.showToast("邀请码不能为空!");
+                } else {
+                    fgtPersonalCenter.getRedPackage(edInvitationCode.getText().toString(), popupWindow);
+                    popupWindow.dismiss();
+                }
             }
         });
         ivClose.setOnClickListener(new View.OnClickListener() {
@@ -1263,11 +1270,11 @@ public class ViewUtil {
      * 标签类型(0无,1热门,2最新,3现金,4活跃,5福利)
      * homepage item statues
      */
-    public void showGridviewStatues(Context context, TextView textView, HomeListEntity entity){
+    public void showGridviewStatues(Context context, TextView textView, HomeListEntity entity) {
         textView.setVisibility(View.INVISIBLE);
 
         int padding = textView.getContext().getResources().getDimensionPixelSize(R.dimen.content_padding_2);
-        switch (entity.getTag()){
+        switch (entity.getTag()) {
             default:
 
                 break;

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAudit.java

@@ -41,12 +41,12 @@ public class FgtAudit extends BaseFragment {
 
     private Activity activity;
     private TaskListItemAdp adp;
-    private List<TaskAcceptedEty> etyList = new ArrayList<>();
+    public List<TaskAcceptedEty> etyList = new ArrayList<>();
 
 
     private int page = 1;//页数
     private int per_page = 10;
-    private int type;
+    public int type;
 
     public static FgtAudit newInstance(int type){
         FgtAudit fgt = new FgtAudit();

+ 29 - 11
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtMainAudit.java

@@ -1,23 +1,30 @@
 package com.sheep.gamegroup.view.fragment;
 
+import android.annotation.SuppressLint;
 import android.app.Activity;
 import android.os.Bundle;
 import android.support.design.widget.TabLayout;
 import android.support.v4.view.ViewPager;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.kfzs.duanduan.BaseCompatFragment;
 import com.kfzs.duanduan.mine.GiftpackListAdapter;
+import com.kfzs.duanduan.mine.ShenheAdapter;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.TaskAuditEntity;
 import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.activity.ActMyMoney;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
+import java.lang.reflect.Field;
+
 import butterknife.BindView;
 import butterknife.ButterKnife;
 import butterknife.Unbinder;
@@ -50,7 +57,8 @@ public class FgtMainAudit extends BaseCompatFragment {
     private Activity activity;
 
     public static final String[] tabNames = {"审核中", "任务成功", "任务失败"};
-    private GiftpackListAdapter mAdapter;
+    private ShenheAdapter mAdapter;
+
     @Override
     protected void initView(Bundle savedInstanceState) {
         setContentView(R.layout.act_audit_layout);
@@ -59,10 +67,10 @@ public class FgtMainAudit extends BaseCompatFragment {
         unbinder = ButterKnife.bind(this, mContentView);
 //        StatusBarUtils.setTranslucent(this);
         TitleBarUtils.getInstance()
-                .setTitle(mContentView,"审核中心")
-                .setTitleListen(mContentView,0,null);
+                .setTitle(mContentView, "审核中心")
+                .setTitleListen(mContentView, 0, null);
 
-        mAdapter = new GiftpackListAdapter(getChildFragmentManager(), activity.getApplicationContext());
+        mAdapter = new ShenheAdapter(getChildFragmentManager(), activity.getApplicationContext());
         mAdapter.add(FgtAudit.newInstance(1), tabNames[0]);
         mAdapter.add(FgtAudit.newInstance(2), tabNames[1]);
         mAdapter.add(FgtAudit.newInstance(3), tabNames[2]);
@@ -92,18 +100,18 @@ public class FgtMainAudit extends BaseCompatFragment {
             public void call(BaseMessage o) {
                 try {
                     TaskAuditEntity taskAuditEntity = o.getData(TaskAuditEntity.class);
-                    if(taskAuditEntity != null){
+                    if (taskAuditEntity != null) {
                         String audit_total_audit = String.format(activity.getResources().getString(R.string.audit_total_audit), taskAuditEntity.getAudit_count());
                         String audit_total_complete = String.format(activity.getResources().getString(R.string.audit_total_complete), taskAuditEntity.getFinish_count());
                         String audit_total_money = String.format(activity.getResources().getString(R.string.audit_total_money), taskAuditEntity.getFinish_cash());
                         String audit_total_welfare = String.format(activity.getResources().getString(R.string.audit_total_welfare), taskAuditEntity.getWelfare_award());
 
-                        if(numberTv == null)
+                        if (numberTv == null)
                             return;
-                        numberTv.setText(audit_total_audit+"");
-                        auditTotalCompleteTv.setText(audit_total_complete+"");
-                        auditTotalMoneyTv.setText(audit_total_money+"");
-                        auditTotalWelfareTv.setText(audit_total_welfare+"");
+                        numberTv.setText(audit_total_audit + "");
+                        auditTotalCompleteTv.setText(audit_total_complete + "");
+                        auditTotalMoneyTv.setText(audit_total_money + "");
+                        auditTotalWelfareTv.setText(audit_total_welfare + "");
                     }
                 } catch (Exception e) {
                     e.printStackTrace();
@@ -112,7 +120,7 @@ public class FgtMainAudit extends BaseCompatFragment {
         });
     }
 
-    private void new_tab(){
+    private void new_tab() {
 //        indicator.newTab();
         pager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(indicator));
         indicator.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(pager));
@@ -125,6 +133,7 @@ public class FgtMainAudit extends BaseCompatFragment {
             @Override
             public void onPageSelected(int i) {
 //                MY_MONEY_TAB.onEvent("tab_name", tabNames[2]);
+
             }
 
             @Override
@@ -135,8 +144,17 @@ public class FgtMainAudit extends BaseCompatFragment {
 
         indicator.setupWithViewPager(pager);
         CommonUtil.getInstance().reflex(indicator, activity);
+        for (int i = 0; i < indicator.getTabCount(); i++) {
+            indicator.getTabAt(i).setCustomView(mAdapter.getTabView(i));
+        }
+
+        TabLayout.Tab tab=indicator.getTabAt(2);
+
+            tab.getCustomView().findViewById(R.id.iv_img).setVisibility(View.VISIBLE);
+
     }
 
+
     @Override
     public void onResume() {
         super.onResume();

+ 9 - 0
app/src/main/res/drawable/shape_litter_red_circle.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <size
+        android:width="30dp"
+        android:height="30dp" />
+    <corners android:radius="30dp" />
+    <solid android:color="@color/red" />
+</shape>

+ 22 - 0
app/src/main/res/layout/view_add_fgtmainaudit.xml

@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="30dp">
+
+    <TextView
+        android:id="@+id/tv_text"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_centerInParent="true"
+        android:text="2121221" />
+
+    <ImageView
+        android:id="@+id/iv_img"
+        android:layout_width="8dp"
+        android:layout_height="8dp"
+        android:layout_centerVertical="true"
+        android:layout_marginLeft="5dp"
+        android:layout_toRightOf="@id/tv_text"
+        android:visibility="gone"
+        android:background="@drawable/shape_litter_red_circle" />
+</RelativeLayout>