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_marginRight="@dimen/list_content_padding"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="12dp"
|
android:paddingTop="@dimen/content_padding_small"
|
||||||
android:paddingBottom="12dp">
|
android:paddingBottom="@dimen/content_padding_small">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/name"
|
android:id="@+id/name"
|
||||||
|
@ -44,8 +44,8 @@
|
||||||
android:id="@+id/read_section"
|
android:id="@+id/read_section"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingTop="2dp"
|
android:paddingTop="@dimen/subHeaderPadding"
|
||||||
android:paddingBottom="2dp"
|
android:paddingBottom="@dimen/subHeaderPadding"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
|
@ -54,8 +54,8 @@
|
||||||
android:id="@+id/distance_icon"
|
android:id="@+id/distance_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/gpx_select_small_icon_end_margin"
|
android:layout_marginEnd="@dimen/content_padding_half"
|
||||||
android:layout_marginRight="@dimen/gpx_select_small_icon_end_margin"
|
android:layout_marginRight="@dimen/content_padding_half"
|
||||||
android:src="@drawable/ic_action_distance_16"
|
android:src="@drawable/ic_action_distance_16"
|
||||||
android:contentDescription="@string/distance" />
|
android:contentDescription="@string/distance" />
|
||||||
|
|
||||||
|
@ -63,8 +63,8 @@
|
||||||
android:id="@+id/distance"
|
android:id="@+id/distance"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/gpx_select_small_text_end_margin"
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
android:layout_marginRight="@dimen/gpx_select_small_text_end_margin"
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size" />
|
android:textSize="@dimen/default_desc_text_size" />
|
||||||
|
|
||||||
|
@ -72,8 +72,8 @@
|
||||||
android:id="@+id/points_icon"
|
android:id="@+id/points_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/gpx_select_small_icon_end_margin"
|
android:layout_marginEnd="@dimen/content_padding_half"
|
||||||
android:layout_marginRight="@dimen/gpx_select_small_icon_end_margin"
|
android:layout_marginRight="@dimen/content_padding_half"
|
||||||
android:src="@drawable/ic_action_waypoint_16"
|
android:src="@drawable/ic_action_waypoint_16"
|
||||||
android:contentDescription="@string/track_points" />
|
android:contentDescription="@string/track_points" />
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@
|
||||||
android:id="@+id/points_count"
|
android:id="@+id/points_count"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/gpx_select_small_text_end_margin"
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
android:layout_marginRight="@dimen/gpx_select_small_text_end_margin"
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
tools:text="0" />
|
tools:text="0" />
|
||||||
|
@ -91,8 +91,8 @@
|
||||||
android:id="@+id/time_icon"
|
android:id="@+id/time_icon"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/gpx_select_small_icon_end_margin"
|
android:layout_marginEnd="@dimen/content_padding_half"
|
||||||
android:layout_marginRight="@dimen/gpx_select_small_icon_end_margin"
|
android:layout_marginRight="@dimen/content_padding_half"
|
||||||
android:src="@drawable/ic_action_time_16"
|
android:src="@drawable/ic_action_time_16"
|
||||||
android:contentDescription="@string/shared_string_time_moving" />
|
android:contentDescription="@string/shared_string_time_moving" />
|
||||||
|
|
||||||
|
@ -100,8 +100,8 @@
|
||||||
android:id="@+id/time"
|
android:id="@+id/time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="@dimen/gpx_select_small_text_end_margin"
|
android:layout_marginEnd="@dimen/content_padding"
|
||||||
android:layout_marginRight="@dimen/gpx_select_small_text_end_margin"
|
android:layout_marginRight="@dimen/content_padding"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size" />
|
android:textSize="@dimen/default_desc_text_size" />
|
||||||
|
|
||||||
|
|
|
@ -78,8 +78,6 @@
|
||||||
<dimen name="dialog_content_bottom_margin">16dp</dimen>
|
<dimen name="dialog_content_bottom_margin">16dp</dimen>
|
||||||
<dimen name="local_size_height">34dp</dimen>
|
<dimen name="local_size_height">34dp</dimen>
|
||||||
<dimen name="standard_icon_size">24dp</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_icon_margin">3dp</dimen>
|
||||||
<dimen name="gpx_small_text_margin">14dp</dimen>
|
<dimen name="gpx_small_text_margin">14dp</dimen>
|
||||||
<dimen name="gpx_text_top_margin">6dp</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> {
|
public class GpxTrackAdapter extends RecyclerView.Adapter<GpxTrackAdapter.TrackViewHolder> {
|
||||||
|
|
||||||
private LayoutInflater themedInflater;
|
private LayoutInflater themedInflater;
|
||||||
private List<GpxUiHelper.GPXInfo> myImageNameList;
|
private List<GpxUiHelper.GPXInfo> gpxInfoList;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private boolean showCurrentGpx;
|
private boolean showCurrentGpx;
|
||||||
private OnItemClickListener onItemClickListener;
|
private OnItemClickListener onItemClickListener;
|
||||||
private UiUtilities iconsCache;
|
private UiUtilities iconsCache;
|
||||||
|
|
||||||
|
|
||||||
GpxTrackAdapter(Activity activity, List<GpxUiHelper.GPXInfo> myImageNameList, boolean showCurrentGpx,
|
GpxTrackAdapter(Activity activity, List<GpxUiHelper.GPXInfo> gpxInfoList, boolean showCurrentGpx,
|
||||||
OnItemClickListener onItemClickListener) {
|
OnItemClickListener onItemClickListener) {
|
||||||
this.showCurrentGpx = showCurrentGpx;
|
this.showCurrentGpx = showCurrentGpx;
|
||||||
this.onItemClickListener = onItemClickListener;
|
this.onItemClickListener = onItemClickListener;
|
||||||
app = (OsmandApplication) activity.getApplication();
|
app = (OsmandApplication) activity.getApplication();
|
||||||
boolean nightMode = !app.getSettings().isLightContent();
|
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
themedInflater = UiUtilities.getInflater(activity, nightMode);
|
themedInflater = UiUtilities.getInflater(activity, nightMode);
|
||||||
this.myImageNameList = myImageNameList;
|
this.gpxInfoList = gpxInfoList;
|
||||||
iconsCache = app.getUIUtilities();
|
iconsCache = app.getUIUtilities();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,23 +61,29 @@ public class GpxTrackAdapter extends RecyclerView.Adapter<GpxTrackAdapter.TrackV
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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);
|
boolean currentlyRecordingTrack = (showCurrentGpx && position == 0);
|
||||||
if (currentlyRecordingTrack) {
|
if (currentlyRecordingTrack) {
|
||||||
holder.icon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_track_recordable));
|
holder.icon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_track_recordable));
|
||||||
} else {
|
} else {
|
||||||
holder.icon.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_polygom_dark));
|
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);
|
GPXDatabase.GpxDataItem dataItem = getDataItem(info);
|
||||||
String itemTitle = GpxUiHelper.getGpxTitle(info.getFileName());
|
String itemTitle = GpxUiHelper.getGpxTitle(info.getFileName());
|
||||||
updateGpxInfoView(holder, itemTitle, info, dataItem, currentlyRecordingTrack, app);
|
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
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return myImageNameList.size();
|
return gpxInfoList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateGpxInfoView(TrackViewHolder holder, String itemTitle, GpxUiHelper.GPXInfo info,
|
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);
|
unknownSection = itemView.findViewById(R.id.unknown_section);
|
||||||
dateAndSize = itemView.findViewById(R.id.date_and_size_details);
|
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 {
|
public interface OnItemClickListener {
|
||||||
|
|
|
@ -356,7 +356,7 @@ public class GpxUiHelper {
|
||||||
final List<GPXInfo> list,
|
final List<GPXInfo> list,
|
||||||
final ContextMenuAdapter adapter) {
|
final ContextMenuAdapter adapter) {
|
||||||
final OsmandApplication app = (OsmandApplication) activity.getApplication();
|
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);
|
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));
|
AlertDialog.Builder builder = new AlertDialog.Builder(UiUtilities.getThemedContext(activity, nightMode));
|
||||||
builder.setView(customLayout);
|
builder.setView(customLayout);
|
||||||
|
|
Loading…
Reference in a new issue