[android] add: Dynamic list shadows.
|
@ -50,7 +50,6 @@ import android.view.ViewGroup;
|
|||
import android.view.ViewTreeObserver;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.FrameLayout;
|
||||
|
@ -80,8 +79,7 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
private Drawable more;
|
||||
private boolean collapseListIcons;
|
||||
private int mStatusBarHeight;
|
||||
private GridView list;
|
||||
private View listShadow;
|
||||
protected GridView list;
|
||||
private SimpleSectionedGridAdapter adapter;
|
||||
private Builder builder;
|
||||
|
||||
|
@ -113,7 +111,7 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
}
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
BottomSheet(Context context, int theme) {
|
||||
protected BottomSheet(Context context, int theme) {
|
||||
super(context, theme);
|
||||
|
||||
TypedArray a = getContext()
|
||||
|
@ -264,7 +262,7 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
cancelOnSwipeDown = cancel;
|
||||
}
|
||||
|
||||
private void init(final Context context) {
|
||||
protected void init(final Context context) {
|
||||
setCanceledOnTouchOutside(cancelOnTouchOutside);
|
||||
final ClosableSlidingLayout mDialogView = (ClosableSlidingLayout) View.inflate(context, R.layout.bottom_sheet_dialog, null);
|
||||
setContentView(mDialogView);
|
||||
|
@ -319,8 +317,6 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
list.setNumColumns(1);
|
||||
}
|
||||
|
||||
listShadow = mDialogView.findViewById(R.id.bottom_sheet_list_shadow);
|
||||
|
||||
if (builder.grid) {
|
||||
for (int i = 0; i < getMenu().size(); i++) {
|
||||
if (getMenu().getItem(i).getIcon() == null)
|
||||
|
@ -480,20 +476,7 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean shouldShowShadow() {
|
||||
int first = list.getFirstVisiblePosition();
|
||||
if (first > 0)
|
||||
return true;
|
||||
|
||||
View child = list.getChildAt(0);
|
||||
return (child.getTop() < 0);
|
||||
}
|
||||
|
||||
private void updateListShadow() {
|
||||
listShadow.setVisibility(shouldShowShadow() ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
private void showFullItems() {
|
||||
protected void showFullItems() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
|
||||
Transition changeBounds = new ChangeBounds();
|
||||
changeBounds.setDuration(300);
|
||||
|
@ -512,20 +495,9 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
}
|
||||
});
|
||||
setListLayout();
|
||||
|
||||
list.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
|
||||
updateListShadow();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showShortItems() {
|
||||
protected void showShortItems() {
|
||||
actions = menuItem;
|
||||
updateSection();
|
||||
adapter.notifyDataSetChanged();
|
||||
|
@ -539,7 +511,6 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
}
|
||||
|
||||
list.setOnScrollListener(null);
|
||||
listShadow.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private boolean hasDivider() {
|
||||
|
@ -852,6 +823,9 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
return this;
|
||||
}
|
||||
|
||||
protected BottomSheet createDialog(Context context, int theme) {
|
||||
return new BottomSheet(context, theme);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a BottomSheet but not show it
|
||||
|
@ -860,7 +834,7 @@ public class BottomSheet extends Dialog implements DialogInterface {
|
|||
*/
|
||||
@SuppressLint("Override")
|
||||
public BottomSheet build() {
|
||||
BottomSheet dialog = new BottomSheet(context, theme);
|
||||
BottomSheet dialog = createDialog(context, theme);
|
||||
dialog.builder = this;
|
||||
return dialog;
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 115 B After Width: | Height: | Size: 115 B |
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 133 B After Width: | Height: | Size: 133 B |
|
@ -46,13 +46,6 @@
|
|||
android:fadingEdge="none"
|
||||
style="?bs_listStyle"
|
||||
tools:listitem="@layout/bs_grid_entry" />
|
||||
|
||||
<View android:id="@+id/bottom_sheet_list_shadow"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bs_shadow"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
BIN
android/res/drawable-hdpi/shadow_bottom.9.png
Normal file
After Width: | Height: | Size: 101 B |
BIN
android/res/drawable-hdpi/shadow_top.9.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
android/res/drawable-mdpi/shadow_bottom.9.png
Normal file
After Width: | Height: | Size: 98 B |
BIN
android/res/drawable-mdpi/shadow_top.9.png
Normal file
After Width: | Height: | Size: 108 B |
BIN
android/res/drawable-xhdpi/shadow_bottom.9.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
android/res/drawable-xhdpi/shadow_top.9.png
Normal file
After Width: | Height: | Size: 115 B |
BIN
android/res/drawable-xxhdpi/shadow_bottom.9.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
android/res/drawable-xxhdpi/shadow_top.9.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
android/res/drawable-xxxhdpi/shadow_bottom.9.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
android/res/drawable-xxxhdpi/shadow_top.9.png
Normal file
After Width: | Height: | Size: 133 B |
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<include
|
||||
android:id="@+id/pp__preview"
|
||||
layout="@layout/place_page_preview"
|
||||
|
@ -9,7 +8,6 @@
|
|||
android:background="@drawable/bg_place_page_back"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/pp__details"
|
||||
layout="@layout/place_page_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/bg_top_panels"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<include layout="@layout/place_page_details_common"/>
|
||||
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
|
@ -1,81 +1,94 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/bg_top_panels"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl__place_details"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.mapswithme.maps.widget.ObservableScrollView
|
||||
android:id="@+id/pp__details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:clipChildren="false"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/margin_base_plus"
|
||||
android:paddingRight="@dimen/margin_base_plus">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:background="?android:attr/listDivider"/>
|
||||
android:background="@color/bg_top_panels"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl__details_attrs"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half">
|
||||
|
||||
<View
|
||||
android:id="@+id/anchor_center"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="@dimen/margin_base"
|
||||
android:layout_marginRight="@dimen/margin_base"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__details_left"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/anchor_center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/place_page_placename"/>
|
||||
|
||||
<include layout="@layout/place_page_phone"/>
|
||||
|
||||
<include layout="@layout/place_page_website"/>
|
||||
|
||||
<include layout="@layout/place_page_schedule"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__details_right"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/anchor_center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/place_page_latlon"/>
|
||||
|
||||
<include layout="@layout/place_page_wifi"/>
|
||||
|
||||
<include layout="@layout/place_page_email"/>
|
||||
|
||||
<include layout="@layout/place_page_operator"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/place_page_bookmark_details"
|
||||
android:id="@+id/rl__place_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/rl__details_attrs"/>
|
||||
android:clipChildren="false">
|
||||
|
||||
</RelativeLayout>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:paddingLeft="@dimen/margin_base_plus"
|
||||
android:paddingRight="@dimen/margin_base_plus"
|
||||
android:background="?android:attr/listDivider"/>
|
||||
|
||||
</ScrollView>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl__details_attrs"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="@dimen/margin_base_plus"
|
||||
android:paddingRight="@dimen/margin_base_plus"
|
||||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half">
|
||||
|
||||
<View
|
||||
android:id="@+id/anchor_center"
|
||||
android:layout_width="0px"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginLeft="@dimen/margin_base"
|
||||
android:layout_marginRight="@dimen/margin_base"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__details_left"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/anchor_center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/place_page_placename"/>
|
||||
|
||||
<include layout="@layout/place_page_phone"/>
|
||||
|
||||
<include layout="@layout/place_page_website"/>
|
||||
|
||||
<include layout="@layout/place_page_schedule"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__details_right"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/anchor_center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/place_page_latlon"/>
|
||||
|
||||
<include layout="@layout/place_page_wifi"/>
|
||||
|
||||
<include layout="@layout/place_page_email"/>
|
||||
|
||||
<include layout="@layout/place_page_operator"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<include
|
||||
layout="@layout/place_page_bookmark_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/margin_base_plus"
|
||||
android:layout_marginRight="@dimen/margin_base_plus"
|
||||
android:layout_below="@id/rl__details_attrs"/>
|
||||
</RelativeLayout>
|
||||
</com.mapswithme.maps.widget.ObservableScrollView>
|
||||
|
||||
<include layout="@layout/shadow_top"/>
|
||||
|
||||
<include layout="@layout/shadow_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom"/>
|
||||
</FrameLayout>
|
|
@ -1,10 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/bg_top_panels"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<include layout="@layout/place_page_details_common"/>
|
||||
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
|
@ -9,7 +9,6 @@
|
|||
android:layout_above="@+id/pp__buttons"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/pp__details"
|
||||
layout="@layout/place_page_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
54
android/res/layout/bottom_sheet_dialog.xml
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<com.cocosw.bottomsheet.ClosableSlidingLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?bs_dialogBackground"
|
||||
tools:ignore="Overdraw"
|
||||
android:layout_gravity="bottom">
|
||||
|
||||
<View
|
||||
style="@style/BottomSheet.TopDivider" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
tools:ignore="UseCompoundDrawables">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bottom_sheet_title_image"
|
||||
android:visibility="gone"
|
||||
tools:ignore="ContentDescription"
|
||||
style="@style/BottomSheet.Icon" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bottom_sheet_title"
|
||||
android:visibility="gone"
|
||||
style="@style/BottomSheet.Title" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.cocosw.bottomsheet.PinnedSectionGridView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/bottom_sheet_gridview"
|
||||
android:numColumns="?bs_numColumns"
|
||||
android:fadingEdge="none"
|
||||
style="?bs_listStyle"
|
||||
tools:listitem="@layout/bs_grid_entry" />
|
||||
|
||||
<include layout="@layout/shadow_top"/>
|
||||
</FrameLayout>
|
||||
</LinearLayout>
|
||||
|
||||
</com.cocosw.bottomsheet.ClosableSlidingLayout>
|
|
@ -13,9 +13,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/pp__details"
|
||||
layout="@layout/place_page_details"/>
|
||||
<include layout="@layout/place_page_details"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/rl__bookmark_details"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/rl__bookmark_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipChildren="false"
|
||||
android:paddingBottom="@dimen/margin_base"
|
||||
android:visibility="invisible">
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
@ -82,7 +84,6 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="-8dp"
|
||||
android:background="?attr/clickableBackground"
|
||||
android:padding="@dimen/margin_half"
|
||||
android:src="@drawable/color_picker_red_on"/>
|
||||
|
|
|
@ -5,7 +5,8 @@
|
|||
android:background="@color/bg_top_panels"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/margin_half_plus"
|
||||
android:paddingRight="@dimen/margin_half_plus">
|
||||
android:paddingRight="@dimen/margin_half_plus"
|
||||
android:layout_marginTop="@dimen/margin_base">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/bg_top_panels"
|
||||
android:overScrollMode="never">
|
||||
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<include layout="@layout/place_page_details_common"/>
|
||||
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
|
@ -1,47 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/rl__place_details"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.mapswithme.maps.widget.ObservableScrollView
|
||||
android:id="@+id/pp__details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/margin_base_plus"
|
||||
android:paddingRight="@dimen/margin_base_plus"
|
||||
android:paddingTop="@dimen/margin_base">
|
||||
|
||||
<View
|
||||
android:layout_height="match_parent"
|
||||
android:overScrollMode="never">
|
||||
<LinearLayout
|
||||
android:id="@+id/rl__place_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
android:background="?android:attr/listDivider"/>
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/bg_top_panels"
|
||||
android:paddingLeft="@dimen/margin_base_plus"
|
||||
android:paddingRight="@dimen/margin_base_plus"
|
||||
android:paddingTop="@dimen/margin_base">
|
||||
|
||||
<include layout="@layout/place_page_placename"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginBottom="@dimen/margin_half"
|
||||
android:background="?android:attr/listDivider"/>
|
||||
|
||||
<include layout="@layout/place_page_phone"/>
|
||||
<include layout="@layout/place_page_placename"/>
|
||||
|
||||
<include layout="@layout/place_page_website"/>
|
||||
<include layout="@layout/place_page_phone"/>
|
||||
|
||||
<include layout="@layout/place_page_schedule"/>
|
||||
<include layout="@layout/place_page_website"/>
|
||||
|
||||
<include layout="@layout/place_page_latlon"/>
|
||||
<include layout="@layout/place_page_schedule"/>
|
||||
|
||||
<include layout="@layout/place_page_wifi"/>
|
||||
<include layout="@layout/place_page_latlon"/>
|
||||
|
||||
<include layout="@layout/place_page_email"/>
|
||||
<include layout="@layout/place_page_wifi"/>
|
||||
|
||||
<include layout="@layout/place_page_operator"/>
|
||||
<include layout="@layout/place_page_email"/>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_marginBottom="@dimen/margin_half"/>
|
||||
<include layout="@layout/place_page_operator"/>
|
||||
|
||||
<include
|
||||
layout="@layout/place_page_bookmark_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0px"
|
||||
android:layout_marginBottom="@dimen/margin_half"/>
|
||||
|
||||
</LinearLayout>
|
||||
<include
|
||||
layout="@layout/place_page_bookmark_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
</LinearLayout>
|
||||
</com.mapswithme.maps.widget.ObservableScrollView>
|
||||
|
||||
</merge>
|
||||
<include layout="@layout/shadow_top"/>
|
||||
|
||||
<include layout="@layout/shadow_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
</FrameLayout>
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__place_email"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll__place_email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/clickableBackground"
|
||||
|
@ -10,7 +11,9 @@
|
|||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half"
|
||||
android:tag="email"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:background="#F000FF00">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_email"
|
||||
|
@ -24,5 +27,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_place_page_blue"
|
||||
android:textSize="@dimen/place_page_subtitle"/>
|
||||
android:textSize="@dimen/place_page_subtitle"
|
||||
tools:text="email@maps.me"/>
|
||||
</LinearLayout>
|
|
@ -15,7 +15,6 @@
|
|||
android:background="@drawable/bg_place_page_back"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/pp__details"
|
||||
layout="@layout/place_page_details"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__place_latlon"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll__place_latlon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/clickableBackground"
|
||||
|
@ -9,7 +10,8 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half"
|
||||
android:tag="latlon">
|
||||
android:tag="latlon"
|
||||
tools:background="#20FF0000">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_latlon"
|
||||
|
@ -23,5 +25,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_place_page"
|
||||
android:textSize="@dimen/place_page_subtitle"/>
|
||||
android:textSize="@dimen/place_page_subtitle"
|
||||
tools:text="55.747, 37.616"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__place_operator"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll__place_operator"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/clickableBackground"
|
||||
|
@ -10,7 +11,9 @@
|
|||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half"
|
||||
android:tag="operator"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:background="#8000FFFF">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_operator"
|
||||
|
@ -24,5 +27,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_place_page"
|
||||
android:textSize="@dimen/place_page_subtitle"/>
|
||||
android:textSize="@dimen/place_page_subtitle"
|
||||
tools:text="Operator"/>
|
||||
</LinearLayout>
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__place_phone"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll__place_phone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/clickableBackground"
|
||||
|
@ -10,7 +11,9 @@
|
|||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half"
|
||||
android:tag="phone"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:background="#200000FF">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_phone"
|
||||
|
@ -24,6 +27,8 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_place_page_blue"
|
||||
android:textSize="@dimen/place_page_subtitle"/>
|
||||
android:textSize="@dimen/place_page_subtitle"
|
||||
tools:text="+1 234 567-89-00"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__place_name"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll__place_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/clickableBackground"
|
||||
|
@ -9,7 +10,9 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:background="#6000FF00">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_name"
|
||||
|
@ -23,5 +26,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_place_page"
|
||||
android:textSize="@dimen/place_page_subtitle"/>
|
||||
android:textSize="@dimen/place_page_subtitle"
|
||||
tools:text="Sample place"/>
|
||||
</LinearLayout>
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__place_website"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll__place_website"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/clickableBackground"
|
||||
|
@ -10,7 +11,9 @@
|
|||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half"
|
||||
android:tag="website"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:background="#20FF0000">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_website"
|
||||
|
@ -24,5 +27,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_place_page_blue"
|
||||
android:textSize="@dimen/place_page_subtitle"/>
|
||||
android:textSize="@dimen/place_page_subtitle"
|
||||
tools:text="Sample website"/>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
android:id="@+id/ll__place_wifi"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/ll__place_wifi"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/clickableBackground"
|
||||
|
@ -9,7 +10,9 @@
|
|||
android:orientation="horizontal"
|
||||
android:paddingBottom="@dimen/margin_half"
|
||||
android:paddingTop="@dimen/margin_half"
|
||||
android:visibility="gone">
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:background="#40FF0000">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv__place_wifi"
|
||||
|
@ -23,5 +26,6 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/text_place_page"
|
||||
android:textSize="@dimen/place_page_subtitle"/>
|
||||
android:textSize="@dimen/place_page_subtitle"
|
||||
tools:text="Wi-Fi"/>
|
||||
</LinearLayout>
|
9
android/res/layout/shadow_bottom.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<View xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/shadow_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shadow_bottom"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
9
android/res/layout/shadow_top.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<View xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/shadow_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/shadow_top"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"/>
|
|
@ -181,7 +181,7 @@
|
|||
<style name="MwmWidget.FrameLayout"/>
|
||||
|
||||
<style name="MwmWidget.FrameLayout.Elevation">
|
||||
<item name="android:foreground">@drawable/bs_shadow</item>
|
||||
<item name="android:foreground">@drawable/shadow_top</item>
|
||||
</style>
|
||||
|
||||
<style name="MwmWidget.Shadow">
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
package com.mapswithme.maps.widget;
|
||||
|
||||
import android.support.annotation.IdRes;
|
||||
import android.util.SparseArray;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.mapswithme.maps.R;
|
||||
|
||||
public abstract class BaseShadowController<V extends ViewGroup, ScrollListener>
|
||||
{
|
||||
// Shadow IDs
|
||||
public static final int TOP = 0;
|
||||
public static final int BOTTOM = 1;
|
||||
|
||||
protected final V mList;
|
||||
protected final SparseArray<View> mShadows = new SparseArray<>(1);
|
||||
protected ScrollListener mScrollListener;
|
||||
|
||||
|
||||
public BaseShadowController(V list)
|
||||
{
|
||||
this(list, R.id.shadow_top);
|
||||
}
|
||||
|
||||
public BaseShadowController(V list, @IdRes int shadowId)
|
||||
{
|
||||
mList = list;
|
||||
addShadow(TOP, shadowId);
|
||||
}
|
||||
|
||||
public BaseShadowController addShadow(int id, @IdRes int shadowViewId)
|
||||
{
|
||||
View shadow = ((ViewGroup)mList.getParent()).findViewById(shadowViewId);
|
||||
if (shadow != null)
|
||||
mShadows.put(id, shadow);
|
||||
return this;
|
||||
}
|
||||
|
||||
public BaseShadowController setScrollListener(ScrollListener scrollListener)
|
||||
{
|
||||
mScrollListener = scrollListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void updateShadows()
|
||||
{
|
||||
for (int i = 0; i < mShadows.size(); i++)
|
||||
{
|
||||
int id = mShadows.keyAt(i);
|
||||
mShadows.get(id).setVisibility(shouldShowShadow(id) ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public BaseShadowController attach()
|
||||
{
|
||||
updateShadows();
|
||||
return this;
|
||||
}
|
||||
|
||||
public void detach()
|
||||
{
|
||||
for (int i = 0; i < mShadows.size(); i++)
|
||||
mShadows.get(mShadows.keyAt(i))
|
||||
.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
protected abstract boolean shouldShowShadow(int id);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
package com.mapswithme.maps.widget;
|
||||
|
||||
import android.view.View;
|
||||
import android.widget.AbsListView;
|
||||
|
||||
public class ListShadowController extends BaseShadowController<AbsListView, AbsListView.OnScrollListener>
|
||||
{
|
||||
public ListShadowController(AbsListView list)
|
||||
{
|
||||
super(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldShowShadow(int id) {
|
||||
switch (id)
|
||||
{
|
||||
case TOP:
|
||||
int first = mList.getFirstVisiblePosition();
|
||||
if (first > 0)
|
||||
return true;
|
||||
|
||||
View child = mList.getChildAt(0);
|
||||
return (child.getTop() < 0);
|
||||
|
||||
case BOTTOM:
|
||||
int last = mList.getFirstVisiblePosition() + mList.getChildCount();
|
||||
if (last < mList.getAdapter().getCount())
|
||||
return true;
|
||||
|
||||
child = mList.getChildAt(last - 1);
|
||||
return (child.getBottom() > mList.getHeight());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseShadowController attach()
|
||||
{
|
||||
super.attach();
|
||||
|
||||
mList.setOnScrollListener(new AbsListView.OnScrollListener() {
|
||||
@Override
|
||||
public void onScrollStateChanged(AbsListView view, int scrollState)
|
||||
{
|
||||
if (mScrollListener != null)
|
||||
mScrollListener.onScrollStateChanged(view, scrollState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)
|
||||
{
|
||||
updateShadows();
|
||||
if (mScrollListener != null)
|
||||
mScrollListener.onScroll(view, firstVisibleItem, visibleItemCount, totalItemCount);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
updateShadows();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach()
|
||||
{
|
||||
super.detach();
|
||||
mList.setOnScrollListener(mScrollListener);
|
||||
}
|
||||
}
|
109
android/src/com/mapswithme/maps/widget/ObservableScrollView.java
Normal file
|
@ -0,0 +1,109 @@
|
|||
package com.mapswithme.maps.widget;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
public class ObservableScrollView extends ScrollView
|
||||
{
|
||||
public interface ScrollListener
|
||||
{
|
||||
void onScroll(int left, int top);
|
||||
void onScrollEnd();
|
||||
}
|
||||
|
||||
|
||||
private static final int SCROLL_END_DETECT_INTERVAL = 100;
|
||||
|
||||
private final Runnable mScrollEndDetector = new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (mTouched)
|
||||
return;
|
||||
|
||||
if (mPrevScroll == getScrollY())
|
||||
{
|
||||
if (mScrollListener != null)
|
||||
mScrollListener.onScrollEnd();
|
||||
return;
|
||||
}
|
||||
|
||||
mPrevScroll = getScrollY();
|
||||
postDelayed(this, SCROLL_END_DETECT_INTERVAL);
|
||||
}
|
||||
};
|
||||
|
||||
private ScrollListener mScrollListener;
|
||||
private int mPrevScroll;
|
||||
private boolean mTouched;
|
||||
|
||||
|
||||
public ObservableScrollView(Context context)
|
||||
{
|
||||
super(context);
|
||||
}
|
||||
|
||||
public ObservableScrollView(Context context, AttributeSet attrs)
|
||||
{
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public ObservableScrollView(Context context, AttributeSet attrs, int defStyle)
|
||||
{
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
private boolean shouldSkipEvent(MotionEvent ev)
|
||||
{
|
||||
return (mTouched &&
|
||||
(ev.getActionMasked() == MotionEvent.ACTION_MOVE) &&
|
||||
getScrollY() == mPrevScroll);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onScrollChanged(int curLeft, int curTop, int prevLeft, int prevTop)
|
||||
{
|
||||
super.onScrollChanged(curLeft, curTop, prevLeft, prevTop);
|
||||
if (mScrollListener != null)
|
||||
mScrollListener.onScroll(curLeft, curTop);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(@NonNull MotionEvent ev)
|
||||
{
|
||||
if (!super.onTouchEvent(ev))
|
||||
return false;
|
||||
|
||||
if (shouldSkipEvent(ev))
|
||||
return true;
|
||||
|
||||
switch (ev.getAction() & MotionEvent.ACTION_MASK)
|
||||
{
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
mTouched = true;
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP:
|
||||
case MotionEvent.ACTION_CANCEL:
|
||||
mTouched = false;
|
||||
|
||||
if (mScrollListener != null)
|
||||
{
|
||||
mPrevScroll = getScrollY();
|
||||
postDelayed(mScrollEndDetector, SCROLL_END_DETECT_INTERVAL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setScrollListener(ScrollListener scrollListener)
|
||||
{
|
||||
mScrollListener = scrollListener;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
package com.mapswithme.maps.widget;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public class ScrollViewShadowController extends BaseShadowController<ObservableScrollView,
|
||||
ObservableScrollView.ScrollListener>
|
||||
{
|
||||
public ScrollViewShadowController(ObservableScrollView list)
|
||||
{
|
||||
super(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldShowShadow(int id)
|
||||
{
|
||||
if (mList.getChildCount() == 0)
|
||||
return false;
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case TOP:
|
||||
return (mList.getScrollY() > 0);
|
||||
|
||||
case BOTTOM:
|
||||
View child = mList.getChildAt(0);
|
||||
return (mList.getScrollY() + mList.getHeight() < child.getHeight());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseShadowController attach()
|
||||
{
|
||||
super.attach();
|
||||
mList.setScrollListener(new ObservableScrollView.ScrollListener() {
|
||||
@Override
|
||||
public void onScroll(int left, int top)
|
||||
{
|
||||
updateShadows();
|
||||
if (mScrollListener != null)
|
||||
mScrollListener.onScroll(left, top);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollEnd()
|
||||
{
|
||||
if (mScrollListener != null)
|
||||
mScrollListener.onScrollEnd();
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detach()
|
||||
{
|
||||
super.detach();
|
||||
mList.setScrollListener(mScrollListener);
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ import android.widget.LinearLayout;
|
|||
import android.widget.PopupMenu;
|
||||
import android.widget.RatingBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mapswithme.maps.BuildConfig;
|
||||
|
@ -48,12 +49,16 @@ import com.mapswithme.maps.bookmarks.data.Metadata;
|
|||
import com.mapswithme.maps.bookmarks.data.ParcelablePoint;
|
||||
import com.mapswithme.maps.location.LocationHelper;
|
||||
import com.mapswithme.maps.widget.ArrowView;
|
||||
import com.mapswithme.maps.widget.BaseShadowController;
|
||||
import com.mapswithme.maps.widget.ObservableScrollView;
|
||||
import com.mapswithme.maps.widget.ScrollViewShadowController;
|
||||
import com.mapswithme.util.InputUtils;
|
||||
import com.mapswithme.util.LocationUtils;
|
||||
import com.mapswithme.util.sharing.ShareAction;
|
||||
import com.mapswithme.util.StringUtils;
|
||||
import com.mapswithme.util.UiUtils;
|
||||
import com.mapswithme.util.Utils;
|
||||
import com.mapswithme.util.concurrency.UiThread;
|
||||
import com.mapswithme.util.sharing.ShareAction;
|
||||
import com.mapswithme.util.statistics.AlohaHelper;
|
||||
import com.mapswithme.util.statistics.Statistics;
|
||||
|
||||
|
@ -73,7 +78,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
private RatingBar mRbStars;
|
||||
private TextView mTvElevation;
|
||||
// Place page details
|
||||
private ViewGroup mPpDetails;
|
||||
private ScrollView mPpDetails;
|
||||
private LinearLayout mLlAddress;
|
||||
private TextView mTvAddress;
|
||||
private LinearLayout mLlPhone;
|
||||
|
@ -98,6 +103,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
private Button mBtnEditHtmlDescription;
|
||||
private TextView mTvBookmarkGroup;
|
||||
// Place page buttons
|
||||
private BaseShadowController mShadowController;
|
||||
private LinearLayout mLlApiBack;
|
||||
private ImageView mIvBookmark;
|
||||
// Animations
|
||||
|
@ -156,7 +162,7 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
mRbStars = (RatingBar) ppPreview.findViewById(R.id.rb__stars);
|
||||
mTvElevation = (TextView) ppPreview.findViewById(R.id.tv__peak_elevation);
|
||||
|
||||
mPpDetails = (ViewGroup) findViewById(R.id.pp__details);
|
||||
mPpDetails = (ScrollView) findViewById(R.id.pp__details);
|
||||
mLlAddress = (LinearLayout) mPpDetails.findViewById(R.id.ll__place_name);
|
||||
mTvAddress = (TextView) mPpDetails.findViewById(R.id.tv__place_address);
|
||||
mLlPhone = (LinearLayout) mPpDetails.findViewById(R.id.ll__place_phone);
|
||||
|
@ -209,6 +215,10 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
bookmarkGroup.setOnClickListener(this);
|
||||
mIvBookmark = (ImageView) bookmarkGroup.findViewById(R.id.iv__bookmark);
|
||||
ppButtons.findViewById(R.id.rl__share).setOnClickListener(this);
|
||||
|
||||
mShadowController = new ScrollViewShadowController((ObservableScrollView) mPpDetails)
|
||||
.addShadow(BaseShadowController.BOTTOM, R.id.shadow_bottom)
|
||||
.attach();
|
||||
}
|
||||
|
||||
private void initAnimationController(AttributeSet attrs, int defStyleAttr)
|
||||
|
@ -255,6 +265,9 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
public void setState(State state)
|
||||
{
|
||||
InputUtils.hideKeyboard(mEtBookmarkName);
|
||||
|
||||
mPpDetails.scrollTo(0, 0);
|
||||
|
||||
if (mMapObject != null)
|
||||
mAnimationController.setState(state, mMapObject.getType());
|
||||
}
|
||||
|
@ -319,6 +332,16 @@ public class PlacePageView extends RelativeLayout implements View.OnClickListene
|
|||
refreshButtons(false);
|
||||
break;
|
||||
}
|
||||
|
||||
UiThread.runLater(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
mShadowController.updateShadows();
|
||||
requestLayout();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.mapswithme.util;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.DrawableRes;
|
||||
|
@ -10,11 +11,45 @@ import android.support.v4.content.ContextCompat;
|
|||
|
||||
import com.cocosw.bottomsheet.BottomSheet;
|
||||
import com.mapswithme.maps.MWMApplication;
|
||||
import com.mapswithme.maps.widget.ListShadowController;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
public final class BottomSheetHelper
|
||||
{
|
||||
public static class ShadowedBottomSheet extends BottomSheet
|
||||
{
|
||||
private ListShadowController mShadowController;
|
||||
|
||||
|
||||
ShadowedBottomSheet(Context context, int theme)
|
||||
{
|
||||
super(context, theme);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init(Context context)
|
||||
{
|
||||
super.init(context);
|
||||
mShadowController = new ListShadowController(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showFullItems()
|
||||
{
|
||||
super.showFullItems();
|
||||
mShadowController.attach();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showShortItems()
|
||||
{
|
||||
super.showShortItems();
|
||||
mShadowController.detach();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class Builder extends BottomSheet.Builder
|
||||
{
|
||||
public Builder(@NonNull Activity context)
|
||||
|
@ -23,6 +58,12 @@ public final class BottomSheetHelper
|
|||
setOnDismissListener(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BottomSheet createDialog(Context context, int theme)
|
||||
{
|
||||
return new ShadowedBottomSheet(context, theme);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BottomSheet build()
|
||||
{
|
||||
|
|