Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void showBottomSheet(String latitude, String longitude, final String address, final GoogleMap mySearchMap, String status, String message, final String location_type, final int position) {
- mySearchMap.clear();
- //google map
- try {
- if (status.equals("not_covered")) {
- Log.e("covered?", "not");
- Log.e("sugestListAddress", "size " + sugestListAddress.size());
- if (sugestListAddress.size() > 0) {
- // Click to Clicked Location
- CameraPosition cameraPosition = new CameraPosition.Builder()
- .target(new LatLng(sugestListAddress.get(position).getLatitude(), sugestListAddress.get(position).getLongitude()))
- .zoom(17) // Zoom levelnya (1:Dunia, 5:benua, 10:kota, 15:jalanan, 20:Gedung)
- .tilt(30) // Diatur kemiringan kameranya sampai 30 derajat
- .build();
- mySearchMap.addMarker(new MarkerOptions().position(new LatLng(sugestListAddress.get(position).getLatitude(), sugestListAddress.get(position).getLongitude())));
- mySearchMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
- LAT = "" + sugestListAddress.get(position).getLatitude();
- LONG = "" + sugestListAddress.get(position).getLongitude();
- ADDRESS = "" + tv_search.getText().toString();
- String address_split[] = ADDRESS.split(",");
- int city_position = address_split.length - 2;
- Log.e("city_value", address_split[city_position - 1]);
- SESSION.setCITY_NAME_NEW(address_split[city_position]);
- } else {
- Geocoder geocoder = new Geocoder(CheckCoverage.this, Locale.getDefault());
- // List<Address> listAddress = geocoder.getFromLocationName(address + " Indonesia", 1);
- List<Address> listAddress = geocoder.getFromLocation(Double.valueOf(latitude), Double.valueOf(longitude), 1);
- // Click to Clicked Location
- if (listAddress.size() >0) {
- CameraPosition cameraPosition = new CameraPosition.Builder()
- .target(new LatLng(listAddress.get(0).getLatitude(), listAddress.get(0).getLongitude()))
- .zoom(17) // Zoom levelnya (1:Dunia, 5:benua, 10:kota, 15:jalanan, 20:Gedung)
- .tilt(30) // Diatur kemiringan kameranya sampai 30 derajat
- .build();
- mySearchMap.addMarker(new MarkerOptions().position(new LatLng(listAddress.get(0).getLatitude(), listAddress.get(0).getLongitude())));
- mySearchMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
- }
- LAT = "" + listAddress.get(0).getLatitude();
- LONG = "" + listAddress.get(0).getLongitude();
- ADDRESS = "" + tv_search.getText().toString();
- }
- } else {
- Geocoder geocoder = new Geocoder(CheckCoverage.this, Locale.getDefault());
- // List<Address> listAddress = geocoder.getFromLocationName(address + " Indonesia", 1);
- List<Address> listAddress = geocoder.getFromLocation(Double.valueOf(latitude), Double.valueOf(longitude), 1);
- // Click to Clicked Location
- if (listAddress.size() >0 ) {
- CameraPosition cameraPosition = new CameraPosition.Builder()
- .target(new LatLng(listAddress.get(0).getLatitude(), listAddress.get(0).getLongitude()))
- .zoom(17) // Zoom levelnya (1:Dunia, 5:benua, 10:kota, 15:jalanan, 20:Gedung)
- .tilt(30) // Diatur kemiringan kameranya sampai 30 derajat
- .build();
- mySearchMap.addMarker(new MarkerOptions().position(new LatLng(listAddress.get(0).getLatitude(), listAddress.get(0).getLongitude())));
- mySearchMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
- }
- LAT = "" + latitude;
- LONG = "" + longitude;
- ADDRESS = "" + address;
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- final TextView tv_stat_cc;
- final WebView tv_note_value_cc;
- tv_stat_cc = (TextView)
- findViewById(R.id.stat_cc);
- tv_note_value_cc = (WebView)
- findViewById(R.id.note_value_cc);
- if (!status.equals("covered")) {
- //not coverage
- btn_confirm.setText("Get Offer");
- tv_stat_cc.setText("Not Covered");
- tv_stat_cc.setTextColor(Color.parseColor("#F15B42"));
- } else {
- btn_confirm.setText("Subscribe");
- tv_stat_cc.setText("Covered");
- tv_stat_cc.setTextColor(Color.parseColor("#28912e"));
- }
- tv_note_value_cc.loadData("" + message, "text/html", null);
- View current = CheckCoverage.this.getCurrentFocus();
- InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
- imm.hideSoftInputFromWindow(current.getWindowToken(), 0);
- dialog_custom_cov.dismiss();
- Handler handler = new Handler();
- handler.postDelayed(new
- Runnable() {
- @Override
- public void run() {
- //animation
- slideup = AnimationUtils.loadAnimation(CheckCoverage.this, R.anim.slide_up);
- bottom_sheet.setAnimation(slideup);
- bottom_sheet.startAnimation(slideup);
- bottom_sheet.setVisibility(View.VISIBLE);
- /*slideup.setAnimationListener(new Animation.AnimationListener() {
- @Override
- public void onAnimationStart(Animation animation) {
- bottom_sheet.startAnimation(slideup);
- }
- @Override
- public void onAnimationEnd(Animation animation) {
- bottom_sheet.setVisibility(View.VISIBLE);
- }
- @Override
- public void onAnimationRepeat(Animation animation) {
- }
- });*/
- }
- }, 500);
- btn_confirm.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Log.e("location_type", "" + location_type);
- if (btn_confirm.getText().toString().equals("Get Offer")) {
- // SESSION.setCITY_NAME_NEW(city_not_coverage);
- Intent i = new Intent(CheckCoverage.this, bd_signup.class);
- i.putExtra("coverage", "not");
- i.putExtra("long", LONG);
- i.putExtra("lat", LAT);
- i.putExtra("alamat", "" + ADDRESS);
- startActivity(i);
- } else if (btn_confirm.getText().toString().equals("Subscribe")) {
- Intent i = new Intent(CheckCoverage.this, bd_signup.class);
- i.putExtra("coverage", "yes");
- i.putExtra("long", LONG);
- i.putExtra("lat", LAT);
- if (location_type.equals("APART")) {
- i.putExtra("type", "apartment");
- i.putExtra("coverage_info", arList.get(position));
- } else if (location_type.equals("STREET") || location_type.equals("STREE")) {
- i.putExtra("type", "residence");
- i.putExtra("coverage_info", arList.get(position));
- } else if (location_type.equals("RESID")) {
- i.putExtra("type", "residence_notstreet");
- i.putExtra("coverage_info", arList.get(position));
- }
- startActivity(i);
- }
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement