This commit is contained in:
Chumva 2019-05-15 14:42:02 +03:00
parent 32c56a693e
commit 3243ef03e5
6 changed files with 115 additions and 111 deletions

View file

@ -51,9 +51,9 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:textColor="@color/color_white"
android:textColor="@color/activity_background_light"
android:textSize="@dimen/map_top_widget_text_size"
android:textStyle="bold"
tools:textStyle="bold"
tools:text="N 20°9660″" />
</LinearLayout>
@ -91,11 +91,10 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_white"
android:textColor="@color/activity_background_light"
android:textSize="@dimen/map_top_widget_text_size"
android:textStyle="bold"
tools:textStyle="bold"
tools:text="W 120°3112″" />
</LinearLayout>

View file

@ -8,7 +8,104 @@
<!-- TOP ROW -->
<FrameLayout
<FrameLayout
android:id="@+id/coordinates_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:minHeight="@dimen/map_address_height"
android:visibility="visible"
tools:background="@color/activity_background_dark"
tools:visibility="visible">
<LinearLayout
android:id="@+id/coordinates_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/lat_coordinates_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/lat_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_marginBottom="@dimen/content_padding_half"
android:src="@drawable/widget_coordinates_latitude_day" />
<TextView
android:id="@+id/lat_coordinates"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:textColor="@color/activity_background_light"
android:textSize="@dimen/map_top_widget_text_size"
tools:textStyle="bold"
tools:text="N 20°9660″" />
</LinearLayout>
<View
android:id="@+id/coordinates_divider"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginBottom="@dimen/content_padding_small"
tools:background="@color/map_progress_bar_bg_light" />
<LinearLayout
android:id="@+id/lon_coordinates_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/lon_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_marginBottom="@dimen/content_padding_half"
android:src="@drawable/widget_coordinates_longitude_day" />
<TextView
android:id="@+id/lon_coordinates"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:textColor="@color/activity_background_light"
android:textSize="@dimen/map_top_widget_text_size"
tools:textStyle="bold"
tools:text="W 120°3112″" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/map_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -299,105 +396,7 @@
</FrameLayout>
<FrameLayout
android:id="@+id/coordinates_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:minHeight="@dimen/map_address_height"
android:visibility="visible"
tools:background="@color/activity_background_dark"
tools:visibility="visible">
<LinearLayout
android:id="@+id/coordinates_row"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/lat_coordinates_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/lat_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_marginBottom="@dimen/content_padding_half"
android:src="@drawable/widget_coordinates_latitude_day" />
<TextView
android:id="@+id/lat_coordinates"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:maxLines="1"
android:textColor="@color/color_white"
android:textSize="@dimen/map_top_widget_text_size"
android:textStyle="bold"
tools:text="N 20°9660″" />
</LinearLayout>
<View
android:id="@+id/coordinates_divider"
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginBottom="@dimen/content_padding_small"
tools:background="@color/map_progress_bar_bg_light" />
<LinearLayout
android:id="@+id/lon_coordinates_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_weight="1"
android:orientation="horizontal">
<ImageView
android:id="@+id/lon_icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding_half"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_marginBottom="@dimen/content_padding_half"
android:src="@drawable/widget_coordinates_longitude_day" />
<TextView
android:id="@+id/lon_coordinates"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:ellipsize="end"
android:maxLines="1"
android:textColor="@color/color_white"
android:textSize="@dimen/map_top_widget_text_size"
android:textStyle="bold"
tools:text="W 120°3112″" />
</LinearLayout>
</LinearLayout>
</FrameLayout>
<FrameLayout
<FrameLayout
android:id="@+id/map_markers_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"

View file

@ -11,7 +11,6 @@
Thx - Hardy
-->
<string name="coordinates_copy_to_clipboard">Coordinates copy to clipboard</string>
<string name="searching_gps">Searching GPS</string>
<string name="coordinates_widget">Coordinates widget</string>
<string name="files_moved">Moved %1$d files (%2$s).</string>

View file

@ -298,6 +298,12 @@ public class AndroidUtils {
tv.setTextColor(ContextCompat.getColor(view.getContext(), colorId));
}
public static void setSnackbarTextMaxLines(Snackbar snackbar, int maxLines) {
View view = snackbar.getView();
TextView tv = (TextView) view.findViewById(android.support.design.R.id.snackbar_text);
tv.setMaxLines(maxLines);
}
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public static void setBackground(Context ctx, View view, boolean night, int lightResId, int darkResId) {

View file

@ -919,10 +919,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
boolean mapTopBar = findViewById(R.id.map_top_bar).getVisibility() == View.VISIBLE;
boolean markerTopBar = findViewById(R.id.map_markers_top_bar).getVisibility() == View.VISIBLE;
boolean coordinatesTopBar = findViewById(R.id.coordinates_top_bar).getVisibility() == View.VISIBLE;
if (mapTopBar && mapControlsVisible) {
colorId = night ? R.color.status_bar_route_dark : R.color.status_bar_route_light;
} else if (coordinatesTopBar && mapControlsVisible) {
if (coordinatesTopBar && mapControlsVisible) {
colorId = night ? R.color.status_bar_main_dark : R.color.status_bar_main_dark;
} else if (mapTopBar && mapControlsVisible) {
colorId = night ? R.color.status_bar_route_dark : R.color.status_bar_route_light;
} else if (markerTopBar && mapControlsVisible) {
colorId = R.color.status_bar_dark;
} else {

View file

@ -1056,7 +1056,7 @@ public class MapInfoWidgetsFactory {
if (lastKnownLocation != null) {
String coordinates = latitudeText.getText().toString();
if (lonCoordinatesContainer.getVisibility() == View.VISIBLE) {
coordinates += "," + longitudeText.getText().toString();
coordinates += ", " + longitudeText.getText().toString();
}
copyToClipboard(coordinates);
}
@ -1132,7 +1132,7 @@ public class MapInfoWidgetsFactory {
}
private void showShareSnackbar(@NonNull final String text, @NonNull final Context ctx) {
Snackbar snackbar = Snackbar.make(map.getLayout(), R.string.coordinates_copy_to_clipboard, Snackbar.LENGTH_LONG)
Snackbar snackbar = Snackbar.make(map.getLayout(), ctx.getResources().getString(R.string.copied_to_clipboard) + ":\n" + text, Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_share, new View.OnClickListener() {
@Override
public void onClick(View view) {
@ -1144,6 +1144,7 @@ public class MapInfoWidgetsFactory {
}
});
AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
AndroidUtils.setSnackbarTextMaxLines(snackbar, 5);
snackbar.show();
}