| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package com.usai.apex;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import com.usai.apex.ShipMap.ShipMap;
- import org.json.JSONException;
- import org.json.JSONObject;
- public class TestActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_test);
- String test = "{\n" +
- " \"title\":\"SH - PT. WANGSA MANUNGGAL JAYA PERKASA\",\n" +
- " \"icon\":\"status_vd\",\n" +
- " \"serial_no\":\"85625278dbaae299ffbbd10ee22cf875\",\n" +
- " \"hbol\":\"A1805340018\",\n" +
- " \"description\":\"A1805340018(1 containers)\",\n" +
- " \"detail\":\"Vessel Departure; IDSUB (SURABAYA, INDONESIA 2018-05-05)\",\n" +
- " \"date\":\"05/05/2018 - 06/02/2018\",\n" +
- " \"port\":\"IDSUB - USOAK\",\n" +
- " \"transport_stage\":\"3\",\n" +
- " \"locations\":{\n" +
- " \"por\":{\n" +
- " \"icon\":\"\",\n" +
- " \"lat\":\"-7.2000000000\",\n" +
- " \"lon\":\"112.7333333333\",\n" +
- " \"name\":\"SURABAYA\",\n" +
- " \"addr\":\"\"\n" +
- " },\n" +
- " \"pol\":{\n" +
- " \"icon\":\"\",\n" +
- " \"lat\":\"-7.2000000000\",\n" +
- " \"lon\":\"112.7333333333\",\n" +
- " \"name\":\"SURABAYA\",\n" +
- " \"addr\":\"\"\n" +
- " },\n" +
- " \"pod\":{\n" +
- " \"icon\":\"\",\n" +
- " \"lat\":\"37.7978400000\",\n" +
- " \"lon\":\"-122.2864000000\",\n" +
- " \"name\":\"OAKLAND\",\n" +
- " \"addr\":\"\"\n" +
- " }\n" +
- " }\n" +
- " }";
- ShipMap shipMap = findViewById(R.id.ship_map);
- shipMap.setShowPol(true);
- shipMap.setShowPod(true);
- shipMap.setShowPoe(true);
- shipMap.setShowPor(true);
- shipMap.setShowOrigin(true);
- shipMap.setShowDestination(true);
- shipMap.setShowCurrent(true);
- try {
- JSONObject j = new JSONObject(test);
- shipMap.showShipAnnotation(j.getJSONObject("locations"));
- } catch (JSONException e) {
- e.printStackTrace();
- }
- }
- }
|