shadow without animation
This commit is contained in:
parent
14d4ca32a8
commit
3c4f9618af
11 changed files with 137 additions and 34 deletions
32
OsmAnd/res/drawable/shadow.xml
Normal file
32
OsmAnd/res/drawable/shadow.xml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<shape
|
||||||
|
android:dither="true"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<gradient
|
||||||
|
android:angle="90"
|
||||||
|
android:startColor="#1A000000"
|
||||||
|
android:centerColor="#00FFFFFF"
|
||||||
|
android:endColor="#00FFFFFF" />
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<shape
|
||||||
|
android:dither="true"
|
||||||
|
android:shape="rectangle">
|
||||||
|
|
||||||
|
<gradient
|
||||||
|
android:angle="90"
|
||||||
|
android:startColor="#0D000000"
|
||||||
|
android:centerColor="#00FFFFFF"
|
||||||
|
android:endColor="#00FFFFFF" />
|
||||||
|
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
|
@ -38,9 +38,9 @@
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/buttons_shadow"
|
android:id="@+id/buttons_shadow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="8dp"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/bg_contextmenu_shadow_top_light"
|
android:background="@drawable/shadow"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
|
|
||||||
<include layout="@layout/bottom_buttons" />
|
<include layout="@layout/bottom_buttons" />
|
||||||
|
|
|
@ -33,9 +33,9 @@
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/buttons_shadow"
|
android:id="@+id/buttons_shadow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="8dp"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/bg_contextmenu_shadow_top_light"
|
android:background="@drawable/shadow"
|
||||||
android:visibility="gone" />
|
android:visibility="gone" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/buttons_shadow"
|
android:id="@+id/buttons_shadow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="8dp"
|
||||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
android:background="@drawable/shadow" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -128,9 +128,9 @@
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/buttons_shadow"
|
android:id="@+id/buttons_shadow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="8dp"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
android:background="@drawable/shadow" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/bottom_buttons"
|
layout="@layout/bottom_buttons"
|
||||||
|
|
|
@ -98,9 +98,9 @@
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/buttons_shadow"
|
android:id="@+id/buttons_shadow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="8dp"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
android:background="@drawable/shadow" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/bottom_buttons"
|
layout="@layout/bottom_buttons"
|
||||||
|
|
|
@ -591,9 +591,9 @@
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/buttons_shadow"
|
android:id="@+id/buttons_shadow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="8dp"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
android:background="@drawable/shadow" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/route_info_menu_control_buttons"
|
layout="@layout/route_info_menu_control_buttons"
|
||||||
|
|
81
OsmAnd/res/layout/shadow.xml
Normal file
81
OsmAnd/res/layout/shadow.xml
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="20dp" android:layout_width="30dp">
|
||||||
|
|
||||||
|
<!-- Drop Shadow Stack -->
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<padding
|
||||||
|
android:bottom="1dp"
|
||||||
|
android:left="1dp"
|
||||||
|
android:right="1dp"
|
||||||
|
android:top="1dp" />
|
||||||
|
|
||||||
|
<solid android:color="#00CCCCCC" />
|
||||||
|
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<padding
|
||||||
|
android:bottom="1dp"
|
||||||
|
android:left="1dp"
|
||||||
|
android:right="1dp"
|
||||||
|
android:top="1dp" />
|
||||||
|
|
||||||
|
<solid android:color="#10CCCCCC" />
|
||||||
|
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<padding
|
||||||
|
android:bottom="1dp"
|
||||||
|
android:left="1dp"
|
||||||
|
android:right="1dp"
|
||||||
|
android:top="1dp" />
|
||||||
|
|
||||||
|
<solid android:color="#20CCCCCC" />
|
||||||
|
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<padding
|
||||||
|
android:bottom="1dp"
|
||||||
|
android:left="1dp"
|
||||||
|
android:right="1dp"
|
||||||
|
android:top="1dp" />
|
||||||
|
|
||||||
|
<solid android:color="#30CCCCCC" />
|
||||||
|
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<padding
|
||||||
|
android:bottom="1dp"
|
||||||
|
android:left="1dp"
|
||||||
|
android:right="1dp"
|
||||||
|
android:top="1dp" />
|
||||||
|
|
||||||
|
<solid android:color="#50CCCCCC" />
|
||||||
|
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
<!-- Background -->
|
||||||
|
<item>
|
||||||
|
<shape>
|
||||||
|
<solid android:color="@android:color/white" />
|
||||||
|
|
||||||
|
<corners android:radius="3dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
|
||||||
|
</layer-list>
|
|
@ -129,9 +129,9 @@
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/buttons_shadow"
|
android:id="@+id/buttons_shadow"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="10dp"
|
android:layout_height="8dp"
|
||||||
android:layout_gravity="bottom"
|
android:layout_gravity="bottom"
|
||||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
android:background="@drawable/shadow" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/bottom_buttons"
|
layout="@layout/bottom_buttons"
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.routepreparationmenu;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.graphics.drawable.AnimationDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
@ -16,6 +17,7 @@ import android.view.ViewGroup.MarginLayoutParams;
|
||||||
import android.view.ViewTreeObserver.OnScrollChangedListener;
|
import android.view.ViewTreeObserver.OnScrollChangedListener;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
@ -86,6 +88,8 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
||||||
|
|
||||||
private GPXFile gpxFile;
|
private GPXFile gpxFile;
|
||||||
|
|
||||||
|
private View buttonsShadow;
|
||||||
|
|
||||||
private boolean editingTrack;
|
private boolean editingTrack;
|
||||||
private boolean selectingTrack;
|
private boolean selectingTrack;
|
||||||
private int menuTitleHeight;
|
private int menuTitleHeight;
|
||||||
|
@ -148,6 +152,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
||||||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
ImageButton closeButton = view.findViewById(R.id.close_button);
|
ImageButton closeButton = view.findViewById(R.id.close_button);
|
||||||
|
buttonsShadow = view.findViewById(R.id.buttons_shadow);
|
||||||
closeButton.setImageDrawable(getContentIcon(AndroidUtils.getNavigationIconResId(app)));
|
closeButton.setImageDrawable(getContentIcon(AndroidUtils.getNavigationIconResId(app)));
|
||||||
closeButton.setOnClickListener(new View.OnClickListener() {
|
closeButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -597,22 +602,15 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
||||||
UiUtilities.setupDialogButton(isNightMode(), cancelButton, DialogButtonType.SECONDARY, R.string.shared_string_close);
|
UiUtilities.setupDialogButton(isNightMode(), cancelButton, DialogButtonType.SECONDARY, R.string.shared_string_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupScrollShadow() {
|
|
||||||
int shadowIconId = isNightMode() ? R.drawable.bg_contextmenu_shadow : R.drawable.bg_contextmenu_shadow;
|
|
||||||
final Drawable shadowIcon = app.getUIUtilities().getIcon(shadowIconId);
|
|
||||||
|
|
||||||
|
private void setupScrollShadow() {
|
||||||
final View scrollView = getBottomScrollView();
|
final View scrollView = getBottomScrollView();
|
||||||
final FrameLayout bottomContainer = getBottomContainer();
|
|
||||||
scrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
|
scrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScrollChanged() {
|
public void onScrollChanged() {
|
||||||
int scrollY = scrollView.getScrollY();
|
boolean scrollToBottomAvailable = scrollView.canScrollVertically(1);
|
||||||
if (scrollY <= 0 && bottomContainer.getForeground() != null) {
|
AndroidUiHelper.updateVisibility(buttonsShadow, scrollToBottomAvailable);
|
||||||
bottomContainer.setForeground(null);
|
|
||||||
} else if (scrollY > 0 && bottomContainer.getForeground() == null) {
|
|
||||||
bottomContainer.setForeground(shadowIcon);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -477,21 +477,13 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupScrollShadow() {
|
private void setupScrollShadow() {
|
||||||
int shadowIconId = isNightMode() ? R.drawable.bg_contextmenu_shadow : R.drawable.bg_contextmenu_shadow;
|
|
||||||
final Drawable shadowIcon = app.getUIUtilities().getIcon(shadowIconId);
|
|
||||||
|
|
||||||
final View scrollView = getBottomScrollView();
|
final View scrollView = getBottomScrollView();
|
||||||
final FrameLayout bottomContainer = getBottomContainer();
|
|
||||||
scrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
|
scrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onScrollChanged() {
|
public void onScrollChanged() {
|
||||||
int scrollY = scrollView.getScrollY();
|
boolean scrollToBottomAvailable = scrollView.canScrollVertically(1);
|
||||||
if (scrollY <= 0 && bottomContainer.getForeground() != null) {
|
AndroidUiHelper.updateVisibility(buttonsShadow, scrollToBottomAvailable);
|
||||||
bottomContainer.setForeground(null);
|
|
||||||
} else if (scrollY > 0 && bottomContainer.getForeground() == null) {
|
|
||||||
bottomContainer.setForeground(shadowIcon);
|
|
||||||
}
|
|
||||||
updateButtonsShadow();
|
updateButtonsShadow();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue