Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
722b0f8c2d
8 changed files with 205 additions and 104 deletions
19
OsmAnd/res/layout/list_shadow_footer.xml
Normal file
19
OsmAnd/res/layout/list_shadow_footer.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout android:id="@+id/bottomShadowView"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_bottom"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="16dp"/>
|
||||
|
||||
</LinearLayout>
|
19
OsmAnd/res/layout/list_shadow_header.xml
Normal file
19
OsmAnd/res/layout/list_shadow_header.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout android:id="@+id/topShadowView"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="16dp"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scaleType="fitXY"
|
||||
android:src="@drawable/bg_shadow_list_top"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -73,6 +73,7 @@
|
|||
android:id="@+id/tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/ctx_menu_info_view_bg"
|
||||
android:theme="?attr/search_tabbar_layout_theme"
|
||||
app:tabGravity="fill"
|
||||
app:tabMaxWidth="0dp"
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
<ListView
|
||||
android:id="@android:id/list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"/>
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@null"
|
||||
android:dividerHeight="0dp"
|
||||
android:drawSelectorOnTop="true"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -3,117 +3,130 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="60dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="visible"/>
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:orientation="vertical">
|
||||
android:orientation="horizontal"
|
||||
android:minHeight="60dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="8dp"
|
||||
android:scaleType="centerInside"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Amsterdam"/>
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/compass_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingRight="16dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
tools:text="Amsterdam"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/compass_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/direction"
|
||||
android:layout_width="@dimen/dashFavDirectionSize"
|
||||
android:layout_height="@dimen/dashFavDirectionSize"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="100500 km"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/direction"
|
||||
android:layout_width="@dimen/dashFavDirectionSize"
|
||||
android:layout_height="@dimen/dashFavDirectionSize"
|
||||
android:layout_gravity="center_vertical"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/distance"
|
||||
android:id="@+id/type_name_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:src="@drawable/ic_small_group"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="City"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/time_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/gpx_small_icon_margin"
|
||||
android:src="@drawable/ic_small_time"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:scrollHorizontally="true"
|
||||
android:singleLine="true"
|
||||
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"
|
||||
tools:text="100500 km"/>
|
||||
tools:text="10-12 am"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/type_name_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@drawable/ic_small_group" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/subtitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
tools:text="City"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/time_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/gpx_small_icon_margin"
|
||||
android:src="@drawable/ic_small_time"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/time"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:lines="1"
|
||||
android:maxLines="1"
|
||||
android:scrollHorizontally="true"
|
||||
tools:text="10-12 am"
|
||||
|
||||
android:singleLine="true"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/default_sub_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -159,7 +159,6 @@
|
|||
<item name="colorAccent">@color/osmand_orange</item>
|
||||
<item name="android:textColorSecondary">@color/searchbar_tab_inactive_light</item>
|
||||
<item name="android:textColorHint">@color/searchbar_tab_inactive_light</item>
|
||||
<item name="android:background">@color/ctx_menu_info_view_bg_light</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.Toolbar">
|
||||
|
@ -188,7 +187,6 @@
|
|||
<item name="colorAccent">@color/osmand_orange</item>
|
||||
<item name="android:textColorSecondary">@color/searchbar_tab_inactive_dark</item>
|
||||
<item name="android:textColorHint">@color/searchbar_tab_inactive_dark</item>
|
||||
<item name="android:background">@color/ctx_menu_info_view_bg_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="OsmandLightTheme.BottomSheet">
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.support.v7.widget.Toolbar;
|
|||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -749,6 +750,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
|
||||
private QuickSearchDialogFragment dialogFragment;
|
||||
private QuickSearchListAdapter listAdapter;
|
||||
private boolean touching;
|
||||
|
||||
enum SearchListFragmentType {
|
||||
HISTORY,
|
||||
|
@ -763,9 +765,21 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
return inflater.inflate(R.layout.search_dialog_list_layout, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
ListView listView = getListView();
|
||||
if (listView != null) {
|
||||
View header = getLayoutInflater(savedInstanceState).inflate(R.layout.list_shadow_header, null);
|
||||
View footer = getLayoutInflater(savedInstanceState).inflate(R.layout.list_shadow_footer, null);
|
||||
listView.addHeaderView(header, null, false);
|
||||
listView.addFooterView(footer, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View view, int position, long id) {
|
||||
QuickSearchListItem item = listAdapter.getItem(position);
|
||||
QuickSearchListItem item = listAdapter.getItem(position - l.getHeaderViewsCount());
|
||||
if (item instanceof QuickSearchMoreListItem) {
|
||||
((QuickSearchMoreListItem) item).getOnClickListener().onClick(view);
|
||||
} else {
|
||||
|
@ -795,18 +809,29 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
dialogFragment = (QuickSearchDialogFragment) getParentFragment();
|
||||
listAdapter = new QuickSearchListAdapter(getMyApplication(), getActivity());
|
||||
setListAdapter(listAdapter);
|
||||
ListView listView = getListView();
|
||||
listView.setBackgroundColor(getResources().getColor(
|
||||
getMyApplication().getSettings().isLightContent() ? R.color.ctx_menu_info_view_bg_light
|
||||
: R.color.ctx_menu_info_view_bg_dark));
|
||||
listView.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(View v, MotionEvent event) {
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
case MotionEvent.ACTION_POINTER_DOWN:
|
||||
touching = true;
|
||||
break;
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_POINTER_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
touching = false;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
} 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);
|
||||
|
||||
*/
|
||||
|
||||
public ArrayAdapter<?> getAdapter() {
|
||||
return listAdapter;
|
||||
}
|
||||
|
@ -863,7 +888,7 @@ public class QuickSearchDialogFragment extends DialogFragment implements OsmAndC
|
|||
}
|
||||
|
||||
public void updateLocation(LatLon latLon, Float heading) {
|
||||
if (listAdapter != null) {
|
||||
if (listAdapter != null && !touching) {
|
||||
listAdapter.setLocation(latLon);
|
||||
listAdapter.setHeading(heading);
|
||||
listAdapter.notifyDataSetChanged();
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.LatLon;
|
||||
|
@ -31,11 +32,15 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
|
|||
private Float heading;
|
||||
private int searchMoreItemPosition;
|
||||
private int screenOrientation;
|
||||
private int dp56;
|
||||
private int dp1;
|
||||
|
||||
public QuickSearchListAdapter(OsmandApplication app, Activity activity) {
|
||||
super(app, R.layout.search_list_item);
|
||||
this.app = app;
|
||||
this.activity = activity;
|
||||
dp56 = AndroidUtils.dpToPx(app, 56f);
|
||||
dp1 = AndroidUtils.dpToPx(app, 1f);
|
||||
}
|
||||
|
||||
public int getScreenOrientation() {
|
||||
|
@ -176,6 +181,25 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
|
|||
|
||||
updateCompassVisibility(view, listItem);
|
||||
}
|
||||
view.setBackgroundColor(app.getResources().getColor(
|
||||
app.getSettings().isLightContent() ? R.color.bg_color_light : R.color.bg_color_dark));
|
||||
View divider = view.findViewById(R.id.divider);
|
||||
if (divider != null) {
|
||||
if (position == getCount() - 1) {
|
||||
divider.setVisibility(View.GONE);
|
||||
} else {
|
||||
divider.setVisibility(View.VISIBLE);
|
||||
if (position + 1 == searchMoreItemPosition) {
|
||||
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp1);
|
||||
p.setMargins(0, 0, 0 ,0);
|
||||
divider.setLayoutParams(p);
|
||||
} else {
|
||||
LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, dp1);
|
||||
p.setMargins(dp56, 0, 0 ,0);
|
||||
divider.setLayoutParams(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue