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
|
||||
android:id="@+id/buttons_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_contextmenu_shadow_top_light"
|
||||
android:background="@drawable/shadow"
|
||||
android:visibility="gone" />
|
||||
|
||||
<include layout="@layout/bottom_buttons" />
|
||||
|
|
|
@ -33,9 +33,9 @@
|
|||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/buttons_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_contextmenu_shadow_top_light"
|
||||
android:background="@drawable/shadow"
|
||||
android:visibility="gone" />
|
||||
</FrameLayout>
|
||||
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/buttons_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
||||
android:layout_height="8dp"
|
||||
android:background="@drawable/shadow" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -128,9 +128,9 @@
|
|||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/buttons_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
||||
android:background="@drawable/shadow" />
|
||||
|
||||
<include
|
||||
layout="@layout/bottom_buttons"
|
||||
|
|
|
@ -98,9 +98,9 @@
|
|||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/buttons_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
||||
android:background="@drawable/shadow" />
|
||||
|
||||
<include
|
||||
layout="@layout/bottom_buttons"
|
||||
|
|
|
@ -591,9 +591,9 @@
|
|||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/buttons_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
||||
android:background="@drawable/shadow" />
|
||||
|
||||
<include
|
||||
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
|
||||
android:id="@+id/buttons_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="10dp"
|
||||
android:layout_height="8dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:background="@drawable/bg_contextmenu_shadow_top_light" />
|
||||
android:background="@drawable/shadow" />
|
||||
|
||||
<include
|
||||
layout="@layout/bottom_buttons"
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.routepreparationmenu;
|
|||
import android.app.Activity;
|
||||
import android.content.ActivityNotFoundException;
|
||||
import android.content.Intent;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
@ -16,6 +17,7 @@ import android.view.ViewGroup.MarginLayoutParams;
|
|||
import android.view.ViewTreeObserver.OnScrollChangedListener;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -86,6 +88,8 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
|||
|
||||
private GPXFile gpxFile;
|
||||
|
||||
private View buttonsShadow;
|
||||
|
||||
private boolean editingTrack;
|
||||
private boolean selectingTrack;
|
||||
private int menuTitleHeight;
|
||||
|
@ -148,6 +152,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
|||
View view = super.onCreateView(inflater, container, savedInstanceState);
|
||||
if (view != null) {
|
||||
ImageButton closeButton = view.findViewById(R.id.close_button);
|
||||
buttonsShadow = view.findViewById(R.id.buttons_shadow);
|
||||
closeButton.setImageDrawable(getContentIcon(AndroidUtils.getNavigationIconResId(app)));
|
||||
closeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -597,22 +602,15 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
|||
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 FrameLayout bottomContainer = getBottomContainer();
|
||||
scrollView.getViewTreeObserver().addOnScrollChangedListener(new OnScrollChangedListener() {
|
||||
|
||||
@Override
|
||||
public void onScrollChanged() {
|
||||
int scrollY = scrollView.getScrollY();
|
||||
if (scrollY <= 0 && bottomContainer.getForeground() != null) {
|
||||
bottomContainer.setForeground(null);
|
||||
} else if (scrollY > 0 && bottomContainer.getForeground() == null) {
|
||||
bottomContainer.setForeground(shadowIcon);
|
||||
}
|
||||
boolean scrollToBottomAvailable = scrollView.canScrollVertically(1);
|
||||
AndroidUiHelper.updateVisibility(buttonsShadow, scrollToBottomAvailable);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -477,21 +477,13 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
}
|
||||
|
||||
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 FrameLayout bottomContainer = getBottomContainer();
|
||||
scrollView.getViewTreeObserver().addOnScrollChangedListener(new ViewTreeObserver.OnScrollChangedListener() {
|
||||
|
||||
@Override
|
||||
public void onScrollChanged() {
|
||||
int scrollY = scrollView.getScrollY();
|
||||
if (scrollY <= 0 && bottomContainer.getForeground() != null) {
|
||||
bottomContainer.setForeground(null);
|
||||
} else if (scrollY > 0 && bottomContainer.getForeground() == null) {
|
||||
bottomContainer.setForeground(shadowIcon);
|
||||
}
|
||||
boolean scrollToBottomAvailable = scrollView.canScrollVertically(1);
|
||||
AndroidUiHelper.updateVisibility(buttonsShadow, scrollToBottomAvailable);
|
||||
updateButtonsShadow();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue