|
@@ -4,17 +4,19 @@
|
|
|
* @author masensio
|
|
|
* @author David A. Velasco
|
|
|
* @author Juan Carlos González Cabrero
|
|
|
+ * @author Andy Scherzinger
|
|
|
* Copyright (C) 2015 ownCloud Inc.
|
|
|
- * <p/>
|
|
|
+ * Copyright (C) 2018 Andy Scherzinger
|
|
|
+ *
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
* it under the terms of the GNU General Public License version 2,
|
|
|
* as published by the Free Software Foundation.
|
|
|
- * <p/>
|
|
|
+ *
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
* GNU General Public License for more details.
|
|
|
- * <p/>
|
|
|
+ *
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
*/
|
|
@@ -40,7 +42,6 @@ import android.widget.Button;
|
|
|
import android.widget.CompoundButton;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
-import android.widget.ListAdapter;
|
|
|
import android.widget.ListView;
|
|
|
import android.widget.ScrollView;
|
|
|
import android.widget.TextView;
|
|
@@ -57,6 +58,7 @@ import com.owncloud.android.ui.activity.FileActivity;
|
|
|
import com.owncloud.android.ui.adapter.ShareUserListAdapter;
|
|
|
import com.owncloud.android.ui.dialog.ExpirationDatePickerDialogFragment;
|
|
|
import com.owncloud.android.ui.dialog.SharePasswordDialogFragment;
|
|
|
+import com.owncloud.android.ui.fragment.util.FileDetailSharingFragmentHelper;
|
|
|
import com.owncloud.android.utils.DisplayUtils;
|
|
|
import com.owncloud.android.utils.MimeTypeUtil;
|
|
|
import com.owncloud.android.utils.ThemeUtils;
|
|
@@ -651,7 +653,7 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
noShares.setVisibility(View.GONE);
|
|
|
usersList.setVisibility(View.VISIBLE);
|
|
|
usersList.setAdapter(mUserGroupsAdapter);
|
|
|
- setListViewHeightBasedOnChildren(usersList);
|
|
|
+ FileDetailSharingFragmentHelper.setListViewHeightBasedOnChildren(usersList);
|
|
|
} else {
|
|
|
noShares.setVisibility(View.VISIBLE);
|
|
|
usersList.setVisibility(View.GONE);
|
|
@@ -908,29 +910,6 @@ public class ShareFileFragment extends Fragment implements ShareUserListAdapter.
|
|
|
getHideFileListingPermissionSection().setVisibility(View.GONE);
|
|
|
}
|
|
|
|
|
|
- public static void setListViewHeightBasedOnChildren(ListView listView) {
|
|
|
- ListAdapter listAdapter = listView.getAdapter();
|
|
|
- if (listAdapter == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- int desiredWidth = View.MeasureSpec.makeMeasureSpec(listView.getWidth(), View.MeasureSpec.AT_MOST);
|
|
|
- int totalHeight = 0;
|
|
|
- View view = null;
|
|
|
- for (int i = 0; i < listAdapter.getCount(); i++) {
|
|
|
- view = listAdapter.getView(i, view, listView);
|
|
|
- if (i == 0) {
|
|
|
- view.setLayoutParams(new ViewGroup.LayoutParams(desiredWidth, ViewGroup.LayoutParams.WRAP_CONTENT));
|
|
|
- }
|
|
|
- view.measure(desiredWidth, View.MeasureSpec.UNSPECIFIED);
|
|
|
- totalHeight += view.getMeasuredHeight();
|
|
|
- }
|
|
|
- ViewGroup.LayoutParams params = listView.getLayoutParams();
|
|
|
- params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
|
|
|
- listView.setLayoutParams(params);
|
|
|
- listView.requestLayout();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* Starts a dialog that requests a password to the user to protect a share link.
|
|
|
*
|