Merge branch 'master' of github.com:osmandapp/Osmand

This commit is contained in:
Victor Shcherb 2015-03-03 17:57:37 +02:00
commit 93913036f7
23 changed files with 464 additions and 120 deletions

View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/dashboard"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#70000000"
android:visibility="gone">
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_height="match_parent">
<net.osmand.plus.dashboard.NotifyingScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="360dp"
android:layout_height="match_parent"
android:id="@+id/main_scroll">
<LinearLayout
android:id="@+id/content"
android:paddingTop="@dimen/dashboard_map_top_padding"
android:paddingBottom="@dimen/dashboard_map_bottom_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"/>
</net.osmand.plus.dashboard.NotifyingScrollView>
</LinearLayout>
</FrameLayout>

View file

@ -1,53 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clipChildren="false"
android:keepScreenOn="true"
android:orientation="vertical">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clipChildren="false"
android:keepScreenOn="true"
android:orientation="vertical">
<ViewStub
android:id="@+id/atlasMapRendererViewStub"
android:inflatedId="@+id/atlasMapRendererView"
android:layout="@layout/atlas_map_renderer_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ViewStub
android:id="@+id/atlasMapRendererViewStub"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:inflatedId="@+id/atlasMapRendererView"
android:layout="@layout/atlas_map_renderer_view"/>
<net.osmand.plus.views.OsmAndMapSurfaceView
android:id="@+id/MapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="@string/map_view"
android:visibility="gone" />
<net.osmand.plus.views.OsmAndMapSurfaceView
android:id="@+id/MapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="@string/map_view"
android:visibility="gone"/>
<net.osmand.plus.views.OsmAndMapLayersView
android:id="@+id/MapLayersView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="@string/map_view"
android:visibility="gone" />
<net.osmand.plus.views.OsmAndMapLayersView
android:id="@+id/MapLayersView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:contentDescription="@string/map_view"
android:visibility="gone"/>
<LinearLayout
android:id="@+id/dialog_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal" />
</FrameLayout>
<FrameLayout android:id="@+id/MapInfoControls"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<ListView
android:id="@+id/left_drawer"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
<LinearLayout
android:id="@+id/dialog_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:orientation="horizontal"/>
<FrameLayout android:id="@+id/MapButtons"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
<ListView
android:id="@+id/left_drawer"
android:layout_width="280dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="?attr/expandable_list_background"
android:divider="@drawable/divider"
android:dividerHeight="1dp" />
android:choiceMode="singleChoice"
android:divider="@drawable/divider"
android:dividerHeight="1dp"/>
</android.support.v4.widget.DrawerLayout>

View file

@ -56,6 +56,22 @@
android:textSize="@dimen/showAllButtonTextSize"
tools:text="100500 km"/>
<ImageView
android:id="@+id/type_name_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_small_group"
android:layout_gravity="center_vertical"/>
<TextView
android:id="@+id/type_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/showAllButtonTextSize"
tools:text="100500 km"/>
</LinearLayout>
</LinearLayout>

View file

@ -33,7 +33,7 @@
<string name="poi_hunting_shop">Lovecké vybavení</string>
<string name="poi_jewelry_shop">Klenotnictví</string>
<string name="poi_kiosk">Kiosek</string>
<string name="poi_kitchen_shop">Kuchyňské náčiní</string>
<string name="poi_kitchen_shop">Kuchyňské studio</string>
<string name="poi_musical_instrument_shop">Hudební nástroje</string>
<string name="poi_optician_shop">Optik</string>
<string name="poi_pet_shop">Zverimex</string>
@ -65,7 +65,7 @@
<string name="poi_public_transport_platform">Zastávka veřejné dopravy</string>
<string name="poi_public_transport_platform_bus">Autobusová zastávka</string>
<string name="poi_public_transport_platform_trolleybus">Zastávka trolejbusu</string>
<string name="poi_bus_stop">Zastávka autobusu (zastaralé)</string>
<string name="poi_bus_stop">Zastávka autobusu</string>
<string name="poi_public_transport_platform_tram">Tramvajová zastávka</string>
<string name="poi_public_transport_station">Zastávka veřejné dopravy</string>
<string name="poi_airport">Letiště</string>
@ -229,5 +229,6 @@
<string name="poi_traffic_calming_hump">Retardér</string>
<string name="poi_vehicle_inspection">Kontrola vozidel</string>
<string name="poi_parking_entrance">Vjezd parkoviště</string>
<string name="poi_tram_stop">Zastávka tramvaje (zastaralé)</string>
<string name="poi_tram_stop">Zastávka tramvaje</string>
<string name="poi_mine_historic">Historický důl</string>
</resources>

View file

@ -1856,7 +1856,7 @@ s často kladenými otázkami.</string>
<string name="photo">Fotografie</string>
<string name="watch">Zobrazit</string>
<string name="selected_tracks">Vybrané</string>
<string name="showed_on_map">Zobrazené na mapě</string>
<string name="showed_on_map">Zobrazeno na mapě</string>
<string name="rename_failed">Přejmenování selhalo.</string>
<string name="currently_recording_track">Právě zaznamenávaná trasa</string>
<string name="back_to_map">Zpět na mapu</string>

View file

@ -1,2 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources></resources>
<?xml version='1.0' encoding='utf-8'?>
<resources><string name="poi_shop">Pood</string>
<string name="poi_emergency">Hädaabi</string>
<string name="poi_transportation">Transport</string>
<string name="poi_man_made">Käsitsi tehtud</string>
<string name="poi_education">Haridus</string>
<string name="poi_administrative">Administratiiv</string>
<string name="poi_healthcare">Tervishoid</string>
<string name="poi_office">Büroo</string>
<string name="poi_sport">Sport</string>
<string name="poi_tourism">Turism</string>
<string name="poi_entertainment">Vaba aeg</string>
</resources>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="dashboard_map_top_padding">100dp</dimen>
<dimen name="dashboard_map_bottom_padding">0dp</dimen>
</resources>

View file

@ -1947,7 +1947,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="int_hour">u.</string>
<string name="duration">Duur</string>
<string name="distance">Afstand</string>
<string name="record_plugin_description">Bewaar uw tracks met één tik op de kaart. Bekijk de instellingen voor het opnemen van uw trip naar een lokaal GPX bestand of online door middel van een web service.</string>
<string name="record_plugin_description">Activeert de functie om uw tracks met één tik op de kaart te bewaren. En toont de instellingen voor het opnemen van uw trip naar een lokaal GPX bestand of naar een online web service.</string>
<string name="save_track_to_gpx_globally">Track maken in GPX-bestand</string>
<string name="save_track_to_gpx_globally_descr">Het registreren van de afgelegde weg in een GPX-bestand kan worden aan- en uitgeschakeld met een knop op het kaartscherm</string>
<string name="save_track_interval_globally">Interval tussen geregistreerde punten</string>
@ -2036,7 +2036,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="rendering_value_orange_name">Oranje</string>
<string name="rendering_value_germanRoadAtlas_name">Duitse wegenkaart</string>
<string name="rendering_value_americanRoadAtlas_name">Amerikaanse wegenkaart</string>
<string name="routing_attr_no_new_routing_name">Gebruik routeberekening v1.9 niet</string>
<string name="routing_attr_no_new_routing_name">Gebruik extra routeberekening v1.9 niet</string>
<string name="routing_attr_no_new_routing_description">Gebruik de routeregels van vóór versie 1.9</string>
<string name="traffic_warning_railways">Spoorweg overgang</string>
<string name="traffic_warning_pedestrian">Voetgangers oversteekplaats</string>
@ -2060,7 +2060,7 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="recents">RECENT</string>
<string name="navigation_over_track">Navigatie over spoor starten?</string>
<string name="avoid_roads_msg">Je kan een alternatieve route vinden door aan te geven welke wegen niet gebruikt mogen worden</string>
<string name="save_track_to_gpx_globally_headline">Spoorloggen op aanvraag</string>
<string name="save_track_to_gpx_globally_headline">Gpx spoor loggen op aanvraag</string>
<string name="enable_proxy_title">HTTP-proxy aanzetten</string>
<string name="enable_proxy_descr">HTTP-proxy instellen voor alle netwerkverzoeken</string>
<string name="proxy_host_title">Proxy-host</string>
@ -2073,10 +2073,14 @@ Afghanistan, Albanie, Algerije, Andorra, Angola, Anguilla, Antigua en Barbuda, A
<string name="plugin_settings_button_caption">Instellingen</string>
<string name="edit_group">Bewerk groep</string>
<string name="plugin_install_needs_network">Om deze plugin te installeren is een internetverbinding nodig.</string>
<string name="plugin_nautical_name">Nautische kaarten</string>
<string name="world_ski_missing">Om skikaarten te kunnen gebruiken moet u aparte kaarten downloaden.</string>
<string name="nautical_maps_missing">Om nautische kaarten te kunnen gebruiken moet u aparte kaarten downloaden.</string>
<string name="plugin_nautical_name">Nautische kaartweergave</string>
<string name="world_ski_missing">Om skikaarten te kunnen gebruiken, moet u de speciale offline skikaart downloaden</string>
<string name="nautical_maps_missing">Om nautische kaarten te kunnen gebruiken, moet u de speciale offline nautische kaart downloaden</string>
<string name="enable_plugin2">Activeren</string>
<string name="disable_plugin2">Deactiveren</string>
<string name="get_plugin">Verkrijg</string>
</resources>
<string name="currently_recording_track">Huidige opname track</string>
<string name="watch">Bekijk</string>
<string name="rendering_attr_pisteRoutes_name">Piste routes</string>
<string name="rendering_attr_pisteGrooming_name">Piste verzorging</string>
</resources>

View file

@ -1897,6 +1897,6 @@
<string name="photo">Фото</string>
<string name="rename_failed">Не удалось переименовать.</string>
<string name="back_to_map">Вернуться на карту</string>
<string name="location_on_map">Координаты:\n Широта %1$s\n Долгота %2$s</string>
<string name="location_on_map">Координаты:\n Широта %1$s\n Долгота %2$s</string>
<string name="currently_recording_track">Текущий пишущийся трек</string>
</resources>

View file

@ -43,6 +43,9 @@
<dimen name="gpx_small_icon_margin">3dp</dimen>
<dimen name="gpx_small_text_margin">14dp</dimen>
<dimen name="gpx_text_top_margin">6dp</dimen>
<dimen name="dashboard_map_width">360dp</dimen>
<dimen name="dashboard_map_top_padding">200dp</dimen>
<dimen name="dashboard_map_bottom_padding">80dp</dimen>
<!-- TextSizes -->
<dimen name="list_header_text_size">14sp</dimen>

View file

@ -17,6 +17,7 @@ import net.osmand.core.jni.MapPresentationEnvironment.LanguagePreference;
import net.osmand.core.jni.MapPrimitivesProvider;
import net.osmand.core.jni.MapPrimitiviser;
import net.osmand.core.jni.MapRasterLayerProvider_Software;
import net.osmand.core.jni.MapRendererSetupOptions;
import net.osmand.core.jni.MapStylesCollection;
import net.osmand.core.jni.ObfMapObjectsProvider;
import net.osmand.core.jni.QStringStringHash;
@ -231,6 +232,14 @@ public class MapRendererContext implements RendererRegistry.IRendererLoadedEvent
}
private void applyCurrentContextToView() {
mapRendererView.setMapRendererSetupOptionsConfigurator(
new MapRendererView.IMapRendererSetupOptionsConfigurator() {
@Override
public void configureMapRendererSetupOptions(
MapRendererSetupOptions mapRendererSetupOptions) {
mapRendererSetupOptions.setMaxNumberOfRasterMapLayersInBatch(1);
}
});
if (mapRendererView instanceof AtlasMapRendererView) {
cachedReferenceTileSize = getReferenceTileSize();
((AtlasMapRendererView)mapRendererView).setReferenceTileSizeOnScreenInPixels(cachedReferenceTileSize);

View file

@ -51,6 +51,10 @@ public class PointDescription {
}
}
public String getTypeName() {
return typeName;
}
@NonNull
public String getName() {
return name;

View file

@ -1,13 +1,32 @@
package net.osmand.plus.activities;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.Toast;
import net.osmand.Location;
import net.osmand.StateChangedListener;
@ -33,9 +52,9 @@ import net.osmand.plus.TargetPointsHelper;
import net.osmand.plus.TargetPointsHelper.TargetPoint;
import net.osmand.plus.Version;
import net.osmand.plus.activities.search.SearchActivity;
import net.osmand.plus.audionotes.MediaRemoteControlReceiver;
import net.osmand.plus.base.FailSafeFuntions;
import net.osmand.plus.base.MapViewTrackingUtilities;
import net.osmand.plus.dashboard.DashboardOnMap;
import net.osmand.plus.helpers.GpxImportHelper;
import net.osmand.plus.helpers.WakeLockHelper;
import net.osmand.plus.poi.PoiLegacyFilter;
@ -51,33 +70,14 @@ import net.osmand.plus.views.OsmandMapTileView;
import net.osmand.plus.views.corenative.NativeCoreContext;
import net.osmand.render.RenderingRulesStorage;
import net.osmand.util.Algorithms;
import android.app.Dialog;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.util.DisplayMetrics;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
import android.widget.Toast;
import java.io.File;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class MapActivity extends AccessibleActivity {
@ -113,8 +113,9 @@ public class MapActivity extends AccessibleActivity {
private GpxImportHelper gpxImportHelper;
private WakeLockHelper wakeLockHelper ;
private boolean intentLocation = false;
private DashboardOnMap dashboardOnMap;
private Notification getNotification() {
Intent notificationIndent = new Intent(this, getMyApplication().getAppCustomization().getMapActivity());
notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
@ -224,9 +225,11 @@ public class MapActivity extends AccessibleActivity {
mapActions.prepareStartOptionsMenu();
wakeLockHelper = new WakeLockHelper(getMyApplication());
dashboardOnMap = new DashboardOnMap(this);
dashboardOnMap.createDashboardView();
}
public void addLockView(FrameLayout lockView) {
this.lockView = lockView;
}
@ -300,6 +303,9 @@ public class MapActivity extends AccessibleActivity {
@Override
public void onBackPressed() {
if (dashboardOnMap.isVisible()){
dashboardOnMap.setDashboardVisibility(false);
}
if (!mapActions.onBackPressed()) {
super.onBackPressed();
}
@ -840,4 +846,7 @@ public class MapActivity extends AccessibleActivity {
}
public DashboardOnMap getDashboard() {
return dashboardOnMap;
}
}

View file

@ -700,9 +700,10 @@ public class MapActivityActions implements DialogProvider {
.listen(new OnContextMenuClick() {
@Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMainMenuActivity());
newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
mapActivity.startActivity(newIntent);
// Intent newIntent = new Intent(mapActivity, mapActivity.getMyApplication().getAppCustomization().getMainMenuActivity());
// newIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
// mapActivity.startActivity(newIntent);
mapActivity.getDashboard().setDashboardVisibility(true);
return true;
}
}).reg();
@ -948,6 +949,14 @@ public class MapActivityActions implements DialogProvider {
listAdapter, null));
}
public void disableDrawer(){
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
}
public void enableDrawer(){
mDrawerLayout.setDrawerLockMode(DrawerLayout.LOCK_MODE_UNLOCKED);
}
public void openIntermediatePointsDialog(){
waypointDialogHelper.showWaypointsDialog(mapActivity, false);
}

View file

@ -230,6 +230,14 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
icon.setImageDrawable(addressIcon);
}
String typeName = historyEntry.getName().getTypeName();
if (typeName !=null && !typeName.isEmpty()){
row.findViewById(R.id.type_name_icon).setVisibility(View.VISIBLE);
((TextView) row.findViewById(R.id.type_name)).setText(typeName);
} else {
row.findViewById(R.id.type_name_icon).setVisibility(View.GONE);
((TextView) row.findViewById(R.id.type_name)).setText("");
}
options.setOnClickListener(new View.OnClickListener() {
@Override

View file

@ -14,6 +14,7 @@ import net.osmand.util.Algorithms;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.os.Bundle;
import android.support.annotation.Nullable;
@ -30,6 +31,9 @@ import android.widget.TextView;
* on 15.12.2014.
*/
public class DashAudioVideoNotesFragment extends DashBaseFragment {
public static final String TAG = "DASH_NOTES_FRAGMENT";
AudioVideoNotesPlugin plugin;
@Override
@ -98,6 +102,7 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
View view = inflater.inflate(R.layout.note, null, false);
getNoteView(recording, view, getActivity());
view.setBackgroundColor(Color.TRANSPARENT);
view.findViewById(R.id.play).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

View file

@ -25,9 +25,13 @@ import android.widget.LinearLayout;
import android.widget.TextView;
/**
* Created by Denis on 21.11.2014.
* Created by Denis
* on 21.11.2014.
*/
public class DashPluginsFragment extends DashBaseFragment {
public static final String TAG = "DASH_PLUGINS_FRAGMENT";
private final CompoundButton.OnCheckedChangeListener enableDisableListener =
new CompoundButton.OnCheckedChangeListener() {
@Override

View file

@ -115,7 +115,7 @@ public class DashRecentsFragment extends DashLocationFragment {
if (points.size() > 3){
points = points.subList(0, 3);
}
for (final HistoryEntry point : points) {
for (final HistoryEntry historyEntry : points) {
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.dash_favorites_item, null, false);
TextView name = (TextView) view.findViewById(R.id.name);
@ -133,33 +133,42 @@ public class DashRecentsFragment extends DashLocationFragment {
if(loc != null){
direction.setVisibility(View.VISIBLE);
updateArrow(getActivity(), loc, new LatLon(point.getLat(), point.getLon()), direction,
updateArrow(getActivity(), loc, new LatLon(historyEntry.getLat(), historyEntry.getLon()), direction,
10, R.drawable.ic_destination_arrow, heading);
}
arrows.add(direction);
name.setText(point.getName().getName());
name.setText(historyEntry.getName().getName());
//LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
int dist = (int) (MapUtils.getDistance(point.getLat(), point.getLon(),
int dist = (int) (MapUtils.getDistance(historyEntry.getLat(), historyEntry.getLon(),
loc.getLatitude(), loc.getLongitude()));
String distance = OsmAndFormatter.getFormattedDistance(dist, getMyApplication()) + " ";
view.findViewById(R.id.navigate_to).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), point.getLat(), point.getLon(),
point.getName());
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), historyEntry.getLat(), historyEntry.getLon(),
historyEntry.getName());
}
});
label.setText(distance, TextView.BufferType.SPANNABLE);
view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getMyApplication().getSettings().setMapLocationToShow(point.getLat(), point.getLon(), 15,
point.getName(), true,
point); //$NON-NLS-1$
getMyApplication().getSettings().setMapLocationToShow(historyEntry.getLat(), historyEntry.getLon(), 15,
historyEntry.getName(), true,
historyEntry); //$NON-NLS-1$
MapActivity.launchMapActivityMoveToTop(getActivity());
}
});
String typeName = historyEntry.getName().getTypeName();
if (typeName !=null && !typeName.isEmpty()){
view.findViewById(R.id.group_image).setVisibility(View.VISIBLE);
((TextView) view.findViewById(R.id.group_name)).setText(typeName);
} else {
view.findViewById(R.id.group_image).setVisibility(View.GONE);
((TextView) view.findViewById(R.id.group_name)).setText("");
}
favorites.addView(view);
}
updateLocation(location);

View file

@ -0,0 +1,194 @@
package net.osmand.plus.dashboard;
import android.content.res.Resources;
import android.graphics.Color;
import android.os.Build;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.TranslateAnimation;
import android.widget.FrameLayout;
import android.widget.ScrollView;
import net.osmand.plus.R;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.audionotes.DashAudioVideoNotesFragment;
import net.osmand.plus.helpers.ScreenOrientationHelper;
import net.osmand.plus.monitoring.DashTrackFragment;
import net.osmand.plus.views.controls.FloatingActionButton;
/**
* Created by Denis
* on 03.03.15.
*/
public class DashboardOnMap {
private MapActivity ma;
FloatingActionButton fabButton;
boolean floatingButtonVisible = false;
private FrameLayout dashboardView;
private boolean visible = false;
public DashboardOnMap(MapActivity ma) {
this.ma = ma;
}
public void createDashboardView() {
dashboardView = (FrameLayout) ma.getLayoutInflater().inflate(R.layout.dashboard_over_map, null, false);
dashboardView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View v) {
setDashboardVisibility(false);
}
};
dashboardView.findViewById(R.id.content).setOnClickListener(listener);
dashboardView.setOnClickListener(listener);
((FrameLayout)ma.getMapView().getParent()).addView(dashboardView);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
fabButton = new FloatingActionButton.Builder(ma)
.withDrawable(ma.getResources().getDrawable(R.drawable.ic_action_map))
.withButtonColor(Color.parseColor("#ff8f00"))
.withGravity(Gravity.BOTTOM | Gravity.RIGHT)
.withMargins(0, 0, 16, 16)
.create();
fabButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
setDashboardVisibility(false);
fabButton.hideFloatingActionButton();
}
});
fabButton.hideFloatingActionButton();
}
if (ScreenOrientationHelper.isOrientationPortrait(ma)) {
((NotifyingScrollView)dashboardView.findViewById(R.id.main_scroll)).setOnScrollChangedListener(onScrollChangedListener);
}
}
public void setDashboardVisibility(boolean visible) {
this.visible = visible;
if (visible) {
addDashboardFragments();
dashboardView.setVisibility(View.VISIBLE);
if (floatingButtonVisible) {
fabButton.showFloatingActionButton();
}
open(dashboardView.findViewById(R.id.content));
ma.getMapActions().disableDrawer();
//View close = dashboardView.findViewById(R.id.close_dashboard);
if (ScreenOrientationHelper.isOrientationPortrait(ma)) {
//close.setVisibility(View.VISIBLE);
} else {
//close.setVisibility(View.GONE);
}
ma.findViewById(R.id.MapInfoControls).setVisibility(View.GONE);
ma.findViewById(R.id.MapButtons).setVisibility(View.GONE);
} else {
ma.getMapActions().enableDrawer();
dashboardView.setVisibility(View.GONE);
hide(dashboardView.findViewById(R.id.content));
ma.findViewById(R.id.MapInfoControls).setVisibility(View.VISIBLE);
ma.findViewById(R.id.MapButtons).setVisibility(View.VISIBLE);
}
}
// To animate view slide out from right to left
public void open(View view){
TranslateAnimation animate = new TranslateAnimation(0,0,ma.getMapView().getHeight(),0);
animate.setDuration(500);
animate.setFillAfter(true);
view.startAnimation(animate);
view.setVisibility(View.VISIBLE);
}
public void hide(View view){
TranslateAnimation animate = new TranslateAnimation(0,0,0,ma.getMapView().getHeight());
animate.setDuration(500);
animate.setFillAfter(true);
view.startAnimation(animate);
view.setVisibility(View.GONE);
}
private void addDashboardFragments(){
FragmentManager manager =ma. getSupportFragmentManager();
FragmentTransaction fragmentTransaction = manager.beginTransaction();
if (manager.findFragmentByTag(DashSearchFragment.TAG) == null) {
fragmentTransaction.add(R.id.content, new DashSearchFragment(), DashSearchFragment.TAG);
}
if (manager.findFragmentByTag(DashRecentsFragment.TAG) == null) {
fragmentTransaction.add(R.id.content, new DashRecentsFragment(), DashRecentsFragment.TAG);
}
if (manager.findFragmentByTag(DashFavoritesFragment.TAG) == null) {
fragmentTransaction.add(R.id.content, new DashFavoritesFragment(), DashFavoritesFragment.TAG);
}
if (manager.findFragmentByTag(DashAudioVideoNotesFragment.TAG) == null) {
fragmentTransaction.add(R.id.content, new DashAudioVideoNotesFragment(), DashAudioVideoNotesFragment.TAG);
}
if (manager.findFragmentByTag(DashTrackFragment.TAG) == null) {
fragmentTransaction.add(R.id.content, new DashTrackFragment(), DashTrackFragment.TAG);
}
//fragmentTransaction.add(R.id.content, new DashUpdatesFragment(), DashUpdatesFragment.TAG);
if (manager.findFragmentByTag(DashPluginsFragment.TAG) == null) {
fragmentTransaction.add(R.id.content, new DashPluginsFragment(), DashPluginsFragment.TAG);
}
fragmentTransaction.commit();
}
private void addErrorFragment() {
FragmentManager manager = ma.getSupportFragmentManager();
FragmentTransaction fragmentTransaction = manager.beginTransaction();
if (manager.findFragmentByTag(DashErrorFragment.TAG) == null) {
DashErrorFragment errorFragment = new DashErrorFragment();
fragmentTransaction.add(R.id.content, errorFragment, DashErrorFragment.TAG).commit();
}
}
private NotifyingScrollView.OnScrollChangedListener onScrollChangedListener = new NotifyingScrollView.OnScrollChangedListener() {
public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) {
//making background of actionbar transparent with scroll
final int imageHeight = 200;
final int headerHeight = 200;
final float ratio = (float) Math.min(Math.max(t, 0), headerHeight) / headerHeight;
int margintop = -(int)(ratio * 60);
Resources r = ma.getResources();
int px = (int) TypedValue.applyDimension(
TypedValue.COMPLEX_UNIT_DIP,
margintop,
r.getDisplayMetrics());
int margin = px + (int)ma.getResources().getDimension(R.dimen.dashboard_map_bottom_padding);
if (headerHeight < t - margin){
//hiding action bar - showing floating button
//getSupportActionBar().hide();
if (fabButton != null) {
fabButton.showFloatingActionButton();
floatingButtonVisible = true;
}
} else {
//getSupportActionBar().show();
if (fabButton != null) {
fabButton.hideFloatingActionButton();
floatingButtonVisible = false;
}
}
}
};
public boolean isVisible() {
return visible;
}
}

View file

@ -25,6 +25,7 @@ import net.osmand.plus.helpers.FontCache;
import net.osmand.plus.helpers.GpxUiHelper;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
@ -45,6 +46,8 @@ import android.widget.Toast;
*/
public class DashTrackFragment extends DashBaseFragment {
public static final String TAG = "DASH_TRACK_FRAGMENT";
private Drawable gpxOnMap;
private Drawable gpxNormal;
private boolean updateEnable;
@ -158,6 +161,7 @@ public class DashTrackFragment extends DashBaseFragment {
showOnMap(GPXUtilities.loadGPXFile(app, f));
}
});
v.setBackgroundColor(Color.TRANSPARENT);
tracks.addView(v);
}
}

View file

@ -81,7 +81,7 @@ public class MapControlsLayer extends OsmandMapLayer {
@Override
public void initLayer(final OsmandMapTileView view) {
scaleCoefficient = view.getScaleCoefficient();
FrameLayout parent = (FrameLayout) view.getParent();
FrameLayout parent = getParent();
Handler showUIHandler = new Handler();
int rightGravity = Gravity.RIGHT | Gravity.BOTTOM;
int leftGravity = Gravity.LEFT | Gravity.BOTTOM;
@ -208,19 +208,23 @@ public class MapControlsLayer extends OsmandMapLayer {
RotatedTileBox tileBox, DrawSettings nightMode) {
if(visibility != controls.isVisible() ){
if(visibility) {
controls.show((FrameLayout) mapActivity.getMapView().getParent());
controls.show(getParent());
} else {
controls.hide((FrameLayout) mapActivity.getMapView().getParent());
controls.hide(getParent());
}
}
if(controls.isVisible()) {
controls.onDraw(canvas, tileBox, nightMode);
}
}
private FrameLayout getParent() {
return (FrameLayout) mapActivity.findViewById(R.id.MapButtons);
}
private void forceHideView(MapControls controls) {
if (controls.isVisible()) {
controls.forceHide((FrameLayout) mapActivity.getMapView().getParent());
controls.forceHide(getParent());
}
}
@ -239,10 +243,10 @@ public class MapControlsLayer extends OsmandMapLayer {
public boolean onTouchEvent(MotionEvent event, RotatedTileBox tileBox) {
if(!mapActivity.getRoutingHelper().isRoutePlanningMode() && mapActivity.getRoutingHelper().isFollowingMode()) {
if(!settings.SHOW_ZOOM_BUTTONS_NAVIGATION.get()) {
zoomControls.showWithDelay((FrameLayout) mapActivity.getMapView().getParent(), TIMEOUT_TO_SHOW_BUTTONS);
mapMenuControls.showWithDelay((FrameLayout) mapActivity.getMapView().getParent(), TIMEOUT_TO_SHOW_BUTTONS);
zoomControls.showWithDelay(getParent(), TIMEOUT_TO_SHOW_BUTTONS);
mapMenuControls.showWithDelay(getParent(), TIMEOUT_TO_SHOW_BUTTONS);
}
mapRoutePlanControl.showWithDelay((FrameLayout) mapActivity.getMapView().getParent(), TIMEOUT_TO_SHOW_BUTTONS);
mapRoutePlanControl.showWithDelay(getParent(), TIMEOUT_TO_SHOW_BUTTONS);
}
for(MapControls m : allControls) {
if(m.isVisible() && m.onTouchEvent(event, tileBox)){
@ -318,7 +322,7 @@ public class MapControlsLayer extends OsmandMapLayer {
}
public void shiftLayout(int height) {
FrameLayout parent = (FrameLayout) mapActivity.getMapView().getParent();
FrameLayout parent = getParent();
parent.requestLayout();
for(MapControls mc : allControls) {
if(mc.isBottom()){

View file

@ -220,6 +220,7 @@ public class MapInfoLayer extends OsmandMapLayer {
}
public void createControls() {
FrameLayout parent = (FrameLayout) ((FrameLayout) view.getParent()).findViewById(R.id.MapInfoControls);
// 1. Create view groups and controls
statusBar.setBackgroundDrawable(view.getResources().getDrawable(R.drawable.box_top));
@ -239,7 +240,7 @@ public class MapInfoLayer extends OsmandMapLayer {
Rect statusBarPadding = new Rect();
statusBar.getBackground().getPadding(statusBarPadding);
// 3. put into frame parent layout controls
FrameLayout parent = (FrameLayout) view.getParent();
// status bar hides own top part
int topMargin = statusBar.getMeasuredHeight() - statusBarPadding.top - statusBarPadding.bottom ;
// we want that status bar lays over map stack controls

View file

@ -65,7 +65,8 @@ public abstract class MapControls {
protected Button addButton(FrameLayout parent, int stringId, int resourceId) {
return addButton(parent, stringId, resourceId, 0);
}
protected Button addButton(FrameLayout parent, int stringId, int resourceId, int extraMargin) {
protected Button addButton(FrameLayout parent, int stringId, int resourceId, int extraMargin) {
Context ctx = mapActivity;
Button button = new Button(ctx);
applyAttributes(ctx, parent, button, stringId, resourceId, extraMargin);