Переглянути джерело

Merge branch 'master' of http://10.8.230.114:3000/kemllor/small_sheep_android

刁铃刚 8 роки тому
батько
коміт
c7ba363b7c

+ 1 - 3
.idea/modules.xml

@@ -2,10 +2,8 @@
 <project version="4">
   <component name="ProjectModuleManager">
     <modules>
-      <module fileurl="file://D:\Dlg\AndroidStudioProjects\small_sheep_android\SamllSheepPlugin.iml" filepath="D:\Dlg\AndroidStudioProjects\small_sheep_android\SamllSheepPlugin.iml" />
+      <module fileurl="file://$PROJECT_DIR$/SamllSheepPlugin.iml" filepath="$PROJECT_DIR$/SamllSheepPlugin.iml" />
       <module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
-      <module fileurl="file://D:\Dlg\AndroidStudioProjects\small_sheep_android\.idea\modules\app\app.iml" filepath="D:\Dlg\AndroidStudioProjects\small_sheep_android\.idea\modules\app\app.iml" />
-      <module fileurl="file://$PROJECT_DIR$/small_sheep_android.iml" filepath="$PROJECT_DIR$/small_sheep_android.iml" />
     </modules>
   </component>
 </project>

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

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

+ 112 - 13
app/src/main/java/com/sheep/jiuyan/samllsheep/page/MoneyHistroyActivity.java

@@ -1,6 +1,10 @@
 package com.sheep.jiuyan.samllsheep.page;
 
+import android.database.DataSetObserver;
 import android.text.TextUtils;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ExpandableListAdapter;
 import android.widget.ListView;
 
 import com.sheep.jiuyan.samllsheep.R;
@@ -34,29 +38,30 @@ public class MoneyHistroyActivity extends BaseActivity {
     public void initView() {
         mLv = (ListView) findViewById(R.id.lv);
         TitleBarUtils.getInstance()
-                .setTitle(this,"资金记录")
+                .setTitle(this, "资金记录")
                 .setTitleFinish(this);
     }
 
     @Override
     public void initListener() {
     }
-    private  void  showView(List<MoneyHistroy> orders){
-        mAdapter=new CommonAdapter<MoneyHistroy>(MoneyHistroyActivity.this,R.layout.money_history_item, orders) {
+
+    private void showView(List<MoneyHistroy> orders) {
+        mAdapter = new CommonAdapter<MoneyHistroy>(MoneyHistroyActivity.this, R.layout.money_history_item, orders) {
             @Override
             protected void convert(ViewHolder viewHolder, MoneyHistroy item, int position) {
 
-                viewHolder.setText(R.id.tv_time, item.getCreateTime().replace(" ","\n"));
+                viewHolder.setText(R.id.tv_time, item.getCreateTime().replace(" ", "\n"));
                 viewHolder.setText(R.id.tv_blacne, item.getBalance());
                 viewHolder.setText(R.id.tv_des, item.getDesc());
-                if(!TextUtils.isEmpty(item.getMoney())){
+                if (!TextUtils.isEmpty(item.getMoney())) {
 
-                    String  str=item.getMoney();
-                    if(str.startsWith("-")){
-                        viewHolder.setTextColor(R.id.tv_money,getResources().getColor(R.color.green));
+                    String str = item.getMoney();
+                    if (str.startsWith("-")) {
+                        viewHolder.setTextColor(R.id.tv_money, getResources().getColor(R.color.green));
                         viewHolder.setText(R.id.tv_money, str.substring(1));
-                    }else{
-                        viewHolder.setTextColor(R.id.tv_money,getResources().getColor(R.color.sheep_red));
+                    } else {
+                        viewHolder.setTextColor(R.id.tv_money, getResources().getColor(R.color.sheep_red));
                         viewHolder.setText(R.id.tv_money, str);
                     }
                 }
@@ -64,22 +69,116 @@ public class MoneyHistroyActivity extends BaseActivity {
             }
         };
         mLv.setAdapter(mAdapter);
-
     }
 
 
-    private void getTask(){
+    private void getTask() {
         final HashMap<String, String> map = new HashMap<>();
         map.put("wx_open_id", SpUtils.getOpenId(this));
         NetManager.get(Url.MONEYRECORD, map, getApplicationContext(), new SheepCallback<List<MoneyHistroy>>(this) {
             @Override
             public void success(List<MoneyHistroy> orders) {
-                 showView(orders);
+                showView(orders);
             }
         });
     }
+
     @Override
     public void initData() {
         getTask();
     }
+
+
+    class MoneyAdapter implements ExpandableListAdapter {
+
+        @Override
+        public void registerDataSetObserver(DataSetObserver observer) {
+
+        }
+
+        @Override
+        public void unregisterDataSetObserver(DataSetObserver observer) {
+
+        }
+
+        @Override
+        public int getGroupCount() {
+            return 0;
+        }
+
+        @Override
+        public int getChildrenCount(int groupPosition) {
+            return 0;
+        }
+
+        @Override
+        public Object getGroup(int groupPosition) {
+            return null;
+        }
+
+        @Override
+        public Object getChild(int groupPosition, int childPosition) {
+            return null;
+        }
+
+        @Override
+        public long getGroupId(int groupPosition) {
+            return 0;
+        }
+
+        @Override
+        public long getChildId(int groupPosition, int childPosition) {
+            return 0;
+        }
+
+        @Override
+        public boolean hasStableIds() {
+            return false;
+        }
+
+        @Override
+        public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
+            return null;
+        }
+
+        @Override
+        public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
+            return null;
+        }
+
+        @Override
+        public boolean isChildSelectable(int groupPosition, int childPosition) {
+            return false;
+        }
+
+        @Override
+        public boolean areAllItemsEnabled() {
+            return false;
+        }
+
+        @Override
+        public boolean isEmpty() {
+            return false;
+        }
+
+        @Override
+        public void onGroupExpanded(int groupPosition) {
+
+        }
+
+        @Override
+        public void onGroupCollapsed(int groupPosition) {
+
+        }
+
+        @Override
+        public long getCombinedChildId(long groupId, long childId) {
+            return 0;
+        }
+
+        @Override
+        public long getCombinedGroupId(long groupId) {
+            return 0;
+        }
+    }
 }

+ 33 - 5
app/src/main/java/com/sheep/jiuyan/samllsheep/page/WithdrawActivity.java

@@ -3,6 +3,7 @@ package com.sheep.jiuyan.samllsheep.page;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
+import android.support.v7.app.AlertDialog;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
@@ -32,6 +33,8 @@ public class WithdrawActivity extends BaseActivity implements View.OnClickListen
     int[] mMoneys = new int[]{5, 10, 20, 50, 100, 500};
     private TextView mTvWx;
     private GvAdapter mAdapter;
+    private AlertDialog mDialog;
+    private TextView mTvMsg;
 
     @Override
     public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -68,7 +71,7 @@ public class WithdrawActivity extends BaseActivity implements View.OnClickListen
         mAdapter = new GvAdapter();
         mGvMoney.setAdapter(mAdapter);
         TitleBarUtils.getInstance()
-                .setTitle(this,"提  现")
+                .setTitle(this, "提  现")
                 .setTitleFinish(this);
     }
 
@@ -95,7 +98,7 @@ public class WithdrawActivity extends BaseActivity implements View.OnClickListen
             NetManager.get(Url.USER_WITHDRAW, map, getApplicationContext(), new SheepCallback<String>(this) {
                 @Override
                 public void success(String o) {
-                    Toast.makeText(WithdrawActivity.this, o, Toast.LENGTH_SHORT).show();
+                    showMsgDialog(o);
                 }
 
                 @Override
@@ -104,12 +107,32 @@ public class WithdrawActivity extends BaseActivity implements View.OnClickListen
                         startActivity(new Intent(WithdrawActivity.this, BindWxActivity.class));
                         return;
                     }
-                    super.otherCode(code, string);
+                    showMsgDialog(string);
                 }
             });
         }
     }
 
+    private void showMsgDialog(String msg) {
+        if (mDialog == null) {
+            AlertDialog.Builder builder = new AlertDialog.Builder(WithdrawActivity.this, R.style.Theme_AppCompat_Dialog);
+            View view = View.inflate(this, R.layout.simple_dialog, null);
+            view.setBackgroundResource(R.drawable.texe_background_round_white_10dp);
+            View enter = view.findViewById(R.id.tv_enter);
+            mTvMsg = view.findViewById(R.id.tv_msg);
+
+            enter.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    mDialog.dismiss();
+                }
+            });
+            mDialog = builder.setView(view)
+                    .create();
+        }
+        mTvMsg.setText(msg.replace("\"", ""));
+        mDialog.show();
+    }
 
     private class GvAdapter extends BaseAdapter {
         int checked = -1;
@@ -134,16 +157,21 @@ public class WithdrawActivity extends BaseActivity implements View.OnClickListen
         public View getView(final int position, View convertView, ViewGroup parent) {
             View item = View.inflate(getApplicationContext(), R.layout.withdraw_item, null);
             final RadioButton btn = (RadioButton) item.findViewById(R.id.rb_money);
+            final View check = item.findViewById(R.id.img_checked);
             btn.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
                     checked = position;
-                    ViewGroup gv = (ViewGroup) btn.getParent().getParent();
+                    ViewGroup gv = (ViewGroup) btn.getParent().getParent().getParent();
                     for (int i = 0; i < mMoneys.length; i++) {
-                        RadioButton child = (RadioButton) ((ViewGroup) gv.getChildAt(i)).getChildAt(0);
+                        RadioButton child = (RadioButton) ((ViewGroup) ((ViewGroup) gv.getChildAt(i)).getChildAt(0)).getChildAt(0);
+                        View view = ((ViewGroup) ((ViewGroup) gv.getChildAt(i)).getChildAt(0)).getChildAt(1);
                         child.setSelected(false);
+                        view.setVisibility(View.GONE);
                     }
                     btn.setSelected(true);
+                    check.setVisibility(View.VISIBLE);
+
                 }
             });
             btn.setText(mMoneys[position] + "  元");

+ 1 - 1
app/src/main/res/drawable/texe_background_normal_orange.xml

@@ -4,5 +4,5 @@
     <corners android:radius="5dp"/>
     <stroke
         android:width="1dp"
-        android:color="@color/theme"/>
+        android:color="@color/orange_text_light"/>
 </shape>

+ 7 - 0
app/src/main/res/drawable/texe_background_round_white_10dp.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <corners android:radius="10dp"/>
+    <solid android:color="@color/white"/>
+
+</shape>

+ 0 - 4
app/src/main/res/layout/money_history_item.xml

@@ -57,8 +57,4 @@
 
     </LinearLayout>
 
-    <include
-        layout="@layout/line_h_1px_black"/>
-
-
 </LinearLayout>

+ 2 - 48
app/src/main/res/layout/money_histroy_activity.xml

@@ -7,56 +7,10 @@
     <include
         layout="@layout/title"/>
 
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="30dp"
-        android:gravity="center"
-        android:orientation="horizontal">
-
-        <TextView
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:text="申请日期"
-            android:textColor="@color/black_dark"
-            android:textSize="14sp"/>
-
-        <TextView
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:text="金额(元)"
-            android:textColor="@color/black_dark"
-            android:textSize="14sp"/>
-
-        <TextView
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:text="余额(元)"
-            android:textColor="@color/black_dark"
-            android:textSize="14sp"/>
-
-        <TextView
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:gravity="center"
-            android:text="备注"
-            android:textColor="@color/black_dark"
-            android:textSize="14sp"/>
-    </LinearLayout>
-
-    <include
-        layout="@layout/line_h_1px"/>
-
-    <ListView
+    <ExpandableListView
         android:id="@+id/lv"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
-    </ListView>
+    </ExpandableListView>
 
 </LinearLayout>

+ 28 - 0
app/src/main/res/layout/simple_dialog.xml

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="wrap_content"
+              android:layout_height="wrap_content"
+              android:background="@drawable/texe_background_round_white_10dp"
+              android:orientation="vertical">
+
+    <TextView
+        android:id="@+id/tv_msg"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_margin="@dimen/content_padding_big"
+        android:gravity="center"
+        android:textColor="@color/black_text_gray"/>
+
+    <TextView
+        android:id="@+id/tv_enter"
+        style="@style/style_btn"
+        android:layout_width="80dp"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        android:layout_marginBottom="@dimen/content_padding_big"
+        android:layout_marginTop="@dimen/content_padding_big"
+        android:gravity="center"
+        android:text="确定"
+        android:textSize="@dimen/text_size_3"/>
+
+</LinearLayout>

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

@@ -17,7 +17,6 @@
         android:paddingBottom="@dimen/content_padding_big"
         android:paddingLeft="15dp"
         android:paddingTop="@dimen/content_padding_big"
-        android:text="账户余额:¥250"
         android:textColor="@color/orange_text_light"
         android:textSize="@dimen/text_size_7"/>
 
@@ -30,6 +29,7 @@
         android:textColor="@color/black_text_gray"/>
 
     <GridView
+        android:layout_marginLeft="@dimen/content_padding"
         android:id="@+id/gv_money"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"

+ 26 - 20
app/src/main/res/layout/withdraw_item.xml

@@ -1,28 +1,34 @@
 <?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="match_parent"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
                 android:orientation="vertical">
 
-    <RadioButton
-        android:id="@+id/rb_money"
+    <RelativeLayout
         android:layout_width="150dp"
-        android:layout_height="@dimen/layout_heigh_small"
-        android:layout_centerInParent="true"
-        android:layout_margin="10dp"
-        android:background="@drawable/text_backgroud"
-        android:button="@null"
-        android:gravity="center"
-        android:textColor="@drawable/text_color"/>
+        android:layout_height="wrap_content">
+
+        <RadioButton
+            android:id="@+id/rb_money"
+            android:layout_width="130dp"
+            android:layout_height="@dimen/layout_heigh_small"
+            android:layout_centerInParent="true"
+            android:layout_margin="10dp"
+            android:background="@drawable/text_backgroud"
+            android:button="@null"
+            android:gravity="center"
+            android:textColor="@drawable/text_color"
+            android:textSize="@dimen/text_size_4"/>
+
+        <ImageView
+            android:visibility="gone"
+            android:id="@+id/img_checked"
+            android:layout_width="20dp"
+            android:layout_height="20dp"
+            android:layout_alignParentEnd="true"
+            android:layout_alignParentTop="true"
+            android:src="@drawable/withdrawal_choose_hook"/>
+    </RelativeLayout>
 
-    <ImageView
-        android:id="@+id/img_checked"
-        android:layout_width="20dp"
-        android:layout_height="20dp"
-        android:src="@drawable/icon"
-        android:layout_marginBottom="21dp"
-        android:layout_alignBottom="@+id/rb_money"
-        android:layout_alignParentEnd="true"
-        android:layout_marginEnd="95dp"/>
 
 </RelativeLayout>

+ 6 - 8
app/src/main/res/layout/withdraw_record_activity.xml

@@ -9,8 +9,9 @@
 
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="30dp"
+        android:layout_height="@dimen/layout_heigh_default"
         android:gravity="center"
+        android:background="@color/background_light_gray"
         android:orientation="horizontal">
 
         <TextView
@@ -19,7 +20,7 @@
             android:layout_weight="1"
             android:gravity="center"
             android:text="申请日期"
-            android:textColor="@color/black_dark"
+            android:textColor="@color/black_text_deep"
             android:textSize="14sp"/>
 
         <TextView
@@ -28,7 +29,7 @@
             android:layout_weight="1"
             android:gravity="center"
             android:text="金额"
-            android:textColor="@color/black_dark"
+            android:textColor="@color/black_text_deep"
             android:textSize="14sp"/>
 
         <TextView
@@ -37,7 +38,7 @@
             android:layout_weight="1"
             android:gravity="center"
             android:text="微信号"
-            android:textColor="@color/black_dark"
+            android:textColor="@color/black_text_deep"
             android:textSize="14sp"/>
 
         <TextView
@@ -46,13 +47,10 @@
             android:layout_weight="1"
             android:gravity="center"
             android:text="订单状态"
-            android:textColor="@color/black_dark"
+            android:textColor="@color/black_text_deep"
             android:textSize="14sp"/>
     </LinearLayout>
 
-    <include
-        layout="@layout/line_h_1px"/>
-
     <ListView
         android:id="@+id/lv_record"
         android:layout_width="match_parent"

+ 14 - 23
app/src/main/res/layout/withdraw_record_item.xml

@@ -7,41 +7,40 @@
 
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="60dp"
-        android:layout_marginTop="5dp"
-        android:background="@color/backgroud"
+        android:layout_height="@dimen/layout_heigh_default"
+        android:layout_margin="@dimen/content_padding"
+        android:background="@color/background_light_gray"
         android:gravity="center_vertical"
         android:orientation="horizontal"
         >
 
         <TextView
-            android:gravity="center"
             android:id="@+id/tv_time"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_centerVertical="true"
             android:layout_weight="1"
-            android:text="asdas"
-            android:textColor="@color/black_dark"
-            android:textSize="14sp"/>
+            android:gravity="center"
+            android:textColor="@color/black_text_gray"
+            android:textSize="@dimen/text_size_3"/>
 
 
         <TextView
-            android:gravity="center"
             android:id="@+id/tv_money"
             android:layout_width="0dp"
             android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:textColor="@color/theme"
-            android:textSize="14sp"/>
+            android:gravity="center"
+            android:textColor="@color/black_text_gray"
+            android:textSize="@dimen/text_size_3"/>
 
         <TextView
             android:id="@+id/tv_wx"
             android:layout_width="0dp"
-            android:gravity="center"
             android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:textColor="@color/black_dark"
+            android:gravity="center"
+            android:textColor="@color/black_text_gray"
             android:textSize="12sp"/>
 
 
@@ -54,13 +53,11 @@
             >
 
             <TextView
+                style="@style/style_btn"
                 android:id="@+id/tv_state"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:background="@color/theme"
-                android:padding="3dp"
-                android:textColor="@color/white"
-                android:textSize="12dp"/>
+                />
 
             <TextView
                 android:id="@+id/tv_failed"
@@ -69,16 +66,10 @@
                 android:layout_alignParentRight="true"
                 android:layout_marginTop="5dp"
                 android:textColor="@color/black_dark"
-                android:textSize="12dp"
+                android:textSize="@dimen/text_size_3"
                 android:visibility="gone"/>
 
         </LinearLayout>
-
-
     </LinearLayout>
 
-    <include
-        layout="@layout/line_h_1px_black"/>
-
-
 </LinearLayout>