Skip to content

Commit 6f29ad1

Browse files
wip
Signed-off-by: tobiasKaminsky <[email protected]>
1 parent ca8e3f4 commit 6f29ad1

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
//include ':'
2-
include 'nextcloud-android-library'
1+
include ':'
2+
//include 'nextcloud-android-library'

src/main/java/com/owncloud/android/ui/fragment/FileDetailSharingFragment.java

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,12 @@
4949
import com.owncloud.android.datamodel.FileDataStorageManager;
5050
import com.owncloud.android.datamodel.OCFile;
5151
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
52+
import com.owncloud.android.lib.common.utils.Log_OC;
5253
import com.owncloud.android.lib.resources.shares.OCShare;
5354
import com.owncloud.android.lib.resources.shares.SharePermissionsBuilder;
5455
import com.owncloud.android.lib.resources.shares.ShareType;
5556
import com.owncloud.android.lib.resources.status.OCCapability;
57+
import com.owncloud.android.ui.TextDrawable;
5658
import com.owncloud.android.ui.activity.FileActivity;
5759
import com.owncloud.android.ui.activity.FileDisplayActivity;
5860
import com.owncloud.android.ui.adapter.UserListAdapter;
@@ -65,6 +67,7 @@
6567
import com.owncloud.android.utils.ClipboardUtil;
6668
import com.owncloud.android.utils.ThemeUtils;
6769

70+
import java.security.NoSuchAlgorithmException;
6871
import java.util.List;
6972

7073
import 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
*/

src/main/res/layout/file_details_sharing_fragment.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
android:paddingLeft="@dimen/standard_padding"
7171
android:paddingTop="@dimen/standard_half_padding"
7272
android:paddingRight="@dimen/standard_padding"
73-
android:text="Shared with you by s$1"
73+
android:text="@string/shared_with_you_by"
7474
android:textSize="16sp"/>
7575

7676
<TextView

src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,5 +829,6 @@
829829
<string name="hint_note">Note</string>
830830
<string name="note_empty">Note is empty</string>
831831
<string name="shared_avatar_desc">Avatar from shared user</string>
832+
<string name="shared_with_you_by">Shared with you by %1$s</string>
832833

833834
</resources>

0 commit comments

Comments
 (0)