Dashboard UI fixes

This commit is contained in:
Alexey Kulish 2016-02-20 16:35:03 +03:00
parent 2f6bed3160
commit bd995b20ef
8 changed files with 19 additions and 20 deletions

View file

@ -34,14 +34,14 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/card_bottom_divider"/>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawSelectorOnTop="true"/>
<include layout="@layout/card_bottom_divider"/>
</FrameLayout>
</LinearLayout>

View file

@ -36,14 +36,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/card_bottom_divider"/>
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="?attr/dashboard_divider"
android:dividerHeight="1dp"
android:drawSelectorOnTop="true"/>
<include layout="@layout/card_bottom_divider"/>
</FrameLayout>
</LinearLayout>

View file

@ -6,6 +6,7 @@ import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.text.TextUtils;
import android.text.format.DateFormat;
@ -14,6 +15,7 @@ import android.util.TypedValue;
import android.view.View;
import android.view.ViewParent;
import android.view.inputmethod.InputMethodManager;
import android.widget.ListView;
import android.widget.TextView;
import net.osmand.plus.R;
@ -100,6 +102,10 @@ public class AndroidUtils {
setBackgroundColor(ctx, view, night, R.color.bg_color_light, R.color.bg_color_dark);
}
public static void setListBackground(Context ctx, View view, boolean night) {
setBackgroundColor(ctx, view, night, R.color.ctx_menu_info_view_bg_light, R.color.ctx_menu_info_view_bg_dark);
}
public static void setTextPrimaryColor(Context ctx, TextView textView, boolean night) {
textView.setTextColor(night ?
ctx.getResources().getColor(R.color.primary_text_dark)

View file

@ -208,6 +208,9 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
//listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setDrawSelectorOnTop(true);
((DynamicListView) listView).setDynamicListViewCallbacks(this);
listView.setOverscrollFooter(new ColorDrawable(
nightMode ? mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_dark)
: mapActivity.getResources().getColor(R.color.ctx_menu_info_view_bg_light)));
// Create a ListView-specific touch listener. ListViews are given special treatment because
// by default they handle touches for their list items... i.e. they're in charge of drawing

View file

@ -154,8 +154,10 @@ public class MapMarkerDialogHelper {
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
} else if (topDividerView) {
v = mapActivity.getLayoutInflater().inflate(R.layout.card_top_divider, null);
AndroidUtils.setListBackground(mapActivity, v, nightMode);
} else if (bottomDividerView) {
v = mapActivity.getLayoutInflater().inflate(R.layout.card_bottom_divider, null);
AndroidUtils.setListBackground(mapActivity, v, nightMode);
} else if (obj instanceof MapMarker) {
MapMarker marker = (MapMarker) obj;
v = updateMapMarkerItemView(this, v, marker);

View file

@ -353,8 +353,10 @@ public class WaypointDialogHelper {
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
} else if (topDividerView) {
v = ctx.getLayoutInflater().inflate(R.layout.card_top_divider, null);
AndroidUtils.setListBackground(mapActivity, v, nightMode);
} else if (bottomDividerView) {
v = ctx.getLayoutInflater().inflate(R.layout.card_bottom_divider, null);
AndroidUtils.setListBackground(mapActivity, v, nightMode);
} else if (obj instanceof LocationPointWrapper) {
LocationPointWrapper point = (LocationPointWrapper) obj;
v = updateWaypointItemView(edit, deletedPoints, app, ctx, helper, v, point, this,

View file

@ -3,8 +3,6 @@ package net.osmand.plus.mapmarkers;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.Shape;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
@ -27,7 +25,6 @@ import net.osmand.plus.base.BaseOsmAndDialogFragment;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dashboard.DashLocationFragment;
import net.osmand.plus.helpers.MapMarkerDialogHelper;
import net.osmand.plus.views.controls.ListDividerShape;
import java.util.List;
@ -84,18 +81,6 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment {
});
ListView listView = (ListView) view.findViewById(android.R.id.list);
int color;
if (nightMode) {
color = mapActivity.getResources().getColor(R.color.dashboard_divider_dark);
} else {
color = mapActivity.getResources().getColor(R.color.dashboard_divider_light);
}
Shape dividerShape = new ListDividerShape(color, 0);
final ShapeDrawable divider = new ShapeDrawable(dividerShape);
int divHeight = AndroidUtils.dpToPx(getContext(), 1f);
divider.setIntrinsicHeight(divHeight);
listView.setDivider(divider);
final ArrayAdapter<MapMarker> adapter = new MapMarkersListAdapter();
List<MapMarker> markers = getMyApplication().getMapMarkersHelper().getActiveMapMarkers();
if (markers.size() > 0) {

View file

@ -32,7 +32,6 @@ import android.support.annotation.NonNull;
import android.support.v4.view.ViewCompat;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;