Fix review.
This commit is contained in:
parent
f0fc7e1ac4
commit
c6e8c0a7e6
4 changed files with 31 additions and 36 deletions
|
@ -28,8 +28,8 @@
|
|||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingBottom="12dp">
|
||||
android:paddingTop="@dimen/content_padding_small"
|
||||
android:paddingBottom="@dimen/content_padding_small">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
|
@ -44,8 +44,8 @@
|
|||
android:id="@+id/read_section"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:paddingTop="@dimen/subHeaderPadding"
|
||||
android:paddingBottom="@dimen/subHeaderPadding"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
@ -54,8 +54,8 @@
|
|||
android:id="@+id/distance_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/gpx_select_small_icon_end_margin"
|
||||
android:layout_marginRight="@dimen/gpx_select_small_icon_end_margin"
|
||||
android:layout_marginEnd="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:src="@drawable/ic_action_distance_16"
|
||||
android:contentDescription="@string/distance" />
|
||||
|
||||
|
@ -63,8 +63,8 @@
|
|||
android:id="@+id/distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/gpx_select_small_text_end_margin"
|
||||
android:layout_marginRight="@dimen/gpx_select_small_text_end_margin"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size" />
|
||||
|
||||
|
@ -72,8 +72,8 @@
|
|||
android:id="@+id/points_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/gpx_select_small_icon_end_margin"
|
||||
android:layout_marginRight="@dimen/gpx_select_small_icon_end_margin"
|
||||
android:layout_marginEnd="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:src="@drawable/ic_action_waypoint_16"
|
||||
android:contentDescription="@string/track_points" />
|
||||
|
||||
|
@ -81,8 +81,8 @@
|
|||
android:id="@+id/points_count"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/gpx_select_small_text_end_margin"
|
||||
android:layout_marginRight="@dimen/gpx_select_small_text_end_margin"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="0" />
|
||||
|
@ -91,8 +91,8 @@
|
|||
android:id="@+id/time_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/gpx_select_small_icon_end_margin"
|
||||
android:layout_marginRight="@dimen/gpx_select_small_icon_end_margin"
|
||||
android:layout_marginEnd="@dimen/content_padding_half"
|
||||
android:layout_marginRight="@dimen/content_padding_half"
|
||||
android:src="@drawable/ic_action_time_16"
|
||||
android:contentDescription="@string/shared_string_time_moving" />
|
||||
|
||||
|
@ -100,8 +100,8 @@
|
|||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/gpx_select_small_text_end_margin"
|
||||
android:layout_marginRight="@dimen/gpx_select_small_text_end_margin"
|
||||
android:layout_marginEnd="@dimen/content_padding"
|
||||
android:layout_marginRight="@dimen/content_padding"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size" />
|
||||
|
||||
|
|
|
@ -78,8 +78,6 @@
|
|||
<dimen name="dialog_content_bottom_margin">16dp</dimen>
|
||||
<dimen name="local_size_height">34dp</dimen>
|
||||
<dimen name="standard_icon_size">24dp</dimen>
|
||||
<dimen name="gpx_select_small_icon_end_margin">8dp</dimen>
|
||||
<dimen name="gpx_select_small_text_end_margin">16dp</dimen>
|
||||
<dimen name="gpx_small_icon_margin">3dp</dimen>
|
||||
<dimen name="gpx_small_text_margin">14dp</dimen>
|
||||
<dimen name="gpx_text_top_margin">6dp</dimen>
|
||||
|
|
|
@ -29,21 +29,21 @@ import java.util.List;
|
|||
public class GpxTrackAdapter extends RecyclerView.Adapter<GpxTrackAdapter.TrackViewHolder> {
|
||||
|
||||
private LayoutInflater themedInflater;
|
||||
private List<GpxUiHelper.GPXInfo> myImageNameList;
|
||||
private List<GpxUiHelper.GPXInfo> gpxInfoList;
|
||||
private OsmandApplication app;
|
||||
private boolean showCurrentGpx;
|
||||
private OnItemClickListener onItemClickListener;
|
||||
private UiUtilities iconsCache;
|
||||
|
||||
|
||||
GpxTrackAdapter(Activity activity, List<GpxUiHelper.GPXInfo> myImageNameList, boolean showCurrentGpx,
|
||||
GpxTrackAdapter(Activity activity, List<GpxUiHelper.GPXInfo> gpxInfoList, boolean showCurrentGpx,
|
||||
OnItemClickListener onItemClickListener) {
|
||||
this.showCurrentGpx = showCurrentGpx;
|
||||
this.onItemClickListener = onItemClickListener;
|
||||
app = (OsmandApplication) activity.getApplication();
|
||||
boolean nightMode = !app.getSettings().isLightContent();
|
||||
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
themedInflater = UiUtilities.getInflater(activity, nightMode);
|
||||
this.myImageNameList = myImageNameList;
|
||||
this.gpxInfoList = gpxInfoList;
|
||||
iconsCache = app.getUIUtilities();
|
||||
}
|
||||
|
||||
|
@ -61,23 +61,29 @@ public class GpxTrackAdapter extends RecyclerView.Adapter<GpxTrackAdapter.TrackV
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull GpxTrackAdapter.TrackViewHolder holder, final int position) {
|
||||
public void onBindViewHolder(@NonNull final GpxTrackAdapter.TrackViewHolder holder, final int position) {
|
||||
boolean currentlyRecordingTrack = (showCurrentGpx && position == 0);
|
||||
if (currentlyRecordingTrack) {
|
||||
holder.icon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_track_recordable));
|
||||
} else {
|
||||
holder.icon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_polygom_dark));
|
||||
}
|
||||
GpxUiHelper.GPXInfo info = myImageNameList.get(position);
|
||||
final int adapterPosition = holder.getAdapterPosition();
|
||||
GpxUiHelper.GPXInfo info = gpxInfoList.get(adapterPosition);
|
||||
GPXDatabase.GpxDataItem dataItem = getDataItem(info);
|
||||
String itemTitle = GpxUiHelper.getGpxTitle(info.getFileName());
|
||||
updateGpxInfoView(holder, itemTitle, info, dataItem, currentlyRecordingTrack, app);
|
||||
holder.bind(position, onItemClickListener);
|
||||
holder.itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onItemClickListener.onItemClick(adapterPosition);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return myImageNameList.size();
|
||||
return gpxInfoList.size();
|
||||
}
|
||||
|
||||
private void updateGpxInfoView(TrackViewHolder holder, String itemTitle, GpxUiHelper.GPXInfo info,
|
||||
|
@ -143,15 +149,6 @@ public class GpxTrackAdapter extends RecyclerView.Adapter<GpxTrackAdapter.TrackV
|
|||
unknownSection = itemView.findViewById(R.id.unknown_section);
|
||||
dateAndSize = itemView.findViewById(R.id.date_and_size_details);
|
||||
}
|
||||
|
||||
void bind(final int position, final OnItemClickListener onItemClickListener) {
|
||||
itemView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onItemClickListener.onItemClick(position);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public interface OnItemClickListener {
|
||||
|
|
|
@ -356,7 +356,7 @@ public class GpxUiHelper {
|
|||
final List<GPXInfo> list,
|
||||
final ContextMenuAdapter adapter) {
|
||||
final OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
boolean nightMode = !app.getSettings().isLightContent();
|
||||
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
final View customLayout = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.gpx_track_select_dialog, null);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
|
||||
builder.setView(customLayout);
|
||||
|
|
Loading…
Reference in a new issue