Merge pull request #9959 from nextcloud/shareFromMediaView

Fix sharing from media view
This commit is contained in:
Álvaro Brey 2022-03-23 09:30:26 +01:00 committed by GitHub
commit d013464320
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 6 deletions

View file

@ -877,10 +877,11 @@ public abstract class FileActivity extends DrawerActivity
/**
* open the new sharing process fragment to create the share
*
* @param shareeName
* @param shareType
*/
private void doShareWith(String shareeName, ShareType shareType) {
protected void doShareWith(String shareeName, ShareType shareType) {
FileDetailFragment fragment = getFileDetailFragment();
if (fragment != null) {
fragment.initiateSharingProcess(shareeName, shareType);

View file

@ -37,8 +37,10 @@ import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.lib.resources.files.ReadFileRemoteOperation;
import com.owncloud.android.lib.resources.files.model.RemoteFile;
import com.owncloud.android.lib.resources.shares.ShareType;
import com.owncloud.android.operations.GetSharesForFileOperation;
import com.owncloud.android.ui.fragment.FileDetailSharingFragment;
import com.owncloud.android.ui.fragment.FileDetailsSharingProcessFragment;
import com.owncloud.android.utils.DisplayUtils;
import com.owncloud.android.utils.MimeTypeUtil;
import com.owncloud.android.utils.theme.ThemeColorUtils;
@ -133,9 +135,19 @@ public class ShareActivity extends FileActivity {
refreshSharesFromStorageManager();
}
@Override
protected void doShareWith(String shareeName, ShareType shareType) {
getSupportFragmentManager().beginTransaction().replace(R.id.share_fragment_container,
FileDetailsSharingProcessFragment.newInstance(getFile(),
shareeName,
shareType),
FileDetailsSharingProcessFragment.TAG)
.commit();
}
/**
* Updates the view associated to the activity after the finish of some operation over files
* in the current account.
* Updates the view associated to the activity after the finish of some operation over files in the current
* account.
*
* @param operation Removal operation performed.
* @param result Result of the removal.
@ -175,4 +187,9 @@ public class ShareActivity extends FileActivity {
private FileDetailSharingFragment getShareFileFragment() {
return (FileDetailSharingFragment) getSupportFragmentManager().findFragmentByTag(TAG_SHARE_FRAGMENT);
}
@Override
public void onShareProcessClosed() {
finish();
}
}

View file

@ -162,6 +162,7 @@ class FileDetailsSharingProcessFragment : Fragment(), ExpirationDatePickerDialog
private fun showShareProcessFirst() {
binding.shareProcessGroupOne.visibility = View.VISIBLE
binding.shareProcessEditShareLink.visibility = View.VISIBLE
binding.shareProcessGroupTwo.visibility = View.GONE
// set up UI for modifying share
@ -309,6 +310,7 @@ class FileDetailsSharingProcessFragment : Fragment(), ExpirationDatePickerDialog
*/
private fun showShareProcessSecond() {
binding.shareProcessGroupOne.visibility = View.GONE
binding.shareProcessEditShareLink.visibility = View.GONE
binding.shareProcessGroupTwo.visibility = View.VISIBLE
if (share != null) {
binding.shareProcessBtnNext.text = requireContext().resources.getString(R.string.set_note)

View file

@ -24,6 +24,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minHeight="400dp"
android:focusable="true"
android:focusableInTouchMode="true">
@ -38,7 +39,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:minHeight="400dp">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/share_process_edit_share_link"
@ -213,7 +215,7 @@
android:textColor="@color/secondary_text_color"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/share_process_edit_share_link"/>
app:layout_constraintTop_toBottomOf="@+id/share_process_edit_share_link" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/note_container"

View file

@ -74,6 +74,6 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/share_fragment_container"></FrameLayout>
android:id="@+id/share_fragment_container" />
</LinearLayout>