void UploadDocument() { if (llPhotoRow.getChildCount() <= 0 && documentList.size() <= 0) { Util.showToastMessage(mContext, "Please upload a document first", Toast.LENGTH_LONG); } else if (documentList != null && documentList.size() > 0 && (documentList.get(0).contains("/"))) { relProgress.setVisibility(View.VISIBLE); UploadAllFilesTask uploadFiles = new UploadAllFilesTask(); uploadFiles.context = mContext; // uploadFiles.szFileName = "iqra"; // uploadFiles.szFilePath = // Environment.getExternalStorageDirectory() // + "/apk/iqra.jpg";// "/sdcard/apk/pic.jpg"; uploadFiles.execute(); } else { if (isDeleteSuccess && llPhotoRow.getChildCount() >= 1) { Util.setIsDocumentsUploaded(mContext, true); finish(); Intent tutorialIntent = new Intent(mContext, TutorialActivity.class); if (bIsFromRegistration) tutorialIntent.putExtra(Constants.FROM_REGISTRATION_COMPLETE, true); startActivity(tutorialIntent); } else { Util.showToastMessage(mContext, "Please upload a document first", Toast.LENGTH_LONG); } // Util.showToastMessage(mContext, "No new document to upload", // Toast.LENGTH_LONG); } }
@Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); if (result.equals("success")) { Util.showToastMessage(_context, "Link sent successfully", Toast.LENGTH_LONG); } else { Util.showToastMessage(_context, "Error occured, Please try again", Toast.LENGTH_LONG); } }
void walkupPayment() { szEmailPhoneNumber = etEmailOrNumber.getText().toString().trim(); if (szEmailPhoneNumber.isEmpty()) { if (isEmailSelected) { Util.showToastMessage(Util.mContext, "Please enter email address", Toast.LENGTH_LONG); } else if (isSMSselected) { Util.showToastMessage( Util.mContext, "Please enter mobile number for SMS", Toast.LENGTH_LONG); } } else { if (isEmailSelected && !szEmailPhoneNumber.matches(Constants.EMAIL_PATTERN)) { Util.showToastMessage( Util.mContext, "Please enter a valid email address", Toast.LENGTH_LONG); } else if (isSMSselected && szEmailPhoneNumber.length() < 10) { Util.showToastMessage( Util.mContext, "Please enter a valid mobile number", Toast.LENGTH_LONG); } else { sReceiptType = ""; if (isEmailSelected) { sReceiptType = "email"; } else if (isSMSselected) { sReceiptType = "sms"; } else { sReceiptType = "none"; } if (mBundle != null && mBundle.containsKey(Constants.JOB_ID) && mBundle.getString(Constants.JOB_ID) != null && !mBundle.getString(Constants.JOB_ID).isEmpty()) { sJobId = mBundle.getString(Constants.JOB_ID); } if (sJobId.isEmpty()) { // for walk up jobs if (isEmailSelected) { sMobileNo = ""; sInternationalNo = ""; sEmail = szEmailPhoneNumber; } else if (isSMSselected) { sMobileNo = szEmailPhoneNumber; if (AppValues.driverDetails != null && AppValues.driverDetails.getInternationalCode() != null) sInternationalNo = AppValues.driverDetails.getInternationalCode(); sEmail = ""; } sPickUp = ""; sDropOff = ""; } ProceedWithSendURL(); } } }
@Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); if (pDialog != null) pDialog.dismiss(); if (result.contains("success")) { Util.showToastMessage(Util.mContext, "Payment done successfully", Toast.LENGTH_LONG); } else { Log.e(TAG, "Error fetching data: " + result); Toast.makeText(Util.mContext, result, Toast.LENGTH_LONG).show(); } // Pass value of // {"response":"success","cashbackValue":0,"bookingId":246} if (mHandler != null) { Message msg = Message.obtain(); Bundle b = new Bundle(); b.putBoolean("success", true); b.putString("jobId", jobId); b.putLong("cashBackReturned", cashBackReturned); Log.e(TAG, "b: " + b.toString()); msg.setData(b); msg.what = 2; mHandler.sendMessage(msg); // mHandler.sendEmptyMessage(2); } }
void ProceedWithSendURL() { sMeterValue = mBundle.getString(Constants.METER_VALUE); sTipValue = mBundle.getString(Constants.TIP_VALUE); sCardFees = mBundle.getString(Constants.CARD_FEE_VALUE); sTotalAmt = mBundle.getString(Constants.TOTAL_VALUE); if (NetworkUtil.isNetworkOn(Util.mContext)) { rlWalkUpLayout.setVisibility(View.GONE); rlResendLayout.setVisibility(View.VISIBLE); SendURLforPaymentTask sendURLTask = new SendURLforPaymentTask(); sendURLTask.szMeterValue = sMeterValue; sendURLTask.szTipValue = sTipValue; sendURLTask.szCardFees = sCardFees; sendURLTask.szTotalAmt = sTotalAmt; sendURLTask.szJobId = sJobId; sendURLTask.szReceiptType = sReceiptType; sendURLTask.szMobileNumber = sMobileNo; sendURLTask.szInternationalCode = sInternationalNo; sendURLTask.szEmail = sEmail; sendURLTask.szPickUpAddress = sPickUp; sendURLTask.szDropOffAddress = sDropOff; sendURLTask.currency = AppValues.driverSettings.getCurrencySymbol(); sendURLTask.currencyCode = AppValues.driverSettings.getCurrencyCode(); sendURLTask.execute(); } else { Util.showToastMessage( _context, getResources().getString(R.string.no_network_error), Toast.LENGTH_LONG); } }
@Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); // etEmailOrNumber.setText(""); if (result.equals("true")) { Util.showToastMessage(_context, "Payment done successfully", Toast.LENGTH_LONG); /* on success redirect to jobs screen */ finish(); Fragment fragment = null; fragment = new com.android.cabapp.fragments.JobsFragment(); ((MainActivity) Util.mContext).setSlidingMenuPosition(Constants.JOBS_FRAGMENT); if (fragment != null) ((MainActivity) Util.mContext).replaceFragment(fragment, true); } else if (result.equals("false")) { Util.showToastMessage(_context, "Your payment has not received", Toast.LENGTH_LONG); } else { Util.showToastMessage(_context, "Error occured, Please try again", Toast.LENGTH_LONG); } }
@Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); if (progressUploadDocument != null) progressUploadDocument.dismiss(); // On delete of any document ivBack.setVisibility(View.GONE); isDeleteSuccess = true; if (result != null && result.equals("success")) { llPhotoRow.removeView(docDetails.view); documentList.remove(docDetails.szDocumentID); } else Util.showToastMessage(mContext, result, Toast.LENGTH_LONG); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent intent) { String imagePath = ""; String fileName = ""; long file_size = 0; if (resultCode == RESULT_OK) { if (requestCode == TAKE_PHOTO_REQUEST) { // camera picture imagePath = cameraFile.getPath(); file_size = Integer.parseInt(String.valueOf(cameraFile.length() / 1024)); if (Constants.isDebug) Log.i(TAG, "Camera Path::> " + imagePath); } else if (requestCode == PICK_PHOTO_REQUEST) { // gallery Uri selectedImageUri = intent.getData(); imagePath = getPath(selectedImageUri); if (Constants.isDebug) Log.i(TAG, "Gallery Path::> " + imagePath); // File galleryFile = new File(imagePath); // file_size = Integer.parseInt(String.valueOf(galleryFile // .length() / 1024)); if (imagePath != null && (imagePath.endsWith("mp4") || imagePath.endsWith("wmv") || imagePath.endsWith("avi"))) { Util.showToastMessage( DocumentUploadActivity.this, "Video file not supported!", Toast.LENGTH_LONG); return; } } if (documentList == null) documentList = new ArrayList<String>(); if (documentList != null && documentList.size() > 0 && documentList.get(0) != null && !documentList.get(0).contains("/")) documentList.clear(); fileName = extractFileNameFromString(imagePath); // Adding new row: LayoutInflater inflater = LayoutInflater.from(getBaseContext()); viewAddPhoto = inflater.inflate(R.layout.row_attached_files, null); TextView tvAttachedFileName = (TextView) viewAddPhoto.findViewById(R.id.tvAttachedFileName); // TextView tvFileSize = (TextView) viewAddPhoto // .findViewById(R.id.tvFileSize); ImageView ivCancel = (ImageView) viewAddPhoto.findViewById(R.id.ivCancel); ImageView ivThumbnail = (ImageView) viewAddPhoto.findViewById(R.id.ivThumbnail); ImageLoader.getInstance().displayImage("file://" + imagePath, ivThumbnail); DocumentDetails details = new DocumentDetails(); details.szFilePath = imagePath; details.view = viewAddPhoto; ivCancel.setTag(details); ivCancel.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub DocumentDetails details = (DocumentDetails) v.getTag(); llPhotoRow.removeView(details.view); documentList.remove(details.szFilePath); } }); tvAttachedFileName.setText(fileName); // if (file_size > 0) { // tvFileSize.setText(String.valueOf(file_size) + " kb"); // } else { // tvFileSize.setText("0 kb"); // } llPhotoRow.addView(viewAddPhoto); documentList.add(imagePath); } else if (resultCode != RESULT_CANCELED) { Util.showToastMessage(mContext, "Sorry, there was an error", Toast.LENGTH_LONG); } }