forked from organicmaps/organicmaps
[android] Remove com.cocosw.bottomsheet dependency
Signed-off-by: Arnaud Vergnet <arnaud.vergnet@mailo.com>
This commit is contained in:
parent
490ade8b8d
commit
e0cb2b42a6
13 changed files with 28 additions and 164 deletions
|
@ -83,8 +83,7 @@ dependencies {
|
|||
|
||||
// 3-party
|
||||
implementation 'com.google.code.gson:gson:2.9.0'
|
||||
// BottomSheet
|
||||
implementation 'com.cocosw:bottomsheet:1.5.0@aar'
|
||||
// Sticky recycler view headers
|
||||
implementation 'com.timehop.stickyheadersrecyclerview:library:0.4.3@aar'
|
||||
// Glide
|
||||
implementation 'com.github.bumptech.glide:glide:4.13.0'
|
||||
|
|
8
android/res/anim/slide_in_up.xml
Normal file
8
android/res/anim/slide_in_up.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromYDelta="100%"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:toYDelta="0" />
|
||||
</set>
|
8
android/res/anim/slide_out_down.xml
Normal file
8
android/res/anim/slide_out_down.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="@android:integer/config_mediumAnimTime"
|
||||
android:fromYDelta="0"
|
||||
android:interpolator="@android:anim/accelerate_interpolator"
|
||||
android:toYDelta="100%" />
|
||||
</set>
|
Binary file not shown.
Before Width: | Height: | Size: 86 B |
Binary file not shown.
Before Width: | Height: | Size: 70 B |
Binary file not shown.
Before Width: | Height: | Size: 98 B |
Binary file not shown.
Before Width: | Height: | Size: 122 B |
5
android/res/drawable/ic_more.xml
Normal file
5
android/res/drawable/ic_more.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<vector android:height="24dp" android:tint="#FFFFFF"
|
||||
android:viewportHeight="24" android:viewportWidth="24"
|
||||
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="@android:color/white" android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
|
@ -9,12 +9,12 @@
|
|||
|
||||
<style name="MwmWidget.Downloader"/>
|
||||
|
||||
<style name="BottomSheet.Icon">
|
||||
<item name="android:layout_width">0dp</item>
|
||||
<item name="android:layout_height">0dp</item>
|
||||
<item name="android:layout_marginStart">0dp</item>
|
||||
<style name="BottomSheetAnimation">
|
||||
<item name="android:windowEnterAnimation">@anim/slide_in_up</item>
|
||||
<item name="android:windowExitAnimation">@anim/slide_out_down</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="MwmWidget.MapButton" parent="android:Widget.ImageButton">
|
||||
<item name="android:scaleType">center</item>
|
||||
<item name="android:layout_height">64dp</item>
|
||||
|
|
|
@ -142,17 +142,6 @@
|
|||
<item name="android:background">@color/bg_cards_night</item>
|
||||
</style>
|
||||
|
||||
<style name="BottomSheet.Dialog.Dark">
|
||||
<item name="android:textColorPrimary">@color/text_light</item>
|
||||
<item name="android:textColorSecondary">@color/text_light</item>
|
||||
<item name="android:textColorHint">@color/text_light_subtitle</item>
|
||||
<item name="bs_dialogBackground">?panel</item>
|
||||
<item name="bs_dividerColor">@color/bs_dark_divider_color</item>
|
||||
<item name="bs_listStyle">@style/BottomSheet.List.Dark</item>
|
||||
<item name="bs_closeDrawable">@drawable/bs_ic_clear</item>
|
||||
<item name="bs_moreDrawable">@drawable/bs_ic_more</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmTheme.Editor"/>
|
||||
|
||||
<style name="MwmTheme.Downloader">
|
||||
|
|
|
@ -181,7 +181,7 @@ public final class PlacePageButtons
|
|||
// Must not be used outside
|
||||
MORE(
|
||||
R.string.placepage_more_button,
|
||||
new ImageResources(R.drawable.bs_ic_more),
|
||||
new ImageResources(R.drawable.ic_more),
|
||||
ButtonType.MORE),
|
||||
|
||||
CALL(
|
||||
|
|
|
@ -1,146 +0,0 @@
|
|||
package com.mapswithme.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.annotation.IdRes;
|
||||
import androidx.annotation.MenuRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.cocosw.bottomsheet.BottomSheet;
|
||||
|
||||
public final class BottomSheetHelper
|
||||
{
|
||||
public static class Builder extends BottomSheet.Builder
|
||||
{
|
||||
public Builder(@NonNull Activity context)
|
||||
{
|
||||
super(context);
|
||||
setOnDismissListener(null);
|
||||
if (ThemeUtils.isNightTheme(context))
|
||||
darkTheme();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BottomSheet build()
|
||||
{
|
||||
BottomSheet res = super.build();
|
||||
return res;
|
||||
}
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Override
|
||||
public Builder setOnDismissListener(final DialogInterface.OnDismissListener listener)
|
||||
{
|
||||
super.setOnDismissListener(new DialogInterface.OnDismissListener()
|
||||
{
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialog)
|
||||
{
|
||||
if (listener != null)
|
||||
listener.onDismiss(dialog);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder title(CharSequence title)
|
||||
{
|
||||
super.title(title);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder title(@StringRes int title)
|
||||
{
|
||||
super.title(title);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder sheet(@MenuRes int xmlRes)
|
||||
{
|
||||
super.sheet(xmlRes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder sheet(int id, @NonNull Drawable icon, @NonNull CharSequence text)
|
||||
{
|
||||
super.sheet(id, icon, text);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder sheet(int id, @DrawableRes int iconRes, @StringRes int textRes)
|
||||
{
|
||||
super.sheet(id, iconRes, textRes);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder grid()
|
||||
{
|
||||
super.grid();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder listener(@NonNull MenuItem.OnMenuItemClickListener listener)
|
||||
{
|
||||
super.listener(listener);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public static void tint(@NonNull BottomSheet bottomSheet)
|
||||
{
|
||||
for (int i = 0; i < bottomSheet.getMenu().size(); i++)
|
||||
{
|
||||
MenuItem mi = bottomSheet.getMenu().getItem(i);
|
||||
Drawable icon = mi.getIcon();
|
||||
if (icon != null)
|
||||
mi.setIcon(Graphics.tint(bottomSheet.getContext(), icon));
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static MenuItem findItemById(@NonNull BottomSheet bottomSheet, @IdRes int id)
|
||||
{
|
||||
MenuItem item = bottomSheet.getMenu().findItem(id);
|
||||
|
||||
if (item == null)
|
||||
throw new AssertionError("Can not find bottom sheet item with id: " + id);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private BottomSheetHelper()
|
||||
{}
|
||||
|
||||
public static Builder create(Activity context)
|
||||
{
|
||||
return new Builder(context);
|
||||
}
|
||||
|
||||
public static Builder create(Activity context, @StringRes int title)
|
||||
{
|
||||
return create(context).title(title);
|
||||
}
|
||||
|
||||
public static Builder create(Activity context, CharSequence title)
|
||||
{
|
||||
return create(context).title(title);
|
||||
}
|
||||
|
||||
public static Builder createGrid(Activity context, @StringRes int title)
|
||||
{
|
||||
return create(context, title).grid();
|
||||
}
|
||||
}
|
|
@ -75,5 +75,6 @@ public class MenuBottomSheetFragment extends BottomSheetDialogFragment
|
|||
MenuAdapter menuAdapter = new MenuAdapter(menuBottomSheetItems, this::dismiss);
|
||||
recyclerView.setAdapter(menuAdapter);
|
||||
recyclerView.setLayoutManager(new LinearLayoutManager(requireActivity()));
|
||||
requireDialog().getWindow().getAttributes().windowAnimations = R.style.BottomSheetAnimation;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue