Merge remote-tracking branch 'origin/sasha_pasha_branch' into sasha_pasha_branch

This commit is contained in:
Alexander Sytnyk 2017-08-08 13:34:10 +03:00
commit 10ac576355
6 changed files with 137 additions and 0 deletions

View file

@ -109,4 +109,44 @@
</FrameLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/line_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/route_fab"
android:layout_alignParentRight="true"
android:layout_marginBottom="16dp"
android:layout_marginRight="24dp"
android:contentDescription="@string/quick_action_new_action"
android:src="@drawable/ic_action_polygom_dark"
android:visibility="gone"
app:backgroundTint="@color/dashboard_blue"
app:fabSize="mini"
tools:visibility="visible"/>
<FrameLayout
android:id="@+id/line_text_layout"
android:layout_toLeftOf="@id/line_fab"
android:layout_toStartOf="@id/line_fab"
android:layout_above="@id/route_fab"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginBottom="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:visibility="gone"
tools:visibility="visible">
<net.osmand.plus.widgets.TextViewEx
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:layout_gravity="center_vertical"
android:id="@+id/line_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/add_line"/>
</FrameLayout>
</RelativeLayout>

View file

@ -104,4 +104,44 @@
android:text="@string/add_route_point"/>
</FrameLayout>
<android.support.design.widget.FloatingActionButton
android:id="@+id/line_fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@id/route_fab"
android:layout_alignParentRight="true"
android:layout_marginBottom="16dp"
android:layout_marginRight="24dp"
android:contentDescription="@string/quick_action_new_action"
android:src="@drawable/ic_action_polygom_dark"
android:visibility="gone"
app:backgroundTint="@color/dashboard_blue"
app:fabSize="mini"
tools:visibility="visible"/>
<FrameLayout
android:id="@+id/line_text_layout"
android:layout_toLeftOf="@id/line_fab"
android:layout_toStartOf="@id/line_fab"
android:layout_above="@id/route_fab"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_marginBottom="16dp"
android:layout_marginRight="16dp"
android:layout_marginEnd="16dp"
android:visibility="gone"
tools:visibility="visible">
<net.osmand.plus.widgets.TextViewEx
android:textColor="?android:attr/textColorPrimary"
osmand:typeface="@string/font_roboto_medium"
android:layout_gravity="center_vertical"
android:id="@+id/line_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:text="@string/add_line"/>
</FrameLayout>
</RelativeLayout>

View file

@ -2665,6 +2665,7 @@
<string name="retry">Retry</string>
<string name="add_route_point">Add Route Point</string>
<string name="add_waypoint">Add Waypoint</string>
<string name="add_line">Add Line</string>
<string name="save_gpx_waypoint">Save GPX Waypoint</string>
<string name="save_route_point">Save Route Point</string>
<string name="waypoint_one">Waypoint 1</string>

View file

@ -108,6 +108,10 @@ public class TrackActivity extends TabActivity {
}
}
public void addLine() {
}
protected void setGpxDataItem(GpxDataItem gpxDataItem) {
this.gpxDataItem = gpxDataItem;
}

View file

@ -99,6 +99,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
private View waypointTextLayout;
private FloatingActionButton routePointFab;
private View routePointTextLayout;
private FloatingActionButton lineFab;
private View lineTextLayout;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@ -166,6 +168,15 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
});
routePointTextLayout = view.findViewById(R.id.route_text_layout);
lineFab = (FloatingActionButton) view.findViewById(R.id.line_fab);
lineFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
addLine();
}
});
lineTextLayout = view.findViewById(R.id.line_text_layout);
TextView tv = new TextView(getActivity());
tv.setText(R.string.none_selected_gpx);
tv.setTextSize(24);
@ -181,12 +192,18 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
getTrackActivity().addPoint(pointDescription);
}
private void addLine() {
getTrackActivity().addLine();
}
private void openMenu() {
menuFab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_action_remove_dark));
waypointFab.setVisibility(View.VISIBLE);
waypointTextLayout.setVisibility(View.VISIBLE);
routePointFab.setVisibility(View.VISIBLE);
routePointTextLayout.setVisibility(View.VISIBLE);
lineFab.setVisibility(View.VISIBLE);
lineTextLayout.setVisibility(View.VISIBLE);
menuOpened = true;
}
@ -196,6 +213,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
waypointTextLayout.setVisibility(View.GONE);
routePointFab.setVisibility(View.GONE);
routePointTextLayout.setVisibility(View.GONE);
lineFab.setVisibility(View.GONE);
lineTextLayout.setVisibility(View.GONE);
menuOpened = false;
}

View file

@ -148,6 +148,8 @@ public class TrackSegmentFragment extends OsmAndListFragment {
private View waypointTextLayout;
private FloatingActionButton routePointFab;
private View routePointTextLayout;
private FloatingActionButton lineFab;
private View lineTextLayout;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@ -158,6 +160,20 @@ public class TrackSegmentFragment extends OsmAndListFragment {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
getListView().setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView absListView, int i) {
if (i == AbsListView.OnScrollListener.SCROLL_STATE_TOUCH_SCROLL) {
if (menuOpened) {
closeMenu();
}
}
}
@Override
public void onScroll(AbsListView absListView, int i, int i1, int i2) {
}
});
getListView().setBackgroundColor(getResources().getColor(
getMyApplication().getSettings().isLightContent() ? R.color.ctx_menu_info_view_bg_light
: R.color.ctx_menu_info_view_bg_dark));
@ -209,6 +225,15 @@ public class TrackSegmentFragment extends OsmAndListFragment {
});
routePointTextLayout = view.findViewById(R.id.route_text_layout);
lineFab = (FloatingActionButton) view.findViewById(R.id.line_fab);
lineFab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
addLine();
}
});
lineTextLayout = view.findViewById(R.id.line_text_layout);
paint = new Paint();
paint.setStyle(Paint.Style.STROKE);
paint.setAntiAlias(true);
@ -236,12 +261,18 @@ public class TrackSegmentFragment extends OsmAndListFragment {
getTrackActivity().addPoint(pointDescription);
}
private void addLine() {
getTrackActivity().addLine();
}
private void openMenu() {
menuFab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_action_remove_dark));
waypointFab.setVisibility(View.VISIBLE);
waypointTextLayout.setVisibility(View.VISIBLE);
routePointFab.setVisibility(View.VISIBLE);
routePointTextLayout.setVisibility(View.VISIBLE);
lineFab.setVisibility(View.VISIBLE);
lineTextLayout.setVisibility(View.VISIBLE);
menuOpened = true;
}
@ -251,6 +282,8 @@ public class TrackSegmentFragment extends OsmAndListFragment {
waypointTextLayout.setVisibility(View.GONE);
routePointFab.setVisibility(View.GONE);
routePointTextLayout.setVisibility(View.GONE);
lineFab.setVisibility(View.GONE);
lineTextLayout.setVisibility(View.GONE);
menuOpened = false;
}