Add color
This commit is contained in:
parent
76443418f1
commit
9fa5cf5ea6
10 changed files with 39 additions and 86 deletions
|
@ -11,9 +11,6 @@
|
|||
<ImageView android:id="@+id/favourite_icon" android:layout_width="25dp"
|
||||
android:paddingRight="2dp" android:paddingTop="2dp" android:layout_height="fill_parent" />
|
||||
|
||||
<TextView android:id="@+id/favouritedistance_label"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center"
|
||||
android:textSize="23sp" android:maxWidth="150dp" android:minWidth="90dp"/>
|
||||
<TextView android:id="@+id/favourite_label" android:layout_width="wrap_content" android:layout_marginLeft="10dp"
|
||||
android:layout_height="wrap_content" android:textSize="23sp"/>
|
||||
|
||||
|
|
|
@ -4,19 +4,13 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/distance_label"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="80dp"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:gravity="left"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/label"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="3dp"
|
||||
android:layout_marginRight="3dp"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<ImageButton
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
android:paddingLeft="2dp" android:paddingRight="2dp"
|
||||
android:paddingTop="2dp" android:layout_height="fill_parent" />
|
||||
|
||||
<TextView android:id="@+id/distance"
|
||||
android:layout_width="wrap_content" android:layout_height="fill_parent" android:gravity="left|center_vertical"
|
||||
android:maxWidth="70dp" android:minWidth="70dp" style="@style/ListText.Small"/>
|
||||
<TextView android:id="@+id/label" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" style="@style/ListText.Small"/>
|
||||
|
||||
|
|
|
@ -7,9 +7,6 @@
|
|||
android:layout_marginLeft="2dp" android:layout_marginTop="2dp"
|
||||
android:paddingTop="0dp" />
|
||||
|
||||
<TextView android:id="@+id/poidistance_label"
|
||||
android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center"
|
||||
android:textSize="22sp" android:maxWidth="80dp" android:minWidth="80dp" android:layout_marginRight="5dp"/>
|
||||
<TextView android:id="@+id/poi_label" android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:textSize="22sp" />
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
<color name="color_white">#FFFFFF</color>
|
||||
<color name="color_red">#FF0000</color>
|
||||
<color name="color_orange">#FD9822</color>
|
||||
|
||||
|
||||
<color name="color_distance">#FD9822</color>
|
||||
|
||||
<!-- LAYER and SPECIAL PURPOSE consistency colors -->
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ import android.content.DialogInterface;
|
|||
import android.content.res.Resources;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.ContextMenu;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -635,7 +637,6 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
|||
}
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.favourite_label);
|
||||
TextView distanceLabel = (TextView) row.findViewById(R.id.favouritedistance_label);
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
|
||||
final FavouritePoint model = (FavouritePoint) getChild(groupPosition, childPosition);
|
||||
row.setTag(model);
|
||||
|
@ -647,8 +648,9 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
|
|||
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(),
|
||||
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
||||
distanceLabel.setText(OsmAndFormatter.getFormattedDistance(dist, FavouritesActivity.this));
|
||||
label.setText(model.getName());
|
||||
String distance = OsmAndFormatter.getFormattedDistance(dist, FavouritesActivity.this) + " ";
|
||||
label.setText(distance + model.getName(), TextView.BufferType.SPANNABLE);
|
||||
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(R.color.color_distance), 0, distance.length() - 1, 0);
|
||||
final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item);
|
||||
if(selectionMode && model.isStored()){
|
||||
ch.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -19,6 +19,8 @@ import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
|||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -27,6 +29,7 @@ import android.widget.CheckBox;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.BufferType;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -156,7 +159,6 @@ public class FavouritesListActivity extends ListActivity implements SearchActivi
|
|||
}
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.favourite_label);
|
||||
TextView distanceLabel = (TextView) row.findViewById(R.id.favouritedistance_label);
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
|
||||
final FavouritePoint model = getItem(position);
|
||||
if (model.isStored()) {
|
||||
|
@ -164,14 +166,15 @@ public class FavouritesListActivity extends ListActivity implements SearchActivi
|
|||
} else {
|
||||
icon.setImageResource(R.drawable.opened_poi);
|
||||
}
|
||||
String distance = "";
|
||||
if (location != null) {
|
||||
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(), location.getLatitude(), location
|
||||
.getLongitude()));
|
||||
distanceLabel.setText(OsmAndFormatter.getFormattedDistance(dist, FavouritesListActivity.this));
|
||||
distanceLabel.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
distanceLabel.setVisibility(View.GONE);
|
||||
distance = OsmAndFormatter.getFormattedDistance(dist, FavouritesListActivity.this) + " " ;
|
||||
}
|
||||
|
||||
label.setText(distance + getName(model), BufferType.SPANNABLE);
|
||||
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(R.color.color_distance), 0, distance.length(), 0);
|
||||
|
||||
label.setText(getName(model));
|
||||
final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item);
|
||||
|
|
|
@ -3,32 +3,31 @@ package net.osmand.plus.activities.search;
|
|||
import java.util.List;
|
||||
|
||||
import net.londatiga.android.QuickAction;
|
||||
import net.osmand.FavouritePoint;
|
||||
import net.osmand.OsmAndFormatter;
|
||||
import net.osmand.osm.LatLon;
|
||||
import net.osmand.osm.MapUtils;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityActions;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.activities.search.SearchHistoryHelper.HistoryEntry;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ListActivity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.BufferType;
|
||||
|
||||
public class SearchHistoryActivity extends ListActivity implements SearchActivityChild {
|
||||
private LatLon location;
|
||||
|
@ -58,13 +57,6 @@ public class SearchHistoryActivity extends ListActivity implements SearchActivi
|
|||
setListAdapter(new HistoryAdapter(helper.getHistoryEntries(SearchHistoryActivity.this)));
|
||||
}
|
||||
});
|
||||
lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
|
||||
@Override
|
||||
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
||||
return SearchHistoryActivity.this.onItemLongClick(pos);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,29 +92,6 @@ public class SearchHistoryActivity extends ListActivity implements SearchActivi
|
|||
((HistoryAdapter) getListAdapter()).notifyDataSetChanged();
|
||||
}
|
||||
|
||||
private boolean onItemLongClick(int pos) {
|
||||
final HistoryEntry entry = ((HistoryAdapter) getListAdapter()).getItem(pos);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(SearchHistoryActivity.this);
|
||||
builder.setTitle(entry.getName());
|
||||
builder.setItems(new String[] { getString(R.string.show_poi_on_map), getString(R.string.navigate_to) },
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
if (which == 0) {
|
||||
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
|
||||
settings.setMapLocationToShow(entry.getLat(), entry.getLon(), settings.getLastKnownMapZoom(), null, entry
|
||||
.getName(), null);
|
||||
} else if (which == 1) {
|
||||
((OsmandApplication) getApplication()).getSettings().setPointToNavigate(entry.getLat(), entry.getLon(), null);
|
||||
}
|
||||
MapActivity.launchMapActivityMoveToTop(SearchHistoryActivity.this);
|
||||
}
|
||||
|
||||
});
|
||||
builder.show();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
|
@ -159,16 +128,15 @@ public class SearchHistoryActivity extends ListActivity implements SearchActivi
|
|||
row = inflater.inflate(R.layout.search_history_list_item, parent, false);
|
||||
}
|
||||
TextView label = (TextView) row.findViewById(R.id.label);
|
||||
TextView distanceLabel = (TextView) row.findViewById(R.id.distance_label);
|
||||
String distance = "";
|
||||
ImageButton icon = (ImageButton) row.findViewById(R.id.remove);
|
||||
final HistoryEntry model = getItem(position);
|
||||
if (location != null) {
|
||||
int dist = (int) (MapUtils.getDistance(location, model.lat, model.lon));
|
||||
distanceLabel.setText(OsmAndFormatter.getFormattedDistance(dist, SearchHistoryActivity.this));
|
||||
} else {
|
||||
distanceLabel.setText(""); //$NON-NLS-1$
|
||||
distance = OsmAndFormatter.getFormattedDistance(dist, SearchHistoryActivity.this) + " ";
|
||||
}
|
||||
label.setText(model.name);
|
||||
label.setText(distance + model.name, BufferType.SPANNABLE);
|
||||
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(R.color.color_distance), 0, distance.length(), 0);
|
||||
icon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -184,15 +152,6 @@ public class SearchHistoryActivity extends ListActivity implements SearchActivi
|
|||
}
|
||||
};
|
||||
|
||||
// View.OnLongClickListener longClickListener = new View.OnLongClickListener() {
|
||||
// @Override
|
||||
// public boolean onLongClick(View v) {
|
||||
// return onItemLongClick(position);
|
||||
// }
|
||||
// };
|
||||
// distanceLabel.setOnLongClickListener(longClickListener);
|
||||
// label.setOnLongClickListener(longClickListener);
|
||||
distanceLabel.setOnClickListener(clickListener);
|
||||
label.setOnClickListener(clickListener);
|
||||
return row;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,9 @@ import android.os.Bundle;
|
|||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.Editable;
|
||||
import android.text.Spannable;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
|
@ -708,7 +710,6 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
|||
}
|
||||
float[] mes = null;
|
||||
TextView label = (TextView) row.findViewById(R.id.poi_label);
|
||||
TextView distanceLabel = (TextView) row.findViewById(R.id.poidistance_label);
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.poi_icon);
|
||||
Amenity amenity = getItem(position);
|
||||
Location loc = location;
|
||||
|
@ -717,8 +718,6 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
|||
LatLon l = amenity.getLocation();
|
||||
Location.distanceBetween(l.getLatitude(), l.getLongitude(), loc.getLatitude(), loc.getLongitude(), mes);
|
||||
}
|
||||
String str = OsmAndFormatter.getPoiStringWithoutType(amenity, settings.usingEnglishNames());
|
||||
label.setText(str);
|
||||
int opened = -1;
|
||||
if (amenity.getOpeningHours() != null) {
|
||||
OpeningHours rs = OpeningHoursParser.parseOpenedHours(amenity.getOpeningHours());
|
||||
|
@ -751,11 +750,13 @@ public class SearchPOIActivity extends OsmandListActivity implements SensorEvent
|
|||
}
|
||||
}
|
||||
|
||||
if(mes == null){
|
||||
distanceLabel.setText(""); //$NON-NLS-1$
|
||||
} else {
|
||||
distanceLabel.setText(" " + OsmAndFormatter.getFormattedDistance((int) mes[0], SearchPOIActivity.this)); //$NON-NLS-1$
|
||||
String distance = " ";
|
||||
if(mes != null){
|
||||
distance = " " + OsmAndFormatter.getFormattedDistance((int) mes[0], SearchPOIActivity.this) + " "; //$NON-NLS-1$
|
||||
}
|
||||
String poiType = OsmAndFormatter.getPoiStringWithoutType(amenity, settings.usingEnglishNames());
|
||||
label.setText(distance + poiType, TextView.BufferType.SPANNABLE);
|
||||
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(R.color.color_distance), 0, distance.length() - 1, 0);
|
||||
return (row);
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ import android.content.DialogInterface;
|
|||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.text.Spannable;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
|
@ -465,7 +467,6 @@ public class SearchTransportActivity extends ListActivity implements SearchActiv
|
|||
LatLon locationToStart = getLocationToStart();
|
||||
|
||||
TextView label = (TextView) row.findViewById(R.id.label);
|
||||
TextView distanceLabel = (TextView) row.findViewById(R.id.distance);
|
||||
ImageView icon = (ImageView) row.findViewById(R.id.search_icon);
|
||||
RouteInfoLocation stop = getItem(position);
|
||||
|
||||
|
@ -480,7 +481,7 @@ public class SearchTransportActivity extends ListActivity implements SearchActiv
|
|||
labelW.append(getString(R.string.transport_search_none));
|
||||
}
|
||||
labelW.append("]\n").append(route.getName(settings.usingEnglishNames())); //$NON-NLS-1$
|
||||
label.setText(labelW.toString());
|
||||
|
||||
// TODO icons
|
||||
if (locationToGo != null && stop.getDistToLocation() < 400) {
|
||||
icon.setImageResource(R.drawable.opened_poi);
|
||||
|
@ -489,8 +490,9 @@ public class SearchTransportActivity extends ListActivity implements SearchActiv
|
|||
}
|
||||
|
||||
int dist = locationToStart == null ? 0 : (int) (MapUtils.getDistance(stop.getStart().getLocation(), locationToStart));
|
||||
distanceLabel.setText(" " + OsmAndFormatter.getFormattedDistance(dist, SearchTransportActivity.this)); //$NON-NLS-1$
|
||||
|
||||
String distance = OsmAndFormatter.getFormattedDistance(dist, SearchTransportActivity.this) + " "; //$NON-NLS-1$
|
||||
label.setText(distance + labelW.toString(), TextView.BufferType.SPANNABLE);
|
||||
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(R.color.color_distance), 0, distance.length() - 1, 0);
|
||||
return (row);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue