SHARE
TWEET

Untitled

a guest Jan 24th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     private void addMarkerInactive(Department department, Point marker) {
  3.         ImageProvider imageProviderIcon = ImageProvider.fromResource(activity, R.drawable.pin_inactive);
  4.         if (marker != null) {
  5.             String uid = department.getUID();
  6.             ImageProvider imageProvider;
  7.             Department selectedDepartment = isSender ? calculatorData.getReceiverDepartment() : calculatorData.getSenderDepartment();
  8.             String selectedDepartmentUID = selectedDepartment.getUID();
  9.             String selectedKindOfTransportationTypeGuid = calculatorData.getKindOfTransportation().getKindOfTransportationTypeGuid();
  10.             int daysToDeliver = 0;
  11.             if (selectedKindOfTransportationTypeGuid.equals(Kind.AUTO.guid)) {
  12.                 daysToDeliver = calculatorData.getAutoDaysMax();
  13.             } else if (selectedKindOfTransportationTypeGuid.equals(Kind.AVIA.guid)) {
  14.                 daysToDeliver = calculatorData.getAviaDaysMax();
  15.             }
  16.  
  17.             List<TransportationDepartments> list = new ArrayList<>();
  18.             for (TransportationDepartments transportationDepartments : transportationDepartments) {
  19.                 Department sourceDepartment = transportationDepartments.getSourceDepartment();
  20.                 Department targetDepartment = transportationDepartments.getTargetDepartment();
  21.                 if (isSender) {
  22.                     if (targetDepartment.getUID().equals(selectedDepartmentUID) && sourceDepartment.getUID().equals(uid)) {
  23.                         list.add(transportationDepartments);
  24.                     }
  25.  
  26.                 } else {
  27.                     if (sourceDepartment.getUID().equals(selectedDepartmentUID) && targetDepartment.getUID().equals(uid)) {
  28.                         list.add(transportationDepartments);
  29.                     }
  30.                 }
  31.             }
  32.             PlacemarkMapObject e;
  33.             Money dueAmount = new Money("0.0", "6bc73ea8-a8b6-11dc-adc5-0017085a0478");
  34.             Money dueAmountOversized = new Money("0.0", "6bc73ea8-a8b6-11dc-adc5-0017085a0478");
  35.             int days = 0;
  36.             for (TransportationDepartments transportationDepartments : list) {
  37.                 ArrayList<CalculateTransportationRate> transportationRate = transportationDepartments.getTransportationRate();
  38.  
  39.                 for (CalculateTransportationRate rate : transportationRate) {
  40.                     String kindOfTransportationTypeGuid = rate.getKindOfTransportation().getKindOfTransportationTypeGuid();
  41.                     if (kindOfTransportationTypeGuid.equals(selectedKindOfTransportationTypeGuid)) {
  42.                         dueAmount = rate.getDueAmount();
  43.                         dueAmountOversized = rate.getDueAmountOversized();
  44.                         days = Collections.max(rate.getCountDays());
  45.                     }
  46.                 }
  47.             }
  48.  
  49.             dueAmount = !isSender ? dueAmountOversized : dueAmount;
  50.  
  51.             int diffDays = days == 0 ? 0 : days - daysToDeliver;
  52.             if (isSender) {
  53.                 if (diffDays != 0 || dueAmount.getPrice() > 0) {
  54.                     Bitmap bitmap1 = makePaidViewBitmap(dueAmount, diffDays);
  55.                     imageProvider = ImageProvider.fromBitmap(bitmap1);
  56.                     e = mapFragment.ui.map.getMap().getMapObjects().addPlacemark(marker,
  57.                             imageProvider);
  58.                     e.setUserData(department);
  59.                     e.addTapListener(this);
  60.                 } else {
  61.                     Bitmap bitmap1 = makeEmptyViewBitmap();
  62.                     imageProvider = ImageProvider.fromBitmap(bitmap1);
  63.                     e = mapFragment.ui.map.getMap().getMapObjects().addPlacemark(marker,
  64.                             imageProvider);
  65.                     e.setUserData(department);
  66.                     e.addTapListener(this);
  67.                 }
  68.             } else {
  69.                 if (diffDays != 0 || dueAmount.getPrice() > 0) {
  70.                     Bitmap bitmap = makePaidViewBitmap(dueAmount, diffDays);
  71.                     imageProvider = ImageProvider.fromBitmap(bitmap);
  72.                     e = mapFragment.ui.map.getMap().getMapObjects().addPlacemark(marker,
  73.                             imageProvider);
  74.                     e.setUserData(department);
  75.                     e.addTapListener(this);
  76.                 } else {
  77.                     Bitmap bitmap1 = makeEmptyViewBitmap();
  78.                     imageProvider = ImageProvider.fromBitmap(bitmap1);
  79.                     e = mapFragment.ui.map.getMap().getMapObjects().addPlacemark(marker,
  80.                             imageProvider);
  81.                     e.setUserData(department);
  82.                     e.addTapListener(this);
  83.                 }
  84.             }
  85.         }
  86.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top