@SuppressWarnings("unchecked") @Override public void onClick(View view) { StringBuilder location = new StringBuilder(); if (cityTextView.getText().toString().length() > 0) location.append(cityTextView.getText().toString()).append(", "); if (stateEditText.getText().toString().length() > 0) location.append(stateEditText.getText().toString()).append(", "); if (zipCodeEditText.getText().toString().length() > 0) location.append(zipCodeEditText.getText().toString()).append(", "); if (addressLineOneEditText.getText().toString().length() > 0) location.append(addressLineOneEditText.getText().toString()).append(", "); if (addressLineTwoEditText.getText().toString().length() > 0) location.append(addressLineTwoEditText.getText().toString()).append(", "); if (selectedCountry != null) location.append(selectedCountry.getCountry()).append("."); if (location.length() > 0) { List<String> locations = (List<String>) appSession.getData(FragmentsCommons.LOCATION_LIST); int pos = locations.size() - 1; if (locations.get(pos).equals("settings")) { locations.remove(pos); locations.add(location.toString()); for (String loc : locations) { try { moduleManager.createNewLocation(loc, appSession.getAppPublicKey()); } catch (CantCreateLocationPurchaseException ignore) { } } changeActivity( Activities.CBP_CRYPTO_CUSTOMER_WALLET_SETTINGS_MY_LOCATIONS, appSession.getAppPublicKey()); } if (locations.get(pos).equals("wizard")) { locations.remove(pos); locations.add(location.toString()); for (String loc : locations) { try { moduleManager.createNewLocation(loc, appSession.getAppPublicKey()); } catch (CantCreateLocationPurchaseException ignore) { } } changeActivity( Activities.CBP_CRYPTO_CUSTOMER_WALLET_SET_LOCATIONS, appSession.getAppPublicKey()); } } else { Toast.makeText(getActivity(), R.string.ccw_need_to_set_the_fields, Toast.LENGTH_LONG).show(); } }
private void setupUIData() { // digitalAsset = (DigitalAsset) appSession.getData("asset_data"); String digitalAssetPublicKey = ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey(); try { digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey); } catch (CantLoadWalletException e) { e.printStackTrace(); } toolbar.setTitle(digitalAsset.getName()); // if (digitalAsset.getImage() != null) { // assetRedeemImage.setImageBitmap(BitmapFactory.decodeStream(new // ByteArrayInputStream(digitalAsset.getImage()))); // } else { // // assetRedeemImage.setImageDrawable(rootView.getResources().getDrawable(R.drawable.img_asset_without_image)); // } byte[] img = (digitalAsset.getImage() == null) ? new byte[0] : digitalAsset.getImage(); BitmapWorkerTask bitmapWorkerTask = new BitmapWorkerTask(assetRedeemImage, res, R.drawable.img_asset_without_image, false); bitmapWorkerTask.execute(img); // todo comment to be able to compile assetRedeemNameText.setText(digitalAsset.getName()); // assetsToRedeemEditText.setText(digitalAsset.getAvailableBalanceQuantity() + ""); assetsToRedeemEditText.setText(selectedRPCount + ""); long quantity = digitalAsset.getAvailableBalanceQuantity(); assetRedeemRemainingText.setText( quantity + ((quantity == 1) ? " Asset" : " Assets") + " Remaining"); }
@Override public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreateView(inflater, container, savedInstanceState); View layout = inflater.inflate(R.layout.ccw_fragement_create_new_location, container, false); countries = Country.values(); ArrayAdapter<String> adapter = new ArrayAdapter<>( getActivity(), R.layout.ccw_spinner_item, getListOfCountryNames(countries)); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); final Spinner countrySpinner = (Spinner) layout.findViewById(R.id.ccw_country_spinner); countrySpinner.setOnItemSelectedListener(this); countrySpinner.setAdapter(adapter); cityTextView = (FermatEditText) layout.findViewById(R.id.ccw_city_edit_text); stateEditText = (FermatEditText) layout.findViewById(R.id.ccw_state_edit_text); zipCodeEditText = (FermatEditText) layout.findViewById(R.id.ccw_zip_code_edit_text); addressLineOneEditText = (FermatEditText) layout.findViewById(R.id.ccw_address_line_1_edit_text); addressLineTwoEditText = (FermatEditText) layout.findViewById(R.id.ccw_address_line_2_edit_text); stateTextCount = (FermatTextView) layout.findViewById(R.id.ccw_state_edit_text_count); cityTextCount = (FermatTextView) layout.findViewById(R.id.ccw_city_edit_text_count); address1TextCount = (FermatTextView) layout.findViewById(R.id.ccw_address_line_1_edit_text_count); address2TextCount = (FermatTextView) layout.findViewById(R.id.ccw_address_line_2_edit_text_count); // Limit max length, add textWatchers cityTextView.setFilters(new InputFilter[] {new InputFilter.LengthFilter(MAX_LENGTH_CITY)}); stateEditText.setFilters(new InputFilter[] {new InputFilter.LengthFilter(MAX_LENGTH_STATE)}); addressLineOneEditText.setFilters( new InputFilter[] {new InputFilter.LengthFilter(MAX_LENGTH_ADDRESS)}); addressLineTwoEditText.setFilters( new InputFilter[] {new InputFilter.LengthFilter(MAX_LENGTH_ADDRESS)}); cityTextView.addTextChangedListener(cityTextWatcher); stateEditText.addTextChangedListener(stateTextWatcher); addressLineOneEditText.addTextChangedListener(address1TextWatcher); addressLineTwoEditText.addTextChangedListener(address2TextWatcher); cityTextCount.setText(String.valueOf(MAX_LENGTH_CITY)); stateTextCount.setText(String.valueOf(MAX_LENGTH_STATE)); address1TextCount.setText(String.valueOf(MAX_LENGTH_ADDRESS)); address2TextCount.setText(String.valueOf(MAX_LENGTH_ADDRESS)); layout.findViewById(R.id.ccw_create_new_location_button).setOnClickListener(this); moduleManager = appSession.getModuleManager(); configureToolbar(); return layout; }
private void refreshUIData() { String digitalAssetPublicKey = ((DigitalAsset) appSession.getData("asset_data")).getAssetPublicKey(); try { digitalAsset = Data.getDigitalAsset(moduleManager, digitalAssetPublicKey); } catch (CantLoadWalletException e) { e.printStackTrace(); } assetRedeemNameText.setText(digitalAsset.getName()); // assetsToDeliverEditText.setText(digitalAsset.getAvailableBalanceQuantity()+""); assetsToRedeemEditText.setText(selectedRPCount + ""); assetRedeemRemainingText.setText( digitalAsset.getAvailableBalanceQuantity() + " " + getResources().getString(R.string.dap_user_wallet_remaining_assets)); if (digitalAsset.getAvailableBalanceQuantity() == 0) { selectRPButton.setOnClickListener(null); } }