diff --git a/OsmAnd/res/layout/custom_radio_buttons.xml b/OsmAnd/res/layout/custom_radio_buttons.xml
new file mode 100644
index 0000000000..a5ec943f6a
--- /dev/null
+++ b/OsmAnd/res/layout/custom_radio_buttons.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/OsmAnd/res/layout/fragment_route_between_points_bottom_sheet_dialog.xml b/OsmAnd/res/layout/fragment_route_between_points_bottom_sheet_dialog.xml
index dff8a363aa..a138c7ee2c 100644
--- a/OsmAnd/res/layout/fragment_route_between_points_bottom_sheet_dialog.xml
+++ b/OsmAnd/res/layout/fragment_route_between_points_bottom_sheet_dialog.xml
@@ -45,52 +45,7 @@
android:letterSpacing="@dimen/description_letter_spacing"
android:textSize="@dimen/default_desc_text_size" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
Поставите минимални и максимални ниво зума, при коме ће слој бити приказан.
Додатне мапе су потребне да бисте видели сенке брда на мапи.
Додатне мапе су потребне да бисте видели нагибе на мапи.
- Можете прочитати више о нагибима у %1$е.
+ Можете прочитати више о нагибима у %1$s.
Омогућите да би видели сенке брда или мапе нагиба. Можете прочитати више о овим врстама карта на нашем сајту.
Сви подаци %1$S су увезени, можете да употребите дугмад испод да би сте отворили неопходни део апликације ради управљања њима.
Османд проверава %1$S постојање дупликата са постојећим елементима у апликацији.
diff --git a/OsmAnd/src/net/osmand/plus/UiUtilities.java b/OsmAnd/src/net/osmand/plus/UiUtilities.java
index f3d4089040..a3ef28c8d0 100644
--- a/OsmAnd/src/net/osmand/plus/UiUtilities.java
+++ b/OsmAnd/src/net/osmand/plus/UiUtilities.java
@@ -6,6 +6,7 @@ import android.graphics.Color;
import android.graphics.Typeface;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import android.hardware.Sensor;
@@ -89,6 +90,11 @@ public class UiUtilities {
TOOLBAR
}
+ public enum CustomRadioButtonType {
+ LEFT,
+ RIGHT,
+ }
+
public UiUtilities(OsmandApplication app) {
this.app = app;
}
@@ -437,11 +443,44 @@ public class UiUtilities {
image.setRotationY(rotation);
}
+
+ public static void updateCustomRadioButtons(Context app, View buttonsView, boolean nightMode,
+ CustomRadioButtonType buttonType) {
+ int activeColor = ContextCompat.getColor(app, nightMode
+ ? R.color.active_color_primary_dark
+ : R.color.active_color_primary_light);
+ int textColor = ContextCompat.getColor(app, nightMode
+ ? R.color.text_color_primary_dark
+ : R.color.text_color_primary_light);
+ int radius = AndroidUtils.dpToPx(app, 4);
+
+ TextView leftButtonText = buttonsView.findViewById(R.id.left_button);
+ View leftButtonContainer = buttonsView.findViewById(R.id.left_button_container);
+ TextView rightButtonText = buttonsView.findViewById(R.id.right_button);
+ View rightButtonContainer = buttonsView.findViewById(R.id.right_button_container);
+ GradientDrawable background = new GradientDrawable();
+ background.setColor(UiUtilities.getColorWithAlpha(activeColor, 0.1f));
+ background.setStroke(AndroidUtils.dpToPx(app, 1), UiUtilities.getColorWithAlpha(activeColor, 0.5f));
+ if (buttonType == CustomRadioButtonType.LEFT) {
+ background.setCornerRadii(new float[]{radius, radius, 0, 0, 0, 0, radius, radius});
+ rightButtonContainer.setBackgroundColor(Color.TRANSPARENT);
+ rightButtonText.setTextColor(activeColor);
+ leftButtonContainer.setBackgroundDrawable(background);
+ leftButtonText.setTextColor(textColor);
+ } else {
+ background.setCornerRadii(new float[]{0, 0, radius, radius, radius, radius, 0, 0});
+ rightButtonContainer.setBackgroundDrawable(background);
+ rightButtonText.setTextColor(textColor);
+ leftButtonContainer.setBackgroundColor(Color.TRANSPARENT);
+ leftButtonText.setTextColor(activeColor);
+ }
+ }
+
public static void setupCompoundButtonDrawable(Context ctx, boolean nightMode, @ColorInt int activeColor, Drawable drawable) {
int inactiveColor = ContextCompat.getColor(ctx, nightMode ? R.color.icon_color_default_dark : R.color.icon_color_default_light);
- int[][] states = new int[][] {
- new int[] {-android.R.attr.state_checked},
- new int[] {android.R.attr.state_checked}
+ int[][] states = new int[][]{
+ new int[]{-android.R.attr.state_checked},
+ new int[]{android.R.attr.state_checked}
};
ColorStateList csl = new ColorStateList(states, new int[]{inactiveColor, activeColor});
DrawableCompat.setTintList(DrawableCompat.wrap(drawable), csl);
diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java
index fcb7602785..718a1e31d3 100644
--- a/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java
+++ b/OsmAnd/src/net/osmand/plus/measurementtool/RouteBetweenPointsBottomSheetDialogFragment.java
@@ -1,16 +1,13 @@
package net.osmand.plus.measurementtool;
import android.app.Dialog;
-import android.graphics.Color;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.GradientDrawable;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
-import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
@@ -18,7 +15,6 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
@@ -38,6 +34,7 @@ import org.apache.commons.logging.Log;
import java.util.ArrayList;
import java.util.List;
+import static net.osmand.plus.UiUtilities.CustomRadioButtonType.*;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationType.NEXT_SEGMENT;
import static net.osmand.plus.measurementtool.MeasurementEditingContext.CalculationType.WHOLE_TRACK;
@@ -52,14 +49,12 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial
private boolean nightMode;
private boolean portrait;
private boolean snapToRoadEnabled;
- private TextView segmentBtn;
- private TextView wholeTrackBtn;
private TextView btnDescription;
- private FrameLayout segmentBtnContainer;
- private FrameLayout wholeTrackBtnContainer;
private CalculationType calculationType = WHOLE_TRACK;
private ApplicationMode snapToRoadAppMode;
+ private LinearLayout customRadioButton;
+
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -87,10 +82,12 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial
dismiss();
}
});
- segmentBtnContainer = mainView.findViewById(R.id.next_segment_btn_container);
- segmentBtn = mainView.findViewById(R.id.next_segment_btn);
- wholeTrackBtnContainer = mainView.findViewById(R.id.whole_track_btn_container);
- wholeTrackBtn = mainView.findViewById(R.id.whole_track_btn);
+
+ customRadioButton = mainView.findViewById(R.id.custom_radio_buttons);
+ TextView segmentBtn = mainView.findViewById(R.id.left_button);
+ segmentBtn.setText(R.string.next_segment);
+ TextView wholeTrackBtn = mainView.findViewById(R.id.right_button);
+ wholeTrackBtn.setText(R.string.whole_track);
btnDescription = mainView.findViewById(R.id.button_description);
LinearLayout navigationType = mainView.findViewById(R.id.navigation_types_container);
@@ -144,39 +141,18 @@ public class RouteBetweenPointsBottomSheetDialogFragment extends BottomSheetDial
View row = UiUtilities.getInflater(getContext(), nightMode).inflate(R.layout.divider, container, false);
View divider = row.findViewById(R.id.divider);
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) divider.getLayoutParams();
- params.topMargin = container.getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_title_padding_bottom);
- params.bottomMargin = container.getContext().getResources().getDimensionPixelSize(R.dimen.bottom_sheet_title_padding_bottom);
+ params.topMargin = row.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_title_padding_bottom);
+ params.bottomMargin = row.getResources().getDimensionPixelSize(R.dimen.bottom_sheet_title_padding_bottom);
container.addView(row);
}
private void updateModeButtons(CalculationType calculationType) {
- OsmandApplication app = requiredMyApplication();
- int activeColor = ContextCompat.getColor(app, nightMode
- ? R.color.active_color_primary_dark
- : R.color.active_color_primary_light);
- int textColor = ContextCompat.getColor(app, nightMode
- ? R.color.text_color_primary_dark
- : R.color.text_color_primary_light);
- int radius = AndroidUtils.dpToPx(app, 4);
-
- GradientDrawable background = new GradientDrawable();
- background.setColor(UiUtilities.getColorWithAlpha(activeColor, 0.1f));
- background.setStroke(AndroidUtils.dpToPx(app, 1), UiUtilities.getColorWithAlpha(activeColor, 0.5f));
-
if (calculationType == NEXT_SEGMENT) {
- background.setCornerRadii(new float[]{radius, radius, 0, 0, 0, 0, radius, radius});
- wholeTrackBtnContainer.setBackgroundColor(Color.TRANSPARENT);
- wholeTrackBtn.setTextColor(activeColor);
- segmentBtnContainer.setBackgroundDrawable(background);
- segmentBtn.setTextColor(textColor);
+ UiUtilities.updateCustomRadioButtons(getMyApplication(), customRadioButton, nightMode, LEFT);
btnDescription.setText(R.string.rourte_between_points_next_segment_button_desc);
} else {
- background.setCornerRadii(new float[]{0, 0, radius, radius, radius, radius, 0, 0});
- wholeTrackBtnContainer.setBackgroundDrawable(background);
- wholeTrackBtn.setTextColor(textColor);
- segmentBtnContainer.setBackgroundColor(Color.TRANSPARENT);
- segmentBtn.setTextColor(activeColor);
btnDescription.setText(R.string.rourte_between_points_whole_track_button_desc);
+ UiUtilities.updateCustomRadioButtons(getMyApplication(), customRadioButton, nightMode, RIGHT);
}
setCalculationType(calculationType);
Fragment fragment = getTargetFragment();
diff --git a/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainFragment.java b/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainFragment.java
index a57fdfec21..f1517bbaea 100644
--- a/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainFragment.java
+++ b/OsmAnd/src/net/osmand/plus/srtmplugin/TerrainFragment.java
@@ -2,8 +2,6 @@ package net.osmand.plus.srtmplugin;
import android.app.Activity;
import android.content.Intent;
-import android.graphics.Color;
-import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.text.SpannableString;
@@ -16,7 +14,6 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
-import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -55,6 +52,7 @@ import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.List;
+import static net.osmand.plus.UiUtilities.CustomRadioButtonType.*;
import static net.osmand.plus.download.DownloadActivityType.HILLSHADE_FILE;
import static net.osmand.plus.download.DownloadActivityType.SLOPE_FILE;
import static net.osmand.plus.settings.backend.OsmandSettings.TerrainMode.HILLSHADE;
@@ -84,13 +82,10 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
private TextView downloadDescriptionTv;
private TextView transparencyValueTv;
private TextView descriptionTv;
- private TextView hillshadeBtn;
+ private LinearLayout customRadioButton;
private TextView minZoomTv;
private TextView maxZoomTv;
- private TextView slopeBtn;
private TextView stateTv;
- private FrameLayout hillshadeBtnContainer;
- private FrameLayout slopeBtnContainer;
private SwitchCompat switchCompat;
private ImageView iconIv;
private LinearLayout emptyState;
@@ -176,14 +171,13 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
emptyState = root.findViewById(R.id.empty_state);
stateTv = root.findViewById(R.id.state_tv);
iconIv = root.findViewById(R.id.icon_iv);
- slopeBtn = root.findViewById(R.id.slope_btn);
zoomSlider = root.findViewById(R.id.zoom_slider);
minZoomTv = root.findViewById(R.id.zoom_value_min);
maxZoomTv = root.findViewById(R.id.zoom_value_max);
- hillshadeBtn = root.findViewById(R.id.hillshade_btn);
- slopeBtnContainer = root.findViewById(R.id.slope_btn_container);
+ customRadioButton = root.findViewById(R.id.custom_radio_buttons);
+ TextView hillshadeBtn = root.findViewById(R.id.left_button);
+ TextView slopeBtn = root.findViewById(R.id.right_button);
downloadContainer = root.findViewById(R.id.download_container);
- hillshadeBtnContainer = root.findViewById(R.id.hillshade_btn_container);
downloadTopDivider = root.findViewById(R.id.download_container_top_divider);
downloadBottomDivider = root.findViewById(R.id.download_container_bottom_divider);
observableListView = (ObservableListView) root.findViewById(R.id.list_view);
@@ -205,8 +199,10 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
switchCompat.setChecked(terrainEnabled);
hillshadeBtn.setOnClickListener(this);
+ hillshadeBtn.setText(R.string.shared_string_hillshade);
switchCompat.setOnClickListener(this);
slopeBtn.setOnClickListener(this);
+ slopeBtn.setText(R.string.shared_string_slope);
UiUtilities.setupSlider(transparencySlider, nightMode, colorProfile);
UiUtilities.setupSlider(zoomSlider, nightMode, colorProfile, true);
@@ -230,10 +226,10 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
case R.id.switch_compat:
onSwitchClick();
break;
- case R.id.hillshade_btn:
+ case R.id.left_button:
setupTerrainMode(HILLSHADE);
break;
- case R.id.slope_btn:
+ case R.id.right_button:
setupTerrainMode(SLOPE);
break;
default:
@@ -294,30 +290,10 @@ public class TerrainFragment extends BaseOsmAndFragment implements View.OnClickL
}
private void adjustModeButtons(TerrainMode mode) {
- int activeColor = ContextCompat.getColor(app, nightMode
- ? R.color.active_color_primary_dark
- : R.color.active_color_primary_light);
- int textColor = ContextCompat.getColor(app, nightMode
- ? R.color.text_color_primary_dark
- : R.color.text_color_primary_light);
- int radius = AndroidUtils.dpToPx(app, 4);
-
- GradientDrawable background = new GradientDrawable();
- background.setColor(UiUtilities.getColorWithAlpha(activeColor, 0.1f));
- background.setStroke(AndroidUtils.dpToPx(app, 1), UiUtilities.getColorWithAlpha(activeColor, 0.5f));
-
if (mode == SLOPE) {
- background.setCornerRadii(new float[]{0, 0, radius, radius, radius, radius, 0, 0});
- slopeBtnContainer.setBackgroundDrawable(background);
- slopeBtn.setTextColor(textColor);
- hillshadeBtnContainer.setBackgroundColor(Color.TRANSPARENT);
- hillshadeBtn.setTextColor(activeColor);
+ UiUtilities.updateCustomRadioButtons(app, customRadioButton, nightMode, RIGHT);
} else {
- background.setCornerRadii(new float[]{radius, radius, 0, 0, 0, 0, radius, radius});
- slopeBtnContainer.setBackgroundColor(Color.TRANSPARENT);
- slopeBtn.setTextColor(activeColor);
- hillshadeBtnContainer.setBackgroundDrawable(background);
- hillshadeBtn.setTextColor(textColor);
+ UiUtilities.updateCustomRadioButtons(app, customRadioButton, nightMode, LEFT);
}
}