Pārlūkot izejas kodu

Merge branch 'master' of http://git.quyaqu.com/xieshengqi/MoneyMoreMoreNote

Your Name 7 gadi atpakaļ
vecāks
revīzija
9aa40dfe2f

+ 12 - 2
app/src/main/java/com/kuxuan/moneynote/ui/activitys/account/AccountActivity.java

@@ -13,6 +13,7 @@ import android.widget.TextView;
13 13
 import com.kuxuan.moneynote.R;
14 14
 import com.kuxuan.moneynote.base.mvpbase.MVPFragmentActivity;
15 15
 import com.kuxuan.moneynote.common.Constant;
16
+import com.kuxuan.moneynote.json.CategoryList;
16 17
 import com.kuxuan.moneynote.json.netbody.BillBody;
17 18
 import com.kuxuan.moneynote.ui.activitys.eventbus.RefreshEvent;
18 19
 import com.kuxuan.moneynote.ui.weight.CaculatorLayout;
@@ -67,6 +68,7 @@ public class AccountActivity extends MVPFragmentActivity<AccountPresenter, Accou
67 68
     public static final String ICON_URL = "icon_url";
68 69
     private static final String EQUAL = "=";
69 70
     private static final String COMPLETE = "完成";
71
+    public static final String NAME = "name";
70 72
     private static final int LENGTH_2 = 2;
71 73
 
72 74
     private String icon_url;
@@ -96,6 +98,12 @@ public class AccountActivity extends MVPFragmentActivity<AccountPresenter, Accou
96 98
 
97 99
     String daytime;
98 100
 
101
+
102
+    /**
103
+     * 类别名字
104
+     */
105
+    private String name;
106
+
99 107
     /**
100 108
      * @param context
101 109
      * @param num     金额
@@ -221,10 +229,11 @@ public class AccountActivity extends MVPFragmentActivity<AccountPresenter, Accou
221 229
 
222 230
 
223 231
     @Override
224
-    public void click(String category_id, int type, String icon_url) {
232
+    public void click(String category_id, int type, String icon_url, CategoryList categoryList) {
225 233
         this.category_id = category_id;
226 234
         this.mType = type;
227 235
         this.icon_url = icon_url;
236
+        this.name = categoryList.getName();
228 237
         keybord.setVisibility(View.VISIBLE);
229 238
     }
230 239
 
@@ -285,6 +294,7 @@ public class AccountActivity extends MVPFragmentActivity<AccountPresenter, Accou
285 294
         intent.putExtra(TIME, billBody.getTime());
286 295
         intent.putExtra(TYPE, billBody.getType());
287 296
         intent.putExtra(DEMO, billBody.getDemo());
297
+        intent.putExtra(NAME, name);
288 298
         intent.putExtra(ICON_URL, icon_url);
289 299
         setResult(Constant.Code_Request.RESULTCODE, intent);
290 300
         EventBus.getDefault().post(new RefreshEvent());
@@ -306,7 +316,7 @@ public class AccountActivity extends MVPFragmentActivity<AccountPresenter, Accou
306 316
     public void complete() {
307 317
         if (COMPLETE.equals(mResult.getText())) {
308 318
             if (isEdit) {
309
-                if(category_id.equals("0")){
319
+                if (category_id.equals("0")) {
310 320
                     return;
311 321
                 }
312 322
                 BillBody billBody = new BillBody(category_id, mType, num.getText().toString(), getTime(daytime), mNumEdit.getText().toString(), bill_id);

+ 3 - 3
app/src/main/java/com/kuxuan/moneynote/ui/activitys/account/AccountPresenter.java

@@ -56,7 +56,7 @@ public class AccountPresenter extends AccountContract.AccountPresent {
56 56
                     }
57 57
                 }
58 58
                 mAdapter.notifyDataSetChanged();
59
-                mClickListener.click(mCategoryList.get(position).getId(), mCategoryList.get(position).getType(),mCategoryList.get(position).getIcon());
59
+                mClickListener.click(mCategoryList.get(position).getId(), mCategoryList.get(position).getType(),mCategoryList.get(position).getIcon(),mCategoryList.get(position));
60 60
             }
61 61
         });
62 62
 
@@ -131,11 +131,11 @@ public class AccountPresenter extends AccountContract.AccountPresent {
131 131
             }
132 132
         }
133 133
         mAdapter.notifyDataSetChanged();
134
-        mClickListener.click(account.getId(), account.getType(),account.getIcon());
134
+        mClickListener.click(account.getId(), account.getType(),account.getIcon(),account);
135 135
     }
136 136
 
137 137
     interface ClickListener {
138
-        void click(String category_id, int type,String icon_url);
138
+        void click(String category_id, int type,String icon_url,CategoryList categoryList);
139 139
     }
140 140
 
141 141
 }

+ 10 - 3
app/src/main/java/com/kuxuan/moneynote/ui/activitys/edit/EditBillActivity.java

@@ -2,6 +2,7 @@ package com.kuxuan.moneynote.ui.activitys.edit;
2 2
 
3 3
 import android.content.Intent;
4 4
 import android.os.Bundle;
5
+import android.text.TextUtils;
5 6
 import android.view.View;
6 7
 import android.widget.TextView;
7 8
 
@@ -96,7 +97,7 @@ public class EditBillActivity extends BaseActivity {
96 97
             activityEditMoney.setText(dayDataEntity.getAccount().replace("-", ""));
97 98
             activityEditType.setText("支出");
98 99
         }
99
-        GlideUtil.setImageWithNoCache(this,dayDataEntity.getSmall_icon(),getTitleView().getEdit_image());
100
+        GlideUtil.setImageWithNoCache(this, dayDataEntity.getSmall_icon(), getTitleView().getEdit_image());
100 101
         activityEditBeizhu.setText(dayDataEntity.getDemo());
101 102
         getTitleView().getEdit_text().setText(dayDataEntity.getName());
102 103
         getTitleView().getEdit_image().setImageResource(R.mipmap.category_custom_selected);
@@ -115,7 +116,8 @@ public class EditBillActivity extends BaseActivity {
115 116
         activityEditTime.setText(dayDataEntity.getDay_type());
116 117
         activityEditBeizhu.setText(dayDataEntity.getDemo());
117 118
         getTitleView().getEdit_text().setText(dayDataEntity.getName());
118
-        getTitleView().getEdit_image().setImageResource(R.mipmap.category_custom_selected);
119
+        GlideUtil.setImageWithNoCache(this, dayDataEntity.getSmall_icon(), getTitleView().getEdit_image());
120
+//        getTitleView().getEdit_image().setImageResource(R.mipmap.category_custom_selected);
119 121
     }
120 122
 
121 123
     @OnClick({R.id.activity_edit_edit_text, R.id.activity_edit_delete_text})
@@ -127,7 +129,7 @@ public class EditBillActivity extends BaseActivity {
127 129
                 intent.putExtra(AccountActivity.NUM, dayDataEntity.getAccount());
128 130
                 intent.putExtra(AccountActivity.BILL_ID, dayDataEntity.getId() + "");
129 131
                 intent.putExtra(AccountActivity.TYPE, dayDataEntity.getType());
130
-                intent.putExtra(AccountActivity.ID, dayDataEntity.getCategory_id()+"");
132
+                intent.putExtra(AccountActivity.ID, dayDataEntity.getCategory_id() + "");
131 133
                 intent.putExtra(AccountActivity.TIME, timeData);
132 134
                 intent.putExtra(AccountActivity.DEMO, dayDataEntity.getDemo());
133 135
                 intent.putExtra(AccountActivity.ISEDIT, true);
@@ -216,6 +218,11 @@ public class EditBillActivity extends BaseActivity {
216 218
                     dayDataEntity.setSmall_icon(data.getStringExtra(AccountActivity.ICON_URL));
217 219
                     if (type != -1)
218 220
                         dayDataEntity.setType(type);
221
+
222
+
223
+                    String name = data.getStringExtra(AccountActivity.NAME);
224
+                    if (!TextUtils.isEmpty(name))
225
+                        dayDataEntity.setName(name);
219 226
                     initNewData();
220 227
                 }
221 228
             }

+ 2 - 2
app/src/main/java/com/kuxuan/moneynote/ui/fragments/reportsingle/ReportSingleFragment.java

@@ -169,8 +169,8 @@ public class ReportSingleFragment extends MVPFragment<ReportSinglePresent, Repor
169 169
                         Intent intent = new Intent(getActivity(), ReportChartActivity.class);
170 170
                         intent.putExtra(ReportChartActivity.CATROGY_ID, category_id);
171 171
                         intent.putExtra(ReportChartActivity.MONEY_TYPE, mType);
172
-                        intent.putExtra(ReportChartActivity.TITLE, title_text);
173
-                        intent.putExtra(ReportChartActivity.RADIO_TYPE, radio_type);
172
+                        intent.putExtra(ReportChartActivity.TITLE, mPresenter.getTitle_text());
173
+                        intent.putExtra(ReportChartActivity.RADIO_TYPE, mPresenter.getType());
174 174
                         intent.putExtra(ReportChartActivity.CHARTTYPE, ChartLayout.YUANHUAN);
175 175
                         startActivity(intent);
176 176
                     }