Пример #1
1
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (requestCode == 1) {
      if (data.getCharSequenceExtra(SyncDialog.RESULT_FROM_DIALOG)
          .toString()
          .equalsIgnoreCase("ya")) {

        JSONObject outer = new JSONObject();
        JSONArray arrItems = new JSONArray();
        try {
          outer.put("user_id", Contents.getLogInfo().getUserid());
          for (int i = 0; i < m_orders.size(); i++) {
            pemesananDTO penjualan = m_orders.get(i);
            arrItems.put(penjualan.toJSON());
          }
          outer.put("po", arrItems);
        } catch (JSONException e) {
          System.out.println(e);
        }
        dialog =
            ProgressDialog.show(ListPemesanan.this, "", "Mengirim data. Mohon tunggu...", true);

        HttpRequest.instance()
            .request(
                dialog, ListPemesanan.this, Contents.urlServer + "po/syncpo", outer.toString(), 0);
      }
    }
  }
Пример #2
0
  public void journeyCheckout(JourneyDTO _selJourney) {
    final Calendar dd = Calendar.getInstance();
    JourneyDTO jc;
    SimpleDateFormat da = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH);
    _journeyDB = new DBJourneyCycle(this, Contents.getDBHelper().getDB());
    _journey.setType("checkout");
    _journeyDB.insert(_journey);
    jc = _journeyDB.selectByChannelIdandType(_journey.getChannelId(), "checkout");
    _journey.setId(jc.getId());
    if (jc != null) {
      _journeyDB.setChecked(jc.getId(), jc.getType(), jc.getParring_id());
      _journeyDB.setCheckInDate(jc.getId(), String.valueOf(da.format(dd.getTime())));
      Calendar now = Calendar.getInstance();
      int hour = now.get(Calendar.HOUR_OF_DAY);
      int minute = (int) (now.get(Calendar.MINUTE) - Contents.track_interval);
      int sec = now.get(Calendar.SECOND);
      int day = now.get(Calendar.DAY_OF_MONTH);
      int month = now.get(Calendar.MONTH);
      int year = now.get(Calendar.YEAR);

      Date lastupdate = Contents.lastupdate;
      Date date_now =
          parseDate(year + "-" + month + "-" + day + " " + hour + ":" + (minute - 2) + ":" + sec);
      lastupdate = Contents.lastupdate;

      if (lastupdate != null) {
        if (date_now.before(lastupdate)) {
          _journey.setLatitude(Double.toString(Contents.lattitude));
          _journey.setLongitude(Double.toString(Contents.longitude));
          _journey.setAcc(Double.toString(Contents.acc));
        } else {
          _journey.setLatitude("0");
          _journey.setLongitude("0");
          _journey.setAcc("0");
        }
      } else {
        _journey.setLatitude("0");
        _journey.setLongitude("0");
        _journey.setAcc("0");
      }

      _journeyDB.setlonglat(
          jc.getId(), _journey.getLongitude(), _journey.getLatitude(), _journey.getAcc());
      if (isOnline()) {
        _journey.setUserId(Contents.getLogInfo().getUserId());
        _journey.setKeyword(Contents.getLogInfo().getKeyword());
        dialog = ProgressDialog.show(SGSMenu.this, "", "Mengirim data. Mohon tunggu...", true);
        HttpRequest.instance()
            .request(
                dialog,
                SGSMenu.this,
                Contents.URL_SERVER + "updatejourney",
                _journey.toJSONCheckin(),
                0);
      }
    }
  }
Пример #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.lte_coverage);

    dialog = new ProgressDialog(MapsLteCoverage.this);

    newarkBounds =
        new LatLngBounds(new LatLng(-11.878127, 94.662194), new LatLng(8.559047, 125.647806));

    bitmapDescriptor = BitmapDescriptorFactory.fromResource(R.drawable.lte_coverage_mobile);

    if (isOnline()) {

      dialog = ProgressDialog.show(MapsLteCoverage.this, "", "Loading. Please wait...", true);
      dialog.setCancelable(true);

      ImageView imageView = new ImageView(this);
      imageView.setTag(Contents.urlServerFoto + "file/images/icongis/lte_coverage2.png");
      new DownloadImagesTask().execute(imageView);

      String url = Contents.urlServer + "bts/get_latlng_bounds_lte_coverage";
      HttpRequest.instance()
          .request(
              dialog, MapsLteCoverage.this, url, "user_id=" + Contents.getLogInfo().getUserid(), 0);

    } else {
      if (dialog.isShowing()) dialog.dismiss();
      Toast.makeText(
              getApplicationContext(), "Tidak Dapat Terhubung Ke Jaringan", Toast.LENGTH_SHORT)
          .show();

      getMap();
      getCoverage();
      handleIntent(this.getIntent());
    }
  }
Пример #4
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.poineload);

    tipepoinspinner = (Spinner) findViewById(R.id.tipe_poin);
    JumlahPoin = (EditText) findViewById(R.id.jumlah_poin);
    JumlahPoinSell = (TextView) findViewById(R.id.jumlahPoinSell);
    JumlahPoinActivation = (TextView) findViewById(R.id.jumlahPoinActivation);

    if (isOnline()) {

      dialog = ProgressDialog.show(PoinCash.this, "", "Mengirim data. Mohon tunggu...", true);
      dialog.setCancelable(true);
      String url = Contents.urlServer + "poin/get_poin";
      HttpRequest.instance()
          .request(dialog, PoinCash.this, url, "user_id=" + Contents.getLogInfo().getUserid(), 1);

    } else {
      showMessage("Tidak Dapat Terhubung Ke Jaringan");
    }

    List tipePoin = new ArrayList();
    tipePoin.add("Sell Poin");
    tipePoin.add("Activation Poin");

    ArrayAdapter tipepoinAdapter =
        new ArrayAdapter(this, android.R.layout.simple_spinner_item, tipePoin);
    tipepoinAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    tipepoinspinner.setAdapter(tipepoinAdapter);

    // Spinner click listener
    tipepoinspinner.setOnItemSelectedListener(
        new OnItemSelectedListener() {

          public void onItemSelected(AdapterView parent, View view, int position, long id) {
            // On selecting a spinner item
            String item = parent.getItemAtPosition(position).toString();
            // TipePoinSekarang = item;
            Log.d(tag, "Spinner yang dipilih : " + item);

            if (item.equals("Sell Poin")) {
              TipePoinSekarang = "1";
              Log.d(tag, "Number spinner yang dipilih : " + TipePoinSekarang);
            } else {
              TipePoinSekarang = "2";
              Log.d(tag, "Number spinner yang dipilih : " + TipePoinSekarang);
            }
          }

          public void onNothingSelected(AdapterView arg0) {
            // TODO Auto-generated method stub

          }
        });

    Button bsubmit = (Button) findViewById(R.id.b_submit);
    bsubmit.setOnClickListener(
        new OnClickListener() {

          public void onClick(View arg0) {

            if (JumlahPoin.getText().toString().equals("")) {
              showMessage("Silakan Masukkan Jumlah Poin yang Akan Ditukar");
            } else {
              if (isOnline()) {

                Log.d(
                    tag,
                    "jumlah poin edit text : " + Integer.parseInt(JumlahPoin.getText().toString()));
                Log.d(
                    tag,
                    "jumlah poin sell int : "
                        + Integer.parseInt(JumlahPoinSell.getText().toString()));
                Log.d(
                    tag,
                    "jumlah poin activation int : "
                        + Integer.parseInt(JumlahPoinActivation.getText().toString()));

                if (TipePoinSekarang == "1") {
                  if (Integer.parseInt(JumlahPoin.getText().toString())
                      > Integer.parseInt(JumlahPoinSell.getText().toString())) {
                    showMessage("Sell Poin anda tidak mencukupi");
                  } else {
                    dialog =
                        ProgressDialog.show(
                            PoinCash.this, "", "Mengirim data. Mohon tunggu...", true);

                    Log.d(tag, "Tipe poin sekarang : " + TipePoinSekarang);
                    Log.d(tag, "Jumlah poin sekarang : " + JumlahPoin.getText().toString());
                    Log.d(tag, "User id sekarang : " + Contents.getLogInfo().getUserid());
                    Log.d(tag, "Partner id sekarang : " + Contents.getLogInfo().getPartnerid());
                    String url = Contents.urlServer + "poin/redeem_poin_cash";

                    // showMessage(itm.toJSONsave());
                    HttpRequest.instance()
                        .request(
                            dialog,
                            PoinCash.this,
                            url,
                            "tipe_poin="
                                + TipePoinSekarang
                                + "&jumlah_poin="
                                + JumlahPoin.getText().toString()
                                + "&user_id="
                                + Contents.getLogInfo().getUserid()
                                + "&partner_id="
                                + Contents.getLogInfo().getPartnerid(),
                            0);
                  }
                } else {
                  if (Integer.parseInt(JumlahPoin.getText().toString())
                      > Integer.parseInt(JumlahPoinActivation.getText().toString())) {
                    showMessage("Activation Poin anda tidak mencukupi");
                  } else {
                    dialog =
                        ProgressDialog.show(
                            PoinCash.this, "", "Mengirim data. Mohon tunggu...", true);

                    Log.d(tag, "Tipe poin sekarang : " + TipePoinSekarang);
                    Log.d(tag, "Jumlah poin sekarang : " + JumlahPoin.getText().toString());
                    Log.d(tag, "User id sekarang : " + Contents.getLogInfo().getUserid());
                    Log.d(tag, "Partner id sekarang : " + Contents.getLogInfo().getPartnerid());
                    String url = Contents.urlServer + "poin/redeem_poin_cash";

                    // showMessage(itm.toJSONsave());
                    HttpRequest.instance()
                        .request(
                            dialog,
                            PoinCash.this,
                            url,
                            "tipe_poin="
                                + TipePoinSekarang
                                + "&jumlah_poin="
                                + JumlahPoin.getText().toString()
                                + "&user_id="
                                + Contents.getLogInfo().getUserid()
                                + "&partner_id="
                                + Contents.getLogInfo().getPartnerid(),
                            0);
                  }
                }

              } else {
                showMessage("Tidak Dapat Terhubung Ke Jaringan");
              }
            }
          }
        });
  }