UI fixes first part

This commit is contained in:
Vitaliy 2020-09-01 02:06:22 +03:00
parent 794f75bf49
commit 053c4701ff
5 changed files with 35 additions and 23 deletions

View file

@ -37,7 +37,7 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@+id/no_search_results_description" android:id="@+id/track_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"

View file

@ -44,7 +44,8 @@
android:id="@+id/slider_container" android:id="@+id/slider_container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:paddingBottom="@dimen/content_padding">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"

View file

@ -79,6 +79,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
private TrackColoringCard trackColoringCard; private TrackColoringCard trackColoringCard;
private ImageView trackIcon; private ImageView trackIcon;
private View buttonsShadow;
@Override @Override
public int getMainLayoutId() { public int getMainLayoutId() {
@ -108,6 +109,11 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
return trackDrawInfo; return trackDrawInfo;
} }
@Override
public int getSupportedMenuStatesPortrait() {
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
}
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -172,6 +178,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
View view = super.onCreateView(inflater, container, savedInstanceState); View view = super.onCreateView(inflater, container, savedInstanceState);
if (view != null) { if (view != null) {
trackIcon = view.findViewById(R.id.track_icon); trackIcon = view.findViewById(R.id.track_icon);
buttonsShadow = view.findViewById(R.id.buttons_shadow);
view.setOnClickListener(new View.OnClickListener() { view.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -202,8 +209,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
@Override @Override
protected void calculateLayout(View view, boolean initLayout) { protected void calculateLayout(View view, boolean initLayout) {
menuTitleHeight = view.findViewById(R.id.route_menu_top_shadow_all).getHeight() menuTitleHeight = view.findViewById(R.id.route_menu_top_shadow_all).getHeight()
+ view.findViewById(R.id.control_buttons).getHeight() + view.findViewById(R.id.control_buttons).getHeight() - buttonsShadow.getHeight();
- view.findViewById(R.id.buttons_shadow).getHeight();
super.calculateLayout(view, initLayout); super.calculateLayout(view, initLayout);
} }
@ -219,6 +225,11 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
updateStatusBarColor(); updateStatusBarColor();
} }
@Override
public boolean shouldShowMapControls(int menuState) {
return menuState == MenuState.HEADER_ONLY || menuState == MenuState.HALF_SCREEN;
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
@ -315,10 +326,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
if (card instanceof SplitIntervalCard) { if (card instanceof SplitIntervalCard) {
SplitIntervalBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), trackDrawInfo, this); SplitIntervalBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), trackDrawInfo, this);
} else if (card instanceof TrackColoringCard) { } else if (card instanceof TrackColoringCard) {
updateAppearanceIcon(); updateColorItems();
if (trackWidthCard != null) {
trackWidthCard.updateItems();
}
} else if (card instanceof TrackWidthCard) { } else if (card instanceof TrackWidthCard) {
updateAppearanceIcon(); updateAppearanceIcon();
} else if (card instanceof DirectionArrowsCard) { } else if (card instanceof DirectionArrowsCard) {
@ -335,6 +343,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
@Override @Override
public void onColorSelected(int prevColor, int newColor) { public void onColorSelected(int prevColor, int newColor) {
trackColoringCard.onColorSelected(prevColor, newColor); trackColoringCard.onColorSelected(prevColor, newColor);
updateColorItems();
} }
@Override @Override
@ -455,10 +464,23 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
} else if (scrollY > 0 && bottomContainer.getForeground() == null) { } else if (scrollY > 0 && bottomContainer.getForeground() == null) {
bottomContainer.setForeground(shadowIcon); bottomContainer.setForeground(shadowIcon);
} }
updateButtonsShadow();
} }
}); });
} }
private void updateButtonsShadow() {
boolean scrollToBottomAvailable = getBottomScrollView().canScrollVertically(1);
AndroidUiHelper.updateVisibility(buttonsShadow, scrollToBottomAvailable);
}
private void updateColorItems() {
updateAppearanceIcon();
if (trackWidthCard != null) {
trackWidthCard.updateItems();
}
}
private void saveTrackInfo() { private void saveTrackInfo() {
GPXFile gpxFile = selectedGpxFile.getGpxFile(); GPXFile gpxFile = selectedGpxFile.getGpxFile();
@ -537,19 +559,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
} }
private void saveGpx(final GPXFile gpxFile) { private void saveGpx(final GPXFile gpxFile) {
new SaveGpxAsyncTask(gpxFile, new SaveGpxAsyncTask.SaveGpxListener() { new SaveGpxAsyncTask(gpxFile, null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@Override
public void gpxSavingStarted() {
}
@Override
public void gpxSavingFinished(Exception errorMessage) {
if (errorMessage == null) {
app.showShortToastMessage(R.string.shared_string_track_is_saved, Algorithms.getFileWithoutDirs(gpxFile.path));
}
}
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
private void setupCards() { private void setupCards() {

View file

@ -281,6 +281,7 @@ public class TrackColoringCard extends BaseCard implements ColorPickerListener {
public void onColorSelected(int prevColor, int newColor) { public void onColorSelected(int prevColor, int newColor) {
if (prevColor == INVALID_VALUE && customColors.size() < 6) { if (prevColor == INVALID_VALUE && customColors.size() < 6) {
customColors.add(newColor); customColors.add(newColor);
trackDrawInfo.setColor(newColor);
} else if (!Algorithms.isEmpty(customColors)) { } else if (!Algorithms.isEmpty(customColors)) {
int index = customColors.indexOf(prevColor); int index = customColors.indexOf(prevColor);
if (index != INVALID_VALUE) { if (index != INVALID_VALUE) {

View file

@ -887,12 +887,12 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
@Override @Override
public boolean disableSingleTap() { public boolean disableSingleTap() {
return false; return isInTrackAppearanceMode();
} }
@Override @Override
public boolean disableLongPressOnMap() { public boolean disableLongPressOnMap() {
return false; return isInTrackAppearanceMode();
} }
@Override @Override