Merge pull request #1092 from Bars107/master
Updates to my places and search views.
This commit is contained in:
commit
5be7a12180
10 changed files with 173 additions and 82 deletions
|
@ -67,7 +67,6 @@
|
|||
android:layout_marginRight="0dp"
|
||||
android:layout_marginTop="0dp"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/expandable_list_background"
|
||||
android:groupIndicator="@android:color/transparent"/>
|
||||
|
||||
|
||||
|
|
|
@ -23,46 +23,47 @@
|
|||
android:id="@+id/check_local_index"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="@dimen/local_index_check_right_margin"
|
||||
android:layout_marginTop="@dimen/favorites_icon_top_margin"/>
|
||||
android:layout_marginTop="@dimen/favorites_icon_top_margin"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:src="@drawable/ic_gpx_track"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginTop="@dimen/favorites_icon_top_margin"
|
||||
android:focusable="false"/>
|
||||
android:focusable="false"
|
||||
android:src="@drawable/ic_gpx_track"
|
||||
android:visibility="gone"/>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/subHeaderMarginLeft"
|
||||
android:layout_marginRight="@dimen/showAllButtonMarginRight"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
android:textSize="@dimen/dashFavNameTextSize"
|
||||
android:layout_marginTop="@dimen/gpx_text_top_margin"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/dashFavNameTextSize"
|
||||
tools:text="@string/validate_gpx_upload_name_pwd"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/read_section"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/read_section"
|
||||
android:visibility="visible"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/points_icon"
|
||||
|
@ -77,24 +78,24 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/gpx_small_text_margin"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/download_descr_text_size"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/distance_icon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/gpx_small_icon_margin"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="@dimen/gpx_small_icon_margin"
|
||||
android:src="@drawable/ic_small_distance"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_marginRight="@dimen/gpx_small_text_margin"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
android:layout_marginRight="@dimen/gpx_small_text_margin"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/download_descr_text_size"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/time_icon"
|
||||
|
@ -109,69 +110,71 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/gpx_small_text_margin"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/download_descr_text_size"/>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/unknown_section"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/unknown_section"
|
||||
android:visibility="gone"
|
||||
android:orientation="horizontal">
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/date_and_size_details"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
android:textColor="?android:textColorSecondary"/>
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/download_descr_text_size"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/description"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textSize="@dimen/download_descr_text_size"
|
||||
android:textColor="?android:textColorPrimary"/>
|
||||
android:visibility="gone"/>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/stop"
|
||||
android:visibility="gone"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/options_button_background"
|
||||
android:src="@drawable/ic_action_rec_stop"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/show_on_map"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"
|
||||
android:layout_marginLeft="@dimen/favorites_icon_right_margin"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/favorites_icon_right_margin"
|
||||
android:background="?attr/options_button_background"
|
||||
android:src="@drawable/ic_action_gsave_dark"/>
|
||||
android:src="@drawable/ic_action_gsave_dark"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/options"
|
||||
android:visibility="gone"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:background="?attr/options_button_background"
|
||||
android:focusable="false"
|
||||
android:src="?attr/list_settings_icon"/>
|
||||
android:src="?attr/list_settings_icon"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<include android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
layout="@layout/check_item_rel"/>
|
||||
|
||||
<!--
|
||||
<include layout="@layout/check_item_rel" />
|
||||
-->
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
style="@style/OsmandListView"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="0dp"
|
||||
android:background="?attr/expandable_list_background"
|
||||
android:layout_marginLeft="0dp"
|
||||
android:layout_marginRight="0dp"
|
||||
android:layout_marginTop="0dp"
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<dimen name="favorite_icon_size">24dp</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>
|
||||
|
||||
<!-- TextSizes -->
|
||||
<dimen name="list_header_text_size">14sp</dimen>
|
||||
|
|
|
@ -107,6 +107,9 @@ public class PointDescription {
|
|||
return POINT_TYPE_FAVORITE.equals(type);
|
||||
}
|
||||
|
||||
public boolean isAvNote() {
|
||||
return POINT_TYPE_NOTE.equals(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
|
|
@ -66,6 +66,7 @@ import android.view.View;
|
|||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.Filter;
|
||||
|
@ -267,6 +268,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
|
||||
v.findViewById(R.id.options).setVisibility(View.GONE);
|
||||
v.findViewById(R.id.stop).setVisibility(View.VISIBLE);
|
||||
v.findViewById(R.id.check_item).setVisibility(View.GONE);
|
||||
save.setImageDrawable(icon);
|
||||
}
|
||||
|
||||
|
@ -787,6 +789,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
v = inflater.inflate(R.layout.dash_gpx_track_item, parent, false);
|
||||
}
|
||||
udpateGpxInfoView(v, child, app, gpxNormal, gpxOnMap, false);
|
||||
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.icon);
|
||||
ImageButton options = (ImageButton) v.findViewById(R.id.options);
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -821,6 +824,27 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
options.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
final CompoundButton checkItem = (CompoundButton) v.findViewById(R.id.check_item);
|
||||
if (isSelectedGroup(groupPosition)) {
|
||||
checkItem.setVisibility(View.VISIBLE);
|
||||
v.findViewById(R.id.options).setVisibility(View.GONE);
|
||||
} else {
|
||||
checkItem.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
final SelectedGpxFile selectedGpxFile = selectedGpxHelper.getSelectedFileByName(child.getFileName());
|
||||
checkItem.setChecked(selectedGpxFile != null);
|
||||
checkItem.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (child.gpx != null) {
|
||||
selectedGpxHelper.selectGpxFile(child.gpx, checkItem.isChecked(), false);
|
||||
} else {
|
||||
selectedGpxHelper.getSelectedGPXFiles().remove(selectedGpxFile);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
v.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -1420,6 +1444,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
if (sgpx != null) {
|
||||
icon.setImageDrawable(gpxOnMap);
|
||||
analysis = sgpx.getTrackAnalysis();
|
||||
|
||||
}
|
||||
boolean sectionRead = analysis == null;
|
||||
if (sectionRead) {
|
||||
|
@ -1473,6 +1498,8 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
} else {
|
||||
descr.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
v.findViewById(R.id.check_item).setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
package net.osmand.plus.activities;
|
||||
|
||||
|
@ -11,6 +11,7 @@ import android.graphics.drawable.Drawable;
|
|||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.view.*;
|
||||
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -22,6 +23,7 @@ import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
|||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
@ -31,20 +33,20 @@ import android.widget.ListView;
|
|||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class FavoritesListFragment extends ListFragment implements SearchActivityChild {
|
||||
|
||||
public static final String SELECT_FAVORITE_POINT_INTENT_KEY = "SELECT_FAVORITE_POINT_INTENT_KEY";
|
||||
public static final String SELECT_FAVORITE_POINT_INTENT_KEY = "SELECT_FAVORITE_POINT_INTENT_KEY";
|
||||
public static final int SELECT_FAVORITE_POINT_RESULT_OK = 1;
|
||||
|
||||
|
||||
private FavouritesAdapter favouritesAdapter;
|
||||
|
||||
private boolean selectFavoriteMode;
|
||||
private OsmandSettings settings;
|
||||
private LatLon location;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
super.onAttach(activity);
|
||||
|
@ -58,7 +60,7 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
private OsmandApplication getApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -73,14 +75,14 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
}
|
||||
}
|
||||
}
|
||||
if (!isSelectFavoriteMode()) {
|
||||
if (location == null && getActivity() instanceof SearchActivity) {
|
||||
location = ((SearchActivity) getActivity()).getSearchPoint();
|
||||
}
|
||||
if (location == null) {
|
||||
location = settings.getLastKnownMapLocation();
|
||||
}
|
||||
|
||||
if (location == null && getActivity() instanceof SearchActivity) {
|
||||
location = ((SearchActivity) getActivity()).getSearchPoint();
|
||||
}
|
||||
if (location == null) {
|
||||
location = settings.getLastKnownMapLocation();
|
||||
}
|
||||
|
||||
locationUpdate(location);
|
||||
|
||||
}
|
||||
|
@ -92,22 +94,22 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
favouritesAdapter.updateLocation(l);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSelectFavoriteMode(){
|
||||
|
||||
public boolean isSelectFavoriteMode() {
|
||||
return selectFavoriteMode;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu onCreate, MenuInflater inflater) {
|
||||
if(getActivity() instanceof SearchActivity) {
|
||||
if (getActivity() instanceof SearchActivity) {
|
||||
((SearchActivity) getActivity()).getClearToolbar(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListItemClick(ListView l, View v, int position, long id) {
|
||||
|
||||
|
||||
if (!isSelectFavoriteMode()) {
|
||||
FavouritePoint point = favouritesAdapter.getItem(position);
|
||||
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
|
||||
|
@ -128,11 +130,11 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
private LatLon location;
|
||||
private OsmandApplication app;
|
||||
Drawable arrowImage;
|
||||
|
||||
|
||||
public LatLon getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
|
||||
public void updateLocation(LatLon l) {
|
||||
location = l;
|
||||
sort(new Comparator<FavouritePoint>() {
|
||||
|
@ -151,7 +153,7 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
return getName(object1).compareTo(getName(object2));
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public FavouritesAdapter(Activity activity, List<FavouritePoint> list) {
|
||||
|
@ -167,11 +169,11 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
arrowImage.setColorFilter(activity.getResources().getColor(R.color.color_distance), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
}
|
||||
|
||||
public String getName(FavouritePoint model){
|
||||
|
||||
public String getName(FavouritePoint model) {
|
||||
return model.getName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View row = convertView;
|
||||
|
@ -186,23 +188,23 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
ImageView direction = (ImageView) row.findViewById(R.id.direction);
|
||||
direction.setImageDrawable(arrowImage);
|
||||
direction.setVisibility(View.VISIBLE);
|
||||
final FavouritePoint model = getItem(position);
|
||||
if (!model.getCategory().isEmpty()){
|
||||
final FavouritePoint favorite = getItem(position);
|
||||
if (!favorite.getCategory().isEmpty()) {
|
||||
row.findViewById(R.id.group_image).setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
row.findViewById(R.id.group_image).setVisibility(View.GONE);
|
||||
}
|
||||
((TextView) row.findViewById(R.id.group_name)).setText(model.getCategory());
|
||||
((TextView) row.findViewById(R.id.group_name)).setText(favorite.getCategory());
|
||||
|
||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(activity, model.getColor()));
|
||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(activity, favorite.getColor()));
|
||||
String distance = "";
|
||||
if (location != null) {
|
||||
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(), location.getLatitude(), location
|
||||
int dist = (int) (MapUtils.getDistance(favorite.getLatitude(), favorite.getLongitude(), location.getLatitude(), location
|
||||
.getLongitude()));
|
||||
distance = OsmAndFormatter.getFormattedDistance(dist, app) + " " ;
|
||||
distance = OsmAndFormatter.getFormattedDistance(dist, app) + " ";
|
||||
}
|
||||
distanceText.setText(distance);
|
||||
name.setText(getName(model));
|
||||
name.setText(getName(favorite));
|
||||
final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item);
|
||||
row.findViewById(R.id.favourite_icon).setVisibility(View.VISIBLE);
|
||||
ch.setVisibility(View.GONE);
|
||||
|
@ -212,6 +214,6 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
}
|
||||
|
||||
public OsmandApplication getMyApplication() {
|
||||
return (OsmandApplication)getActivity().getApplication();
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,12 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
public static final String SEARCH_LAT = SearchActivity.SEARCH_LAT;
|
||||
public static final String SEARCH_LON = SearchActivity.SEARCH_LON;
|
||||
private HistoryAdapter historyAdapter;
|
||||
private Drawable addressIcon;
|
||||
private Drawable favoriteIcon;
|
||||
private Drawable locationIcon;
|
||||
private Drawable poiIcon;
|
||||
private Drawable wptIcon;
|
||||
private Drawable noteIcon;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
|
@ -57,15 +63,39 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
clearButton.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
loadIcons();
|
||||
return view;
|
||||
}
|
||||
|
||||
private void loadIcons() {
|
||||
addressIcon = getResources().getDrawable(R.drawable.ic_type_coordinates);
|
||||
favoriteIcon = getResources().getDrawable(R.drawable.ic_action_fav_dark);
|
||||
locationIcon = getResources().getDrawable(R.drawable.ic_action_marker_dark);
|
||||
poiIcon = getResources().getDrawable(R.drawable.ic_action_gabout_dark);
|
||||
wptIcon = getResources().getDrawable(R.drawable.ic_action_flage_dark);
|
||||
noteIcon = getResources().getDrawable(R.drawable.ic_action_note_dark);
|
||||
if (getMyApplication().getSettings().isLightContent()) {
|
||||
addressIcon = addressIcon.mutate();
|
||||
addressIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
favoriteIcon = favoriteIcon.mutate();
|
||||
favoriteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
locationIcon = locationIcon.mutate();
|
||||
locationIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
poiIcon = poiIcon.mutate();
|
||||
poiIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
wptIcon = wptIcon.mutate();
|
||||
wptIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
noteIcon = noteIcon.mutate();
|
||||
noteIcon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
helper = SearchHistoryHelper.getInstance((OsmandApplication) getActivity().getApplicationContext());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
|
@ -73,8 +103,8 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
setListAdapter(historyAdapter);
|
||||
setHasOptionsMenu(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -97,18 +127,18 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
location = ((OsmandApplication) activity.getApplication()).getSettings().getLastKnownMapLocation();
|
||||
}
|
||||
historyAdapter.clear();
|
||||
for(HistoryEntry entry : helper.getHistoryEntries()){
|
||||
for (HistoryEntry entry : helper.getHistoryEntries()) {
|
||||
historyAdapter.add(entry);
|
||||
}
|
||||
locationUpdate(location);
|
||||
clearButton.setVisibility(historyAdapter.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void locationUpdate(LatLon l) {
|
||||
//location = l;
|
||||
if(historyAdapter != null) {
|
||||
if (historyAdapter != null) {
|
||||
historyAdapter.updateLocation(l);
|
||||
}
|
||||
}
|
||||
|
@ -175,18 +205,36 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
ImageView arrow = (ImageView) row.findViewById(R.id.direction);
|
||||
arrow.setImageDrawable(arrowImage);
|
||||
ImageButton options = (ImageButton) row.findViewById(R.id.options);
|
||||
final HistoryEntry model = getItem(position);
|
||||
final HistoryEntry historyEntry = getItem(position);
|
||||
if (location != null) {
|
||||
int dist = (int) (MapUtils.getDistance(location, model.getLat(), model.getLon()));
|
||||
int dist = (int) (MapUtils.getDistance(location, historyEntry.getLat(), historyEntry.getLon()));
|
||||
distance = OsmAndFormatter.getFormattedDistance(dist, (OsmandApplication) getActivity().getApplication()) + " ";
|
||||
}
|
||||
distanceText.setText(distance);
|
||||
nameText.setText(model.getName().getName(), BufferType.SPANNABLE);
|
||||
nameText.setText(historyEntry.getName().getName(), BufferType.SPANNABLE);
|
||||
ImageView icon =((ImageView) row.findViewById(R.id.icon));
|
||||
|
||||
if (historyEntry.getName().isAddress()) {
|
||||
icon.setImageDrawable(addressIcon);
|
||||
} else if (historyEntry.getName().isFavorite()) {
|
||||
icon.setImageDrawable(favoriteIcon);
|
||||
} else if (historyEntry.getName().isLocation()) {
|
||||
icon.setImageDrawable(locationIcon);
|
||||
} else if (historyEntry.getName().isPoi()) {
|
||||
icon.setImageDrawable(poiIcon);
|
||||
} else if (historyEntry.getName().isWpt()) {
|
||||
icon.setImageDrawable(wptIcon);
|
||||
} else if (historyEntry.getName().isAvNote()) {
|
||||
icon.setImageDrawable(noteIcon);
|
||||
} else {
|
||||
icon.setImageDrawable(addressIcon);
|
||||
}
|
||||
|
||||
|
||||
options.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
selectModel(model, v);
|
||||
selectModel(historyEntry, v);
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -197,8 +245,8 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu onCreate, MenuInflater inflater) {
|
||||
if(getActivity() instanceof SearchActivity) {
|
||||
((SearchActivity) getActivity()).getClearToolbar(false);
|
||||
if (getActivity() instanceof SearchActivity) {
|
||||
((SearchActivity) getActivity()).getClearToolbar(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,9 @@ import net.osmand.util.MapUtils;
|
|||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -42,6 +44,7 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
|
||||
private List<ImageView> arrows = new ArrayList<ImageView>();
|
||||
List<HistoryEntry> points = new ArrayList<HistoryEntry>();
|
||||
Drawable icon;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
@ -65,6 +68,11 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
activity.startActivity(search);
|
||||
}
|
||||
});
|
||||
icon = getResources().getDrawable(R.drawable.ic_type_coordinates);
|
||||
if (getMyApplication().getSettings().isLightContent()) {
|
||||
icon = icon.mutate();
|
||||
icon.setColorFilter(getResources().getColor(R.color.icon_color_light), PorterDuff.Mode.MULTIPLY);
|
||||
}
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -121,7 +129,7 @@ public class DashRecentsFragment extends DashLocationFragment {
|
|||
|
||||
|
||||
((ImageView) view.findViewById(R.id.icon)).
|
||||
setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(), Color.BLUE));
|
||||
setImageDrawable(icon);
|
||||
|
||||
if(loc != null){
|
||||
direction.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -140,6 +140,7 @@ public class DashTrackFragment extends DashBaseFragment {
|
|||
AvailableGPXFragment.createCurrentTrackView(view, app);
|
||||
((TextView) view.findViewById(R.id.name)).setText(R.string.currently_recording_track);
|
||||
AvailableGPXFragment.updateCurrentTrack(view, getActivity(), app);
|
||||
view.findViewById(R.id.divider).setVisibility(View.VISIBLE);
|
||||
tracks.addView(view);
|
||||
startHandler(view);
|
||||
|
||||
|
|
Loading…
Reference in a new issue