Add on click listeners
This commit is contained in:
parent
9b7664448e
commit
ae01e250a9
3 changed files with 35 additions and 7 deletions
|
@ -69,8 +69,8 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_marginLeft="56dp"
|
||||
android:layout_marginStart="56dp">
|
||||
android:layout_marginLeft="44dp"
|
||||
android:layout_marginStart="44dp">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/use_location_button"
|
||||
|
@ -80,8 +80,8 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingEnd="@dimen/measurement_tool_text_button_padding_small"
|
||||
android:paddingRight="@dimen/measurement_tool_text_button_padding_small"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:text="@string/use_location"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
osmand:textAllCapsCompat="true"
|
||||
|
@ -95,8 +95,8 @@
|
|||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="@dimen/measurement_tool_text_button_padding_small"
|
||||
android:paddingStart="@dimen/measurement_tool_text_button_padding_small"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingRight="12dp"
|
||||
android:text="@string/shared_string_do_not_use"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
osmand:textAllCapsCompat="true"
|
||||
|
|
|
@ -216,6 +216,16 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUseLocationClick() {
|
||||
Toast.makeText(mapActivity, "use location", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDoNotUseLocationClick() {
|
||||
Toast.makeText(mapActivity, "do not use location", Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
});
|
||||
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
|
||||
markersRv.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
|
||||
|
|
|
@ -87,6 +87,20 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
|||
|
||||
if (holder instanceof UseLocationCardViewHolder) {
|
||||
final UseLocationCardViewHolder locationCardHolder = (UseLocationCardViewHolder) holder;
|
||||
|
||||
locationCardHolder.useLocationBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
listener.onUseLocationClick();
|
||||
}
|
||||
});
|
||||
|
||||
locationCardHolder.doNotUseLocationBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
listener.onDoNotUseLocationClick();
|
||||
}
|
||||
});
|
||||
} else if (holder instanceof MapMarkerItemViewHolder) {
|
||||
MapMarker marker = getItem(pos);
|
||||
final MapMarkerItemViewHolder itemHolder = (MapMarkerItemViewHolder) holder;
|
||||
|
@ -203,6 +217,10 @@ public class MapMarkersListAdapter extends RecyclerView.Adapter<RecyclerView.Vie
|
|||
void onDragStarted(RecyclerView.ViewHolder holder);
|
||||
|
||||
void onDragEnded(RecyclerView.ViewHolder holder);
|
||||
|
||||
void onUseLocationClick();
|
||||
|
||||
void onDoNotUseLocationClick();
|
||||
}
|
||||
|
||||
private class UseLocationCardViewHolder extends RecyclerView.ViewHolder {
|
||||
|
|
Loading…
Reference in a new issue