|
@@ -11,6 +11,7 @@ import com.kuxuan.moneynote.R;
|
11
|
11
|
import com.kuxuan.moneynote.base.BaseFragmentActivity;
|
12
|
12
|
import com.kuxuan.moneynote.base.mvpbase.MVPFragment;
|
13
|
13
|
import com.kuxuan.moneynote.common.Constant;
|
|
14
|
+import com.kuxuan.moneynote.db.CategoryDaoOperator;
|
14
|
15
|
import com.kuxuan.moneynote.json.BillJson;
|
15
|
16
|
import com.kuxuan.moneynote.json.HeadImg;
|
16
|
17
|
import com.kuxuan.moneynote.json.MineJson;
|
|
@@ -30,6 +31,7 @@ import com.kuxuan.moneynote.utils.LoginStatusUtil;
|
30
|
31
|
import com.kuxuan.moneynote.utils.SPUtil;
|
31
|
32
|
import com.kuxuan.moneynote.utils.TextSetUtil;
|
32
|
33
|
import com.kuxuan.moneynote.utils.UIHelper;
|
|
34
|
+import com.kuxuan.sqlite.db.CategoryDB;
|
33
|
35
|
import com.umeng.socialize.ShareAction;
|
34
|
36
|
import com.umeng.socialize.UMShareListener;
|
35
|
37
|
import com.umeng.socialize.bean.SHARE_MEDIA;
|
|
@@ -45,6 +47,7 @@ import org.greenrobot.eventbus.Subscribe;
|
45
|
47
|
import org.greenrobot.eventbus.ThreadMode;
|
46
|
48
|
|
47
|
49
|
import java.lang.ref.WeakReference;
|
|
50
|
+import java.util.ArrayList;
|
48
|
51
|
import java.util.Calendar;
|
49
|
52
|
|
50
|
53
|
import butterknife.Bind;
|
|
@@ -198,7 +201,7 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
|
198
|
201
|
TextSetUtil.setTextForMonth(month, monthTv);
|
199
|
202
|
if(LoginStatusUtil.isLoginin()){
|
200
|
203
|
mPresenter.getMineData();
|
201
|
|
- mPresenter.getMineBill(year);
|
|
204
|
+// mPresenter.getMineBill(year);
|
202
|
205
|
}
|
203
|
206
|
mShareAction = new ShareAction(getActivity()).setDisplayList(
|
204
|
207
|
SHARE_MEDIA.WEIXIN, SHARE_MEDIA.WEIXIN_CIRCLE).setShareboardclickCallback(new ShareBoardlistener() {
|
|
@@ -214,9 +217,52 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
|
214
|
217
|
}
|
215
|
218
|
});
|
216
|
219
|
|
217
|
|
- TextSetUtil.setTextForMoey("0.00", incomeText, 16, 12);
|
218
|
|
- TextSetUtil.setTextForMoey("0.00", payText, 16, 12);
|
219
|
|
- TextSetUtil.setTextForMoey("0.00", balanceText, 16, 12);
|
|
220
|
+// TextSetUtil.setTextForMoey("0.00", incomeText, 16, 12);
|
|
221
|
+// TextSetUtil.setTextForMoey("0.00", payText, 16, 12);
|
|
222
|
+// TextSetUtil.setTextForMoey("0.00", balanceText, 16, 12);
|
|
223
|
+
|
|
224
|
+ setBillData();
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+ }
|
|
228
|
+
|
|
229
|
+ private void setBillData() {
|
|
230
|
+
|
|
231
|
+ CategoryDaoOperator categoryDaoOperator = CategoryDaoOperator.newInstance();
|
|
232
|
+
|
|
233
|
+ //收入 type ==1
|
|
234
|
+ ArrayList<CategoryDB> categoryDBArrayList_Income = categoryDaoOperator.getMonthData(Integer.parseInt(year),Integer.parseInt(month),1);
|
|
235
|
+
|
|
236
|
+ double income = 0;
|
|
237
|
+
|
|
238
|
+ for (int i =0 ;i < categoryDBArrayList_Income.size();i++){
|
|
239
|
+
|
|
240
|
+ income = income + categoryDBArrayList_Income.get(i).getAccount();
|
|
241
|
+
|
|
242
|
+ }
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+ ArrayList<CategoryDB> categoryDBArrayList_expenditure = categoryDaoOperator.getMonthData(Integer.parseInt(year),Integer.parseInt(month),2);
|
|
246
|
+
|
|
247
|
+ double expenditure = 0;
|
|
248
|
+
|
|
249
|
+ for (int i =0 ;i < categoryDBArrayList_expenditure.size();i++){
|
|
250
|
+
|
|
251
|
+ expenditure = expenditure + categoryDBArrayList_expenditure.get(i).getAccount();
|
|
252
|
+
|
|
253
|
+ }
|
|
254
|
+
|
|
255
|
+ double surplus = 0;
|
|
256
|
+
|
|
257
|
+ surplus = income - expenditure;
|
|
258
|
+
|
|
259
|
+ String incomeStr = TextSetUtil.formatFloatNumber(income);
|
|
260
|
+ String expenditureStr = TextSetUtil.formatFloatNumber(expenditure);
|
|
261
|
+ String surplusStr = TextSetUtil.formatFloatNumber(surplus);
|
|
262
|
+
|
|
263
|
+ TextSetUtil.setTextForMoey(incomeStr, incomeText, 16, 12);
|
|
264
|
+ TextSetUtil.setTextForMoey(expenditureStr, payText, 16, 12);
|
|
265
|
+ TextSetUtil.setTextForMoey(surplusStr, balanceText, 16, 12);
|
220
|
266
|
|
221
|
267
|
}
|
222
|
268
|
|
|
@@ -254,7 +300,8 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
|
254
|
300
|
if(LoginStatusUtil.isLoginin()){
|
255
|
301
|
newUser = loginEvent.isNewUser();
|
256
|
302
|
mPresenter.getMineData();
|
257
|
|
- mPresenter.getMineBill(year);
|
|
303
|
+// mPresenter.getMineBill(year);
|
|
304
|
+ setBillData();
|
258
|
305
|
}
|
259
|
306
|
|
260
|
307
|
}
|
|
@@ -286,13 +333,16 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
|
286
|
333
|
public void onMessageEvent(RefreshEvent loginEvent) {
|
287
|
334
|
|
288
|
335
|
mPresenter.getMineData();
|
289
|
|
- mPresenter.getMineBill(year);
|
|
336
|
+// mPresenter.getMineBill(year);
|
|
337
|
+
|
|
338
|
+ setBillData();
|
|
339
|
+
|
290
|
340
|
}
|
291
|
341
|
|
292
|
342
|
|
293
|
343
|
|
294
|
344
|
/**
|
295
|
|
- * add账单之后刷新数据
|
|
345
|
+ * 退出
|
296
|
346
|
*
|
297
|
347
|
* @param loginOutEvent
|
298
|
348
|
*/
|
|
@@ -304,9 +354,9 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
|
304
|
354
|
if(mNameText!=null){
|
305
|
355
|
mNameText.setText("未登录");
|
306
|
356
|
mPortraitImage.setImageResource(R.drawable.im_portrait);
|
307
|
|
- TextSetUtil.setTextForMoey("0.00", incomeText, 16, 12);
|
308
|
|
- TextSetUtil.setTextForMoey("0.00 ", payText, 16, 12);
|
309
|
|
- TextSetUtil.setTextForMoey("0.00", balanceText, 16, 12);
|
|
357
|
+// TextSetUtil.setTextForMoey("0.00", incomeText, 16, 12);
|
|
358
|
+// TextSetUtil.setTextForMoey("0.00 ", payText, 16, 12);
|
|
359
|
+// TextSetUtil.setTextForMoey("0.00", balanceText, 16, 12);
|
310
|
360
|
}
|
311
|
361
|
|
312
|
362
|
}
|
|
@@ -389,10 +439,9 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
|
389
|
439
|
}
|
390
|
440
|
}
|
391
|
441
|
|
392
|
|
-
|
393
|
|
- TextSetUtil.setTextForMoey("0.00", incomeText, 16, 12);
|
394
|
|
- TextSetUtil.setTextForMoey("0.00 ", payText, 16, 12);
|
395
|
|
- TextSetUtil.setTextForMoey("0.00", balanceText, 16, 12);
|
|
442
|
+// TextSetUtil.setTextForMoey("0.00", incomeText, 16, 12);
|
|
443
|
+// TextSetUtil.setTextForMoey("0.00 ", payText, 16, 12);
|
|
444
|
+// TextSetUtil.setTextForMoey("0.00", balanceText, 16, 12);
|
396
|
445
|
|
397
|
446
|
|
398
|
447
|
}
|
|
@@ -403,9 +452,9 @@ public class MineFragment extends MVPFragment<MinePresent, MineModel> implements
|
403
|
452
|
if(mNameText!=null){
|
404
|
453
|
mNameText.setText("未登录");
|
405
|
454
|
mPortraitImage.setImageResource(R.drawable.im_portrait);
|
406
|
|
- TextSetUtil.setTextForMoey("0.00", incomeText, 16, 12);
|
407
|
|
- TextSetUtil.setTextForMoey("0.00 ", payText, 16, 12);
|
408
|
|
- TextSetUtil.setTextForMoey("0.00", balanceText, 16, 12);
|
|
455
|
+// TextSetUtil.setTextForMoey("0.00", incomeText, 16, 12);
|
|
456
|
+// TextSetUtil.setTextForMoey("0.00 ", payText, 16, 12);
|
|
457
|
+// TextSetUtil.setTextForMoey("0.00", balanceText, 16, 12);
|
409
|
458
|
}
|
410
|
459
|
|
411
|
460
|
}
|