UI fixes first part
This commit is contained in:
parent
794f75bf49
commit
053c4701ff
5 changed files with 35 additions and 23 deletions
|
@ -37,7 +37,7 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/no_search_results_description"
|
||||
android:id="@+id/track_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
|
|
@ -44,7 +44,8 @@
|
|||
android:id="@+id/slider_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/content_padding">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -79,6 +79,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
private TrackColoringCard trackColoringCard;
|
||||
|
||||
private ImageView trackIcon;
|
||||
private View buttonsShadow;
|
||||
|
||||
@Override
|
||||
public int getMainLayoutId() {
|
||||
|
@ -108,6 +109,11 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
return trackDrawInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSupportedMenuStatesPortrait() {
|
||||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -172,6 +178,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view != null) {
|
||||
trackIcon = view.findViewById(R.id.track_icon);
|
||||
buttonsShadow = view.findViewById(R.id.buttons_shadow);
|
||||
|
||||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -202,8 +209,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
@Override
|
||||
protected void calculateLayout(View view, boolean initLayout) {
|
||||
menuTitleHeight = view.findViewById(R.id.route_menu_top_shadow_all).getHeight()
|
||||
+ view.findViewById(R.id.control_buttons).getHeight()
|
||||
- view.findViewById(R.id.buttons_shadow).getHeight();
|
||||
+ view.findViewById(R.id.control_buttons).getHeight() - buttonsShadow.getHeight();
|
||||
super.calculateLayout(view, initLayout);
|
||||
}
|
||||
|
||||
|
@ -219,6 +225,11 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
updateStatusBarColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldShowMapControls(int menuState) {
|
||||
return menuState == MenuState.HEADER_ONLY || menuState == MenuState.HALF_SCREEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
@ -315,10 +326,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
if (card instanceof SplitIntervalCard) {
|
||||
SplitIntervalBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), trackDrawInfo, this);
|
||||
} else if (card instanceof TrackColoringCard) {
|
||||
updateAppearanceIcon();
|
||||
if (trackWidthCard != null) {
|
||||
trackWidthCard.updateItems();
|
||||
}
|
||||
updateColorItems();
|
||||
} else if (card instanceof TrackWidthCard) {
|
||||
updateAppearanceIcon();
|
||||
} else if (card instanceof DirectionArrowsCard) {
|
||||
|
@ -335,6 +343,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
@Override
|
||||
public void onColorSelected(int prevColor, int newColor) {
|
||||
trackColoringCard.onColorSelected(prevColor, newColor);
|
||||
updateColorItems();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -455,10 +464,23 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
} else if (scrollY > 0 && bottomContainer.getForeground() == null) {
|
||||
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() {
|
||||
GPXFile gpxFile = selectedGpxFile.getGpxFile();
|
||||
|
||||
|
@ -537,19 +559,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
}
|
||||
|
||||
private void saveGpx(final GPXFile gpxFile) {
|
||||
new SaveGpxAsyncTask(gpxFile, new SaveGpxAsyncTask.SaveGpxListener() {
|
||||
@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);
|
||||
new SaveGpxAsyncTask(gpxFile, null).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||
}
|
||||
|
||||
private void setupCards() {
|
||||
|
|
|
@ -281,6 +281,7 @@ public class TrackColoringCard extends BaseCard implements ColorPickerListener {
|
|||
public void onColorSelected(int prevColor, int newColor) {
|
||||
if (prevColor == INVALID_VALUE && customColors.size() < 6) {
|
||||
customColors.add(newColor);
|
||||
trackDrawInfo.setColor(newColor);
|
||||
} else if (!Algorithms.isEmpty(customColors)) {
|
||||
int index = customColors.indexOf(prevColor);
|
||||
if (index != INVALID_VALUE) {
|
||||
|
|
|
@ -887,12 +887,12 @@ public class GPXLayer extends OsmandMapLayer implements IContextMenuProvider, IM
|
|||
|
||||
@Override
|
||||
public boolean disableSingleTap() {
|
||||
return false;
|
||||
return isInTrackAppearanceMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disableLongPressOnMap() {
|
||||
return false;
|
||||
return isInTrackAppearanceMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue