Просмотр исходного кода

添加一些监听事件

Signed-off-by: 刁铃刚 <315096953@qq.com>
刁铃刚 лет назад: 8
Родитель
Сommit
ddbc2a0b70

+ 1 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/net/SheepCallback.java

@@ -68,6 +68,7 @@ public abstract class SheepCallback<T> implements Callback {
 
     public void otherCode(int code, String string) {
         Toast.makeText(SheepApp.mContext, string, Toast.LENGTH_SHORT).show();
+        failure(new IOException(string));
     }
 
     public abstract void success(T t);

+ 2 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/page/LoginActivity.java

@@ -108,7 +108,8 @@ public class LoginActivity extends BaseActivity {
         req.state = "small_sheep_auther";
         SheepApp.mWxapi.sendReq(req);*/
 
-        SpUtils.login(this, "4ff3898049503dfb7ca61da4dc31cc91");
+//        SpUtils.login(this, "4ff3898049503dfb7ca61da4dc31cc91");
+        SpUtils.login(this, "123456");
     }
 
 

+ 18 - 7
app/src/main/java/com/sheep/jiuyan/samllsheep/page/MainActivity.java

@@ -25,6 +25,7 @@ import com.sheep.jiuyan.samllsheep.page.fragment.FgtMainPageTask;
 import com.sheep.jiuyan.samllsheep.page.view.RappTabLayout;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.PremissUtils;
+import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
 import java.util.ArrayList;
@@ -160,6 +161,16 @@ public class MainActivity extends BaseActivity {
                 startActivity(intent);
             }
         });
+        findViewById(R.id.txt_get_cash).setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                if (SpUtils.isLogin(getApplicationContext())) {
+                    Intent intent = new Intent(MainActivity.this, WithdrawActivity.class);
+                    intent.putExtra("money", G.mUser.getBalance());
+                    startActivity(intent);
+                }
+            }
+        });
     }
 
     private void reSetSwipeRefreshLayout() {
@@ -207,13 +218,13 @@ public class MainActivity extends BaseActivity {
                 .setupWithViewPager(mViewPager, R.layout.tab_ripple);
 
         TitleBarUtils.getInstance()
-                .setTitleFinish(this)
-                .setRightImgBotton(this, R.drawable.set, new View.OnClickListener() {
-                    @Override
-                    public void onClick(View view) {
-                        G.showToast("点设置");
-                    }
-                });
+                .setTitleFinish(this);
+//                .setRightImgBotton(this, R.drawable.set, new View.OnClickListener() {
+//                    @Override
+//                    public void onClick(View view) {
+//                        G.showToast("点设置");
+//                    }
+//                });
     }
 
     @Override

+ 3 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/page/UserCenterActivity.java

@@ -13,6 +13,7 @@ import com.sheep.jiuyan.samllsheep.net.NetManager;
 import com.sheep.jiuyan.samllsheep.net.SheepCallback;
 import com.sheep.jiuyan.samllsheep.net.Url;
 import com.sheep.jiuyan.samllsheep.page.entry.User;
+import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
@@ -75,6 +76,7 @@ public class UserCenterActivity extends BaseActivity implements View.OnClickList
             @Override
             public void success(User user) {
                 mUser = user;
+                G.mUser = user;
                 mTvNick.setText(user.getNickName());
                 mTvMoney.setText(user.getBalance());
                 mTvCode.setText("我的邀请码  " + user.getInvitationCode());
@@ -97,7 +99,7 @@ public class UserCenterActivity extends BaseActivity implements View.OnClickList
         mLlMoneyHostroy = (LinearLayout) findViewById(R.id.ll_money_hostroy);
 
         TitleBarUtils.getInstance()
-                .setTitle(this,"个人中心")
+                .setTitle(this, "个人中心")
                 .setTitleFinish(this);
     }
 

+ 1 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/page/WxAccountDetail.java

@@ -59,7 +59,7 @@ public class WxAccountDetail extends BaseActivity {
     public void initData() {
         HashMap<String, String> map = new HashMap<>();
         map.put("wx_open_id", SpUtils.getOpenId(this));
-        map.put("wx_id", SpUtils.getOpenId(this));
+        map.put("wx_id", "39");
         NetManager.get(Url.TASK_LIST, map, this, new SheepCallback<List<WxDetailList>>(this) {
             @Override
             public void success(List<WxDetailList> tasks) {

+ 2 - 9
app/src/main/java/com/sheep/jiuyan/samllsheep/page/fragment/FgtMainPageOffline.java

@@ -98,16 +98,9 @@ public class FgtMainPageOffline extends BaseFragment {
                 reFreshView();
             }
 
-            //TODO 你的框架不知道哪个是失败必须执行的,要添加拒绝加载更多等
             @Override
-            public void onFailure(Call call, IOException e) {
-                super.onFailure(call, e);
-                mRecyleViewLoadMoreUtils.setmIsLoading(true);
-                reFreshView();
-            }
-
-            @Override
-            public void otherCode(int code, String string) {
+            public void failure(IOException e) {
+                super.failure(e);
                 mRecyleViewLoadMoreUtils.setmIsLoading(true);
                 reFreshView();
             }

+ 29 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/page/fragment/FgtMainPageTask.java

@@ -16,6 +16,8 @@ import com.sheep.jiuyan.samllsheep.net.NetManager;
 import com.sheep.jiuyan.samllsheep.net.SheepCallback;
 import com.sheep.jiuyan.samllsheep.net.Url;
 import com.sheep.jiuyan.samllsheep.page.DownloadActivity;
+import com.sheep.jiuyan.samllsheep.page.MoneyHistroyActivity;
+import com.sheep.jiuyan.samllsheep.page.TaskRecordActivity;
 import com.sheep.jiuyan.samllsheep.page.adapter.AdpMainActivity;
 import com.sheep.jiuyan.samllsheep.page.entry.TaskPublish;
 import com.sheep.jiuyan.samllsheep.page.entry.User;
@@ -77,6 +79,26 @@ public class FgtMainPageTask extends BaseFragment {
             }
         });
         initData(false);
+
+        findViewById(R.id.view_income_today)
+                .setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        Intent intent = new Intent(getActivity(), MoneyHistroyActivity.class);
+                        startActivity(intent);
+                    }
+                });
+        View.OnClickListener onClickListener=new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                Intent intent = new Intent(getActivity(), TaskRecordActivity.class);
+                startActivity(intent);
+            }
+        };
+        findViewById(R.id.view_complete_today)
+                .setOnClickListener(onClickListener);
+        findViewById(R.id.view_history_record)
+                .setOnClickListener(onClickListener);
     }
 
 
@@ -191,6 +213,13 @@ public class FgtMainPageTask extends BaseFragment {
                 super.onFailure(call, e);
                 mRecyleViewLoadMoreUtils.setmIsLoading(true);
             }
+
+            @Override
+            public void failure(IOException e) {
+                super.failure(e);
+                mRecyleViewLoadMoreUtils.setmIsLoading(true);
+            }
+
             @Override
             public void otherCode(int code, String string) {
                 mRecyleViewLoadMoreUtils.setmIsLoading(true);

+ 17 - 10
app/src/main/res/layout/fgt_main_page_task.xml

@@ -44,6 +44,7 @@
             android:text="128"
             android:textColor="@color/orange_text_light"
             android:textSize="@dimen/text_size_3"
+            android:visibility="gone"
             app:layout_constraintLeft_toRightOf="@id/txt_fgt_main_page_task_succ"
             app:layout_constraintRight_toLeftOf="@+id/txt_fgt_main_page_task_history"
             app:layout_constraintTop_toTopOf="parent" />
@@ -90,6 +91,7 @@
             android:text="剩余次数"
             android:textColor="@color/black_text_gray"
             android:textSize="@dimen/text_size_2"
+            android:visibility="gone"
             app:layout_constraintLeft_toLeftOf="@id/txt_fgt_main_page_task_remain"
             app:layout_constraintRight_toRightOf="@id/txt_fgt_main_page_task_remain"
             app:layout_constraintTop_toBottomOf="@id/txt_fgt_main_page_task_income" />
@@ -107,14 +109,16 @@
 
         <LinearLayout
             android:layout_width="match_parent"
-            android:layout_height="match_parent"
+            android:layout_height="@dimen/layout_heigh_default"
+            android:gravity="center_vertical"
             android:orientation="horizontal"
             app:layout_constraintBottom_toBottomOf="parent"
             app:layout_constraintTop_toTopOf="parent">
 
-            <Space
+            <View
+                android:id="@+id/view_income_today"
                 android:layout_width="0dp"
-                android:layout_height="1px"
+                android:layout_height="match_parent"
                 android:layout_weight="1" />
 
             <View
@@ -122,19 +126,21 @@
                 android:layout_height="25dp"
                 android:background="@color/sheep_red" />
 
-            <Space
+            <View
                 android:layout_width="0dp"
-                android:layout_height="1px"
-                android:layout_weight="1" />
+                android:layout_height="match_parent"
+                android:layout_weight="1"
+                android:visibility="gone" />
 
             <View
                 android:layout_width="1px"
                 android:layout_height="25dp"
                 android:background="@color/sheep_red" />
 
-            <Space
+            <View
+                android:id="@+id/view_complete_today"
                 android:layout_width="0dp"
-                android:layout_height="1px"
+                android:layout_height="match_parent"
                 android:layout_weight="1" />
 
             <View
@@ -142,9 +148,10 @@
                 android:layout_height="25dp"
                 android:background="@color/sheep_red" />
 
-            <Space
+            <View
+                android:id="@+id/view_history_record"
                 android:layout_width="0dp"
-                android:layout_height="1px"
+                android:layout_height="match_parent"
                 android:layout_weight="1" />
 
         </LinearLayout>

+ 1 - 1
app/src/main/res/layout/main_activity.xml

@@ -77,7 +77,7 @@
 
 
                     <TextView
-                        android:id="@+id/tv_withdraw"
+                        android:id="@+id/txt_get_cash"
                         android:layout_width="wrap_content"
                         android:layout_height="wrap_content"
                         android:layout_centerVertical="true"