Add navigation card
This commit is contained in:
parent
f2516bfa92
commit
8c01331c57
7 changed files with 139 additions and 8 deletions
62
OsmAnd/res/layout/dash_navigation.xml
Normal file
62
OsmAnd/res/layout/dash_navigation.xml
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/expandable_list_item_background"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<View
|
||||
android:id="@+id/divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:focusable="false"
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="@dimen/list_item_height"
|
||||
android:paddingLeft="@dimen/list_content_padding" >
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:scaleType="center"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:src="@drawable/ic_action_start_navigation" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/name"
|
||||
style="@style/ListText.Small"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_weight="1"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
tools:text="@string/app_version" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/play"
|
||||
android:layout_width="@dimen/dashListItemHeight"
|
||||
android:layout_height="@dimen/dashListItemHeight"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginLeft="@dimen/dashFavIconMargin"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:src="@drawable/ic_play_dark" />
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/cancel"
|
||||
android:layout_width="@dimen/list_item_height"
|
||||
android:layout_height="@dimen/list_item_height"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="?attr/dashboard_button"
|
||||
android:focusable="false"
|
||||
android:src="@drawable/ic_action_remove_dark" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="current_route">Current route</string>
|
||||
<string name="osm_changes_added_to_local_edits">OSM changes added to local changes</string>
|
||||
<string name="mark_to_delete">Mark to delete</string>
|
||||
<string name="osmo_grop_name_length_alert">Group name should be at least 3 symbols long!</string>
|
||||
|
|
|
@ -165,7 +165,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
|
||||
|
||||
protected void aboutRoute() {
|
||||
public void aboutRoute() {
|
||||
Intent intent = new Intent(mapActivity, ShowRouteInfoActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
mapActivity.startActivity(intent);
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
package net.osmand.plus.dashboard;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.ShowRouteInfoActivity;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class DashNavigationFragment extends DashBaseFragment {
|
||||
public static final String TAG = "DASH_NAVIGATION_FRAGMENT";
|
||||
List<TargetPoint> points = new ArrayList<TargetPoint>();
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = getActivity().getLayoutInflater().inflate(R.layout.dash_common_fragment, container, false);
|
||||
((TextView) view.findViewById(R.id.fav_text)).setText(R.string.current_route);
|
||||
((TextView)view.findViewById(R.id.show_all)).setText(R.string.info_button);
|
||||
(view.findViewById(R.id.show_all)).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Intent intent = new Intent(view.getContext(), ShowRouteInfoActivity.class);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
view.getContext().startActivity(intent);
|
||||
}
|
||||
});
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOpenDash() {
|
||||
setupNavigation();
|
||||
}
|
||||
|
||||
public void setupNavigation() {
|
||||
View mainView = getView();
|
||||
final RoutingHelper helper = getMyApplication().getRoutingHelper();
|
||||
if (!getMyApplication().getRoutingHelper().isRouteCalculated()) {
|
||||
(mainView.findViewById(R.id.main_fav)).setVisibility(View.GONE);
|
||||
return;
|
||||
} else {
|
||||
(mainView.findViewById(R.id.main_fav)).setVisibility(View.VISIBLE);
|
||||
}
|
||||
LinearLayout favorites = (LinearLayout) mainView.findViewById(R.id.items);
|
||||
favorites.removeAllViews();
|
||||
LayoutInflater inflater = getActivity().getLayoutInflater();
|
||||
View view = inflater.inflate(R.layout.dash_navigation, null, false);
|
||||
TextView name = (TextView) view.findViewById(R.id.name);
|
||||
ImageView icon = (ImageView) view.findViewById(R.id.icon);
|
||||
ImageView cancel = (ImageView) view.findViewById(R.id.cancel);
|
||||
ImageView play = (ImageView) view.findViewById(R.id.play);
|
||||
name.setText(helper.getGeneralRouteInformation());
|
||||
icon.setImageDrawable(getMyApplication().getIconsCache().getIcon(R.drawable.ic_action_start_navigation,
|
||||
R.color.color_myloc_distance));
|
||||
cancel.setImageDrawable(getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_remove_dark)
|
||||
);
|
||||
play.setImageDrawable(getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_play_dark)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,17 +7,13 @@ import java.util.List;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
import android.app.Dialog;
|
||||
import android.graphics.Typeface;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
|
@ -32,7 +28,6 @@ import android.widget.LinearLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Created by Denis on 24.11.2014.
|
||||
*/
|
||||
public class DashWaypointsFragment extends DashLocationFragment {
|
||||
public static final String TAG = "DASH_WAYPOINTS_FRAGMENT";
|
||||
|
|
|
@ -625,6 +625,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
|
||||
showFragment(manager, fragmentTransaction, DashErrorFragment.TAG, DashErrorFragment.class,
|
||||
mapActivity.getMyApplication().getAppInitializer().checkPreviousRunsForExceptions(mapActivity) && showCards);
|
||||
showFragment(manager, fragmentTransaction, DashNavigationFragment.TAG, DashNavigationFragment.class, showCards);
|
||||
showFragment(manager, fragmentTransaction, DashParkingFragment.TAG, DashParkingFragment.class, showCards);
|
||||
showFragment(manager, fragmentTransaction, DashWaypointsFragment.TAG, DashWaypointsFragment.class, showCards);
|
||||
showFragment(manager, fragmentTransaction, DashSearchFragment.TAG, DashSearchFragment.class, showCards);
|
||||
|
@ -769,7 +770,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks {
|
|||
if (listBackgroundView != null) {
|
||||
dashboardView.findViewById(R.id.map_part_dashboard).setBackgroundColor(clr);
|
||||
}
|
||||
if (t < 0.2) {
|
||||
if (t < 1) {
|
||||
((Toolbar) dashboardView.findViewById(R.id.toolbar)).setBackgroundDrawable(gradientToolbar);
|
||||
} else {
|
||||
((Toolbar) dashboardView.findViewById(R.id.toolbar)).setBackgroundColor(clr);
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.osmand.plus.OsmandSettings.CommonPreference;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.views.controls.MapRouteInfoControl;
|
||||
import net.osmand.plus.views.controls.MapRoutePreferencesControl;
|
||||
|
|
Loading…
Reference in a new issue