Restored Sharing menu for reshared file with warning if resharing isn't allowed

This commit is contained in:
Victor Nidens 2017-08-23 12:28:36 +03:00 committed by tobiasKaminsky
parent 8e57107f87
commit 4193dd04ab
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
5 changed files with 32 additions and 5 deletions

View file

@ -24,6 +24,7 @@ package com.owncloud.android.ui.fragment;
import android.accounts.Account;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater;
import android.view.Menu;
@ -312,8 +313,16 @@ public class FileDetailFragment extends FileFragment implements OnClickListener,
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_send_share_file: {
mContainerActivity.getFileOperationsHelper().sendShareFile(getFile(),
if(getFile().isSharedWithMe() && !getFile().canReshare()){
Snackbar.make(getView(),
R.string.resharing_is_not_allowed,
Snackbar.LENGTH_LONG
)
.show();
} else {
mContainerActivity.getFileOperationsHelper().sendShareFile(getFile(),
(FileDisplayActivity) mContainerActivity);
}
return true;
}
case R.id.action_open_file_with: {

View file

@ -944,8 +944,8 @@ public class OCFileListFragment extends ExtendedListFragment implements OCFileLi
OCFile singleFile = checkedFiles.get(0);
switch (menuId) {
case R.id.action_send_share_file: {
mContainerActivity.getFileOperationsHelper().sendShareFile(singleFile,
(FileDisplayActivity) mContainerActivity);
mContainerActivity.getFileOperationsHelper().sendShareFile(singleFile,
(FileDisplayActivity) mContainerActivity);
return true;
}
case R.id.action_open_file_with: {

View file

@ -422,8 +422,16 @@ public class PreviewImageFragment extends FileFragment {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_send_share_file:
mContainerActivity.getFileOperationsHelper().sendShareFile(getFile(),
if(getFile().isSharedWithMe() && !getFile().canReshare()){
Snackbar.make(getView(),
R.string.resharing_is_not_allowed,
Snackbar.LENGTH_LONG
)
.show();
} else {
mContainerActivity.getFileOperationsHelper().sendShareFile(getFile(),
(FileDisplayActivity) mContainerActivity);
}
return true;
case R.id.action_open_file_with:

View file

@ -38,6 +38,7 @@ import android.os.Bundle;
import android.os.IBinder;
import android.support.annotation.DrawableRes;
import android.support.annotation.StringRes;
import android.support.design.widget.Snackbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;

View file

@ -22,6 +22,7 @@ package com.owncloud.android.ui.preview;
import android.accounts.Account;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
@ -382,8 +383,16 @@ public class PreviewTextFragment extends FileFragment {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_send_share_file: {
mContainerActivity.getFileOperationsHelper().sendShareFile(getFile(),
if(getFile().isSharedWithMe() && !getFile().canReshare()){
Snackbar.make(getView(),
R.string.resharing_is_not_allowed,
Snackbar.LENGTH_LONG
)
.show();
} else {
mContainerActivity.getFileOperationsHelper().sendShareFile(getFile(),
(FileDisplayActivity) mContainerActivity);
}
return true;
}
case R.id.action_open_file_with: {