|
@@ -3,7 +3,7 @@ package com.usai.apex;
|
|
|
import android.app.AlertDialog;
|
|
import android.app.AlertDialog;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
import android.content.DialogInterface;
|
|
import android.content.DialogInterface;
|
|
|
-import android.content.Intent;
|
|
|
|
|
|
|
+
|
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageInfo;
|
|
|
import android.content.pm.PackageManager.NameNotFoundException;
|
|
import android.content.pm.PackageManager.NameNotFoundException;
|
|
|
import android.graphics.Bitmap;
|
|
import android.graphics.Bitmap;
|
|
@@ -23,6 +23,7 @@ import android.view.View;
|
|
|
import android.widget.TextView;
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
import com.baidu.mapapi.map.SupportMapFragment;
|
|
import com.baidu.mapapi.map.SupportMapFragment;
|
|
|
|
|
+import com.usai.apex.servicelocationmap.ApexServiceLocationMapFragment;
|
|
|
import com.usai.redant.rautils.contactkit.Contact;
|
|
import com.usai.redant.rautils.contactkit.Contact;
|
|
|
import com.usai.redant.rautils.contactkit.ContactHelper;
|
|
import com.usai.redant.rautils.contactkit.ContactHelper;
|
|
|
import com.usai.redant.rautils.contactkit.ContactUIHelper;
|
|
import com.usai.redant.rautils.contactkit.ContactUIHelper;
|
|
@@ -34,82 +35,24 @@ import com.usai.redant.rautils.contactkit.element.Photo;
|
|
|
import com.usai.redant.rautils.contactkit.element.PostalAddress;
|
|
import com.usai.redant.rautils.contactkit.element.PostalAddress;
|
|
|
import com.usai.redant.rautils.contactkit.element.WebSite;
|
|
import com.usai.redant.rautils.contactkit.element.WebSite;
|
|
|
|
|
|
|
|
-import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
|
|
|
|
|
-//import com.baidu.mapapi.MKGeneralListener;
|
|
|
|
|
-//import com.baidu.mapapi.map.MKEvent;
|
|
|
|
|
-
|
|
|
|
|
-public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragment.BaiduMarkerClickListener,ServiceLocationFragment.MarkerClickListener
|
|
|
|
|
|
|
+public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragment.BaiduMarkerClickListener,ServiceLocationFragment.MarkerClickListener, ApexServiceLocationMapFragment.ApexServiceLocationMapInfoWindowClickListener
|
|
|
{
|
|
{
|
|
|
-// public static boolean m_bKeyRight = true;
|
|
|
|
|
-// BMapManager mBMapManager = null;
|
|
|
|
|
|
|
|
|
|
-// public String strKey = getString(R.string.baidu_key);//"nqBQoSDbxrslhuzW91uViQX7";//release
|
|
|
|
|
- private static final String LTAG = "test";
|
|
|
|
|
SupportMapFragment map;
|
|
SupportMapFragment map;
|
|
|
-
|
|
|
|
|
boolean m_bhasgoogleframework = true;
|
|
boolean m_bhasgoogleframework = true;
|
|
|
private InnerMapActivity self = this;
|
|
private InnerMapActivity self = this;
|
|
|
|
|
+ private final static boolean USE_APEX_MAP = false;
|
|
|
|
|
|
|
|
-// static class MyGeneralListener implements MKGeneralListener
|
|
|
|
|
-// {
|
|
|
|
|
-//
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public void onGetNetworkState(int iError)
|
|
|
|
|
-// {
|
|
|
|
|
-// if (iError == MKEvent.ERROR_NETWORK_CONNECT)
|
|
|
|
|
-// {
|
|
|
|
|
-// Toast.makeText(
|
|
|
|
|
-// ApexTrackingApplication.get_instance()
|
|
|
|
|
-// .getApplicationContext(),
|
|
|
|
|
-// "????????????????????????", Toast.LENGTH_LONG).show();
|
|
|
|
|
-// }
|
|
|
|
|
-// else if (iError == MKEvent.ERROR_NETWORK_DATA)
|
|
|
|
|
-// {
|
|
|
|
|
-// Toast.makeText(
|
|
|
|
|
-// ApexTrackingApplication.get_instance()
|
|
|
|
|
-// .getApplicationContext(),
|
|
|
|
|
-// "??????????????????????????????", Toast.LENGTH_LONG)
|
|
|
|
|
-// .show();
|
|
|
|
|
-// }
|
|
|
|
|
-// // ...
|
|
|
|
|
-// }
|
|
|
|
|
-//
|
|
|
|
|
-// @Override
|
|
|
|
|
-// public void onGetPermissionState(int iError)
|
|
|
|
|
-// {
|
|
|
|
|
-// // ???????????????key???????????????
|
|
|
|
|
-// if (iError != 0)
|
|
|
|
|
-// {
|
|
|
|
|
-// // ??????Key?????????
|
|
|
|
|
-// Toast.makeText(
|
|
|
|
|
-// ApexTrackingApplication.get_instance()
|
|
|
|
|
-// .getApplicationContext(),
|
|
|
|
|
-// "?????? MyApplication.java???????????????????????????Key,??????????????????????????????????????????error: "
|
|
|
|
|
-// + iError, Toast.LENGTH_LONG).show();
|
|
|
|
|
-// m_bKeyRight = false;
|
|
|
|
|
-// }
|
|
|
|
|
-// else
|
|
|
|
|
-// {
|
|
|
|
|
-// m_bKeyRight = true;
|
|
|
|
|
-// Toast.makeText(
|
|
|
|
|
-// ApexTrackingApplication.get_instance()
|
|
|
|
|
-// .getApplicationContext(), "key????????????",
|
|
|
|
|
-// Toast.LENGTH_LONG).show();
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
|
public boolean onKeyDown(int keyCode, KeyEvent event)
|
|
|
{
|
|
{
|
|
|
if (keyCode == KeyEvent.KEYCODE_BACK)
|
|
if (keyCode == KeyEvent.KEYCODE_BACK)
|
|
|
{
|
|
{
|
|
|
- // Intent myIntent = new Intent();
|
|
|
|
|
- // myIntent = new Intent(EditActivity.this, tabActivity.class);
|
|
|
|
|
- // startActivity(myIntent);
|
|
|
|
|
|
|
+
|
|
|
finish();
|
|
finish();
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -118,7 +61,6 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
|
|
|
@Override
|
|
@Override
|
|
|
public boolean onOptionsItemSelected(MenuItem item)
|
|
public boolean onOptionsItemSelected(MenuItem item)
|
|
|
{
|
|
{
|
|
|
- Intent intent = new Intent();
|
|
|
|
|
switch (item.getItemId())
|
|
switch (item.getItemId())
|
|
|
{
|
|
{
|
|
|
case android.R.id.home:
|
|
case android.R.id.home:
|
|
@@ -140,8 +82,6 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
|
|
|
setTitle("Service Location");
|
|
setTitle("Service Location");
|
|
|
ActionBar actionBar = getSupportActionBar();
|
|
ActionBar actionBar = getSupportActionBar();
|
|
|
actionBar.setCustomView(mActionBarView, lp);
|
|
actionBar.setCustomView(mActionBarView, lp);
|
|
|
-// actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
|
|
|
|
|
-// actionBar.setDisplayShowCustomEnabled(true);
|
|
|
|
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
actionBar.setDisplayHomeAsUpEnabled(true);
|
|
|
|
|
|
|
|
|
|
|
|
@@ -155,11 +95,33 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
|
|
|
{
|
|
{
|
|
|
super.onCreate(savedInstanceState);
|
|
super.onCreate(savedInstanceState);
|
|
|
mContext = this;
|
|
mContext = this;
|
|
|
|
|
+ setCustomActionBar();
|
|
|
|
|
+
|
|
|
|
|
+ if (USE_APEX_MAP) {
|
|
|
|
|
+ setupApexMap();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ setupMap();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void setupApexMap() {
|
|
|
|
|
+
|
|
|
|
|
+ setContentView(R.layout.service_location_map_activity);
|
|
|
|
|
+
|
|
|
|
|
+ ApexServiceLocationMapFragment fragment = new ApexServiceLocationMapFragment();
|
|
|
|
|
+ fragment.setInfoWindowClickListener(this);
|
|
|
|
|
+
|
|
|
|
|
+ FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
|
|
|
|
+ transaction.replace(R.id.service_location_map_fragment,fragment);
|
|
|
|
|
+ transaction.commit();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void setupMap() {
|
|
|
|
|
+
|
|
|
PackageInfo packageInfo;
|
|
PackageInfo packageInfo;
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- packageInfo = this.getPackageManager().getPackageInfo(
|
|
|
|
|
- "com.google.android.gms", 0);
|
|
|
|
|
|
|
+ packageInfo = this.getPackageManager().getPackageInfo("com.google.android.gms", 0);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
catch (NameNotFoundException e)
|
|
catch (NameNotFoundException e)
|
|
@@ -177,13 +139,8 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
|
|
|
m_bhasgoogleframework = true;
|
|
m_bhasgoogleframework = true;
|
|
|
System.out.println("已经安装");
|
|
System.out.println("已经安装");
|
|
|
}
|
|
}
|
|
|
- // setUpMapIfNeeded();
|
|
|
|
|
|
|
|
|
|
// m_bhasgoogleframework = false;
|
|
// m_bhasgoogleframework = false;
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
// m_bhasgoogleframework= true;
|
|
// m_bhasgoogleframework= true;
|
|
|
|
|
|
|
|
Fragment slFragment = null;
|
|
Fragment slFragment = null;
|
|
@@ -192,8 +149,7 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
|
|
|
setContentView(R.layout.activity_inner_map);
|
|
setContentView(R.layout.activity_inner_map);
|
|
|
slFragment = new ServiceLocationFragment();
|
|
slFragment = new ServiceLocationFragment();
|
|
|
((ServiceLocationFragment)slFragment).markerClickListener = this;
|
|
((ServiceLocationFragment)slFragment).markerClickListener = this;
|
|
|
- FragmentTransaction ft = getSupportFragmentManager()
|
|
|
|
|
- .beginTransaction();
|
|
|
|
|
|
|
+ FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
|
|
|
ft.replace(R.id.inner_map, slFragment);
|
|
ft.replace(R.id.inner_map, slFragment);
|
|
|
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
|
ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
|
|
|
ft.addToBackStack("Location");
|
|
ft.addToBackStack("Location");
|
|
@@ -202,56 +158,15 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
-// if (mBMapManager == null)
|
|
|
|
|
-// {
|
|
|
|
|
-// mBMapManager = new BMapManager(getApplicationContext());
|
|
|
|
|
-// /**
|
|
|
|
|
-// * ??????BMapManager???????????????????????????BMapManager
|
|
|
|
|
-// */
|
|
|
|
|
-// mBMapManager.init(strKey, new MyGeneralListener());
|
|
|
|
|
-// }
|
|
|
|
|
-
|
|
|
|
|
-// f.initEngineManager(this);
|
|
|
|
|
setContentView(R.layout.activity_inner_map);
|
|
setContentView(R.layout.activity_inner_map);
|
|
|
-// Log.d(LTAG, "onCreate");
|
|
|
|
|
-// // setContentView(R.layout.activity_main);
|
|
|
|
|
-// map = SupportMapFragment.newInstance();
|
|
|
|
|
BaiduMapFragment f = new BaiduMapFragment();
|
|
BaiduMapFragment f = new BaiduMapFragment();
|
|
|
FragmentManager manager = getSupportFragmentManager();
|
|
FragmentManager manager = getSupportFragmentManager();
|
|
|
- manager.beginTransaction().add(R.id.inner_map, f, "map_fragment")
|
|
|
|
|
- .commit();
|
|
|
|
|
|
|
+ manager.beginTransaction().add(R.id.inner_map, f, "map_fragment").commit();
|
|
|
f.markerClickListener = this;
|
|
f.markerClickListener = this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- setCustomActionBar();
|
|
|
|
|
-
|
|
|
|
|
-// LocationDetail detail = new LocationDetail("Kerry Freight (USA), Inc","3200 NW 67th Ave. Bldg. 3 Suite 390 Miami, FL 33122 Miami","+(305)12345678","+(305)4567890",null,"mario.alfonso@kerrylogistics.com");
|
|
|
|
|
-// markerClicked(detail);
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // @Override
|
|
|
|
|
- // public boolean onCreateOptionsMenu(Menu menu)
|
|
|
|
|
- // {
|
|
|
|
|
- // // Inflate the menu; this adds items to the action bar if it is present.
|
|
|
|
|
- // getMenuInflater().inflate(R.menu.inner_map, menu);
|
|
|
|
|
- // return true;
|
|
|
|
|
- // }
|
|
|
|
|
- // private void setUpMapIfNeeded() {
|
|
|
|
|
- // // Do a null check to confirm that we have not already instantiated the
|
|
|
|
|
- // map.
|
|
|
|
|
- // if (mMap == null) {
|
|
|
|
|
- // // Try to obtain the map from the SupportMapFragment.
|
|
|
|
|
- // mMap = ((SupportMapFragment)
|
|
|
|
|
- // getSupportFragmentManager().findFragmentById(R.id.map))
|
|
|
|
|
- // .getMap();
|
|
|
|
|
- // // Check if we were successful in obtaining the map.
|
|
|
|
|
- // if (mMap != null) {
|
|
|
|
|
- // setUpMap();
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void markerClicked(LocationDetail detail) {
|
|
public void markerClicked(LocationDetail detail) {
|
|
|
|
|
|
|
@@ -396,4 +311,8 @@ public class InnerMapActivity extends AppCompatActivity implements BaiduMapFragm
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onInfoWindowClick(LocationDetail detail) {
|
|
|
|
|
+ markerClicked(detail);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|