mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Add actions for buttons
This commit is contained in:
		
							parent
							
								
									a10e27cf9e
								
							
						
					
					
						commit
						5265ff49c0
					
				
					 3 changed files with 38 additions and 20 deletions
				
			
		|  | @ -208,9 +208,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment { | |||
|                     } else if (slideOffset == 0){ | ||||
|                         transparentView.setClickable(false); | ||||
|                     } | ||||
|                 } else { | ||||
|                     // Not to allow user swipe down, she should press back instead | ||||
|                     //bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|  | @ -252,8 +249,6 @@ public class NearbyMapFragment extends android.support.v4.app.Fragment { | |||
|                     passInfoToSheet(place); | ||||
|                     bottomSheetListBehavior.setState(BottomSheetBehavior.STATE_HIDDEN); | ||||
|                     bottomSheetDetailsBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED); | ||||
|                     //NearbyInfoDialog.showYourself(getActivity(), place); | ||||
| 
 | ||||
|                 } | ||||
|                 return false; | ||||
|             }); | ||||
|  |  | |||
|  | @ -1,5 +1,7 @@ | |||
| package fr.free.nrw.commons.nearby; | ||||
| 
 | ||||
| import android.content.Intent; | ||||
| import android.net.Uri; | ||||
| import android.os.CountDownTimer; | ||||
| import android.support.annotation.NonNull; | ||||
| import android.support.transition.TransitionManager; | ||||
|  | @ -14,6 +16,7 @@ import android.widget.ImageView; | |||
| import android.widget.LinearLayout; | ||||
| import android.widget.TextView; | ||||
| 
 | ||||
| import com.mapbox.mapboxsdk.geometry.LatLng; | ||||
| import com.pedrogomez.renderers.Renderer; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
|  | @ -30,8 +33,8 @@ class PlaceRenderer extends Renderer<Place> { | |||
|     @BindView(R.id.distance) TextView distance; | ||||
|     @BindView(R.id.icon) ImageView icon; | ||||
|     @BindView(R.id.buttonLayout) LinearLayout buttonLayout; | ||||
|     @BindView(R.id.wikidataButton) LinearLayout wikidataButton; | ||||
|     @BindView(R.id.wikipediaButton) LinearLayout wikipediaButton; | ||||
|     @BindView(R.id.cameraButton) LinearLayout cameraButton; | ||||
|     @BindView(R.id.galeryButton) LinearLayout galeryButton; | ||||
|     @BindView(R.id.directionsButton) LinearLayout directionsButton; | ||||
| 
 | ||||
|     private View view; | ||||
|  | @ -105,9 +108,25 @@ class PlaceRenderer extends Renderer<Place> { | |||
|         distance.setText(place.distance); | ||||
|         icon.setImageResource(place.getDescription().getIcon()); | ||||
| 
 | ||||
|         directionsButton.setOnClickListener(new View.OnClickListener() { | ||||
|             @Override | ||||
|             public void onClick(View view) { | ||||
|                 LatLng location = new LatLng(place.location.getLatitude() | ||||
|                         , place.location.getLongitude(), 0); | ||||
|                 //Open map app at given position | ||||
|                 Uri gmmIntentUri = Uri.parse( | ||||
|                         "geo:0,0?q=" + location.getLatitude() + "," + location.getLongitude()); | ||||
|                 Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri); | ||||
| 
 | ||||
|                 if (mapIntent.resolveActivity(view.getContext().getPackageManager()) != null) { | ||||
|                     view.getContext().startActivity(mapIntent); | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     /*interface PlaceClickedListener { | ||||
|         void onPlaceOpened(Place place); | ||||
|     }*/ | ||||
|     private void startActivity(Intent intent){ | ||||
| 
 | ||||
|     } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 neslihanturan
						neslihanturan