2 * ownCloud Android client application
5 * @author David A. Velasco
6 * Copyright (C) 2015 ownCloud Inc.
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 package com
.owncloud
.android
.ui
.fragment
;
24 import android
.accounts
.Account
;
25 import android
.app
.Activity
;
26 import android
.graphics
.Bitmap
;
27 import android
.os
.Bundle
;
28 import android
.support
.v4
.app
.Fragment
;
29 import android
.support
.v7
.widget
.AppCompatButton
;
30 import android
.view
.LayoutInflater
;
31 import android
.view
.View
;
32 import android
.view
.ViewGroup
;
33 import android
.widget
.Button
;
34 import android
.widget
.CompoundButton
;
35 import android
.widget
.ImageView
;
36 import android
.widget
.ListAdapter
;
37 import android
.widget
.ListView
;
38 import android
.widget
.ScrollView
;
39 import android
.widget
.Switch
;
40 import android
.widget
.TextView
;
41 import android
.widget
.Toast
;
43 import com
.owncloud
.android
.R
;
44 import com
.owncloud
.android
.authentication
.AccountUtils
;
45 import com
.owncloud
.android
.datamodel
.OCFile
;
46 import com
.owncloud
.android
.datamodel
.ThumbnailsCacheManager
;
47 import com
.owncloud
.android
.lib
.common
.utils
.Log_OC
;
48 import com
.owncloud
.android
.lib
.resources
.shares
.OCShare
;
49 import com
.owncloud
.android
.lib
.resources
.shares
.ShareType
;
50 import com
.owncloud
.android
.lib
.resources
.status
.OCCapability
;
51 import com
.owncloud
.android
.ui
.activity
.FileActivity
;
52 import com
.owncloud
.android
.ui
.adapter
.ShareUserListAdapter
;
53 import com
.owncloud
.android
.ui
.dialog
.ExpirationDatePickerDialogFragment
;
54 import com
.owncloud
.android
.utils
.DisplayUtils
;
55 import com
.owncloud
.android
.utils
.MimetypeIconUtil
;
57 import java
.text
.SimpleDateFormat
;
59 import java
.util
.ArrayList
;
60 import java
.util
.Date
;
63 * Fragment for Sharing a file with sharees (users or groups) or creating
66 * A simple {@link Fragment} subclass.
68 * Activities that contain this fragment must implement the
69 * {@link ShareFileFragment.OnShareFragmentInteractionListener} interface
70 * to handle interaction events.
72 * Use the {@link ShareFileFragment#newInstance} factory method to
73 * create an instance of this fragment.
75 public class ShareFileFragment
extends Fragment
76 implements ShareUserListAdapter
.ShareUserAdapterListener
{
78 private static final String TAG
= ShareFileFragment
.class.getSimpleName();
80 /** The fragment initialization parameters */
81 private static final String ARG_FILE
= "FILE";
82 private static final String ARG_ACCOUNT
= "ACCOUNT";
84 // /** Tag for dialog */
85 // private static final String FTAG_CHOOSER_DIALOG = "CHOOSER_DIALOG";
87 /** File to share, received as a parameter in construction time */
90 /** OC account holding the file to share, received as a parameter in construction time */
91 private Account mAccount
;
93 /** Reference to parent listener */
94 private OnShareFragmentInteractionListener mListener
;
96 /** List of private shares bound to the file */
97 private ArrayList
<OCShare
> mPrivateShares
;
99 /** Capabilities of the server */
100 private OCCapability mCapabilities
;
102 /** Adapter to show private shares */
103 private ShareUserListAdapter mUserGroupsAdapter
= null
;
105 /** Public share bound to the file */
106 private OCShare mPublicShare
;
108 /** Listener for changes on switch to share / unshare publicly */
109 private CompoundButton
.OnCheckedChangeListener mOnShareViaLinkSwitchCheckedChangeListener
;
112 * Listener for user actions to set, update or clear password on public link
114 private OnPasswordInteractionListener mOnPasswordInteractionListener
= null
;
117 * Listener for user actions to set, update or clear expiration date on public link
119 private OnExpirationDateInteractionListener mOnExpirationDateInteractionListener
= null
;
123 * Public factory method to create new ShareFileFragment instances.
125 * @param fileToShare An {@link OCFile} to show in the fragment
126 * @param account An ownCloud account
127 * @return A new instance of fragment ShareFileFragment.
129 public static ShareFileFragment
newInstance(OCFile fileToShare
, Account account
) {
130 ShareFileFragment fragment
= new ShareFileFragment();
131 Bundle args
= new Bundle();
132 args
.putParcelable(ARG_FILE
, fileToShare
);
133 args
.putParcelable(ARG_ACCOUNT
, account
);
134 fragment
.setArguments(args
);
138 public ShareFileFragment() {
139 // Required empty public constructor
146 public void onCreate(Bundle savedInstanceState
) {
147 super.onCreate(savedInstanceState
);
148 Log_OC
.d(TAG
, "onCreate");
149 if (getArguments() != null
) {
150 mFile
= getArguments().getParcelable(ARG_FILE
);
151 mAccount
= getArguments().getParcelable(ARG_ACCOUNT
);
160 public View
onCreateView(LayoutInflater inflater
, ViewGroup container
,
161 Bundle savedInstanceState
) {
162 Log_OC
.d(TAG
, "onCreateView");
164 // Inflate the layout for this fragment
165 View view
= inflater
.inflate(R
.layout
.share_file_layout
, container
, false
);
169 ImageView icon
= (ImageView
) view
.findViewById(R
.id
.shareFileIcon
);
170 icon
.setImageResource(MimetypeIconUtil
.getFileTypeIconId(mFile
.getMimetype(),
171 mFile
.getFileName()));
172 if (mFile
.isImage()) {
173 String remoteId
= String
.valueOf(mFile
.getRemoteId());
174 Bitmap thumbnail
= ThumbnailsCacheManager
.getBitmapFromDiskCache(remoteId
);
175 if (thumbnail
!= null
) {
176 icon
.setImageBitmap(thumbnail
);
180 TextView filename
= (TextView
) view
.findViewById(R
.id
.shareFileName
);
181 filename
.setText(mFile
.getFileName());
183 TextView size
= (TextView
) view
.findViewById(R
.id
.shareFileSize
);
184 if (mFile
.isFolder()) {
185 size
.setVisibility(View
.GONE
);
187 size
.setText(DisplayUtils
.bytesToHumanReadable(mFile
.getFileLength()));
191 Button addUserGroupButton
= (Button
)
192 view
.findViewById(R
.id
.addUserButton
);
193 addUserGroupButton
.setOnClickListener(new View
.OnClickListener() {
195 public void onClick(View view
) {
196 boolean shareWithUsersEnable
= AccountUtils
.hasSearchUsersSupport(mAccount
);
197 if (shareWithUsersEnable
) {
198 // Show Search Fragment
199 mListener
.showSearchUsersAndGroups();
201 String message
= getString(R
.string
.share_sharee_unavailable
);
202 Toast
.makeText(getActivity(), message
, Toast
.LENGTH_LONG
).show();
207 // Switch to create public share
208 mOnShareViaLinkSwitchCheckedChangeListener
= new CompoundButton
.OnCheckedChangeListener() {
210 public void onCheckedChanged(CompoundButton switchView
, boolean isChecked
) {
214 // Set listener for user actions on switch for sharing/unsharing via link
215 initShareViaLinkListener(view
);
217 // Set listener for user actions on expiration date
218 initExpirationListener(view
);
220 // Set listener for user actions on password
221 initPasswordListener(view
);
228 * Binds listener for user actions to create or delete a public share
229 * to the views receiving the user events.
231 * @param shareView Root view in the fragment.
233 private void initShareViaLinkListener(View shareView
) {
234 mOnShareViaLinkSwitchCheckedChangeListener
= new OnShareViaLinkListener();
235 Switch shareViaLinkSwitch
= (Switch
) shareView
.findViewById(R
.id
.shareViaLinkSectionSwitch
);
236 shareViaLinkSwitch
.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener
);
240 * Listener for user actions that create or delete a public share.
242 private class OnShareViaLinkListener
243 implements CompoundButton
.OnCheckedChangeListener
{
246 * Called by R.id.shareViaLinkSectionSwitch to create or delete a public link.
248 * @param switchView {@link Switch} toggled by the user, R.id.shareViaLinkSectionSwitch
249 * @param isChecked New switch state.
252 public void onCheckedChanged(CompoundButton switchView
, boolean isChecked
) {
254 // very important, setCheched(...) is called automatically during
255 // Fragment recreation on device rotations
259 if (mCapabilities
!= null
&&
260 mCapabilities
.getFilesSharingPublicPasswordEnforced().isTrue()) {
261 // password enforced by server, request to the user before trying to create
262 ((FileActivity
) getActivity()).getFileOperationsHelper().
263 requestPasswordForShareViaLink(mFile
, true
);
266 // create without password if not enforced by server or we don't know if enforced;
267 ((FileActivity
) getActivity()).getFileOperationsHelper().
268 shareFileViaLink(mFile
, null
);
270 // FileActivtiy#onCreateShareViaLinkOperationFinish still handles the guess of enforcement
271 // for server in versions previous to OwnCloudVersion#MINIMUM_VERSION_CAPABILITIES_API
275 ((FileActivity
) getActivity()).getFileOperationsHelper().
276 unshareFileViaLink(mFile
);
279 // undo the toggle to grant the view will be correct if any intermediate dialog is cancelled or
280 // the create/delete operation fails
281 switchView
.setOnCheckedChangeListener(null
);
283 switchView
.setOnCheckedChangeListener(mOnShareViaLinkSwitchCheckedChangeListener
);
289 * Binds listener for user actions that start any update on a expiration date
290 * for the public link to the views receiving the user events.
292 * @param shareView Root view in the fragment.
294 private void initExpirationListener(View shareView
) {
295 mOnExpirationDateInteractionListener
= new OnExpirationDateInteractionListener();
297 ((Switch
) shareView
.findViewById(R
.id
.shareViaLinkExpirationSwitch
)).
298 setOnCheckedChangeListener(mOnExpirationDateInteractionListener
);
300 shareView
.findViewById(R
.id
.shareViaLinkExpirationLabel
).
301 setOnClickListener(mOnExpirationDateInteractionListener
);
303 shareView
.findViewById(R
.id
.shareViaLinkExpirationValue
).
304 setOnClickListener(mOnExpirationDateInteractionListener
);
308 * Listener for user actions that start any update on the expiration date for the public link.
310 private class OnExpirationDateInteractionListener
311 implements CompoundButton
.OnCheckedChangeListener
, View
.OnClickListener
{
314 * Called by R.id.shareViaLinkExpirationSwitch to set or clear the expiration date.
316 * @param switchView {@link Switch} toggled by the user, R.id.shareViaLinkExpirationSwitch
317 * @param isChecked New switch state.
320 public void onCheckedChanged(CompoundButton switchView
, boolean isChecked
) {
322 // very important, setCheched(...) is called automatically during
323 // Fragment recreation on device rotations
327 ExpirationDatePickerDialogFragment dialog
=
328 ExpirationDatePickerDialogFragment
.newInstance(mFile
, -1);
330 getActivity().getSupportFragmentManager(),
331 ExpirationDatePickerDialogFragment
.DATE_PICKER_DIALOG
335 ((FileActivity
) getActivity()).getFileOperationsHelper().
336 setExpirationDateToShareViaLink(mFile
, -1);
339 // undo the toggle to grant the view will be correct if the dialog is cancelled
340 switchView
.setOnCheckedChangeListener(null
);
342 switchView
.setOnCheckedChangeListener(mOnExpirationDateInteractionListener
);
346 * Called by R.id.shareViaLinkExpirationLabel or R.id.shareViaLinkExpirationValue
347 * to change the current expiration date.
349 * @param expirationView Label or value view touched by the user.
352 public void onClick(View expirationView
) {
353 if (mPublicShare
!= null
&& mPublicShare
.getExpirationDate() > 0) {
354 long chosenDateInMillis
= -1;
355 if (mPublicShare
!= null
) {
356 chosenDateInMillis
= mPublicShare
.getExpirationDate();
358 ExpirationDatePickerDialogFragment dialog
=
359 ExpirationDatePickerDialogFragment
.newInstance(
364 getActivity().getSupportFragmentManager(),
365 ExpirationDatePickerDialogFragment
.DATE_PICKER_DIALOG
373 * Binds listener for user actions that start any update on a password for the public link
374 * to the views receiving the user events.
376 * @param shareView Root view in the fragment.
378 private void initPasswordListener(View shareView
) {
379 mOnPasswordInteractionListener
= new OnPasswordInteractionListener();
381 ((Switch
) shareView
.findViewById(R
.id
.shareViaLinkPasswordSwitch
)).
382 setOnCheckedChangeListener(mOnPasswordInteractionListener
);
384 shareView
.findViewById(R
.id
.shareViaLinkPasswordLabel
).
385 setOnClickListener(mOnPasswordInteractionListener
);
387 shareView
.findViewById(R
.id
.shareViaLinkPasswordValue
).
388 setOnClickListener(mOnPasswordInteractionListener
);
393 * Listener for user actions that start any update on a password for the public link.
395 private class OnPasswordInteractionListener
396 implements CompoundButton
.OnCheckedChangeListener
, View
.OnClickListener
{
399 * Called by R.id.shareViaLinkPasswordSwitch to set or clear the password.
401 * @param switchView {@link Switch} toggled by the user, R.id.shareViaLinkPasswordSwitch
402 * @param isChecked New switch state.
405 public void onCheckedChanged(CompoundButton switchView
, boolean isChecked
) {
407 // very important, setCheched(...) is called automatically during
408 // Fragment recreation on device rotations
412 ((FileActivity
) getActivity()).getFileOperationsHelper().
413 requestPasswordForShareViaLink(mFile
, false
);
415 ((FileActivity
) getActivity()).getFileOperationsHelper().
416 setPasswordToShareViaLink(mFile
, ""); // "" clears
419 // undo the toggle to grant the view will be correct if the dialog is cancelled
420 switchView
.setOnCheckedChangeListener(null
);
422 switchView
.setOnCheckedChangeListener(mOnPasswordInteractionListener
);
426 * Called by R.id.shareViaLinkPasswordLabel or R.id.shareViaLinkPasswordValue
427 * to change the current password.
429 * @param passwordView Label or value view touched by the user.
432 public void onClick(View passwordView
) {
433 if (mPublicShare
!= null
&& mPublicShare
.isPasswordProtected()) {
434 ((FileActivity
) getActivity()).getFileOperationsHelper().
435 requestPasswordForShareViaLink(mFile
, false
);
442 public void onActivityCreated(Bundle savedInstanceState
) {
443 super.onActivityCreated(savedInstanceState
);
444 Log_OC
.d(TAG
, "onActivityCreated");
446 // Load known capabilities of the server from DB
447 refreshCapabilitiesFromDB();
449 // Load data into the list of private shares
450 refreshUsersOrGroupsListFromDB();
452 // Load data of public share, if exists
453 refreshPublicShareFromDB();
457 public void onAttach(Activity activity
) {
458 super.onAttach(activity
);
460 mListener
= (OnShareFragmentInteractionListener
) activity
;
461 } catch (ClassCastException e
) {
462 throw new ClassCastException(activity
.toString()
463 + " must implement OnShareFragmentInteractionListener");
468 public void onDetach() {
475 * Get known server capabilities from DB
477 * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
478 * instance ready to use. If not ready, does nothing.
480 public void refreshCapabilitiesFromDB() {
481 if (((FileActivity
)mListener
).getStorageManager() != null
) {
482 mCapabilities
= ((FileActivity
)mListener
).getStorageManager().
483 getCapability(mAccount
.name
);
489 * Get users and groups from the DB to fill in the "share with" list.
491 * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
492 * instance ready to use. If not ready, does nothing.
494 public void refreshUsersOrGroupsListFromDB (){
495 if (((FileActivity
) mListener
).getStorageManager() != null
) {
496 // Get Users and Groups
497 mPrivateShares
= ((FileActivity
) mListener
).getStorageManager().getSharesWithForAFile(
498 mFile
.getRemotePath(),
502 // Update list of users/groups
503 updateListOfUserGroups();
507 private void updateListOfUserGroups() {
508 // Update list of users/groups
509 // TODO Refactoring: create a new {@link ShareUserListAdapter} instance with every call should not be needed
510 mUserGroupsAdapter
= new ShareUserListAdapter(
512 R
.layout
.share_user_item
,
518 TextView noShares
= (TextView
) getView().findViewById(R
.id
.shareNoUsers
);
519 ListView usersList
= (ListView
) getView().findViewById(R
.id
.shareUsersList
);
521 if (mPrivateShares
.size() > 0) {
522 noShares
.setVisibility(View
.GONE
);
523 usersList
.setVisibility(View
.VISIBLE
);
524 usersList
.setAdapter(mUserGroupsAdapter
);
525 setListViewHeightBasedOnChildren(usersList
);
527 noShares
.setVisibility(View
.VISIBLE
);
528 usersList
.setVisibility(View
.GONE
);
531 // Set Scroll to initial position
532 ScrollView scrollView
= (ScrollView
) getView().findViewById(R
.id
.shareScroll
);
533 scrollView
.scrollTo(0, 0);
537 public void unshareButtonPressed(OCShare share
) {
539 mListener
.unshareWith(share
);
540 Log_OC
.d(TAG
, "Unshare - " + share
.getSharedWithDisplayName());
546 * Get public link from the DB to fill in the "Share link" section in the UI.
548 * Takes into account server capabilities before reading database.
550 * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
551 * instance ready to use. If not ready, does nothing.
553 public void refreshPublicShareFromDB() {
554 if (isPublicShareDisabled()) {
557 } else if (((FileActivity
) mListener
).getStorageManager() != null
) {
559 mPublicShare
= ((FileActivity
) mListener
).getStorageManager().getFirstShareByPathAndType(
560 mFile
.getRemotePath(),
561 ShareType
.PUBLIC_LINK
,
565 // Update public share section
566 updatePublicShareSection();
571 * @return 'True' when public share is disabled in the server
573 private boolean isPublicShareDisabled() {
574 return (mCapabilities
!= null
&&
575 mCapabilities
.getFilesSharingPublicEnabled().isFalse()
580 * Updates in the UI the section about public share with the information in the current
581 * public share bound to mFile, if any
583 private void updatePublicShareSection() {
584 if (mPublicShare
!= null
&& ShareType
.PUBLIC_LINK
.equals(mPublicShare
.getShareType())) {
585 /// public share bound -> expand section
586 Switch shareViaLinkSwitch
= getShareViaLinkSwitch();
587 if (!shareViaLinkSwitch
.isChecked()) {
588 // set null listener before setChecked() to prevent infinite loop of calls
589 shareViaLinkSwitch
.setOnCheckedChangeListener(null
);
590 shareViaLinkSwitch
.setChecked(true
);
591 shareViaLinkSwitch
.setOnCheckedChangeListener(
592 mOnShareViaLinkSwitchCheckedChangeListener
595 getExpirationDateSection().setVisibility(View
.VISIBLE
);
596 getPasswordSection().setVisibility(View
.VISIBLE
);
598 AppCompatButton getLinkButton
= getGetLinkButton();
599 getLinkButton
.setVisibility(View
.VISIBLE
);
600 getLinkButton
.setOnClickListener(new View
.OnClickListener() {
602 public void onClick(View v
) {
603 //GetLink from the server and show ShareLinkToDialog
604 ((FileActivity
) getActivity()).getFileOperationsHelper().
605 getFileWithLink(mFile
);
610 /// update state of expiration date switch and message depending on expiration date
611 Switch expirationDateSwitch
= getExpirationDateSwitch();
612 // set null listener before setChecked() to prevent infinite loop of calls
613 expirationDateSwitch
.setOnCheckedChangeListener(null
);
614 long expirationDate
= mPublicShare
.getExpirationDate();
615 if (expirationDate
> 0) {
616 if (!expirationDateSwitch
.isChecked()) {
617 expirationDateSwitch
.toggle();
619 String formattedDate
=
620 SimpleDateFormat
.getDateInstance().format(
621 new Date(expirationDate
)
623 getExpirationDateValue().setText(formattedDate
);
625 if (expirationDateSwitch
.isChecked()) {
626 expirationDateSwitch
.toggle();
628 getExpirationDateValue().setText(R
.string
.empty
);
631 expirationDateSwitch
.setOnCheckedChangeListener(
632 mOnExpirationDateInteractionListener
635 /// update state of password switch and message depending on password protection
636 Switch passwordSwitch
= getPasswordSwitch();
637 // set null listener before setChecked() to prevent infinite loop of calls
638 passwordSwitch
.setOnCheckedChangeListener(null
);
639 if (mPublicShare
.isPasswordProtected()) {
640 if (!passwordSwitch
.isChecked()) {
641 passwordSwitch
.toggle();
643 getPasswordValue().setVisibility(View
.VISIBLE
);
645 if (passwordSwitch
.isChecked()) {
646 passwordSwitch
.toggle();
648 getPasswordValue().setVisibility(View
.INVISIBLE
);
651 passwordSwitch
.setOnCheckedChangeListener(
652 mOnPasswordInteractionListener
657 /// no public share -> collapse section
658 Switch shareViaLinkSwitch
= getShareViaLinkSwitch();
659 if (shareViaLinkSwitch
.isChecked()) {
660 shareViaLinkSwitch
.setOnCheckedChangeListener(null
);
661 getShareViaLinkSwitch().setChecked(false
);
662 shareViaLinkSwitch
.setOnCheckedChangeListener(
663 mOnShareViaLinkSwitchCheckedChangeListener
666 getExpirationDateSection().setVisibility(View
.GONE
);
667 getPasswordSection().setVisibility(View
.GONE
);
668 getGetLinkButton().setVisibility(View
.GONE
);
673 /// BEWARE: next methods will failed with NullPointerException if called before onCreateView() finishes
675 private Switch
getShareViaLinkSwitch() {
676 return (Switch
) getView().findViewById(R
.id
.shareViaLinkSectionSwitch
);
679 private View
getExpirationDateSection() {
680 return getView().findViewById(R
.id
.shareViaLinkExpirationSection
);
683 private Switch
getExpirationDateSwitch() {
684 return (Switch
) getView().findViewById(R
.id
.shareViaLinkExpirationSwitch
);
687 private TextView
getExpirationDateValue() {
688 return (TextView
) getView().findViewById(R
.id
.shareViaLinkExpirationValue
);
691 private View
getPasswordSection() {
692 return getView().findViewById(R
.id
.shareViaLinkPasswordSection
);
695 private Switch
getPasswordSwitch() {
696 return (Switch
) getView().findViewById(R
.id
.shareViaLinkPasswordSwitch
);
699 private TextView
getPasswordValue() {
700 return (TextView
) getView().findViewById(R
.id
.shareViaLinkPasswordValue
);
703 private AppCompatButton
getGetLinkButton() {
704 return (AppCompatButton
) getView().findViewById(R
.id
.shareViaLinkGetLinkButton
);
708 * Hides all the UI elements related to public share
710 private void hidePublicShare() {
711 getShareViaLinkSwitch().setVisibility(View
.GONE
);
712 getExpirationDateSection().setVisibility(View
.GONE
);
713 getPasswordSection().setVisibility(View
.GONE
);
714 getGetLinkButton().setVisibility(View
.GONE
);
717 public static void setListViewHeightBasedOnChildren(ListView listView
) {
718 ListAdapter listAdapter
= listView
.getAdapter();
719 if (listAdapter
== null
) {
722 int desiredWidth
= View
.MeasureSpec
.makeMeasureSpec(listView
.getWidth(), View
.MeasureSpec
.AT_MOST
);
725 for (int i
= 0; i
< listAdapter
.getCount(); i
++) {
726 view
= listAdapter
.getView(i
, view
, listView
);
728 view
.setLayoutParams(new ViewGroup
.LayoutParams(desiredWidth
, ViewGroup
.LayoutParams
.WRAP_CONTENT
));
730 view
.measure(desiredWidth
, View
.MeasureSpec
.UNSPECIFIED
);
731 totalHeight
+= view
.getMeasuredHeight();
733 ViewGroup
.LayoutParams params
= listView
.getLayoutParams();
734 params
.height
= totalHeight
+ (listView
.getDividerHeight() * (listAdapter
.getCount() - 1));
735 listView
.setLayoutParams(params
);
736 listView
.requestLayout();
740 * This interface must be implemented by activities that contain this
741 * fragment to allow an interaction in this fragment to be communicated
742 * to the activity and potentially other fragments contained in that
745 * See the Android Training lesson <a href=
746 * "http://developer.android.com/training/basics/fragments/communicating.html"
747 * >Communicating with Other Fragments</a> for more information.
749 public interface OnShareFragmentInteractionListener
{
750 void showSearchUsersAndGroups();
751 void refreshUsersOrGroupsListFromServer();
752 void unshareWith(OCShare share
);