rudis

Untitled

Aug 26th, 2016
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. @Override
  2. public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
  3.  
  4. switch (parent.getId()) {
  5.  
  6. case R.id.pack_relatives:
  7. Toast.makeText(ProductView.this, "Spinner 2", Toast.LENGTH_SHORT).show();
  8. packspprice=PACK_PRICE.get(position);
  9. packelseprice=PACK_ELSEWHERE.get(position);
  10. packreorderprice=PACK_REORDER.get(position);
  11.  
  12. System.out.println("SELECTED NP"+selnp);
  13.  
  14. break;
  15.  
  16. }
  17. }
  18.  
  19. public void qtyshow()
  20. {
  21.  
  22. final AlertDialog.Builder alert = new AlertDialog.Builder(ProductView.this);
  23.  
  24. alert.setTitle("Select the Qty: ");
  25.  
  26. np = new NumberPicker(ProductView.this);
  27. np.setMaxValue(20); // max value 20
  28. np.setMinValue(1); // min value 0
  29. np.setWrapSelectorWheel(false);
  30.  
  31. np.setValue(mulqty);
  32. alert.setView(np);
  33.  
  34. selnp=np.getValue();
  35.  
  36. alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  37. public void onClick(DialogInterface dialog, int whichButton) {
  38.  
  39.  
  40. if(stnm.equals("0"))
  41. {
  42. System.out.println("STNMS 0");
  43. proqty.setText(String.valueOf(np.getValue())); //set the value to textview
  44. // Do something with value!
  45.  
  46. /* if(packspprice!=null)
  47. {*/
  48. mulprice= Float.parseFloat(packspprice);
  49. /* }
  50. else
  51. {
  52. mulprice=Float.parseFloat(packlist.get(0).getProductPack_SP());
  53. }*/
  54.  
  55. mulqty= np.getValue();
  56. total=mulprice*mulqty;
  57.  
  58. packsp.setText("$" + String.format("%.2f%n", total));
  59.  
  60. System.out.println("price test" + packlist.get(0).getProductPack_SP() + "," + mulprice + "," + mulqty + "," + String.format("%.2f%n", total));
  61.  
  62. /* if(packelseprice!=null)
  63. {*/
  64. mulelseprice= Float.parseFloat(packelseprice);
  65. /* }
  66. else
  67. {
  68. mulelseprice=Float.parseFloat(packlist.get(0).getProductPack_ElseWhere());
  69. }*/
  70.  
  71.  
  72. totalelse=mulelseprice*mulqty;
  73.  
  74. packelsewhere.setText("$" + String.format("%.2f%n", totalelse));
  75. }
  76. else
  77. {
  78. System.out.println("STNMS NOT 0");
  79. proqty.setText(String.valueOf(np.getValue())); //set the value to textview
  80. // Do something with value!
  81.  
  82. /* if (packreorderprice != null) {*/
  83. mulreorderprice = Float.parseFloat(packreorderprice);
  84. /*} else {
  85. mulreorderprice = Float.parseFloat(packlist.get(0).getProductPack_ReorderPrice());
  86. }*/
  87.  
  88. mulqty= np.getValue();
  89. total=mulreorderprice*mulqty;
  90.  
  91. packsp.setText("$" + String.format("%.2f%n", total));
  92.  
  93. System.out.println("price test" + packlist.get(0).getProductPack_SP() + "," + mulreorderprice + "," + mulqty + "," + String.format("%.2f%n", total));
  94.  
  95. /* if(packelseprice!=null)
  96. {*/
  97. mulelseprice= Float.parseFloat(packelseprice);
  98. /*}
  99. else
  100. {
  101. mulelseprice=Float.parseFloat(packlist.get(0).getProductPack_ElseWhere());
  102. }*/
  103. totalelse=mulelseprice*mulqty;
  104.  
  105. packelsewhere.setText("$" + String.format("%.2f%n", totalelse));
  106. }
  107.  
  108.  
  109. }
  110. });
  111.  
  112. alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  113. public void onClick(DialogInterface dialog, int whichButton) {
  114. // Cancel.
  115.  
  116. }
  117. });
  118.  
  119. alert.show();
  120.  
  121.  
  122. }
Add Comment
Please, Sign In to add comment