Added navigate to button for favorite at dashboard

This commit is contained in:
Bars107 2014-12-09 18:37:05 +02:00
parent 6a3469cce1
commit 706ba54fb2
10 changed files with 16 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 642 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 720 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 452 B

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 777 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 838 B

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -19,8 +19,9 @@
android:layout_height="28dp"/>
<LinearLayout android:orientation="vertical"
android:layout_weight="1"
android:layout_gravity="center_vertical"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content">
<TextView android:id="@+id/name"
android:textSize="16sp"
@ -33,6 +34,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<ImageButton android:id="@+id/navigate_to"
android:src="@drawable/ic_action_gdirections_light"
android:background="@drawable/dashboard_button"
android:layout_marginLeft="12dp"
android:layout_width="50dp"
android:layout_height="50dp"/>
</LinearLayout>

View file

@ -21,6 +21,7 @@ import net.osmand.plus.OsmAndFormatter;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.base.FavoriteImageDrawable;
import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.helpers.FontCache;
import net.osmand.util.MapUtils;
@ -101,6 +102,12 @@ public class DashFavoritesFragment extends DashBaseFragment {
int dist = (int) (MapUtils.getDistance(point.getLatitude(), point.getLongitude(),
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
String distance = OsmAndFormatter.getFormattedDistance(dist, getMyApplication()) + " ";
view.findViewById(R.id.navigate_to).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), point.getLatitude(), point.getLongitude(), point.getName());
}
});
label.setText(distance, TextView.BufferType.SPANNABLE);
label.setTypeface(Typeface.DEFAULT, point.isVisible() ? Typeface.NORMAL : Typeface.ITALIC);
view.setOnClickListener(new View.OnClickListener() {