Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2017-11-01 19:46:35 +01:00
commit 8f01e03d02
34 changed files with 219 additions and 47 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/osmand_orange"/>
</shape>
</item>
<item android:drawable="@drawable/ic_action_marker_passed"/>
</layer-list>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/map_widget_blue"/>
</shape>
</item>
<item android:drawable="@drawable/ic_action_marker_passed"/>
</layer-list>

View file

@ -166,18 +166,22 @@
<LinearLayout
android:id="@+id/title_button_container"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/context_menu_action_buttons_h"
android:layout_marginTop="@dimen/context_menu_buttons_top_margin"
android:clickable="true"
android:orientation="horizontal"
android:minHeight="@dimen/context_menu_action_buttons_h"
android:orientation="vertical"
android:paddingBottom="@dimen/context_menu_buttons_padding_bottom"
android:paddingLeft="62dp"
android:paddingRight="2dp"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/title_button"
android:layout_width="wrap_content"
@ -197,9 +201,9 @@
android:layout_marginLeft="-4dp"
android:clickable="true"
android:gravity="center_vertical"
tools:text="— 00:26"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"/>
android:textSize="@dimen/default_desc_text_size"
tools:text="— 00:26"/>
<Button
android:id="@+id/title_button_right"
@ -212,6 +216,28 @@
android:text="@string/shared_string_delete"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>
<View
android:id="@+id/title_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginLeft="10dp"
android:background="?attr/dashboard_divider"
android:visibility="gone"
tools:visibility="visible"/>
<Button
android:id="@+id/subtitle_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:gravity="left|center_vertical"
android:paddingLeft="@dimen/context_menu_button_padding_x"
android:paddingRight="@dimen/context_menu_button_padding_x"
android:text="@string/recording_context_menu_play"
android:textColor="?attr/contextMenuButtonColor"
android:textSize="@dimen/default_desc_text_size"/>
</LinearLayout>

View file

@ -9,6 +9,10 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
<string name="tap_on_map_to_hide_interface_descr">Tapping anywhere on the map hides the interface and toggles the full screen mode.</string>
<string name="tap_on_map_to_hide_interface">Tap on map hides interface</string>
<string name="show_on_top_bar">Show on Top Bar</string>
<string name="mark_passed">Mark passed</string>
<string name="import_gpx_file_description">can be imported as Favorites points, or as track file.</string>
<string name="import_as_gpx">Import as GPX file</string>
<string name="import_as_favorites">Import as Favorites</string>
@ -66,7 +70,7 @@
<string name="marker_moved_to_active">Map marker moved to active</string>
<string name="shared_string_list">List</string>
<string name="shared_string_groups">Groups</string>
<string name="passed">Passed: %1$s</string>
<string name="passed">Last used: %1$s</string>
<string name="make_active">Make active</string>
<string name="today">Today</string>
<string name="yesterday">Yesterday</string>

View file

@ -243,6 +243,38 @@ public class AndroidUtils {
return new PointF(centroidX, centroidY);
}
public static void showSystemUI(Activity activity) {
if (Build.VERSION.SDK_INT >= 19 && !isSystemUiVisible(activity)) {
switchSystemUiVisibility(activity);
}
}
public static void hideSystemUI(Activity activity) {
if (Build.VERSION.SDK_INT >= 19 && isSystemUiVisible(activity)) {
switchSystemUiVisibility(activity);
}
}
public static boolean isSystemUiVisible(Activity activity) {
if (Build.VERSION.SDK_INT >= 19) {
int uiOptions = activity.getWindow().getDecorView().getSystemUiVisibility();
return !((uiOptions | View.SYSTEM_UI_FLAG_FULLSCREEN) == uiOptions);
}
return true;
}
public static void switchSystemUiVisibility(Activity activity) {
if (Build.VERSION.SDK_INT < 19) {
return;
}
View decorView = activity.getWindow().getDecorView();
int uiOptions = decorView.getSystemUiVisibility();
uiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
uiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
uiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
decorView.setSystemUiVisibility(uiOptions);
}
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValue(Map<K, V> map) {
List<Map.Entry<K, V>> list = new LinkedList<>(map.entrySet());
Collections.sort(list, new Comparator<Map.Entry<K, V>>() {

View file

@ -795,6 +795,16 @@ public class MapMarkersHelper {
}
}
public void moveMarkerToTop(MapMarker marker) {
int i = mapMarkers.indexOf(marker);
if (i != -1 && mapMarkers.size() > 1) {
mapMarkers.remove(i);
mapMarkers.add(0, marker);
reorderActiveMarkersIfNeeded();
refresh();
}
}
public void moveMapMarker(MapMarker marker, LatLon latLon) {
if (marker != null) {
LatLon point = new LatLon(latLon.getLatitude(), latLon.getLongitude());

View file

@ -902,6 +902,8 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> DO_NOT_USE_ANIMATIONS = new BooleanPreference("do_not_use_animations", false).makeGlobal().cache();
public final OsmandPreference<Boolean> DO_NOT_SEND_ANONYMOUS_APP_USAGE = new BooleanPreference("do_not_send_anonymous_app_usage", false).makeGlobal().cache();
public final OsmandPreference<Boolean> MAP_EMPTY_STATE_ALLOWED = new BooleanPreference("map_empty_state_allowed", true).makeGlobal().cache();
public final CommonPreference<Float> TEXT_SCALE = new FloatPreference("text_scale", 1f).makeProfile().cache();

View file

@ -164,7 +164,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
}
View emptyView = view.findViewById(android.R.id.empty);
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_favorites_day_result : R.drawable.ic_empty_state_favorites_night_result);
emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_favorites_day : R.drawable.ic_empty_state_favorites_night);
Button importButton = (Button) emptyView.findViewById(R.id.import_button);
importButton.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -496,6 +496,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_SHOW_STARTUP_MESSAGES, R.string.do_not_show_startup_messages, R.string.do_not_show_startup_messages_desc));
misc.addPreference(createCheckBoxPreference(settings.DO_NOT_USE_ANIMATIONS, R.string.do_not_use_animations, R.string.do_not_use_animations_descr));
misc.addPreference(createCheckBoxPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS, R.string.use_magnetic_sensor, R.string.use_magnetic_sensor_descr));
misc.addPreference(createCheckBoxPreference(settings.MAP_EMPTY_STATE_ALLOWED, R.string.tap_on_map_to_hide_interface, R.string.tap_on_map_to_hide_interface_descr));
}

View file

@ -1035,6 +1035,14 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
}
}
public TitleButtonController getLeftSubtitleButtonController() {
if (menuController != null) {
return menuController.getLeftSubtitleButtonController();
} else {
return null;
}
}
public TitleButtonController getLeftDownloadButtonController() {
if (menuController != null) {
return menuController.getLeftDownloadButtonController();

View file

@ -175,6 +175,18 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
}
});
// Left subtitle button
final Button leftSubtitleButton = (Button) view.findViewById(R.id.subtitle_button);
leftSubtitleButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TitleButtonController leftSubtitleButtonController = menu.getLeftSubtitleButtonController();
if (leftSubtitleButtonController != null) {
leftSubtitleButtonController.buttonPressed();
}
}
});
// Left download button
final Button leftDownloadButton = (Button) view.findViewById(R.id.download_button_left);
leftDownloadButton.setOnClickListener(new View.OnClickListener() {
@ -686,14 +698,17 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
TitleButtonController leftTitleButtonController = menu.getLeftTitleButtonController();
TitleButtonController rightTitleButtonController = menu.getRightTitleButtonController();
TitleButtonController topRightTitleButtonController = menu.getTopRightTitleButtonController();
TitleButtonController leftSubtitleButtonController = menu.getLeftSubtitleButtonController();
TitleButtonController leftDownloadButtonController = menu.getLeftDownloadButtonController();
TitleButtonController rightDownloadButtonController = menu.getRightDownloadButtonController();
TitleProgressController titleProgressController = menu.getTitleProgressController();
// Title buttons
boolean showTitleButtonsContainer = (leftTitleButtonController != null || rightTitleButtonController != null);
boolean showTitleDivider = leftSubtitleButtonController != null;
final View titleButtonsContainer = view.findViewById(R.id.title_button_container);
titleButtonsContainer.setVisibility(showTitleButtonsContainer ? View.VISIBLE : View.GONE);
view.findViewById(R.id.title_divider).setVisibility(showTitleDivider ? View.VISIBLE : View.GONE);
// Left title button
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
@ -705,7 +720,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
Drawable leftIcon = leftTitleButtonController.getLeftIcon();
if (leftIcon != null) {
leftTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
leftTitleButton.setCompoundDrawablePadding(dpToPx(4f));
leftTitleButton.setCompoundDrawablePadding(dpToPx(8f));
}
if (leftTitleButtonController.needRightText) {
@ -727,7 +742,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
Drawable leftIcon = rightTitleButtonController.getLeftIcon();
rightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
rightTitleButton.setCompoundDrawablePadding(dpToPx(4f));
rightTitleButton.setCompoundDrawablePadding(dpToPx(8f));
} else {
rightTitleButton.setVisibility(View.GONE);
}
@ -740,11 +755,26 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
Drawable leftIcon = topRightTitleButtonController.getLeftIcon();
topRightTitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
topRightTitleButton.setCompoundDrawablePadding(dpToPx(4f));
topRightTitleButton.setCompoundDrawablePadding(dpToPx(8f));
} else {
topRightTitleButton.setVisibility(View.GONE);
}
// Left subtitle button
final Button leftSubtitleButton = (Button) view.findViewById(R.id.subtitle_button);
if (leftSubtitleButtonController != null) {
leftSubtitleButton.setText(leftSubtitleButtonController.caption);
leftSubtitleButton.setVisibility(leftSubtitleButtonController.visible ? View.VISIBLE : View.GONE);
Drawable leftIcon = leftSubtitleButtonController.getLeftIcon();
if (leftIcon != null) {
leftSubtitleButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
leftSubtitleButton.setCompoundDrawablePadding(dpToPx(8f));
}
} else {
leftSubtitleButton.setVisibility(View.GONE);
}
// Download buttons
boolean showDownloadButtonsContainer =
((leftDownloadButtonController != null && leftDownloadButtonController.visible)
@ -772,7 +802,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
Drawable leftIcon = leftDownloadButtonController.getLeftIcon();
if (leftIcon != null) {
leftDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
leftDownloadButton.setCompoundDrawablePadding(dpToPx(4f));
leftDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
}
} else {
leftDownloadButton.setVisibility(View.GONE);
@ -786,7 +816,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
Drawable leftIcon = rightDownloadButtonController.getLeftIcon();
rightDownloadButton.setCompoundDrawablesWithIntrinsicBounds(leftIcon, null, null, null);
rightDownloadButton.setCompoundDrawablePadding(dpToPx(4f));
rightDownloadButton.setCompoundDrawablePadding(dpToPx(8f));
} else {
rightDownloadButton.setVisibility(View.GONE);
}

View file

@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.support.annotation.NonNull;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;
@ -98,6 +99,7 @@ public abstract class MenuController extends BaseMenuController {
protected TitleButtonController leftTitleButtonController;
protected TitleButtonController rightTitleButtonController;
protected TitleButtonController topRightTitleButtonController;
protected TitleButtonController leftSubtitleButtonController;
protected TitleButtonController leftDownloadButtonController;
protected TitleButtonController rightDownloadButtonController;
@ -321,6 +323,10 @@ public abstract class MenuController extends BaseMenuController {
return topRightTitleButtonController;
}
public TitleButtonController getLeftSubtitleButtonController() {
return leftSubtitleButtonController;
}
public TitleButtonController getLeftDownloadButtonController() {
return leftDownloadButtonController;
}
@ -495,10 +501,18 @@ public abstract class MenuController extends BaseMenuController {
public boolean needRightText = false;
public String rightTextCaption = "";
public boolean visible = true;
public boolean needColorizeIcon = true;
public Drawable leftIcon;
public Drawable getLeftIcon() {
if (leftIcon != null) {
return leftIcon;
}
if (leftIconId != 0) {
if (needColorizeIcon) {
return getIcon(leftIconId, isLight() ? R.color.map_widget_blue : R.color.osmand_orange);
}
return ContextCompat.getDrawable(getMapActivity(), leftIconId);
} else {
return null;
}

View file

@ -1,8 +1,10 @@
package net.osmand.plus.mapcontextmenu.controllers;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import net.osmand.data.PointDescription;
import net.osmand.plus.IconsCache;
import net.osmand.plus.MapMarkersHelper;
import net.osmand.plus.MapMarkersHelper.MapMarker;
import net.osmand.plus.R;
@ -21,6 +23,7 @@ public class MapMarkerMenuController extends MenuController {
this.mapMarker = mapMarker;
builder.setShowNearestWiki(true);
final MapMarkersHelper markersHelper = mapActivity.getMyApplication().getMapMarkersHelper();
leftTitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
@ -28,8 +31,27 @@ public class MapMarkerMenuController extends MenuController {
getMapActivity().getContextMenu().close();
}
};
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_remove);
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
leftTitleButtonController.needColorizeIcon = false;
leftTitleButtonController.caption = getMapActivity().getString(R.string.mark_passed);
leftTitleButtonController.leftIconId = isLight() ? R.drawable.passed_icon_light : R.drawable.passed_icon_dark;
leftSubtitleButtonController = new TitleButtonController() {
@Override
public void buttonPressed() {
markersHelper.moveMarkerToTop(getMapMarker());
getMapActivity().getContextMenu().close();
}
};
leftSubtitleButtonController.caption = getMapActivity().getString(R.string.show_on_top_bar);
leftSubtitleButtonController.leftIcon = createShowOnTopbarIcon();
}
private Drawable createShowOnTopbarIcon() {
IconsCache ic = getMapActivity().getMyApplication().getIconsCache();
Drawable background = ic.getIcon(R.drawable.ic_action_device_top,
isLight() ? R.color.on_map_icon_color : R.color.ctx_menu_info_text_dark);
Drawable topbar = ic.getIcon(R.drawable.ic_action_device_topbar, R.color.dashboard_blue);
return new LayerDrawable(new Drawable[]{background, topbar});
}
@Override

View file

@ -4,7 +4,6 @@ import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

View file

@ -362,10 +362,8 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
public void onResume() {
super.onResume();
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
mapActivity.getMyApplication().getLocationProvider().addLocationListener(this);
}
getMapActivity().getMapLayers().getMapControlsLayer().showMapControls();
mapActivity.getMapLayers().getMapControlsLayer().showMapControls();
}
@Override

View file

@ -330,7 +330,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
listView.addFooterView(footerView);
emptyView = v.findViewById(android.R.id.empty);
ImageView emptyImageView = (ImageView) emptyView.findViewById(R.id.empty_state_image_view);
emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_trip_day_result : R.drawable.ic_empty_state_trip_night_result);
emptyImageView.setImageResource(app.getSettings().isLightContent() ? R.drawable.ic_empty_state_trip_day : R.drawable.ic_empty_state_trip_night);
Button importButton = (Button) emptyView.findViewById(R.id.import_button);
importButton.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -811,8 +811,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
boolean processed = hideVisibleMenues();
processed |= menu.onSingleTapOnMap();
if (!processed) {
activity.getMapLayers().getMapControlsLayer().switchMapControlsVisibility();
if (!processed && activity.getMyApplication().getSettings().MAP_EMPTY_STATE_ALLOWED.get()) {
activity.getMapLayers().getMapControlsLayer().switchMapControlsVisibility(true);
}
return false;
}

View file

@ -48,7 +48,6 @@ import net.osmand.plus.dialogs.DirectionsDialogs;
import net.osmand.plus.mapcontextmenu.MapContextMenu;
import net.osmand.plus.mapcontextmenu.other.MapRouteInfoMenu;
import net.osmand.plus.mapcontextmenu.other.TrackDetailsMenu;
import net.osmand.plus.measurementtool.MeasurementToolFragment;
import net.osmand.plus.routing.RoutingHelper;
import net.osmand.plus.views.corenative.NativeCoreContext;
@ -659,7 +658,9 @@ public class MapControlsLayer extends OsmandMapLayer {
public void showMapControls() {
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.VISIBLE);
AndroidUtils.showSystemUI(mapActivity);
}
public void hideMapControls() {
mapActivity.findViewById(R.id.MapHudButtonsOverlay).setVisibility(View.INVISIBLE);
}
@ -673,7 +674,7 @@ public class MapControlsLayer extends OsmandMapLayer {
return mapActivity.findViewById(R.id.MapHudButtonsOverlay).getVisibility() == View.VISIBLE;
}
public void switchMapControlsVisibility() {
public void switchMapControlsVisibility(boolean switchSystemUiVisibility) {
if (app.getRoutingHelper().isFollowingMode() || app.getRoutingHelper().isPauseNavigation()
|| mapActivity.getMeasurementToolFragment() != null
|| mapActivity.getPlanRouteFragment() != null
@ -682,6 +683,9 @@ public class MapControlsLayer extends OsmandMapLayer {
}
if (isMapControlsVisible()) {
hideMapControls();
if (switchSystemUiVisibility) {
AndroidUtils.hideSystemUI(mapActivity);
}
} else {
showMapControls();
}