This commit is contained in:
PavelRatushny 2017-09-22 14:51:50 +03:00
parent 3dd6f2ef02
commit 2cf935f635
7 changed files with 24 additions and 11 deletions

View file

@ -69,13 +69,13 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:gravity="center_vertical">
<ImageView
android:id="@+id/map_marker_direction_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="4dp"
android:layout_marginEnd="4dp"
tools:src="@drawable/ic_direction_arrow"/>
@ -84,7 +84,6 @@
android:id="@+id/map_marker_distance"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:textSize="@dimen/default_desc_text_size"
tools:text="213 m"/>
@ -92,13 +91,12 @@
<View
android:id="@+id/map_marker_left_point_space"
android:layout_width="4dp"
android:layout_height="wrap_content"/>
android:layout_height="match_parent"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_point_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="•"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
@ -108,13 +106,12 @@
<View
android:id="@+id/map_marker_right_point_space"
android:layout_width="4dp"
android:layout_height="wrap_content"/>
android:layout_height="match_parent"/>
<android.support.v7.widget.AppCompatTextView
android:id="@+id/map_marker_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:ellipsize="end"
android:maxLines="1"
android:textColor="?android:textColorSecondary"

View file

@ -11,6 +11,7 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.MapMarkersHelper.MapMarker;
@ -37,8 +38,11 @@ public class MapMarkersActiveFragment extends Fragment implements OsmAndCompassL
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
final RecyclerView recyclerView = new RecyclerView(getContext());
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
final MapActivity mapActivity = (MapActivity) getActivity();
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
adapter = new MapMarkersActiveAdapter(mapActivity);
final ItemTouchHelper touchHelper = new ItemTouchHelper(new MapMarkersItemTouchHelperCallback(mapActivity, adapter));

View file

@ -20,6 +20,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.Location;
import net.osmand.data.LatLon;
import net.osmand.plus.MapMarkersHelper;
@ -54,6 +55,10 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
final MapActivity mapActivity = (MapActivity) getActivity();
final boolean night = !mapActivity.getMyApplication().getSettings().isLightContent();
final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
backgroundPaint.setColor(ContextCompat.getColor(getActivity(), night ? R.color.dashboard_divider_dark : R.color.dashboard_divider_light));
backgroundPaint.setStyle(Paint.Style.FILL_AND_STROKE);
@ -73,7 +78,6 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
final int moveToHistoryStrWidth = bounds.width();
final int textHeight = bounds.height();
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {
private float marginSides = getResources().getDimension(R.dimen.list_content_padding);
private Bitmap deleteBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.ic_action_delete_dark);

View file

@ -20,6 +20,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import net.osmand.AndroidUtils;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.OsmandApplication;
@ -74,6 +75,9 @@ public class MapMarkersHistoryFragment extends Fragment implements MapMarkersHel
}
final RecyclerView recyclerView = new RecyclerView(getContext());
boolean isSmartphone = getResources().getConfiguration().smallestScreenWidthDp < 600;
recyclerView.setPadding(0, 0, 0, AndroidUtils.dpToPx(mapActivity, isSmartphone ? 72 : 108));
recyclerView.setClipToPadding(false);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) {

View file

@ -131,6 +131,8 @@ public class MapMarkersActiveAdapter extends RecyclerView.Adapter<MapMarkerItemV
holder.divider.setVisibility(View.VISIBLE);
}
holder.point.setVisibility(View.VISIBLE);
holder.iconReorder.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent event) {

View file

@ -397,7 +397,8 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
SimpleDateFormat dateFormat = new SimpleDateFormat("LLLL", Locale.getDefault());
Date date = new Date();
date.setMonth(month);
return dateFormat.format(date);
String monthStr = dateFormat.format(date);
return Character.toUpperCase(monthStr.charAt(0)) + monthStr.substring(1);
}
private int getLastDisplayItemIndexOfGroup(MapMarkersGroup group) {

View file

@ -190,7 +190,8 @@ public class MapMarkersHistoryAdapter extends RecyclerView.Adapter<RecyclerView.
SimpleDateFormat dateFormat = new SimpleDateFormat("LLLL", Locale.getDefault());
Date date = new Date();
date.setMonth(month);
return dateFormat.format(date);
String monthStr = dateFormat.format(date);
return Character.toUpperCase(monthStr.charAt(0)) + monthStr.substring(1);
}
public interface MapMarkersHistoryAdapterListener {