private void initActionBar() { menu = (ImageButton) findViewById(R.id.btn_menu); filter = (ImageButton) findViewById(R.id.btn_filter); final SimpleSideDrawer mMenu = new SimpleSideDrawer(this); mMenu.setLeftBehindContentView(R.layout.menu); menu.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { mMenu.toggleLeftDrawer(); } }); ImageView menu_top = (ImageView) mMenu.findViewById(R.id.menu_top); if (Utils.isNight()) { menu_top.setBackgroundResource(R.mipmap.menu_topimage_night); } else { menu_top.setBackgroundResource(R.mipmap.menu_topimage_day); } ListView listView = (ListView) mMenu.findViewById(R.id.listView); listView.setAdapter(new MenuAdapter(this)); listView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { switch (position) { case 0: mMenu.toggleLeftDrawer(); break; case 1: startActivity(new Intent(MainActivity.this, SettingActivity.class)); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); break; case 2: startActivity(new Intent(MainActivity.this, AboutActivity.class)); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); break; default: break; } } }); filter.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (filterLayout.getVisibility() == View.VISIBLE) { filterLayout.setVisibility(View.INVISIBLE); } else { filterLayout.setVisibility(View.VISIBLE); } } }); filterImplement(); }
private void updateMarker(LatLng cameraPosition) { if (gasIsCheck) { for (Marker marker : gasData.keySet()) { marker.remove(); } for (int i = 0; i < nodeGas.size(); i++) { if (Utils.getDistance(new LatLng(nodeGas.get(i).lat, nodeGas.get(i).lon), cameraPosition) < 1000) { setGasInfo(nodeGas.get(i)); } } } else { for (Marker marker : gasData.keySet()) { marker.setVisible(false); } } if (parkingLotIsCheck) { for (Marker marker : parkingLotData.keySet()) { marker.remove(); } for (int i = 0; i < nodeParkingLot.size(); i++) { if (Utils.getDistance( new LatLng(nodeParkingLot.get(i).lat, nodeParkingLot.get(i).lon), cameraPosition) < 1000) { setParkingInfo(nodeParkingLot.get(i)); } } } else { for (Marker marker : parkingLotData.keySet()) { marker.setVisible(false); } } if (constructIsCheck) { for (Marker marker : constructData.keySet()) { marker.remove(); } for (int i = 0; i < nodeConstruct.size(); i++) { if (Utils.getDistance( new LatLng(nodeConstruct.get(i).lat, nodeConstruct.get(i).lon), cameraPosition) < 1000) { setConstructInfo(nodeConstruct.get(i)); } } for (Marker marker : trafficData.keySet()) { marker.remove(); } for (int i = 0; i < nodeTraffic.size(); i++) { if (Utils.getDistance( new LatLng(nodeTraffic.get(i).lat, nodeTraffic.get(i).lon), cameraPosition) < 1000) { setTrafficInfo(nodeTraffic.get(i)); } } } else { for (Marker marker : constructData.keySet()) { marker.setVisible(false); } for (Marker marker : trafficData.keySet()) { marker.setVisible(false); } } if (carFlowIsCheck) { mMap.setTrafficEnabled(true); } else { mMap.setTrafficEnabled(false); } }