diff --git a/android/3rd_party/BottomSheet/build.gradle b/android/3rd_party/BottomSheet/build.gradle index 375b7ce36c..777c623dad 100644 --- a/android/3rd_party/BottomSheet/build.gradle +++ b/android/3rd_party/BottomSheet/build.gradle @@ -20,4 +20,8 @@ dependencies { android { compileSdkVersion propTargetSdkVersion.toInteger() buildToolsVersion propBuildToolsVersion + + defaultConfig { + minSdkVersion propMinSdkVersion.toInteger() + } } \ No newline at end of file diff --git a/android/3rd_party/BottomSheet/gradle.properties b/android/3rd_party/BottomSheet/gradle.properties deleted file mode 100644 index c29e2d0984..0000000000 --- a/android/3rd_party/BottomSheet/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -manifestmerger.enabled=false diff --git a/android/3rd_party/BottomSheet/src/main/java/com/cocosw/bottomsheet/BottomSheet.java b/android/3rd_party/BottomSheet/src/main/java/com/cocosw/bottomsheet/BottomSheet.java index 0fd5cbe07f..7711c24786 100644 --- a/android/3rd_party/BottomSheet/src/main/java/com/cocosw/bottomsheet/BottomSheet.java +++ b/android/3rd_party/BottomSheet/src/main/java/com/cocosw/bottomsheet/BottomSheet.java @@ -50,8 +50,10 @@ 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; import android.widget.GridView; import android.widget.ImageView; import android.widget.LinearLayout; @@ -79,6 +81,7 @@ public class BottomSheet extends Dialog implements DialogInterface { private boolean collapseListIcons; private int mStatusBarHeight; private GridView list; + private View listShadow; private SimpleSectionedGridAdapter adapter; private Builder builder; @@ -316,6 +319,8 @@ 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) @@ -475,6 +480,19 @@ 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() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { Transition changeBounds = new ChangeBounds(); @@ -484,7 +502,7 @@ public class BottomSheet extends Dialog implements DialogInterface { actions = fullMenuItem; updateSection(); adapter.notifyDataSetChanged(); - list.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.MATCH_PARENT)); + list.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT)); icon.setVisibility(View.VISIBLE); icon.setImageDrawable(close); icon.setOnClickListener(new View.OnClickListener() { @@ -494,6 +512,17 @@ 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() { @@ -508,6 +537,9 @@ public class BottomSheet extends Dialog implements DialogInterface { icon.setVisibility(View.VISIBLE); icon.setImageDrawable(builder.icon); } + + list.setOnScrollListener(null); + listShadow.setVisibility(View.GONE); } private boolean hasDivider() { @@ -529,7 +561,7 @@ public class BottomSheet extends Dialog implements DialogInterface { } View lastChild = list.getChildAt(list.getChildCount() - 1); if (lastChild != null) - list.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, lastChild.getBottom() + lastChild.getPaddingBottom() + list.getPaddingBottom())); + list.setLayoutParams(new FrameLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, lastChild.getBottom() + lastChild.getPaddingBottom() + list.getPaddingBottom())); } }); } diff --git a/android/3rd_party/BottomSheet/src/main/res/drawable-hdpi/bs_shadow.9.png b/android/3rd_party/BottomSheet/src/main/res/drawable-hdpi/bs_shadow.9.png new file mode 100644 index 0000000000..00696aa757 Binary files /dev/null and b/android/3rd_party/BottomSheet/src/main/res/drawable-hdpi/bs_shadow.9.png differ diff --git a/android/3rd_party/BottomSheet/src/main/res/drawable-mdpi/bs_shadow.9.png b/android/3rd_party/BottomSheet/src/main/res/drawable-mdpi/bs_shadow.9.png new file mode 100644 index 0000000000..1a784f3c12 Binary files /dev/null and b/android/3rd_party/BottomSheet/src/main/res/drawable-mdpi/bs_shadow.9.png differ diff --git a/android/3rd_party/BottomSheet/src/main/res/drawable-xhdpi/bs_shadow.9.png b/android/3rd_party/BottomSheet/src/main/res/drawable-xhdpi/bs_shadow.9.png new file mode 100644 index 0000000000..62083b02e8 Binary files /dev/null and b/android/3rd_party/BottomSheet/src/main/res/drawable-xhdpi/bs_shadow.9.png differ diff --git a/android/3rd_party/BottomSheet/src/main/res/drawable-xxhdpi/bs_shadow.9.png b/android/3rd_party/BottomSheet/src/main/res/drawable-xxhdpi/bs_shadow.9.png new file mode 100644 index 0000000000..4dcf1830ca Binary files /dev/null and b/android/3rd_party/BottomSheet/src/main/res/drawable-xxhdpi/bs_shadow.9.png differ diff --git a/android/3rd_party/BottomSheet/src/main/res/drawable-xxxhdpi/bs_shadow.9.png b/android/3rd_party/BottomSheet/src/main/res/drawable-xxxhdpi/bs_shadow.9.png new file mode 100644 index 0000000000..ad5e1dc7a2 Binary files /dev/null and b/android/3rd_party/BottomSheet/src/main/res/drawable-xxxhdpi/bs_shadow.9.png differ diff --git a/android/3rd_party/BottomSheet/src/main/res/layout/bottom_sheet_dialog.xml b/android/3rd_party/BottomSheet/src/main/res/layout/bottom_sheet_dialog.xml index c68e74a4b6..2f0c21f788 100644 --- a/android/3rd_party/BottomSheet/src/main/res/layout/bottom_sheet_dialog.xml +++ b/android/3rd_party/BottomSheet/src/main/res/layout/bottom_sheet_dialog.xml @@ -36,15 +36,24 @@ - + + + + \ No newline at end of file diff --git a/android/3rd_party/BottomSheet/src/main/res/values/styles.xml b/android/3rd_party/BottomSheet/src/main/res/values/styles.xml index 4644e2b4a3..8b1321bb70 100644 --- a/android/3rd_party/BottomSheet/src/main/res/values/styles.xml +++ b/android/3rd_party/BottomSheet/src/main/res/values/styles.xml @@ -159,7 +159,6 @@ ?bs_dividerColor fill_parent 1dp - 8dp \ No newline at end of file diff --git a/android/gradle.properties b/android/gradle.properties index 29944072e8..9b61e6e40c 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -6,5 +6,4 @@ propVersionName=4.4.3 propDebugNdkFlags=V=1 NDK_DEBUG=1 DEBUG=1 propReleaseNdkFlags=V=1 NDK_DEBUG=0 PRODUCTION=1 -propStatisticsUrl="http://localhost:8080" -manifestmerger.enabled=false +propStatisticsUrl="http://localhost:8080" \ No newline at end of file diff --git a/android/res/drawable/bg_toolbar_bottom_shadow.9.png b/android/res/drawable/bg_toolbar_bottom_shadow.9.png deleted file mode 100644 index 7dd85936ba..0000000000 Binary files a/android/res/drawable/bg_toolbar_bottom_shadow.9.png and /dev/null differ diff --git a/android/res/values/styles.xml b/android/res/values/styles.xml index cfbc013f26..3418c66548 100644 --- a/android/res/values/styles.xml +++ b/android/res/values/styles.xml @@ -163,7 +163,7 @@