예제 #1
0
 private void initYValues(double max, double min) {
   yValues.clear();
   if (min >= 0) {
     double yCell = getYCell(max, NO_SIGN_SIZE);
     for (int i = 0; i <= NO_SIGN_SIZE; i++) {
       yValues.add(Utils.generateFormatMoney(dollar, i * yCell));
     }
     yCellLength = (int) ((float) (yAxisEndYPosition - yAxisStartYPosition) / NO_SIGN_SIZE);
     xAxisYPosition = yAxisEndYPosition;
     maximumWithdrawal = NO_SIGN_SIZE * yCell;
     minimumWithdrawal = 0;
   } else if (min < 0 && max > 0) {
     double mm = Math.max(Math.abs(min), Math.abs(max));
     double yCell = getYCell(mm, SIGN_SIZE / 2);
     for (int i = -SIGN_SIZE / 2; i <= SIGN_SIZE / 2; i++) {
       yValues.add(Utils.generateFormatMoney(dollar, i * yCell));
     }
     yCellLength = (int) ((float) (yAxisEndYPosition - yAxisStartYPosition) / SIGN_SIZE);
     xAxisYPosition = yAxisEndYPosition - yCellLength * (SIGN_SIZE / 2);
     maximumWithdrawal = SIGN_SIZE / 2 * yCell;
     minimumWithdrawal = -SIGN_SIZE / 2 * yCell;
   } else {
     double mm = Math.abs(min);
     double yCell = getYCell(mm, NO_SIGN_SIZE);
     for (int i = -NO_SIGN_SIZE; i <= 0; i++) {
       yValues.add(Utils.generateFormatMoney(dollar, i * yCell));
     }
     yCellLength = (int) ((float) (yAxisEndYPosition - yAxisStartYPosition) / NO_SIGN_SIZE);
     xAxisYPosition = yAxisStartYPosition;
     maximumWithdrawal = 0;
     minimumWithdrawal = -NO_SIGN_SIZE * yCell;
   }
 }
예제 #2
0
 private void generateBarList() {
   int x = yAxisXPosition + xCellLength;
   mPaint.setColor(Color.GRAY);
   barList.clear();
   int top;
   int bottom;
   for (int count = dataList.size(), i = count - 1; i >= 0; i--) {
     DashboardDataModel model = dataList.get(i);
     int y =
         (int)
             (model.getWithdrawals()
                 / (maximumWithdrawal - minimumWithdrawal)
                 * (yAxisEndYPosition - yAxisStartYPosition));
     if (y >= 0) {
       top = xAxisYPosition - y;
       bottom = xAxisYPosition;
     } else {
       top = xAxisYPosition;
       bottom = xAxisYPosition - y;
     }
     Bar bar = new Bar(x, top, bottom);
     bar.withdrawal = model.getWithdrawals();
     bar.xValue = convertDateFormat(model.getLastUpdate());
     bar.yValue = Utils.generateFormatMoney(dollar, model.getWithdrawals());
     barList.add(bar);
     x += xCellLength;
   }
 }
 public void setAccountsModel(AccountsModel mAccountsModel) {
   mAccountInfoTitle.accountName.setText(mAccountsModel.getAccountAlias());
   String money =
       Utils.generateFormatMoney(
           contentView.getContext().getResources().getString(R.string.eur),
           mAccountsModel.getAccountBalance());
   mAccountInfoTitle.account_balance_value.setText(money);
   money =
       Utils.generateFormatMoney(
           contentView.getContext().getResources().getString(R.string.eur),
           mAccountsModel.getAvailableBalance());
   mAccountInfoTitle.available_balance_value.setText(money);
   if (mAccountsModel.getIsPreferred()) {
     mAccountInfoTitle.setPerferredStar(AccountInfoTitle.PAYMENT);
   } else {
     mAccountInfoTitle.isPerferredStar.setVisibility(View.GONE);
   }
 }
예제 #4
0
  public void setData() {

    if (getDepositInfo != null) {
      String present = Utils.generateMoney(getDepositInfo.getShares().getPercentage());
      String value = Utils.generateMoney(getDepositInfo.getShares().getValue());
      if (getDepositInfo.getShares().getValue() > 0) {}

      value =
          Utils.generateFormatMoney(
              getContext().getResources().getString(R.string.dollar),
              getDepositInfo.getShares().getValue());
      shares.setText(value + "(" + present + "%)");

      present = Utils.generateMoney(getDepositInfo.getBonds().getPercentage());
      value =
          Utils.generateFormatMoney(
              getContext().getResources().getString(R.string.dollar),
              getDepositInfo.getBonds().getValue());
      bonds.setText(value + "(" + present + "%)");

      present = Utils.generateMoney(getDepositInfo.getFunds().getPercentage());
      value =
          Utils.generateFormatMoney(
              getContext().getResources().getString(R.string.dollar),
              getDepositInfo.getFunds().getValue());
      funds.setText(value + "(" + present + "%)");

      present = Utils.generateMoney(getDepositInfo.getOtherSecurities().getPercentage());
      value =
          Utils.generateFormatMoney(
              getContext().getResources().getString(R.string.dollar),
              getDepositInfo.getOtherSecurities().getValue());
      more.setText(value + "(" + present + "%)");

      value =
          Utils.generateFormatMoney(
              getContext().getResources().getString(R.string.dollar),
              getDepositInfo.getPortfolioValue());
      port.setText(value);
    }
  }
예제 #5
0
  @Override
  protected void initPosition() {
    super.initPosition();
    screen_height = getMeasuredHeight();
    screen_width = getMeasuredWidth();
    int count = dataList.size();

    double sum = 0;
    double withdrawal = 0;
    double min = Integer.MAX_VALUE;
    double max = -Integer.MAX_VALUE;
    for (int i = 0; i < count; i++) {
      withdrawal = dataList.get(i).getWithdrawals();
      sum += withdrawal;
      if (withdrawal > max) {
        max = withdrawal;
      }
      if (withdrawal < min) {
        min = withdrawal;
      }
    }
    averageWithdrawal = (int) sum / count;

    averageText =
        "Average Expenditure on Card: " + Utils.generateFormatMoney(dollar, averageWithdrawal);

    xPaintScale = (int) (screen_height * x_paint_scale);
    yPaintScale = (int) (screen_height * y_paint_scale);

    detailText1Size = (int) (detail_text_1_size * screen_height);
    detailText2Size = (int) (detail_text_2_size * screen_height);
    titleSecondSize = (int) (title_second_size * screen_height);
    titleSecondY = titleLineY + (int) (titleSecondSize * 1.2F);

    yAxisStartYPosition = titleSecondY + padding;
    yAxisEndYPosition = screen_height - padding - 2 * yPaintScale;

    initYValues(max, min);

    yAxisXPosition = getMaxYValueLen() + padding;

    xAxisStartXPosition = yAxisXPosition;
    xAxisEndXPosition = screen_width - padding;

    xCellLength = (int) ((float) (xAxisEndXPosition - xAxisStartXPosition) / (count + 1));

    detailRoundR = (int) (detail_round_r * screen_height);

    generateBarList();
  }