Add options button; move udo and redo buttons; add small improvements

This commit is contained in:
Alex 2017-08-11 14:35:24 +03:00
parent 584143f6a2
commit c7b877aefc
5 changed files with 65 additions and 48 deletions

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout <FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:background="@color/color_transparent" android:background="@color/color_transparent"
android:clickable="true"> android:clickable="true">
@ -51,8 +51,8 @@
android:layout_marginRight="16dp" android:layout_marginRight="16dp"
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:background="@null" android:background="@null"
tools:src="@drawable/ic_action_measure_point" android:visibility="gone"
android:visibility="gone"/> tools:src="@drawable/ic_action_measure_point"/>
<ImageView <ImageView
android:id="@+id/up_down_button" android:id="@+id/up_down_button"
@ -104,8 +104,8 @@
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_toEndOf="@id/move_point_icon" android:layout_toEndOf="@id/move_point_icon"
android:layout_toRightOf="@id/move_point_icon" android:layout_toRightOf="@id/move_point_icon"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:text="@string/move_point" android:text="@string/move_point"
android:textAppearance="@style/TextAppearance.ListItemTitle"
android:visibility="gone"/> android:visibility="gone"/>
</RelativeLayout> </RelativeLayout>
@ -141,13 +141,31 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="52dp"> android:layout_height="52dp">
<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:gravity="center_vertical"
android:paddingEnd="12dp"
android:paddingLeft="16dp"
android:paddingRight="12dp"
android:paddingStart="16dp"
android:text="@string/shared_string_options"
android:textColor="?attr/color_dialog_buttons"
osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium"/>
<LinearLayout
android:id="@+id/redo_undo_container"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_centerHorizontal="true">
<ImageButton <ImageButton
android:id="@+id/undo_point_button" android:id="@+id/undo_point_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingBottom="14dp" android:paddingBottom="14dp"
android:paddingEnd="12dp" android:paddingEnd="12dp"
@ -161,9 +179,6 @@
android:id="@+id/redo_point_button" android:id="@+id/redo_point_button"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/undo_point_button"
android:layout_toRightOf="@id/undo_point_button"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:paddingBottom="14dp" android:paddingBottom="14dp"
android:paddingEnd="16dp" android:paddingEnd="16dp"
@ -172,6 +187,7 @@
android:paddingStart="12dp" android:paddingStart="12dp"
android:paddingTop="14dp" android:paddingTop="14dp"
tools:src="@drawable/ic_action_redo_dark"/> tools:src="@drawable/ic_action_redo_dark"/>
</LinearLayout>
<Button <Button
android:id="@+id/add_point_button" android:id="@+id/add_point_button"
@ -213,19 +229,19 @@
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/cancel_point_button" android:id="@+id/cancel_point_button"
android:gravity="center_vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:paddingEnd="12dp" android:paddingEnd="12dp"
android:paddingLeft="16dp" android:paddingLeft="16dp"
android:paddingRight="12dp" android:paddingRight="12dp"
android:paddingStart="16dp" android:paddingStart="16dp"
android:text="@string/shared_string_cancel" android:text="@string/shared_string_cancel"
android:textColor="?attr/color_dialog_buttons" android:textColor="?attr/color_dialog_buttons"
android:visibility="gone"
osmand:textAllCapsCompat="true" osmand:textAllCapsCompat="true"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"/>
android:visibility="gone"/>
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>

View file

@ -197,7 +197,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/shared_string_cancel" android:text="@string/shared_string_cancel"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="@color/dashboard_general_button_text_light" android:textColor="?attr/color_dialog_buttons"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold"/> android:textStyle="bold"/>
</FrameLayout> </FrameLayout>

View file

@ -51,13 +51,12 @@
android:background="?attr/selectableItemBackground"> android:background="?attr/selectableItemBackground">
<TextView <TextView
android:id="@+id/cancel_row_text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:text="@string/shared_string_cancel" android:text="@string/shared_string_cancel"
android:textAllCaps="true" android:textAllCaps="true"
android:textColor="@color/dashboard_general_button_text_light" android:textColor="?attr/color_dialog_buttons"
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold"/> android:textStyle="bold"/>
</FrameLayout> </FrameLayout>

View file

@ -23,7 +23,6 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.ImageView; import android.widget.ImageView;
@ -56,7 +55,6 @@ import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController; import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
import net.osmand.plus.widgets.IconPopupMenu; import net.osmand.plus.widgets.IconPopupMenu;
import net.osmand.plus.widgets.TextViewEx;
import java.io.File; import java.io.File;
import java.text.MessageFormat; import java.text.MessageFormat;
@ -134,7 +132,7 @@ public class MeasurementToolFragment extends Fragment {
upDownBtn = (ImageView) mainView.findViewById(R.id.up_down_button); upDownBtn = (ImageView) mainView.findViewById(R.id.up_down_button);
upDownBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_arrow_up)); upDownBtn.setImageDrawable(iconsCache.getThemedIcon(R.drawable.ic_action_arrow_up));
((TextViewEx) mainView.findViewById(R.id.cancel_point_button)).setOnClickListener(new View.OnClickListener() { mainView.findViewById(R.id.cancel_point_button).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
cancelMovePointMode(); cancelMovePointMode();
@ -152,14 +150,20 @@ public class MeasurementToolFragment extends Fragment {
} }
}); });
((Button) mainView.findViewById(R.id.apply_point_button)) mainView.findViewById(R.id.apply_point_button).setOnClickListener(new View.OnClickListener() {
.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
applyMovePointMode(); applyMovePointMode();
} }
}); });
mainView.findViewById(R.id.options_button).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getActivity(), "options", Toast.LENGTH_SHORT).show();
}
});
undoBtn = ((ImageButton) mainView.findViewById(R.id.undo_point_button)); undoBtn = ((ImageButton) mainView.findViewById(R.id.undo_point_button));
redoBtn = ((ImageButton) mainView.findViewById(R.id.redo_point_button)); redoBtn = ((ImageButton) mainView.findViewById(R.id.redo_point_button));
@ -413,6 +417,7 @@ public class MeasurementToolFragment extends Fragment {
R.id.measurement_distance_text_view, R.id.measurement_distance_text_view,
R.id.measurement_points_text_view, R.id.measurement_points_text_view,
R.id.up_down_button, R.id.up_down_button,
R.id.options_button,
R.id.undo_point_button, R.id.undo_point_button,
R.id.redo_point_button, R.id.redo_point_button,
R.id.add_point_button); R.id.add_point_button);
@ -435,6 +440,7 @@ public class MeasurementToolFragment extends Fragment {
R.id.measurement_distance_text_view, R.id.measurement_distance_text_view,
R.id.measurement_points_text_view, R.id.measurement_points_text_view,
R.id.up_down_button, R.id.up_down_button,
R.id.options_button,
R.id.undo_point_button, R.id.undo_point_button,
R.id.redo_point_button, R.id.redo_point_button,
R.id.add_point_button); R.id.add_point_button);

View file

@ -4,7 +4,6 @@ import android.content.res.Configuration;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.util.DisplayMetrics; import android.util.DisplayMetrics;
import android.view.ContextThemeWrapper; import android.view.ContextThemeWrapper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -36,10 +35,7 @@ public class SnapToRoadBottomSheetDialogFragment extends BottomSheetDialogFragme
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme; final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_snap_to_road_bottom_sheet_dialog, container); final View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_snap_to_road_bottom_sheet_dialog, container);
if (nightMode) {
((TextView) view.findViewById(R.id.cancel_row_text))
.setTextColor(ContextCompat.getColor(getActivity(), R.color.dashboard_general_button_text_dark));
}
view.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() { view.findViewById(R.id.cancel_row).setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {