Commit 9369dc9b authored by Kyle Milka's avatar Kyle Milka Committed by Commit Bot

[SharingHub] Make share sheet scrollable

Wrap the contents of the share sheet in a ScrollView so
it can be scrolled if it doesn't all fit in the viewport.

Bug: 1127249
Change-Id: Id86b92a52f93b107842f9ddb679537afdec75306
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410310
Commit-Queue: Kyle Milka <kmilka@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807250}
parent 489e3656
...@@ -3,9 +3,14 @@ ...@@ -3,9 +3,14 @@
Use of this source code is governed by a BSD-style license that can be Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. --> found in the LICENSE file. -->
<LinearLayout <ScrollView
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/share_sheet_scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
...@@ -103,4 +108,5 @@ ...@@ -103,4 +108,5 @@
android:minHeight="@dimen/min_touch_target_size" android:minHeight="@dimen/min_touch_target_size"
android:paddingEnd="16dp" android:paddingEnd="16dp"
android:visibility="gone" /> android:visibility="gone" />
</LinearLayout> </LinearLayout>
</ScrollView>
...@@ -15,6 +15,7 @@ import android.view.ViewGroup; ...@@ -15,6 +15,7 @@ import android.view.ViewGroup;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener; import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ScrollView;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.ColorInt; import androidx.annotation.ColorInt;
...@@ -55,6 +56,7 @@ class ShareSheetBottomSheetContent implements BottomSheetContent, OnItemClickLis ...@@ -55,6 +56,7 @@ class ShareSheetBottomSheetContent implements BottomSheetContent, OnItemClickLis
private ViewGroup mContentView; private ViewGroup mContentView;
private ShareParams mParams; private ShareParams mParams;
private String mUrl; private String mUrl;
private ScrollView mContentScrollableView;
/** /**
* Creates a ShareSheetBottomSheetContent (custom share sheet) opened from the given activity. * Creates a ShareSheetBottomSheetContent (custom share sheet) opened from the given activity.
...@@ -76,6 +78,7 @@ class ShareSheetBottomSheetContent implements BottomSheetContent, OnItemClickLis ...@@ -76,6 +78,7 @@ class ShareSheetBottomSheetContent implements BottomSheetContent, OnItemClickLis
private void createContentView() { private void createContentView() {
mContentView = (ViewGroup) LayoutInflater.from(mContext).inflate( mContentView = (ViewGroup) LayoutInflater.from(mContext).inflate(
R.layout.share_sheet_content, null); R.layout.share_sheet_content, null);
mContentScrollableView = mContentView.findViewById(R.id.share_sheet_scrollview);
} }
/* /*
...@@ -315,6 +318,10 @@ class ShareSheetBottomSheetContent implements BottomSheetContent, OnItemClickLis ...@@ -315,6 +318,10 @@ class ShareSheetBottomSheetContent implements BottomSheetContent, OnItemClickLis
@Override @Override
public int getVerticalScrollOffset() { public int getVerticalScrollOffset() {
if (mContentScrollableView != null) {
return mContentScrollableView.getScrollY();
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment