4949import com .owncloud .android .datamodel .FileDataStorageManager ;
5050import com .owncloud .android .datamodel .OCFile ;
5151import com .owncloud .android .lib .common .operations .RemoteOperationResult ;
52+ import com .owncloud .android .lib .common .utils .Log_OC ;
5253import com .owncloud .android .lib .resources .shares .OCShare ;
5354import com .owncloud .android .lib .resources .shares .SharePermissionsBuilder ;
5455import com .owncloud .android .lib .resources .shares .ShareType ;
5556import com .owncloud .android .lib .resources .status .OCCapability ;
57+ import com .owncloud .android .ui .TextDrawable ;
5658import com .owncloud .android .ui .activity .FileActivity ;
5759import com .owncloud .android .ui .activity .FileDisplayActivity ;
5860import com .owncloud .android .ui .adapter .UserListAdapter ;
6567import com .owncloud .android .utils .ClipboardUtil ;
6668import com .owncloud .android .utils .ThemeUtils ;
6769
70+ import java .security .NoSuchAlgorithmException ;
6871import java .util .List ;
6972
7073import butterknife .BindView ;
@@ -76,6 +79,7 @@ public class FileDetailSharingFragment extends Fragment implements UserListAdapt
7679
7780 private static final String ARG_FILE = "FILE" ;
7881 private static final String ARG_ACCOUNT = "ACCOUNT" ;
82+ private static final String TAG = FileDetailSharingFragment .class .getSimpleName ();
7983
8084 // to show share with users/groups info
8185 private List <OCShare > shares ;
@@ -232,7 +236,21 @@ public void setShareWithUserInfo() {
232236 }
233237
234238 private void setShareWithYou () {
235-
239+ if (!TextUtils .isEmpty (file .getOwnerId ()) && !account .name .split ("@" )[0 ].equals (file .getOwnerId ())) {
240+ sharedWithYouUsername .setText (
241+ String .format (getString (R .string .shared_with_you_by ), file .getOwnerDisplayName ()));
242+
243+ try {
244+ sharedWithYouAvatar .setImageDrawable (
245+ TextDrawable .createAvatarWithUserId (file .getOwnerDisplayName (),
246+ getResources ().getDimension (R .dimen .list_item_avatar_icon_radius )));
247+ sharedWithYouAvatar .setVisibility (View .VISIBLE );
248+ } catch (NoSuchAlgorithmException e ) {
249+ Log_OC .d (TAG , "Avatar generation failed" , e );
250+ }
251+ } else {
252+ sharedWithYouContainer .setVisibility (View .GONE );
253+ }
236254 }
237255
238256 private void updateListOfUserGroups () {
@@ -490,7 +508,7 @@ public void requestPasswordForShare(OCShare share) {
490508
491509 /**
492510 * Get known server capabilities from DB
493- *
511+ *
494512 * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
495513 * instance ready to use. If not ready, does nothing.
496514 */
@@ -502,9 +520,9 @@ public void refreshCapabilitiesFromDB() {
502520
503521 /**
504522 * Get public link from the DB to fill in the "Share link" section in the UI.
505- *
523+ *
506524 * Takes into account server capabilities before reading database.
507- *
525+ *
508526 * Depends on the parent Activity provides a {@link com.owncloud.android.datamodel.FileDataStorageManager}
509527 * instance ready to use. If not ready, does nothing.
510528 */
0 commit comments