예제 #1
0
 public String getBeneficiary() {
   String beneficiary = null;
   if (user_my_card_sbtn.isChecked()) {
     Object current = mIbanCardManager.getCurrentItem();
     if (current != null) {
       beneficiary = ((AccountsModel) current).getCardHolder();
     }
   } else {
     beneficiary = beneficiary_name_et.getText().toString();
   }
   return beneficiary;
 }
예제 #2
0
 public String getCardNumber() {
   String result = null;
   if (user_my_card_sbtn.isChecked()) {
     Object current = mIbanCardManager.getCurrentItem();
     if (current != null) {
       result = ((AccountsModel) current).getCardNumber();
       if (result != null && result.length() > 4) {
         result = result.substring(result.length() - 4);
       }
     }
   } else {
     result = iban_et.getText().toString();
   }
   return result;
 }
예제 #3
0
 public boolean isAddPhoneBook() {
   return add_phonebook_sbtn.isChecked()
       && input_benificiary_content.getVisibility() == View.VISIBLE;
 }
예제 #4
0
  void init() {
    onClickListener =
        new OnViewClickListener() {
          @Override
          public void onClick(View v) {
            super.onClick(v);
            switch (v.getId()) {
              case R.id.purpose_currency_ibtn:
                AlertDialog dialog =
                    new AlertDialog.Builder(context)
                        .setIcon(android.R.drawable.ic_dialog_info)
                        .setAdapter(
                            new ListAdapter() {

                              @Override
                              public void unregisterDataSetObserver(DataSetObserver observer) {
                                // TODO Auto-generated method stub

                              }

                              @Override
                              public void registerDataSetObserver(DataSetObserver observer) {
                                // TODO Auto-generated method stub

                              }

                              @Override
                              public boolean isEmpty() {
                                // TODO Auto-generated method stub
                                return false;
                              }

                              @Override
                              public boolean hasStableIds() {
                                // TODO Auto-generated method stub
                                return false;
                              }

                              @Override
                              public int getViewTypeCount() {
                                // TODO Auto-generated method stub
                                return 1;
                              }

                              @Override
                              public View getView(
                                  int position, View convertView, ViewGroup parent) {

                                TextView tv;
                                if (convertView != null) {
                                  tv = (TextView) convertView;
                                } else {
                                  tv = new TextView(context);
                                }
                                String tableNameString =
                                    purposeCurrencyTablesResponseModel
                                        .getTablewrapperList()
                                        .get(position)
                                        .getTableName();
                                tv.setText(tableNameString);
                                return tv;
                              }

                              @Override
                              public int getItemViewType(int position) {
                                // TODO Auto-generated method stub
                                return position;
                              }

                              @Override
                              public long getItemId(int position) {
                                // TODO Auto-generated method stub
                                return position;
                              }

                              @Override
                              public Object getItem(int position) {
                                // TODO Auto-generated method stub
                                return purposeCurrencyTablesResponseModel
                                    .getTablewrapperList()
                                    .get(position);
                              }

                              @Override
                              public int getCount() {
                                // TODO Auto-generated method stub
                                return purposeCurrencyTablesResponseModel
                                    .getTablewrapperList()
                                    .size();
                              }

                              @Override
                              public boolean isEnabled(int position) {
                                // TODO Auto-generated method stub
                                return true;
                              }

                              @Override
                              public boolean areAllItemsEnabled() {
                                // TODO Auto-generated method stub
                                return false;
                              }
                            },
                            new DialogInterface.OnClickListener() {

                              @Override
                              public void onClick(DialogInterface dialog, int which) {
                                purpose_currency_et.setText(
                                    (String)
                                        ((AlertDialog) dialog)
                                            .getListView()
                                            .getAdapter()
                                            .getItem(which));
                                dialog.dismiss();
                              }
                            })
                        .show();
                break;
              case R.id.confirmation_btn:
                onConfirm();
                break;
              case R.id.birth_data_et:
              case R.id.data_ibtn:
                final Calendar calender = Calendar.getInstance();
                new DatePickerDialog(
                        context,
                        new OnDateSetListener() {
                          @Override
                          public void onDateSet(
                              DatePicker view, int year, int monthOfYear, int dayOfMonth) {
                            calender.set(year, monthOfYear, dayOfMonth);
                            setDate(calender.getTimeInMillis());
                          }
                        },
                        calender.get(Calendar.YEAR),
                        calender.get(Calendar.MONDAY),
                        calender.get(Calendar.DATE))
                    .show();
                break;
              default:
                break;
            }
          }
        };
    super.init();
    tabHost = (TabHost) contentView.findViewById(R.id.tabhost);
    tabHost.setup();
    Button icon = (Button) mLayoutInflater.inflate(R.layout.payment_tab_left_btn, null);
    icon.setText(R.string.phone_top_up_recent_payment_tab_name);
    tabHost.addTab(
        tabHost
            .newTabSpec(RECENTPAYMENT_TAB)
            .setIndicator(icon /*, getResources().getDrawable(R.drawable.mumule)*/)
            .setContent(R.id.tab1));

    icon = (Button) mLayoutInflater.inflate(R.layout.payment_tab_right_btn, null);
    icon.setText(R.string.phone_top_up_new_payment_tab_name);
    tabHost.addTab(tabHost.newTabSpec(NEWPAYMENT_TAB).setIndicator(icon).setContent(R.id.tab2));
    tabHost.setCurrentTab(1);
    recent_content = (TableLayout) contentView.findViewById(R.id.recent_content);
    user_my_card_sbtn = (SwitchButton) contentView.findViewById(R.id.user_my_card_sbtn);
    user_my_card_sbtn.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            showInputBeneficiary(!isChecked);
            onCheckForConfirm(false);
          }
        });
    beneficiary_rg = (TableLayout) contentView.findViewById(R.id.beneficiary_rg);
    input_benificiary_content = contentView.findViewById(R.id.input_benificiary_content);
    beneficiary_name_et = (AutoCompleteTextView) contentView.findViewById(R.id.name_et);
    beneficiary_name_et.postDelayed(
        new Runnable() {

          @Override
          public void run() {
            // TODO Auto-generated method stub
            beneficiary_name_et.setText("");
          }
        },
        3000);
    beneficiary_name_et.addTextChangedListener(confirmTextChangeListener);
    beneficiary_name_et.setOnEditorActionListener(
        new OnEditorActionListener() {

          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            iban_et.setFocusable(true);
            iban_et.requestFocus();
            iban_et.setFocusableInTouchMode(true);
            return true;
          }
        });
    beneficiary_ibtn = (ImageButton) contentView.findViewById(R.id.phonebook_btn);
    iban_et = (EditText) contentView.findViewById(R.id.phone_et);
    iban_et.postDelayed(
        new Runnable() {

          @Override
          public void run() {
            // TODO Auto-generated method stub
            iban_et.setText("");
          }
        },
        3000);
    iban_et.addTextChangedListener(confirmTextChangeListener);
    add_phonebook_sbtn = (SwitchButton) contentView.findViewById(R.id.add_phonebook_sbtn);
    add_phonebook_sbtn.setOnCheckedChangeListener(this);
    currency_tv = (TextView) contentView.findViewById(R.id.currency_tv);
    currency_tv.setText(NewPaymentDataUtils.getCurrency());
    amount_et = (EditText) contentView.findViewById(R.id.amount_et);
    amount_et.addTextChangedListener(confirmTextChangeListener);
    new AmountItalyInputFilter(amount_et, null);
    description_of_payment_et = (EditText) contentView.findViewById(R.id.description_of_payment_et);
    description_of_payment_et.setOnEditorActionListener(
        new OnEditorActionListener() {

          @Override
          public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            KeyBoardUtils.hideSoftInputFromWindow(
                context, description_of_payment_et.getWindowToken());
            return false;
          }
        });
    description_of_payment_et.addTextChangedListener(confirmTextChangeListener);
    des_length_alerter_tv = (TextView) contentView.findViewById(R.id.des_length_alerter_tv);
    mDesLimitTextChangedListener =
        new DesLimitTextChangedListener(context, description_of_payment_et, des_length_alerter_tv);
    purpose_currency_liner = (LinearLayout) contentView.findViewById(R.id.purpose_currency_liner);
    purpose_currency_et = (EditText) contentView.findViewById(R.id.purpose_currency_et);
    purpose_currency_et.addTextChangedListener(confirmTextChangeListener);
    purpose_currency_ibtn = (ImageButton) contentView.findViewById(R.id.purpose_currency_ibtn);
    purpose_currency_ibtn.setOnClickListener(onClickListener);

    birth_date_container = (LinearLayout) contentView.findViewById(R.id.birth_date_container);
    birth_data_et = (EditText) birth_date_container.findViewById(R.id.birth_data_et);
    data_ibtn = (ImageButton) birth_date_container.findViewById(R.id.data_ibtn);
    birth_data_et.setOnClickListener(onClickListener);
    data_ibtn.setOnClickListener(onClickListener);

    confirmation_btn = (Button) contentView.findViewById(R.id.confirmation_btn);
    confirmation_btn.setOnClickListener(mOnConfirmClickListener);
    confirmation_btn.setOnTouchListener(mOnConfirmTouchListener);
    mDesLimitTextChangedListener.setDestriptionMaxLenth(DES_LENGTH_OFF);
  }