Add toolbar
This commit is contained in:
parent
0b86ae8643
commit
8185c1753b
2 changed files with 82 additions and 18 deletions
|
@ -1,6 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -30,6 +31,66 @@
|
|||
android:orientation="vertical"
|
||||
tools:background="@color/bg_color_dark">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/plan_route_toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||
android:background="?attr/bg_color"
|
||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||
android:visibility="gone"
|
||||
app:contentInsetLeft="54dp"
|
||||
app:contentInsetStart="54dp"
|
||||
tools:visibility="visible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:text="@string/plan_route"
|
||||
android:textColor="?android:textColorSecondary"
|
||||
android:textSize="@dimen/dialog_header_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/options_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_options"
|
||||
android:textAllCaps="true"
|
||||
android:textColor="?attr/color_dialog_buttons"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"/>
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/toolbar_divider"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="1dp"
|
||||
tools:background="?attr/dashboard_divider"/>
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/snap_to_road_progress_bar"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
|
|
|
@ -159,6 +159,8 @@ public class PlanRouteFragment extends Fragment {
|
|||
if (portrait) {
|
||||
mainView.findViewById(R.id.background_view).setBackgroundResource(nightMode ? R.color.bg_color_dark : R.color.bg_color_light);
|
||||
|
||||
mainView.findViewById(R.id.toolbar_divider).setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.actionbar_dark_color : R.color.dashboard_divider_light));
|
||||
|
||||
((ImageView) mainView.findViewById(R.id.up_down_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_up));
|
||||
|
||||
mainView.findViewById(R.id.up_down_row).setOnClickListener(new View.OnClickListener() {
|
||||
|
@ -218,26 +220,26 @@ public class PlanRouteFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.plan_route_toolbar);
|
||||
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (quit(false)) {
|
||||
MapMarkersDialogFragment.showInstance(mapActivity);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
optionsOnClick();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Toolbar toolbar = (Toolbar) mainView.findViewById(R.id.plan_route_toolbar);
|
||||
toolbar.setNavigationIcon(getContentIcon(R.drawable.ic_arrow_back));
|
||||
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (quit(false)) {
|
||||
MapMarkersDialogFragment.showInstance(mapActivity);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
optionsOnClick();
|
||||
}
|
||||
});
|
||||
|
||||
markersRv = mainView.findViewById(R.id.markers_recycler_view);
|
||||
|
||||
adapter = new MapMarkersListAdapter(mapActivity);
|
||||
|
@ -615,6 +617,7 @@ public class PlanRouteFragment extends Fragment {
|
|||
mapActivity.findViewById(R.id.fragments_container).getLayoutParams().height = height;
|
||||
mainView.findViewById(R.id.markers_list_container).getLayoutParams().height = listHeight;
|
||||
mainView.findViewById(R.id.plan_route_shadow).setVisibility(visibility);
|
||||
mainView.findViewById(R.id.plan_route_toolbar).setVisibility(markersListOpened ? View.VISIBLE : View.GONE);
|
||||
mainView.getLayoutParams().height = height;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue