UI fixes first part
This commit is contained in:
parent
4b4100cf0d
commit
0df0d3894b
8 changed files with 128 additions and 44 deletions
6
OsmAnd/res/drawable/bg_dash_line_dark.xml
Normal file
6
OsmAnd/res/drawable/bg_dash_line_dark.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/icon_color_secondary_dark" />
|
||||
<corners android:radius="30dp" />
|
||||
</shape>
|
6
OsmAnd/res/drawable/bg_dash_line_light.xml
Normal file
6
OsmAnd/res/drawable/bg_dash_line_light.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape android:shape="rectangle"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/icon_color_secondary_light" />
|
||||
<corners android:radius="30dp" />
|
||||
</shape>
|
|
@ -30,7 +30,7 @@
|
|||
android:layout_gravity="center"
|
||||
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
|
||||
android:layout_marginBottom="@dimen/list_item_button_padding"
|
||||
android:background="?attr/secondary_icon_color" />
|
||||
android:background="?attr/bg_dash_line" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -133,6 +133,7 @@
|
|||
<attr name="profile_save_btn" format="reference"/>
|
||||
<attr name="profile_cancel_btn" format="reference"/>
|
||||
<attr name="btn_bg_border_inactive" format="reference"/>
|
||||
<attr name="bg_dash_line" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="PagerSlidingTabStrip">
|
||||
|
|
|
@ -296,6 +296,7 @@
|
|||
<item name="actionBarSize">@dimen/action_bar_height</item>
|
||||
<item name="android:toolbarStyle">@style/ToolbarStyle</item>
|
||||
<item name="toolbarStyle">@style/ToolbarStyle</item>
|
||||
<item name="bg_dash_line">@drawable/bg_dash_line_light</item>
|
||||
</style>
|
||||
|
||||
<style name="ToolbarStyle" parent="@style/Widget.AppCompat.Toolbar">
|
||||
|
@ -576,6 +577,7 @@
|
|||
<item name="actionBarSize">@dimen/action_bar_height</item>
|
||||
<item name="android:toolbarStyle">@style/ToolbarStyle</item>
|
||||
<item name="toolbarStyle">@style/ToolbarStyle</item>
|
||||
<item name="bg_dash_line">@drawable/bg_dash_line_dark</item>
|
||||
</style>
|
||||
|
||||
<style name="FreeVersionBanner" parent="OsmandDarkTheme">
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
package net.osmand.plus.track;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -28,7 +31,7 @@ import net.osmand.plus.helpers.AndroidUiHelper;
|
|||
import net.osmand.plus.myplaces.DirectionArrowsCard;
|
||||
import net.osmand.plus.myplaces.SaveGpxAsyncTask;
|
||||
import net.osmand.plus.myplaces.SplitTrackAsyncTask;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.track.TrackDrawInfo.OnTrackAppearanceChangedListener;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -52,9 +55,21 @@ public class TrackAppearanceFragment extends ContextMenuFragment {
|
|||
private SelectedGpxFile selectedGpxFile;
|
||||
private List<GpxDisplayGroup> displayGroups;
|
||||
|
||||
private ImageView appearanceIcon;
|
||||
|
||||
private int menuTitleHeight;
|
||||
private long modifiedTime = -1;
|
||||
|
||||
private OnTrackAppearanceChangedListener trackAppearanceListener;
|
||||
|
||||
private TrackWidthCard trackWidthCard;
|
||||
private SplitIntervalCard splitIntervalCard;
|
||||
|
||||
private void updateAppearanceIcon() {
|
||||
Drawable icon = getPaintedContentIcon(R.drawable.ic_action_gpx_width_bold, trackDrawInfo.getColor());
|
||||
appearanceIcon.setImageDrawable(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMainLayoutId() {
|
||||
return R.layout.track_appearance;
|
||||
|
@ -101,12 +116,15 @@ public class TrackAppearanceFragment extends ContextMenuFragment {
|
|||
gpxDataItem = app.getGpxDbHelper().getItem(file);
|
||||
trackDrawInfo = new TrackDrawInfo(gpxDataItem);
|
||||
}
|
||||
trackDrawInfo.setTrackAppearanceListener(getTrackAppearanceListener());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view != null) {
|
||||
appearanceIcon = view.findViewById(R.id.appearance_icon);
|
||||
|
||||
if (isPortrait()) {
|
||||
updateCardsLayout();
|
||||
}
|
||||
|
@ -131,6 +149,18 @@ public class TrackAppearanceFragment extends ContextMenuFragment {
|
|||
super.calculateLayout(view, initLayout);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setViewY(int y, boolean animated, boolean adjustMapPos) {
|
||||
super.setViewY(y, animated, adjustMapPos);
|
||||
updateStatusBarColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateMainViewLayout(int posY) {
|
||||
super.updateMainViewLayout(posY);
|
||||
updateStatusBarColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -155,6 +185,27 @@ public class TrackAppearanceFragment extends ContextMenuFragment {
|
|||
trackDrawInfo.saveToBundle(outState);
|
||||
}
|
||||
|
||||
private OnTrackAppearanceChangedListener getTrackAppearanceListener() {
|
||||
if (trackAppearanceListener == null) {
|
||||
trackAppearanceListener = new OnTrackAppearanceChangedListener() {
|
||||
|
||||
@Override
|
||||
public void onTrackColorChanged() {
|
||||
updateAppearanceIcon();
|
||||
if (trackWidthCard != null) {
|
||||
trackWidthCard.updateItems();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTrackWidthChanged() {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
return trackAppearanceListener;
|
||||
}
|
||||
|
||||
private void updateCardsLayout() {
|
||||
View mainView = getMainView();
|
||||
if (mainView != null) {
|
||||
|
@ -280,17 +331,17 @@ public class TrackAppearanceFragment extends ContextMenuFragment {
|
|||
ViewGroup cardsContainer = getCardsContainer();
|
||||
cardsContainer.removeAllViews();
|
||||
|
||||
BaseCard splitIntervalCard = new SplitIntervalCard(mapActivity, trackDrawInfo, this);
|
||||
splitIntervalCard = new SplitIntervalCard(mapActivity, trackDrawInfo, this);
|
||||
cardsContainer.addView(splitIntervalCard.build(mapActivity));
|
||||
|
||||
BaseCard arrowsCard = new DirectionArrowsCard(mapActivity, trackDrawInfo);
|
||||
cardsContainer.addView(arrowsCard.build(mapActivity));
|
||||
DirectionArrowsCard directionArrowsCard = new DirectionArrowsCard(mapActivity, trackDrawInfo);
|
||||
cardsContainer.addView(directionArrowsCard.build(mapActivity));
|
||||
|
||||
TrackColoringCard trackColoringCard = new TrackColoringCard(mapActivity, selectedGpxFile, trackDrawInfo);
|
||||
cardsContainer.addView(trackColoringCard.build(mapActivity));
|
||||
|
||||
BaseCard width = new TrackWidthCard(mapActivity, trackDrawInfo);
|
||||
cardsContainer.addView(width.build(mapActivity));
|
||||
trackWidthCard = new TrackWidthCard(mapActivity, trackDrawInfo);
|
||||
cardsContainer.addView(trackWidthCard.build(mapActivity));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,6 +360,32 @@ public class TrackAppearanceFragment extends ContextMenuFragment {
|
|||
return displayGroups;
|
||||
}
|
||||
|
||||
private void updateStatusBarColor() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
mapActivity.updateStatusBarColor();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
if (view != null) {
|
||||
boolean nightMode = isNightMode();
|
||||
if (getViewY() <= getFullScreenTopPosY() || !isPortrait()) {
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
return nightMode ? R.color.divider_color_dark : R.color.divider_color_light;
|
||||
} else {
|
||||
if (Build.VERSION.SDK_INT >= 23 && !nightMode) {
|
||||
view.setSystemUiVisibility(view.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void dismissImmediate() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
|
|
|
@ -34,6 +34,8 @@ public class TrackDrawInfo {
|
|||
private boolean showArrows;
|
||||
private boolean showStartFinish;
|
||||
|
||||
private OnTrackAppearanceChangedListener trackAppearanceListener;
|
||||
|
||||
public TrackDrawInfo() {
|
||||
|
||||
}
|
||||
|
@ -53,12 +55,12 @@ public class TrackDrawInfo {
|
|||
showStartFinish = gpxDataItem.isShowStartFinish();
|
||||
}
|
||||
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
public void setTrackAppearanceListener(OnTrackAppearanceChangedListener trackAppearanceListener) {
|
||||
this.trackAppearanceListener = trackAppearanceListener;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
public String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public String getWidth() {
|
||||
|
@ -67,6 +69,9 @@ public class TrackDrawInfo {
|
|||
|
||||
public void setWidth(String width) {
|
||||
this.width = width;
|
||||
if (trackAppearanceListener != null) {
|
||||
trackAppearanceListener.onTrackWidthChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public GradientScaleType getGradientScaleType() {
|
||||
|
@ -83,30 +88,9 @@ public class TrackDrawInfo {
|
|||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
if (trackAppearanceListener != null) {
|
||||
trackAppearanceListener.onTrackColorChanged();
|
||||
}
|
||||
|
||||
public int getGradientSpeedColor() {
|
||||
return gradientSpeedColor;
|
||||
}
|
||||
|
||||
public void setGradientSpeedColor(int gradientSpeedColor) {
|
||||
this.gradientSpeedColor = gradientSpeedColor;
|
||||
}
|
||||
|
||||
public int getGradientAltitudeColor() {
|
||||
return gradientAltitudeColor;
|
||||
}
|
||||
|
||||
public void setGradientAltitudeColor(int gradientAltitudeColor) {
|
||||
this.gradientAltitudeColor = gradientAltitudeColor;
|
||||
}
|
||||
|
||||
public int getGradientSlopeColor() {
|
||||
return gradientSlopeColor;
|
||||
}
|
||||
|
||||
public void setGradientSlopeColor(int gradientSlopeColor) {
|
||||
this.gradientSlopeColor = gradientSlopeColor;
|
||||
}
|
||||
|
||||
public int getSplitType() {
|
||||
|
@ -129,10 +113,6 @@ public class TrackDrawInfo {
|
|||
return joinSegments;
|
||||
}
|
||||
|
||||
public void setJoinSegments(boolean joinSegments) {
|
||||
this.joinSegments = joinSegments;
|
||||
}
|
||||
|
||||
public boolean isShowArrows() {
|
||||
return showArrows;
|
||||
}
|
||||
|
@ -145,10 +125,6 @@ public class TrackDrawInfo {
|
|||
return showStartFinish;
|
||||
}
|
||||
|
||||
public void setShowStartFinish(boolean showStartFinish) {
|
||||
this.showStartFinish = showStartFinish;
|
||||
}
|
||||
|
||||
protected void readBundle(@NonNull Bundle bundle) {
|
||||
filePath = bundle.getString(TRACK_FILE_PATH);
|
||||
width = bundle.getString(TRACK_WIDTH);
|
||||
|
@ -178,4 +154,11 @@ public class TrackDrawInfo {
|
|||
bundle.putBoolean(TRACK_SHOW_ARROWS, showArrows);
|
||||
bundle.putBoolean(TRACK_SHOW_START_FINISH, showStartFinish);
|
||||
}
|
||||
|
||||
public interface OnTrackAppearanceChangedListener {
|
||||
|
||||
void onTrackColorChanged();
|
||||
|
||||
void onTrackWidthChanged();
|
||||
}
|
||||
}
|
|
@ -40,6 +40,8 @@ public class TrackWidthCard extends BaseCard {
|
|||
private AppearanceListItem selectedItem;
|
||||
private List<AppearanceListItem> appearanceItems;
|
||||
|
||||
private GpxWidthAdapter widthAdapter;
|
||||
|
||||
public TrackWidthCard(MapActivity mapActivity, TrackDrawInfo trackDrawInfo) {
|
||||
super(mapActivity);
|
||||
this.trackDrawInfo = trackDrawInfo;
|
||||
|
@ -56,11 +58,18 @@ public class TrackWidthCard extends BaseCard {
|
|||
updateHeader();
|
||||
updateCustomWidthSlider();
|
||||
|
||||
widthAdapter = new GpxWidthAdapter(appearanceItems);
|
||||
RecyclerView groupRecyclerView = view.findViewById(R.id.recycler_view);
|
||||
groupRecyclerView.setAdapter(new GpxWidthAdapter(appearanceItems));
|
||||
groupRecyclerView.setAdapter(widthAdapter);
|
||||
groupRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
|
||||
}
|
||||
|
||||
public void updateItems() {
|
||||
if (widthAdapter != null) {
|
||||
widthAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private AppearanceListItem getSelectedItem() {
|
||||
if (selectedItem == null) {
|
||||
String selectedWidth = trackDrawInfo.getWidth();
|
||||
|
|
Loading…
Reference in a new issue