mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Add actions for buttons
This commit is contained in:
parent
e099c72cc9
commit
ae215cdba1
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);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -254,8 +251,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;
|
||||
|
|
@ -104,9 +107,25 @@ class PlaceRenderer extends Renderer<Place> {
|
|||
tvDesc.setText(descriptionText);
|
||||
distance.setText(place.distance);
|
||||
icon.setImageResource(place.getLabel().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){
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -10,20 +10,21 @@
|
|||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/directionsButton"
|
||||
android:id="@+id/cameraButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="16dp"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/button_background_selector"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:srcCompat="@drawable/ic_photo_camera_white_24dp"
|
||||
android:tint="@color/primaryDarkColor"/>
|
||||
android:tint="@color/button_blue"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
@ -33,51 +34,54 @@
|
|||
/>
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:id="@+id/wikidataButton"
|
||||
android:id="@+id/galeryButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="16dp"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/button_background_selector"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:srcCompat="@drawable/ic_photo_white_24dp"
|
||||
android:tint="@color/primaryDarkColor"/>
|
||||
android:tint="@color/button_blue"
|
||||
android:duplicateParentState="true"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="GALLERY"
|
||||
/>
|
||||
android:duplicateParentState="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/wikipediaButton"
|
||||
android:id="@+id/directionsButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="16dp"
|
||||
android:clickable="true"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/button_background_selector"
|
||||
>
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:srcCompat="@drawable/ic_directions_black_24dp"
|
||||
/>
|
||||
android:duplicateParentState="true"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="DIRECTIONS"
|
||||
|
||||
android:duplicateParentState="true"
|
||||
/>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
@ -95,14 +99,14 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
app:srcCompat="@drawable/ic_overflow"
|
||||
/>
|
||||
android:duplicateParentState="true"/>
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="8dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:text="MORE"
|
||||
|
||||
android:duplicateParentState="true"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue