Merge pull request #4690 from osmandapp/change_statusbar
Change status bar color in some places
This commit is contained in:
commit
74d9a7169c
21 changed files with 361 additions and 93 deletions
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<android.support.v4.widget.DrawerLayout
|
<android.support.v4.widget.DrawerLayout
|
||||||
android:id="@+id/drawer_layout"
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:id="@+id/drawer_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/mapBackground">
|
android:background="?attr/mapBackground">
|
||||||
|
@ -43,7 +43,8 @@
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/MapHudButtonsOverlay"
|
android:id="@+id/MapHudButtonsOverlay"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<include layout="@layout/map_hud_top"/>
|
<include layout="@layout/map_hud_top"/>
|
||||||
|
|
||||||
|
@ -105,6 +106,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="left"
|
android:layout_gravity="left"
|
||||||
android:background="?attr/bg_color"
|
android:background="?attr/bg_color"
|
||||||
android:drawSelectorOnTop="true" />
|
android:clipToPadding="false"
|
||||||
|
android:drawSelectorOnTop="true"/>
|
||||||
|
|
||||||
</android.support.v4.widget.DrawerLayout>
|
</android.support.v4.widget.DrawerLayout>
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
<color name="mapillary_color">#3db878</color>
|
<color name="mapillary_color">#3db878</color>
|
||||||
<color name="mapillary_color_pressed">#3a9f73</color>
|
<color name="mapillary_color_pressed">#3a9f73</color>
|
||||||
|
<color name="mapillary_action_bar">#14c45d</color>
|
||||||
<color name="buy_button_color">#50ae55</color>
|
<color name="buy_button_color">#50ae55</color>
|
||||||
<color name="buy_button_pressed_color">#b5e5b9</color>
|
<color name="buy_button_pressed_color">#b5e5b9</color>
|
||||||
|
|
||||||
|
@ -129,6 +130,15 @@
|
||||||
<color name="dashboard_general_button_text_dark">#ff8f00</color>
|
<color name="dashboard_general_button_text_dark">#ff8f00</color>
|
||||||
<color name="dashboard_general_button_text_light">#536DFE</color>
|
<color name="dashboard_general_button_text_light">#536DFE</color>
|
||||||
|
|
||||||
|
<color name="status_bar_light">#e58200</color>
|
||||||
|
<color name="status_bar_dark">#2f3a40</color>
|
||||||
|
<color name="status_bar_transparent_light">#33000000</color>
|
||||||
|
<color name="status_bar_transparent_dark">#99000000</color>
|
||||||
|
<color name="status_bar_transparent_gradient">#CC000000</color>
|
||||||
|
<color name="status_bar_mapillary">#11ab51</color>
|
||||||
|
<color name="status_bar_route_light">#d9d9d9</color>
|
||||||
|
<color name="status_bar_route_dark">#000000</color>
|
||||||
|
|
||||||
|
|
||||||
<color name="color_transparent">#0000</color>
|
<color name="color_transparent">#0000</color>
|
||||||
<color name="widgettext_night">#ffC8C8C8</color>
|
<color name="widgettext_night">#ffC8C8C8</color>
|
||||||
|
|
|
@ -86,8 +86,13 @@
|
||||||
<item name="android:windowBackground">@drawable/first_splash_screen_free_dev</item>
|
<item name="android:windowBackground">@drawable/first_splash_screen_free_dev</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<style name="OsmandLightThemeWithLightStatusBar" parent="OsmandLightTheme">
|
||||||
|
<item name="android:statusBarColor">@color/status_bar_route_light</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- Osmand themes styles -->
|
<!-- Osmand themes styles -->
|
||||||
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
|
<style name="OsmandLightTheme" parent="Theme.AppCompat.Light">
|
||||||
|
<item name="android:statusBarColor">@color/status_bar_light</item>
|
||||||
<item name="mapBackground">@color/map_background_color_light</item>
|
<item name="mapBackground">@color/map_background_color_light</item>
|
||||||
<item name="chart_marker_background">@drawable/chart_marker_background_light</item>
|
<item name="chart_marker_background">@drawable/chart_marker_background_light</item>
|
||||||
<item name="routeParameterTitleColor">@color/color_myloc_distance</item>
|
<item name="routeParameterTitleColor">@color/color_myloc_distance</item>
|
||||||
|
@ -271,6 +276,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
<style name="OsmandDarkTheme" parent="Theme.AppCompat">
|
||||||
|
<item name="android:statusBarColor">@color/status_bar_dark</item>
|
||||||
<item name="mapBackground">@color/map_background_color_dark</item>
|
<item name="mapBackground">@color/map_background_color_dark</item>
|
||||||
<item name="chart_marker_background">@drawable/chart_marker_background_dark</item>
|
<item name="chart_marker_background">@drawable/chart_marker_background_dark</item>
|
||||||
<item name="routeParameterTitleColor">@color/osmand_orange</item>
|
<item name="routeParameterTitleColor">@color/osmand_orange</item>
|
||||||
|
|
|
@ -182,6 +182,12 @@ public class AndroidUtils {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addStatusBarPadding21v(Context ctx, View view) {
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
view.setPadding(0, getStatusBarHeight(ctx), 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static int getNavBarHeight(Context ctx) {
|
public static int getNavBarHeight(Context ctx) {
|
||||||
if (!hasNavBar(ctx)) {
|
if (!hasNavBar(ctx)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.widget.DrawerLayout;
|
import android.support.v4.widget.DrawerLayout;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
@ -71,6 +72,7 @@ import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.Version;
|
import net.osmand.plus.Version;
|
||||||
import net.osmand.plus.activities.search.SearchActivity;
|
import net.osmand.plus.activities.search.SearchActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.base.FailSafeFuntions;
|
import net.osmand.plus.base.FailSafeFuntions;
|
||||||
import net.osmand.plus.base.MapViewTrackingUtilities;
|
import net.osmand.plus.base.MapViewTrackingUtilities;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
|
@ -225,6 +227,12 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||||
setContentView(R.layout.main);
|
setContentView(R.layout.main);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
enterToFullScreen();
|
||||||
|
// Navigation Drawer:
|
||||||
|
AndroidUtils.addStatusBarPadding21v(this, findViewById(R.id.menuItems));
|
||||||
|
}
|
||||||
|
|
||||||
int statusBarHeight = 0;
|
int statusBarHeight = 0;
|
||||||
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
|
||||||
if (resourceId > 0) {
|
if (resourceId > 0) {
|
||||||
|
@ -275,6 +283,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
app.getResourceManager().getMapTileDownloader().addDownloaderCallback(downloaderCallback);
|
app.getResourceManager().getMapTileDownloader().addDownloaderCallback(downloaderCallback);
|
||||||
createProgressBarForRouting();
|
createProgressBarForRouting();
|
||||||
mapLayers.createLayers(mapView);
|
mapLayers.createLayers(mapView);
|
||||||
|
updateStatusBarColor();
|
||||||
// This situtation could be when navigation suddenly crashed and after restarting
|
// This situtation could be when navigation suddenly crashed and after restarting
|
||||||
// it tries to continue the last route
|
// it tries to continue the last route
|
||||||
if (settings.FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated()
|
if (settings.FOLLOW_THE_ROUTE.get() && !app.getRoutingHelper().isRouteCalculated()
|
||||||
|
@ -318,6 +327,18 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
mIsDestroyed = false;
|
mIsDestroyed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void exitFromFullScreen() {
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void enterToFullScreen() {
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState) {
|
protected void onSaveInstanceState(Bundle outState) {
|
||||||
if (removeFragment(PlanRouteFragment.TAG)) {
|
if (removeFragment(PlanRouteFragment.TAG)) {
|
||||||
|
@ -792,6 +813,52 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void updateStatusBarColor() {
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
int colorId = -1;
|
||||||
|
BaseOsmAndFragment fragmentAboveDashboard = getVisibleBaseOsmAndFragment(R.id.fragmentContainer);
|
||||||
|
BaseOsmAndFragment fragmentBelowDashboard = getVisibleBaseOsmAndFragment(R.id.routeMenuContainer,
|
||||||
|
R.id.topFragmentContainer, R.id.bottomFragmentContainer);
|
||||||
|
if (fragmentAboveDashboard != null) {
|
||||||
|
colorId = fragmentAboveDashboard.getStatusBarColorId();
|
||||||
|
} else if (dashboardOnMap.isVisible()) {
|
||||||
|
colorId = dashboardOnMap.getStatusBarColor();
|
||||||
|
} else if (fragmentBelowDashboard != null) {
|
||||||
|
colorId = fragmentBelowDashboard.getStatusBarColorId();
|
||||||
|
} else if (mapLayers.getMapQuickActionLayer() != null
|
||||||
|
&& mapLayers.getMapQuickActionLayer().isWidgetVisible()) {
|
||||||
|
colorId = R.color.status_bar_transparent_gradient;
|
||||||
|
}
|
||||||
|
if (colorId != -1) {
|
||||||
|
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorId));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boolean night = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
boolean mapTopBar = findViewById(R.id.map_top_bar).getVisibility() == View.VISIBLE;
|
||||||
|
boolean markerTopBar = mapLayers.getMapMarkersLayer() != null
|
||||||
|
&& mapLayers.getMapMarkersLayer().getWidgetsFactory().isTopBarVisible();
|
||||||
|
if (mapTopBar) {
|
||||||
|
colorId = night ? R.color.status_bar_route_dark : R.color.status_bar_route_light;
|
||||||
|
} else if (markerTopBar) {
|
||||||
|
colorId = R.color.status_bar_dark;
|
||||||
|
} else {
|
||||||
|
colorId = night ? R.color.status_bar_transparent_dark : R.color.status_bar_transparent_light;
|
||||||
|
}
|
||||||
|
getWindow().setStatusBarColor(ContextCompat.getColor(this, colorId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private BaseOsmAndFragment getVisibleBaseOsmAndFragment(int... ids) {
|
||||||
|
for (int id : ids) {
|
||||||
|
Fragment fragment = getSupportFragmentManager().findFragmentById(id);
|
||||||
|
if (fragment != null && !fragment.isRemoving() && fragment instanceof BaseOsmAndFragment
|
||||||
|
&& ((BaseOsmAndFragment) fragment).getStatusBarColorId() != -1) {
|
||||||
|
return (BaseOsmAndFragment) fragment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void dismissSecondSplashScreen() {
|
private void dismissSecondSplashScreen() {
|
||||||
if (SecondSplashScreenFragment.VISIBLE) {
|
if (SecondSplashScreenFragment.VISIBLE) {
|
||||||
SecondSplashScreenFragment.VISIBLE = false;
|
SecondSplashScreenFragment.VISIBLE = false;
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
boolean isLightTheme = getMyApplication().getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
boolean isLightTheme = getMyApplication().getSettings().OSMAND_THEME.get() == OsmandSettings.OSMAND_LIGHT_THEME;
|
||||||
int themeId = isLightTheme ? R.style.OsmandLightTheme : R.style.OsmandDarkTheme;
|
int themeId = isLightTheme ? R.style.OsmandLightThemeWithLightStatusBar : R.style.OsmandDarkTheme;
|
||||||
setStyle(STYLE_NO_FRAME, themeId);
|
setStyle(STYLE_NO_FRAME, themeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,10 +144,10 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
}
|
}
|
||||||
RouteDirectionInfo item = adapter.getItem(position - 2);
|
RouteDirectionInfo item = adapter.getItem(position - 2);
|
||||||
Location loc = helper.getLocationFromRouteDirection(item);
|
Location loc = helper.getLocationFromRouteDirection(item);
|
||||||
if(loc != null){
|
if (loc != null) {
|
||||||
MapRouteInfoMenu.directionInfo = position - 2;
|
MapRouteInfoMenu.directionInfo = position - 2;
|
||||||
OsmandSettings settings = getMyApplication().getSettings();
|
OsmandSettings settings = getMyApplication().getSettings();
|
||||||
settings.setMapLocationToShow(loc.getLatitude(),loc.getLongitude(),
|
settings.setMapLocationToShow(loc.getLatitude(), loc.getLongitude(),
|
||||||
Math.max(13, settings.getLastKnownMapZoom()),
|
Math.max(13, settings.getLastKnownMapZoom()),
|
||||||
new PointDescription(PointDescription.POINT_TYPE_MARKER, item.getDescriptionRoutePart() + " " + getTimeDescription(item)),
|
new PointDescription(PointDescription.POINT_TYPE_MARKER, item.getDescriptionRoutePart() + " " + getTimeDescription(item)),
|
||||||
false, null);
|
false, null);
|
||||||
|
@ -161,7 +161,7 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
int time = helper.getLeftTime();
|
int time = helper.getLeftTime();
|
||||||
int hours = time / (60 * 60);
|
int hours = time / (60 * 60);
|
||||||
int minutes = (time / 60) % 60;
|
int minutes = (time / 60) % 60;
|
||||||
((TextView)view.findViewById(R.id.distance)).setText(OsmAndFormatter.getFormattedDistance(dist, app));
|
((TextView) view.findViewById(R.id.distance)).setText(OsmAndFormatter.getFormattedDistance(dist, app));
|
||||||
StringBuilder timeStr = new StringBuilder();
|
StringBuilder timeStr = new StringBuilder();
|
||||||
if (hours > 0) {
|
if (hours > 0) {
|
||||||
timeStr.append(hours).append(" ").append(getString(R.string.osmand_parking_hour)).append(" ");
|
timeStr.append(hours).append(" ").append(getString(R.string.osmand_parking_hour)).append(" ");
|
||||||
|
@ -169,12 +169,12 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
if (minutes > 0) {
|
if (minutes > 0) {
|
||||||
timeStr.append(minutes).append(" ").append(getString(R.string.osmand_parking_minute));
|
timeStr.append(minutes).append(" ").append(getString(R.string.osmand_parking_minute));
|
||||||
}
|
}
|
||||||
((TextView)view.findViewById(R.id.time)).setText(timeStr);
|
((TextView) view.findViewById(R.id.time)).setText(timeStr);
|
||||||
|
|
||||||
view.findViewById(R.id.go_button).setOnClickListener(new View.OnClickListener() {
|
view.findViewById(R.id.go_button).setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
MapActivity activity = (MapActivity)getActivity();
|
MapActivity activity = (MapActivity) getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
activity.getMapLayers().getMapControlsLayer().startNavigation();
|
activity.getMapLayers().getMapControlsLayer().startNavigation();
|
||||||
dismiss();
|
dismiss();
|
||||||
|
@ -357,7 +357,7 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
if (gpxItem != null) {
|
if (gpxItem != null) {
|
||||||
LatLon location = null;
|
LatLon location = null;
|
||||||
WptPt wpt = null;
|
WptPt wpt = null;
|
||||||
gpxItem.chartTypes = new GPXDataSetType[] { GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE };
|
gpxItem.chartTypes = new GPXDataSetType[]{GPXDataSetType.ALTITUDE, GPXDataSetType.SLOPE};
|
||||||
if (gpxItem.chartHighlightPos != -1) {
|
if (gpxItem.chartHighlightPos != -1) {
|
||||||
TrkSegment segment = gpx.tracks.get(0).segments.get(0);
|
TrkSegment segment = gpx.tracks.get(0).segments.get(0);
|
||||||
if (segment != null) {
|
if (segment != null) {
|
||||||
|
@ -383,7 +383,7 @@ public class ShowRouteInfoDialogFragment extends DialogFragment {
|
||||||
gpxItem.locationOnMap = gpxItem.locationStart;
|
gpxItem.locationOnMap = gpxItem.locationStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
final MapActivity activity = (MapActivity)getActivity();
|
final MapActivity activity = (MapActivity) getActivity();
|
||||||
if (activity != null) {
|
if (activity != null) {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,82 @@
|
||||||
package net.osmand.plus.base;
|
package net.osmand.plus.base;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
import android.os.Build;
|
||||||
import android.support.annotation.ColorInt;
|
import android.support.annotation.ColorInt;
|
||||||
import android.support.annotation.ColorRes;
|
import android.support.annotation.ColorRes;
|
||||||
import android.support.annotation.DrawableRes;
|
import android.support.annotation.DrawableRes;
|
||||||
import android.support.annotation.IdRes;
|
import android.support.annotation.IdRes;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import net.osmand.plus.IconsCache;
|
import net.osmand.plus.IconsCache;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.OsmandActionBarActivity;
|
import net.osmand.plus.activities.OsmandActionBarActivity;
|
||||||
|
|
||||||
public class BaseOsmAndFragment extends Fragment {
|
public class BaseOsmAndFragment extends Fragment {
|
||||||
private IconsCache iconsCache;
|
private IconsCache iconsCache;
|
||||||
|
|
||||||
|
private int statusBarColor = -1;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
int colorId = getStatusBarColorId();
|
||||||
|
if (colorId != -1) {
|
||||||
|
if (activity instanceof MapActivity) {
|
||||||
|
((MapActivity) activity).updateStatusBarColor();
|
||||||
|
} else {
|
||||||
|
statusBarColor = activity.getWindow().getStatusBarColor();
|
||||||
|
activity.getWindow().setStatusBarColor(ContextCompat.getColor(activity, colorId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
|
||||||
|
((MapActivity) activity).exitFromFullScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause() {
|
||||||
|
super.onPause();
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (!(activity instanceof MapActivity) && statusBarColor != -1) {
|
||||||
|
activity.getWindow().setStatusBarColor(statusBarColor);
|
||||||
|
}
|
||||||
|
if (!isFullScreenAllowed() && activity instanceof MapActivity) {
|
||||||
|
((MapActivity) activity).enterToFullScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDetach() {
|
||||||
|
super.onDetach();
|
||||||
|
if (Build.VERSION.SDK_INT >= 21 && getStatusBarColorId() != -1) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
if (activity instanceof MapActivity) {
|
||||||
|
((MapActivity) activity).updateStatusBarColor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ColorRes
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isFullScreenAllowed() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
protected OsmandApplication getMyApplication() {
|
protected OsmandApplication getMyApplication() {
|
||||||
return (OsmandApplication) getActivity().getApplication();
|
return (OsmandApplication) getActivity().getApplication();
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.content.res.Resources;
|
||||||
import android.graphics.drawable.ColorDrawable;
|
import android.graphics.drawable.ColorDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.support.annotation.ColorRes;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.app.FragmentTransaction;
|
import android.support.v4.app.FragmentTransaction;
|
||||||
|
@ -225,6 +226,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
mapMarkerDialogHelper.setHelperCallbacks(this);
|
mapMarkerDialogHelper.setHelperCallbacks(this);
|
||||||
landscape = !AndroidUiHelper.isOrientationPortrait(mapActivity);
|
landscape = !AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
||||||
|
AndroidUtils.addStatusBarPadding21v(mapActivity, dashboardView);
|
||||||
final View.OnClickListener listener = new View.OnClickListener() {
|
final View.OnClickListener listener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -769,6 +771,11 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
addOrUpdateDashboardFragments();
|
addOrUpdateDashboardFragments();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorRes
|
||||||
|
public int getStatusBarColor() {
|
||||||
|
return R.color.status_bar_transparent_gradient;
|
||||||
|
}
|
||||||
|
|
||||||
public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem, boolean animation) {
|
public void setDashboardVisibility(boolean visible, DashboardType type, DashboardType prevItem, boolean animation) {
|
||||||
if (visible == this.visible && type == visibleType) {
|
if (visible == this.visible && type == visibleType) {
|
||||||
return;
|
return;
|
||||||
|
@ -796,6 +803,8 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
removeMapillaryFiltersFragment();
|
removeMapillaryFiltersFragment();
|
||||||
|
|
||||||
|
mapActivity.updateStatusBarColor();
|
||||||
|
|
||||||
if (visible) {
|
if (visible) {
|
||||||
mapActivity.dismissCardDialog();
|
mapActivity.dismissCardDialog();
|
||||||
mapActivity.getContextMenu().hideMenues();
|
mapActivity.getContextMenu().hideMenues();
|
||||||
|
|
|
@ -7,7 +7,6 @@ import android.content.res.Resources;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
|
@ -34,11 +33,11 @@ import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.IconsCache;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
import net.osmand.plus.download.DownloadIndexesThread.DownloadEvents;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
||||||
|
@ -55,7 +54,7 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||||
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
import static net.osmand.plus.mapcontextmenu.MenuBuilder.SHADOW_HEIGHT_TOP_DP;
|
||||||
|
|
||||||
|
|
||||||
public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
public class MapContextMenuFragment extends BaseOsmAndFragment implements DownloadEvents {
|
||||||
public static final String TAG = "MapContextMenuFragment";
|
public static final String TAG = "MapContextMenuFragment";
|
||||||
|
|
||||||
public static final float FAB_PADDING_TOP_DP = 4f;
|
public static final float FAB_PADDING_TOP_DP = 4f;
|
||||||
|
@ -149,8 +148,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
mapZoom = map.getZoom();
|
mapZoom = map.getZoom();
|
||||||
}
|
}
|
||||||
|
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
|
||||||
|
|
||||||
// Left title button
|
// Left title button
|
||||||
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
final Button leftTitleButton = (Button) view.findViewById(R.id.title_button);
|
||||||
leftTitleButton.setOnClickListener(new View.OnClickListener() {
|
leftTitleButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -225,7 +222,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
// Progress bar
|
// Progress bar
|
||||||
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
final ImageView progressButton = (ImageView) view.findViewById(R.id.progressButton);
|
||||||
progressButton.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_remove_dark,
|
progressButton.setImageDrawable(getIcon(R.drawable.ic_action_remove_dark,
|
||||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
progressButton.setOnClickListener(new View.OnClickListener() {
|
progressButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -386,7 +383,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
// FAB
|
// FAB
|
||||||
fabView = (ImageView) view.findViewById(R.id.context_menu_fab_view);
|
fabView = (ImageView) view.findViewById(R.id.context_menu_fab_view);
|
||||||
if (menu.fabVisible()) {
|
if (menu.fabVisible()) {
|
||||||
fabView.setImageDrawable(iconsCache.getIcon(menu.getFabIconId(), 0));
|
fabView.setImageDrawable(getIcon(menu.getFabIconId(), 0));
|
||||||
if (menu.isLandscapeLayout()) {
|
if (menu.isLandscapeLayout()) {
|
||||||
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) fabView.getLayoutParams();
|
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) fabView.getLayoutParams();
|
||||||
params.setMargins(0, 0, dpToPx(28f), 0);
|
params.setMargins(0, 0, dpToPx(28f), 0);
|
||||||
|
@ -446,7 +443,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
// Action buttons
|
// Action buttons
|
||||||
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
||||||
buttonFavorite.setImageDrawable(iconsCache.getIcon(menu.getFavActionIconId(),
|
buttonFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(),
|
||||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonFavorite, nightMode);
|
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonFavorite, nightMode);
|
||||||
buttonFavorite.setContentDescription(getString(menu.getFavActionStringId()));
|
buttonFavorite.setContentDescription(getString(menu.getFavActionStringId()));
|
||||||
|
@ -459,11 +456,11 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
|
|
||||||
final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button);
|
final ImageButton buttonWaypoint = (ImageButton) view.findViewById(R.id.context_menu_route_button);
|
||||||
if (getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
|
if (getMyApplication().getSettings().USE_MAP_MARKERS.get()) {
|
||||||
buttonWaypoint.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_flag_dark,
|
buttonWaypoint.setImageDrawable(getIcon(R.drawable.map_action_flag_dark,
|
||||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
buttonWaypoint.setContentDescription(getString(R.string.shared_string_add_to_map_markers));
|
buttonWaypoint.setContentDescription(getString(R.string.shared_string_add_to_map_markers));
|
||||||
} else {
|
} else {
|
||||||
buttonWaypoint.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_waypoint,
|
buttonWaypoint.setImageDrawable(getIcon(R.drawable.map_action_waypoint,
|
||||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
buttonWaypoint.setContentDescription(getString(R.string.context_menu_item_destination_point));
|
buttonWaypoint.setContentDescription(getString(R.string.context_menu_item_destination_point));
|
||||||
}
|
}
|
||||||
|
@ -476,7 +473,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
});
|
});
|
||||||
|
|
||||||
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button);
|
final ImageButton buttonShare = (ImageButton) view.findViewById(R.id.context_menu_share_button);
|
||||||
buttonShare.setImageDrawable(iconsCache.getIcon(R.drawable.map_action_gshare_dark,
|
buttonShare.setImageDrawable(getIcon(R.drawable.map_action_gshare_dark,
|
||||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonShare, nightMode);
|
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonShare, nightMode);
|
||||||
buttonShare.setOnClickListener(new View.OnClickListener() {
|
buttonShare.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -487,7 +484,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
});
|
});
|
||||||
|
|
||||||
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button);
|
final ImageButton buttonMore = (ImageButton) view.findViewById(R.id.context_menu_more_button);
|
||||||
buttonMore.setImageDrawable(iconsCache.getIcon(R.drawable.map_overflow_menu_white,
|
buttonMore.setImageDrawable(getIcon(R.drawable.map_overflow_menu_white,
|
||||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonMore, nightMode);
|
AndroidUtils.setDashButtonBackground(getMapActivity(), buttonMore, nightMode);
|
||||||
buttonMore.setOnClickListener(new View.OnClickListener() {
|
buttonMore.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -523,6 +520,14 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
if (menu != null && (menu.getCurrentMenuState() == MenuState.FULL_SCREEN || menu.isLandscapeLayout())) {
|
||||||
|
return nightMode ? R.color.status_bar_dark : R.color.status_bar_route_light;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateImageButton(ImageButton button, int iconLightId, int iconDarkId, int bgLightId, int bgDarkId, boolean night) {
|
private void updateImageButton(ImageButton button, int iconLightId, int iconDarkId, int bgLightId, int bgDarkId, boolean night) {
|
||||||
button.setImageDrawable(getMapActivity().getMyApplication().getIconsCache().getIcon(night ? iconDarkId : iconLightId));
|
button.setImageDrawable(getMapActivity().getMyApplication().getIconsCache().getIcon(night ? iconDarkId : iconLightId));
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
@ -850,8 +855,6 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
private void buildHeader() {
|
private void buildHeader() {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
if (app != null && view != null) {
|
if (app != null && view != null) {
|
||||||
IconsCache iconsCache = app.getIconsCache();
|
|
||||||
|
|
||||||
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
final View iconLayout = view.findViewById(R.id.context_menu_icon_layout);
|
||||||
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
|
final ImageView iconView = (ImageView) view.findViewById(R.id.context_menu_icon_view);
|
||||||
Drawable icon = menu.getLeftIcon();
|
Drawable icon = menu.getLeftIcon();
|
||||||
|
@ -860,7 +863,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
iconView.setImageDrawable(icon);
|
iconView.setImageDrawable(icon);
|
||||||
iconLayout.setVisibility(View.VISIBLE);
|
iconLayout.setVisibility(View.VISIBLE);
|
||||||
} else if (iconId != 0) {
|
} else if (iconId != 0) {
|
||||||
iconView.setImageDrawable(iconsCache.getIcon(iconId,
|
iconView.setImageDrawable(getIcon(iconId,
|
||||||
!nightMode ? R.color.osmand_orange : R.color.osmand_orange_dark));
|
!nightMode ? R.color.osmand_orange : R.color.osmand_orange_dark));
|
||||||
iconLayout.setVisibility(View.VISIBLE);
|
iconLayout.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -947,9 +950,8 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
public void rebuildMenu(boolean centered) {
|
public void rebuildMenu(boolean centered) {
|
||||||
OsmandApplication app = getMyApplication();
|
OsmandApplication app = getMyApplication();
|
||||||
if (app != null && view != null) {
|
if (app != null && view != null) {
|
||||||
IconsCache iconsCache = app.getIconsCache();
|
|
||||||
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
final ImageButton buttonFavorite = (ImageButton) view.findViewById(R.id.context_menu_fav_button);
|
||||||
buttonFavorite.setImageDrawable(iconsCache.getIcon(menu.getFavActionIconId(),
|
buttonFavorite.setImageDrawable(getIcon(menu.getFavActionIconId(),
|
||||||
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
!nightMode ? R.color.icon_color : R.color.dashboard_subheader_text_dark));
|
||||||
buttonFavorite.setContentDescription(getString(menu.getFavActionStringId()));
|
buttonFavorite.setContentDescription(getString(menu.getFavActionStringId()));
|
||||||
|
|
||||||
|
@ -1224,13 +1226,25 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
break;
|
break;
|
||||||
case MenuState.FULL_SCREEN:
|
case MenuState.FULL_SCREEN:
|
||||||
posY = -menuTopShadowHeight - dpToPx(SHADOW_HEIGHT_TOP_DP);
|
posY = -menuTopShadowHeight - dpToPx(SHADOW_HEIGHT_TOP_DP);
|
||||||
|
posY = addStatusBarHeightIfNeeded(posY);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!menu.isLandscapeLayout()) {
|
||||||
|
getMapActivity().updateStatusBarColor();
|
||||||
|
}
|
||||||
return posY;
|
return posY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int addStatusBarHeightIfNeeded(int res) {
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
// One pixel is needed to fill a thin gap between the status bar and the fragment.
|
||||||
|
return res + AndroidUtils.getStatusBarHeight(getActivity()) - 1;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateMainViewLayout(int posY) {
|
private void updateMainViewLayout(int posY) {
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
menuFullHeight = view.getHeight() - posY;
|
menuFullHeight = view.getHeight() - posY;
|
||||||
|
@ -1356,6 +1370,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
|
||||||
int fabY = y + fabPaddingTopPx;
|
int fabY = y + fabPaddingTopPx;
|
||||||
if (fabY < fabPaddingTopPx) {
|
if (fabY < fabPaddingTopPx) {
|
||||||
fabY = fabPaddingTopPx;
|
fabY = fabPaddingTopPx;
|
||||||
|
fabY = addStatusBarHeightIfNeeded(fabY);
|
||||||
}
|
}
|
||||||
return fabY;
|
return fabY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ package net.osmand.plus.mapcontextmenu.builders.cards.dialogs;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.widget.AppCompatImageView;
|
import android.support.v7.widget.AppCompatImageView;
|
||||||
import android.support.v7.widget.PopupMenu;
|
import android.support.v7.widget.PopupMenu;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -16,11 +16,12 @@ import android.widget.TextView;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||||
import net.osmand.plus.mapillary.MapillaryPlugin;
|
import net.osmand.plus.mapillary.MapillaryPlugin;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
public class ContextMenuCardDialogFragment extends Fragment {
|
public class ContextMenuCardDialogFragment extends BaseOsmAndFragment {
|
||||||
public static final String TAG = "ContextMenuCardDialogFragment";
|
public static final String TAG = "ContextMenuCardDialogFragment";
|
||||||
|
|
||||||
private ContextMenuCardDialog dialog;
|
private ContextMenuCardDialog dialog;
|
||||||
|
@ -39,6 +40,10 @@ public class ContextMenuCardDialogFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
View view = inflater.inflate(R.layout.context_menu_card_dialog, container, false);
|
View view = inflater.inflate(R.layout.context_menu_card_dialog, container, false);
|
||||||
|
if (dialog.getType() == ContextMenuCardDialog.CardDialogType.MAPILLARY) {
|
||||||
|
view.findViewById(R.id.dialog_layout)
|
||||||
|
.setBackgroundColor(ContextCompat.getColor(getActivity(), R.color.mapillary_action_bar));
|
||||||
|
}
|
||||||
contentLayout = (LinearLayout) view.findViewById(R.id.content);
|
contentLayout = (LinearLayout) view.findViewById(R.id.content);
|
||||||
contentView = dialog.getContentView();
|
contentView = dialog.getContentView();
|
||||||
if (contentView != null) {
|
if (contentView != null) {
|
||||||
|
@ -106,6 +111,19 @@ public class ContextMenuCardDialogFragment extends Fragment {
|
||||||
dialog.saveMenu(outState);
|
dialog.saveMenu(outState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
if (dialog != null && dialog.getType() == ContextMenuCardDialog.CardDialogType.MAPILLARY) {
|
||||||
|
return R.color.status_bar_mapillary;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isFullScreenAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static void showInstance(ContextMenuCardDialog menu) {
|
public static void showInstance(ContextMenuCardDialog menu) {
|
||||||
ContextMenuCardDialogFragment fragment = new ContextMenuCardDialogFragment();
|
ContextMenuCardDialogFragment fragment = new ContextMenuCardDialogFragment();
|
||||||
fragment.dialog = menu;
|
fragment.dialog = menu;
|
||||||
|
|
|
@ -8,7 +8,6 @@ import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -24,14 +23,14 @@ import android.widget.ScrollView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.IconsCache;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
public abstract class PointEditorFragment extends Fragment {
|
public abstract class PointEditorFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
private View view;
|
private View view;
|
||||||
private EditText nameEdit;
|
private EditText nameEdit;
|
||||||
|
@ -181,9 +180,7 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Drawable getRowIcon(int iconId) {
|
public Drawable getRowIcon(int iconId) {
|
||||||
IconsCache iconsCache = getMyApplication().getIconsCache();
|
return getIcon(iconId, getEditor().isLight() ? R.color.icon_color : R.color.icon_color_light);
|
||||||
return iconsCache.getIcon(iconId,
|
|
||||||
getEditor().isLight() ? R.color.icon_color : R.color.icon_color_light);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -217,6 +214,16 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
return R.color.status_bar_light;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isFullScreenAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void hideKeyboard() {
|
private void hideKeyboard() {
|
||||||
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
InputMethodManager inputMethodManager = (InputMethodManager) getActivity().getSystemService(Activity.INPUT_METHOD_SERVICE);
|
||||||
if (inputMethodManager != null) {
|
if (inputMethodManager != null) {
|
||||||
|
@ -325,7 +332,6 @@ public abstract class PointEditorFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Drawable getPaintedIcon(int iconId, int color) {
|
protected Drawable getPaintedIcon(int iconId, int color) {
|
||||||
IconsCache iconsCache = getMapActivity().getMyApplication().getIconsCache();
|
return getPaintedContentIcon(iconId, color);
|
||||||
return iconsCache.getPaintedIcon(iconId, color);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package net.osmand.plus.mapcontextmenu.other;
|
package net.osmand.plus.mapcontextmenu.other;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -12,14 +11,17 @@ import android.widget.TextView;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
|
||||||
public class MapRouteInfoMenuFragment extends Fragment {
|
public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
public static final String TAG = "MapRouteInfoMenuFragment";
|
public static final String TAG = "MapRouteInfoMenuFragment";
|
||||||
|
|
||||||
private MapRouteInfoMenu menu;
|
private MapRouteInfoMenu menu;
|
||||||
private View mainView;
|
private View mainView;
|
||||||
|
|
||||||
|
private boolean portrait;
|
||||||
|
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
return (MapActivity) getActivity();
|
return (MapActivity) getActivity();
|
||||||
}
|
}
|
||||||
|
@ -31,6 +33,10 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
||||||
|
|
||||||
menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
menu = mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu();
|
||||||
View view = inflater.inflate(R.layout.plan_route_info, container, false);
|
View view = inflater.inflate(R.layout.plan_route_info, container, false);
|
||||||
|
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
|
if (!portrait) {
|
||||||
|
AndroidUtils.addStatusBarPadding21v(getActivity(), view);
|
||||||
|
}
|
||||||
if (menu == null) {
|
if (menu == null) {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
@ -65,6 +71,11 @@ public class MapRouteInfoMenuFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
return portrait ? -1 : R.color.status_bar_transparent_gradient;
|
||||||
|
}
|
||||||
|
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
if (mainView != null) {
|
if (mainView != null) {
|
||||||
return mainView.getHeight();
|
return mainView.getHeight();
|
||||||
|
|
|
@ -2,7 +2,6 @@ package net.osmand.plus.mapcontextmenu.other;
|
||||||
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentActivity;
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -16,9 +15,10 @@ import android.widget.TextView;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
|
|
||||||
public class TrackDetailsMenuFragment extends Fragment {
|
public class TrackDetailsMenuFragment extends BaseOsmAndFragment {
|
||||||
public static final String TAG = "TrackDetailsMenuFragment";
|
public static final String TAG = "TrackDetailsMenuFragment";
|
||||||
|
|
||||||
private TrackDetailsMenu menu;
|
private TrackDetailsMenu menu;
|
||||||
|
@ -108,6 +108,11 @@ public class TrackDetailsMenuFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
return R.color.status_bar_transparent_gradient;
|
||||||
|
}
|
||||||
|
|
||||||
public int getHeight() {
|
public int getHeight() {
|
||||||
if (mainView != null) {
|
if (mainView != null) {
|
||||||
return mainView.getHeight();
|
return mainView.getHeight();
|
||||||
|
@ -163,12 +168,12 @@ public class TrackDetailsMenuFragment extends Fragment {
|
||||||
|
|
||||||
ImageView yAxisArrow = (ImageView) mainView.findViewById(R.id.y_axis_arrow);
|
ImageView yAxisArrow = (ImageView) mainView.findViewById(R.id.y_axis_arrow);
|
||||||
ImageView xAxisArrow = (ImageView) mainView.findViewById(R.id.x_axis_arrow);
|
ImageView xAxisArrow = (ImageView) mainView.findViewById(R.id.x_axis_arrow);
|
||||||
yAxisArrow.setImageDrawable(ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_drop_down));
|
yAxisArrow.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
||||||
xAxisArrow.setImageDrawable(ctx.getMyApplication().getIconsCache().getThemedIcon(R.drawable.ic_action_arrow_drop_down));
|
xAxisArrow.setImageDrawable(getContentIcon(R.drawable.ic_action_arrow_drop_down));
|
||||||
|
|
||||||
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button);
|
ImageButton backButton = (ImageButton) mainView.findViewById(R.id.top_bar_back_button);
|
||||||
if (backButton != null) {
|
if (backButton != null) {
|
||||||
backButton.setImageDrawable(ctx.getMyApplication().getIconsCache().getIcon(R.drawable.ic_arrow_back, R.color.color_white));
|
backButton.setImageDrawable(getIcon(R.drawable.ic_arrow_back, R.color.color_white));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import android.support.annotation.DrawableRes;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.design.widget.Snackbar;
|
import android.support.design.widget.Snackbar;
|
||||||
import android.support.v4.app.Fragment;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.ContextThemeWrapper;
|
import android.view.ContextThemeWrapper;
|
||||||
|
@ -17,15 +16,16 @@ import android.widget.ImageButton;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.plus.IconsCache;
|
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndCompassListener;
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.dashboard.DashLocationFragment;
|
import net.osmand.plus.dashboard.DashLocationFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.views.OsmandMapTileView;
|
import net.osmand.plus.views.OsmandMapTileView;
|
||||||
|
@ -38,11 +38,10 @@ import java.util.Locale;
|
||||||
import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
|
import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
|
||||||
import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT;
|
import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT;
|
||||||
|
|
||||||
public class MarkerMenuOnMapFragment extends Fragment implements OsmAndCompassListener, OsmAndLocationListener {
|
public class MarkerMenuOnMapFragment extends BaseOsmAndFragment implements OsmAndCompassListener, OsmAndLocationListener {
|
||||||
|
|
||||||
public static final String TAG = "MarkerMenuOnMapFragment";
|
public static final String TAG = "MarkerMenuOnMapFragment";
|
||||||
|
|
||||||
private IconsCache iconsCache;
|
|
||||||
private MapMarker marker;
|
private MapMarker marker;
|
||||||
|
|
||||||
private boolean night;
|
private boolean night;
|
||||||
|
@ -66,11 +65,13 @@ public class MarkerMenuOnMapFragment extends Fragment implements OsmAndCompassLi
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
final OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
final OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
||||||
night = app.getDaynightHelper().isNightModeForMapControls();
|
night = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
iconsCache = app.getIconsCache();
|
|
||||||
portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
|
portrait = AndroidUiHelper.isOrientationPortrait(getActivity());
|
||||||
final int themeRes = night ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
final int themeRes = night ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||||
|
|
||||||
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_menu_on_map, null);
|
final View mainView = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.fragment_marker_menu_on_map, null);
|
||||||
|
if (!portrait) {
|
||||||
|
AndroidUtils.addStatusBarPadding21v(getActivity(), mainView);
|
||||||
|
}
|
||||||
mainView.setOnClickListener(new View.OnClickListener() {
|
mainView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -79,7 +80,7 @@ public class MarkerMenuOnMapFragment extends Fragment implements OsmAndCompassLi
|
||||||
});
|
});
|
||||||
|
|
||||||
((ImageView) mainView.findViewById(R.id.marker_icon))
|
((ImageView) mainView.findViewById(R.id.marker_icon))
|
||||||
.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex)));
|
.setImageDrawable(getIcon(R.drawable.ic_action_flag_dark, MapMarker.getColorId(marker.colorIndex)));
|
||||||
((ImageView) mainView.findViewById(R.id.rename_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_edit_dark));
|
((ImageView) mainView.findViewById(R.id.rename_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_edit_dark));
|
||||||
((ImageView) mainView.findViewById(R.id.delete_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_delete_dark));
|
((ImageView) mainView.findViewById(R.id.delete_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_delete_dark));
|
||||||
|
|
||||||
|
@ -109,7 +110,7 @@ public class MarkerMenuOnMapFragment extends Fragment implements OsmAndCompassLi
|
||||||
ImageButton visitedBtn = (ImageButton) mainView.findViewById(R.id.marker_visited_button);
|
ImageButton visitedBtn = (ImageButton) mainView.findViewById(R.id.marker_visited_button);
|
||||||
visitedBtn.setBackgroundDrawable(ContextCompat.getDrawable(getContext(),
|
visitedBtn.setBackgroundDrawable(ContextCompat.getDrawable(getContext(),
|
||||||
night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
|
night ? R.drawable.marker_circle_background_dark_with_inset : R.drawable.marker_circle_background_light_with_inset));
|
||||||
visitedBtn.setImageDrawable(iconsCache.getIcon(R.drawable.ic_action_marker_passed, night ? 0 : R.color.icon_color));
|
visitedBtn.setImageDrawable(getIcon(R.drawable.ic_action_marker_passed, night ? 0 : R.color.icon_color));
|
||||||
visitedBtn.setOnClickListener(new View.OnClickListener() {
|
visitedBtn.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -189,6 +190,11 @@ public class MarkerMenuOnMapFragment extends Fragment implements OsmAndCompassLi
|
||||||
stopLocationUpdate();
|
stopLocationUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
return portrait ? -1 : R.color.status_bar_transparent_gradient;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLocation(Location location) {
|
public void updateLocation(Location location) {
|
||||||
boolean newLocation = this.location == null && location != null;
|
boolean newLocation = this.location == null && location != null;
|
||||||
|
@ -214,19 +220,13 @@ public class MarkerMenuOnMapFragment extends Fragment implements OsmAndCompassLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private OsmandApplication getMyApplication() {
|
|
||||||
if (getActivity() != null) {
|
|
||||||
return ((MapActivity) getActivity()).getMyApplication();
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
return (MapActivity) getActivity();
|
return (MapActivity) getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getContentIcon(@DrawableRes int id) {
|
@Override
|
||||||
return iconsCache.getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
|
protected Drawable getContentIcon(@DrawableRes int id) {
|
||||||
|
return getIcon(id, night ? R.color.ctx_menu_info_text_dark : R.color.on_map_icon_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startLocationUpdate() {
|
private void startLocationUpdate() {
|
||||||
|
|
|
@ -35,7 +35,6 @@ import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.GPXUtilities.TrkSegment;
|
import net.osmand.plus.GPXUtilities.TrkSegment;
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.IconsCache;
|
|
||||||
import net.osmand.plus.MapMarkersHelper;
|
import net.osmand.plus.MapMarkersHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
|
@ -46,6 +45,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.mapmarkers.PlanRouteOptionsBottomSheetDialogFragment.PlanRouteOptionsFragmentListener;
|
import net.osmand.plus.mapmarkers.PlanRouteOptionsBottomSheetDialogFragment.PlanRouteOptionsFragmentListener;
|
||||||
import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback;
|
import net.osmand.plus.mapmarkers.adapters.MapMarkersItemTouchHelperCallback;
|
||||||
|
@ -65,7 +65,7 @@ import java.util.List;
|
||||||
import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
|
import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
|
||||||
import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT;
|
import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT;
|
||||||
|
|
||||||
public class PlanRouteFragment extends Fragment implements OsmAndLocationListener {
|
public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocationListener {
|
||||||
|
|
||||||
public static final String TAG = "PlanRouteFragment";
|
public static final String TAG = "PlanRouteFragment";
|
||||||
private static final int MIN_DISTANCE_FOR_RECALCULATE = 50; // in meters
|
private static final int MIN_DISTANCE_FOR_RECALCULATE = 50; // in meters
|
||||||
|
@ -74,7 +74,6 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
||||||
private MarkersPlanRouteContext planRouteContext;
|
private MarkersPlanRouteContext planRouteContext;
|
||||||
|
|
||||||
private MapMarkersListAdapter adapter;
|
private MapMarkersListAdapter adapter;
|
||||||
private IconsCache iconsCache;
|
|
||||||
private PlanRouteToolbarController toolbarController;
|
private PlanRouteToolbarController toolbarController;
|
||||||
|
|
||||||
private int previousMapPosition;
|
private int previousMapPosition;
|
||||||
|
@ -84,6 +83,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
||||||
|
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
private boolean portrait;
|
private boolean portrait;
|
||||||
|
private boolean fullScreen;
|
||||||
private boolean wasCollapseButtonVisible;
|
private boolean wasCollapseButtonVisible;
|
||||||
private boolean cancelSnapToRoad = true;
|
private boolean cancelSnapToRoad = true;
|
||||||
|
|
||||||
|
@ -157,13 +157,12 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
||||||
|
|
||||||
toolbarHeight = mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
|
toolbarHeight = mapActivity.getResources().getDimensionPixelSize(R.dimen.dashboard_map_toolbar);
|
||||||
|
|
||||||
iconsCache = mapActivity.getMyApplication().getIconsCache();
|
|
||||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||||
final int backgroundColor = ContextCompat.getColor(mapActivity,
|
final int backgroundColor = ContextCompat.getColor(mapActivity,
|
||||||
nightMode ? R.color.ctx_menu_info_view_bg_dark : R.color.ctx_menu_info_view_bg_light);
|
nightMode ? R.color.ctx_menu_info_view_bg_dark : R.color.ctx_menu_info_view_bg_light);
|
||||||
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
boolean fullScreen = portrait && planRouteContext.isMarkersListOpened();
|
fullScreen = portrait && planRouteContext.isMarkersListOpened();
|
||||||
int layoutRes = fullScreen ? R.layout.fragment_plan_route_full_screen : R.layout.fragment_plan_route_half_screen;
|
int layoutRes = fullScreen ? R.layout.fragment_plan_route_full_screen : R.layout.fragment_plan_route_half_screen;
|
||||||
|
|
||||||
View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes), layoutRes, null);
|
View view = View.inflate(new ContextThemeWrapper(getContext(), themeRes), layoutRes, null);
|
||||||
|
@ -381,6 +380,19 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
||||||
exitPlanRouteMode();
|
exitPlanRouteMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
if (fullScreen || !portrait) {
|
||||||
|
return nightMode ? R.color.status_bar_dark : R.color.status_bar_route_light;
|
||||||
|
}
|
||||||
|
return R.color.status_bar_transparent_gradient;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isFullScreenAllowed() {
|
||||||
|
return !(fullScreen || !portrait);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateLocation(Location loc) {
|
public void updateLocation(Location loc) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
@ -422,12 +434,13 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getContentIcon(@DrawableRes int id) {
|
@Override
|
||||||
return iconsCache.getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.icon_color);
|
protected Drawable getContentIcon(@DrawableRes int id) {
|
||||||
|
return getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.icon_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getActiveIcon(@DrawableRes int id) {
|
private Drawable getActiveIcon(@DrawableRes int id) {
|
||||||
return iconsCache.getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
|
return getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void moveMapToPosition(double lat, double lon) {
|
private void moveMapToPosition(double lat, double lon) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.DrawableRes;
|
import android.support.annotation.DrawableRes;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
@ -41,11 +42,11 @@ import net.osmand.plus.GPXUtilities.Track;
|
||||||
import net.osmand.plus.GPXUtilities.TrkSegment;
|
import net.osmand.plus.GPXUtilities.TrkSegment;
|
||||||
import net.osmand.plus.GPXUtilities.WptPt;
|
import net.osmand.plus.GPXUtilities.WptPt;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.IconsCache;
|
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.TrackActivity;
|
import net.osmand.plus.activities.TrackActivity;
|
||||||
|
import net.osmand.plus.base.BaseOsmAndFragment;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.measurementtool.NewGpxData.ActionType;
|
import net.osmand.plus.measurementtool.NewGpxData.ActionType;
|
||||||
|
@ -77,11 +78,10 @@ import static net.osmand.plus.OsmandSettings.LANDSCAPE_MIDDLE_RIGHT_CONSTANT;
|
||||||
import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT;
|
import static net.osmand.plus.OsmandSettings.MIDDLE_TOP_CONSTANT;
|
||||||
import static net.osmand.plus.helpers.GpxImportHelper.GPX_SUFFIX;
|
import static net.osmand.plus.helpers.GpxImportHelper.GPX_SUFFIX;
|
||||||
|
|
||||||
public class MeasurementToolFragment extends Fragment {
|
public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
public static final String TAG = "MeasurementToolFragment";
|
public static final String TAG = "MeasurementToolFragment";
|
||||||
|
|
||||||
private IconsCache iconsCache;
|
|
||||||
private RecyclerView pointsRv;
|
private RecyclerView pointsRv;
|
||||||
private String previousToolBarTitle = "";
|
private String previousToolBarTitle = "";
|
||||||
private MeasurementToolBarController toolBarController;
|
private MeasurementToolBarController toolBarController;
|
||||||
|
@ -179,7 +179,6 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
editingCtx.getCommandManager().resetMeasurementLayer(measurementLayer);
|
editingCtx.getCommandManager().resetMeasurementLayer(measurementLayer);
|
||||||
iconsCache = mapActivity.getMyApplication().getIconsCache();
|
|
||||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||||
final int backgroundColor = ContextCompat.getColor(getActivity(),
|
final int backgroundColor = ContextCompat.getColor(getActivity(),
|
||||||
|
@ -480,6 +479,11 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
return R.color.status_bar_transparent_gradient;
|
||||||
|
}
|
||||||
|
|
||||||
private MapActivity getMapActivity() {
|
private MapActivity getMapActivity() {
|
||||||
return (MapActivity) getActivity();
|
return (MapActivity) getActivity();
|
||||||
}
|
}
|
||||||
|
@ -492,12 +496,13 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getContentIcon(@DrawableRes int id) {
|
@Override
|
||||||
return iconsCache.getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.icon_color);
|
protected Drawable getContentIcon(@DrawableRes int id) {
|
||||||
|
return getIcon(id, nightMode ? R.color.ctx_menu_info_text_dark : R.color.icon_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Drawable getActiveIcon(@DrawableRes int id) {
|
private Drawable getActiveIcon(@DrawableRes int id) {
|
||||||
return iconsCache.getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
|
return getIcon(id, nightMode ? R.color.osmand_orange : R.color.color_myloc_distance);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showProgressBar() {
|
private void showProgressBar() {
|
||||||
|
@ -1041,11 +1046,14 @@ public class MeasurementToolFragment extends Fragment {
|
||||||
private void showPointsListFragment() {
|
private void showPointsListFragment() {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
int screenHeight = AndroidUtils.getScreenHeight(mapActivity) - AndroidUtils.getStatusBarHeight(mapActivity);
|
boolean transparentStatusBar = Build.VERSION.SDK_INT >= 21;
|
||||||
|
int statusBarHeight = transparentStatusBar ? 0 : AndroidUtils.getStatusBarHeight(mapActivity);
|
||||||
|
int screenHeight = AndroidUtils.getScreenHeight(mapActivity) - statusBarHeight;
|
||||||
RecyclerViewFragment fragment = new RecyclerViewFragment();
|
RecyclerViewFragment fragment = new RecyclerViewFragment();
|
||||||
fragment.setRecyclerView(pointsRv);
|
fragment.setRecyclerView(pointsRv);
|
||||||
fragment.setWidth(upDownRow.getWidth());
|
fragment.setWidth(upDownRow.getWidth());
|
||||||
fragment.setHeight(screenHeight - upDownRow.getHeight());
|
fragment.setHeight(screenHeight - upDownRow.getHeight());
|
||||||
|
fragment.setTransparentStatusBar(transparentStatusBar);
|
||||||
mapActivity.getSupportFragmentManager().beginTransaction()
|
mapActivity.getSupportFragmentManager().beginTransaction()
|
||||||
.add(R.id.fragmentContainer, fragment, RecyclerViewFragment.TAG)
|
.add(R.id.fragmentContainer, fragment, RecyclerViewFragment.TAG)
|
||||||
.commitAllowingStateLoss();
|
.commitAllowingStateLoss();
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class RecyclerViewFragment extends Fragment {
|
||||||
private RecyclerView rv;
|
private RecyclerView rv;
|
||||||
private int height;
|
private int height;
|
||||||
private int width;
|
private int width;
|
||||||
|
private boolean transparentStatusBar;
|
||||||
private FrameLayout parent;
|
private FrameLayout parent;
|
||||||
private FrameLayout mainView;
|
private FrameLayout mainView;
|
||||||
|
|
||||||
|
@ -40,6 +41,10 @@ public class RecyclerViewFragment extends Fragment {
|
||||||
this.width = width;
|
this.width = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setTransparentStatusBar(boolean transparentStatusBar) {
|
||||||
|
this.transparentStatusBar = transparentStatusBar;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
|
@ -68,6 +73,11 @@ public class RecyclerViewFragment extends Fragment {
|
||||||
shadow.setScaleType(ImageView.ScaleType.FIT_XY);
|
shadow.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||||
shadow.setImageResource(R.drawable.bg_shadow_onmap);
|
shadow.setImageResource(R.drawable.bg_shadow_onmap);
|
||||||
|
|
||||||
|
if (transparentStatusBar) {
|
||||||
|
AndroidUtils.addStatusBarPadding21v(getActivity(), rv);
|
||||||
|
rv.setClipToPadding(false);
|
||||||
|
}
|
||||||
|
|
||||||
mainView.addView(rv);
|
mainView.addView(rv);
|
||||||
mainView.addView(shadow);
|
mainView.addView(shadow);
|
||||||
parent.addView(mainView);
|
parent.addView(mainView);
|
||||||
|
|
|
@ -138,7 +138,17 @@ public class QuickActionListFragment extends BaseOsmAndFragment implements Quick
|
||||||
quickActionRegistry.setUpdatesListener(null);
|
quickActionRegistry.setUpdatesListener(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private MapActivity getMapActivity() {
|
@Override
|
||||||
|
protected boolean isFullScreenAllowed() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getStatusBarColorId() {
|
||||||
|
return getSettings().isLightContent() ? R.color.status_bar_light : R.color.status_bar_dark;
|
||||||
|
}
|
||||||
|
|
||||||
|
private MapActivity getMapActivity() {
|
||||||
return (MapActivity) getActivity();
|
return (MapActivity) getActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isWidgetVisible() {
|
public boolean isWidgetVisible() {
|
||||||
return quickActionsWidget.getVisibility() == View.VISIBLE;
|
return quickActionsWidget.getVisibility() == View.VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
|
|
||||||
updateQuickActionButton(showWidget);
|
updateQuickActionButton(showWidget);
|
||||||
quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE);
|
quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE);
|
||||||
|
mapActivity.updateStatusBarColor();
|
||||||
|
|
||||||
if (!showWidget) {
|
if (!showWidget) {
|
||||||
quitMovingMarker();
|
quitMovingMarker();
|
||||||
|
|
|
@ -715,7 +715,11 @@ public class MapInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateVisibility(boolean visible) {
|
public boolean updateVisibility(boolean visible) {
|
||||||
return updateVisibility(topBar, visible);
|
boolean res = updateVisibility(topBar, visible);
|
||||||
|
if (res) {
|
||||||
|
map.updateStatusBarColor();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateVisibility(View v, boolean visible) {
|
public boolean updateVisibility(View v, boolean visible) {
|
||||||
|
|
|
@ -55,6 +55,8 @@ public class MapMarkersWidgetsFactory {
|
||||||
|
|
||||||
private LatLon loc;
|
private LatLon loc;
|
||||||
|
|
||||||
|
private boolean cachedTopBarVisibility;
|
||||||
|
|
||||||
public MapMarkersWidgetsFactory(final MapActivity map) {
|
public MapMarkersWidgetsFactory(final MapActivity map) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
helper = map.getMyApplication().getMapMarkersHelper();
|
helper = map.getMyApplication().getMapMarkersHelper();
|
||||||
|
@ -151,7 +153,12 @@ public class MapMarkersWidgetsFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateVisibility(boolean visible) {
|
public boolean updateVisibility(boolean visible) {
|
||||||
return updateVisibility(topBar, visible);
|
boolean res = updateVisibility(topBar, visible);
|
||||||
|
if (visible != cachedTopBarVisibility) {
|
||||||
|
cachedTopBarVisibility = visible;
|
||||||
|
map.updateStatusBarColor();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateVisibility(View v, boolean visible) {
|
public boolean updateVisibility(View v, boolean visible) {
|
||||||
|
|
Loading…
Reference in a new issue