Add fab for add line action
This commit is contained in:
parent
8a767be254
commit
137ce99023
6 changed files with 125 additions and 2 deletions
|
@ -27,7 +27,7 @@
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:contentDescription="@string/quick_action_new_action"
|
android:contentDescription="@string/quick_action_new_action"
|
||||||
android:src="@drawable/ic_action_plus"
|
tools:src="@drawable/ic_action_plus"
|
||||||
app:backgroundTint="@color/dashboard_blue"
|
app:backgroundTint="@color/dashboard_blue"
|
||||||
app:fabSize="normal"/>
|
app:fabSize="normal"/>
|
||||||
|
|
||||||
|
@ -109,4 +109,44 @@
|
||||||
|
|
||||||
</FrameLayout>
|
</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>
|
</RelativeLayout>
|
|
@ -23,7 +23,7 @@
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:contentDescription="@string/quick_action_new_action"
|
android:contentDescription="@string/quick_action_new_action"
|
||||||
android:src="@drawable/ic_action_plus"
|
tools:src="@drawable/ic_action_plus"
|
||||||
app:backgroundTint="@color/dashboard_blue"
|
app:backgroundTint="@color/dashboard_blue"
|
||||||
app:fabSize="normal"/>
|
app:fabSize="normal"/>
|
||||||
|
|
||||||
|
@ -104,4 +104,44 @@
|
||||||
android:text="@string/add_route_point"/>
|
android:text="@string/add_route_point"/>
|
||||||
|
|
||||||
</FrameLayout>
|
</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>
|
</RelativeLayout>
|
|
@ -2665,6 +2665,7 @@
|
||||||
<string name="retry">Retry</string>
|
<string name="retry">Retry</string>
|
||||||
<string name="add_route_point">Add Route Point</string>
|
<string name="add_route_point">Add Route Point</string>
|
||||||
<string name="add_waypoint">Add Waypoint</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_gpx_waypoint">Save GPX Waypoint</string>
|
||||||
<string name="save_route_point">Save Route Point</string>
|
<string name="save_route_point">Save Route Point</string>
|
||||||
<string name="waypoint_one">Waypoint 1</string>
|
<string name="waypoint_one">Waypoint 1</string>
|
||||||
|
|
|
@ -108,6 +108,10 @@ public class TrackActivity extends TabActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addLine() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void setGpxDataItem(GpxDataItem gpxDataItem) {
|
protected void setGpxDataItem(GpxDataItem gpxDataItem) {
|
||||||
this.gpxDataItem = gpxDataItem;
|
this.gpxDataItem = gpxDataItem;
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
private View waypointTextLayout;
|
private View waypointTextLayout;
|
||||||
private FloatingActionButton routePointFab;
|
private FloatingActionButton routePointFab;
|
||||||
private View routePointTextLayout;
|
private View routePointTextLayout;
|
||||||
|
private FloatingActionButton lineFab;
|
||||||
|
private View lineTextLayout;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
@ -166,6 +168,15 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
});
|
});
|
||||||
routePointTextLayout = view.findViewById(R.id.route_text_layout);
|
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());
|
TextView tv = new TextView(getActivity());
|
||||||
tv.setText(R.string.none_selected_gpx);
|
tv.setText(R.string.none_selected_gpx);
|
||||||
tv.setTextSize(24);
|
tv.setTextSize(24);
|
||||||
|
@ -181,12 +192,18 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
getTrackActivity().addPoint(pointDescription);
|
getTrackActivity().addPoint(pointDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addLine() {
|
||||||
|
getTrackActivity().addLine();
|
||||||
|
}
|
||||||
|
|
||||||
private void openMenu() {
|
private void openMenu() {
|
||||||
menuFab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_action_remove_dark));
|
menuFab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_action_remove_dark));
|
||||||
waypointFab.setVisibility(View.VISIBLE);
|
waypointFab.setVisibility(View.VISIBLE);
|
||||||
waypointTextLayout.setVisibility(View.VISIBLE);
|
waypointTextLayout.setVisibility(View.VISIBLE);
|
||||||
routePointFab.setVisibility(View.VISIBLE);
|
routePointFab.setVisibility(View.VISIBLE);
|
||||||
routePointTextLayout.setVisibility(View.VISIBLE);
|
routePointTextLayout.setVisibility(View.VISIBLE);
|
||||||
|
lineFab.setVisibility(View.VISIBLE);
|
||||||
|
lineTextLayout.setVisibility(View.VISIBLE);
|
||||||
menuOpened = true;
|
menuOpened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,6 +213,8 @@ public class TrackPointFragment extends OsmandExpandableListFragment {
|
||||||
waypointTextLayout.setVisibility(View.GONE);
|
waypointTextLayout.setVisibility(View.GONE);
|
||||||
routePointFab.setVisibility(View.GONE);
|
routePointFab.setVisibility(View.GONE);
|
||||||
routePointTextLayout.setVisibility(View.GONE);
|
routePointTextLayout.setVisibility(View.GONE);
|
||||||
|
lineFab.setVisibility(View.GONE);
|
||||||
|
lineTextLayout.setVisibility(View.GONE);
|
||||||
menuOpened = false;
|
menuOpened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,8 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
private View waypointTextLayout;
|
private View waypointTextLayout;
|
||||||
private FloatingActionButton routePointFab;
|
private FloatingActionButton routePointFab;
|
||||||
private View routePointTextLayout;
|
private View routePointTextLayout;
|
||||||
|
private FloatingActionButton lineFab;
|
||||||
|
private View lineTextLayout;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
@ -209,6 +211,15 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
});
|
});
|
||||||
routePointTextLayout = view.findViewById(R.id.route_text_layout);
|
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 = new Paint();
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
paint.setAntiAlias(true);
|
paint.setAntiAlias(true);
|
||||||
|
@ -236,12 +247,18 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
getTrackActivity().addPoint(pointDescription);
|
getTrackActivity().addPoint(pointDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addLine() {
|
||||||
|
getTrackActivity().addLine();
|
||||||
|
}
|
||||||
|
|
||||||
private void openMenu() {
|
private void openMenu() {
|
||||||
menuFab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_action_remove_dark));
|
menuFab.setImageDrawable(ContextCompat.getDrawable(getContext(), R.drawable.ic_action_remove_dark));
|
||||||
waypointFab.setVisibility(View.VISIBLE);
|
waypointFab.setVisibility(View.VISIBLE);
|
||||||
waypointTextLayout.setVisibility(View.VISIBLE);
|
waypointTextLayout.setVisibility(View.VISIBLE);
|
||||||
routePointFab.setVisibility(View.VISIBLE);
|
routePointFab.setVisibility(View.VISIBLE);
|
||||||
routePointTextLayout.setVisibility(View.VISIBLE);
|
routePointTextLayout.setVisibility(View.VISIBLE);
|
||||||
|
lineFab.setVisibility(View.VISIBLE);
|
||||||
|
lineTextLayout.setVisibility(View.VISIBLE);
|
||||||
menuOpened = true;
|
menuOpened = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,6 +268,8 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
waypointTextLayout.setVisibility(View.GONE);
|
waypointTextLayout.setVisibility(View.GONE);
|
||||||
routePointFab.setVisibility(View.GONE);
|
routePointFab.setVisibility(View.GONE);
|
||||||
routePointTextLayout.setVisibility(View.GONE);
|
routePointTextLayout.setVisibility(View.GONE);
|
||||||
|
lineFab.setVisibility(View.GONE);
|
||||||
|
lineTextLayout.setVisibility(View.GONE);
|
||||||
menuOpened = false;
|
menuOpened = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue