mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 13:45:35 +03:00
Merge pull request #311 from tobiasKaminsky/develop
Added support for sharing files:
This commit is contained in:
commit
7ead9a0fe4
9 changed files with 30 additions and 3 deletions
|
@ -29,5 +29,6 @@
|
||||||
<item android:id="@+id/action_rename_file" android:title="@string/common_rename" android:icon="@android:drawable/ic_menu_set_as" android:orderInCategory="1" />
|
<item android:id="@+id/action_rename_file" android:title="@string/common_rename" android:icon="@android:drawable/ic_menu_set_as" android:orderInCategory="1" />
|
||||||
<item android:id="@+id/action_remove_file" android:title="@string/common_remove" android:icon="@android:drawable/ic_menu_delete" android:orderInCategory="1" />
|
<item android:id="@+id/action_remove_file" android:title="@string/common_remove" android:icon="@android:drawable/ic_menu_delete" android:orderInCategory="1" />
|
||||||
<item android:id="@+id/action_see_details" android:title="@string/actionbar_see_details" android:icon="@android:drawable/ic_menu_info_details" android:orderInCategory="1" />
|
<item android:id="@+id/action_see_details" android:title="@string/actionbar_see_details" android:icon="@android:drawable/ic_menu_info_details" android:orderInCategory="1" />
|
||||||
|
<item android:id="@+id/action_share_file" android:title="@string/actionbar_share_file" android:icon="@android:drawable/ic_menu_info_details" android:orderInCategory="1" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<string name="actionbar_mkdir">Ordner anlegen</string>
|
<string name="actionbar_mkdir">Ordner anlegen</string>
|
||||||
<string name="actionbar_settings">Einstellungen</string>
|
<string name="actionbar_settings">Einstellungen</string>
|
||||||
<string name="actionbar_see_details">Details</string>
|
<string name="actionbar_see_details">Details</string>
|
||||||
|
<string name="actionbar_share_file">Teile Datei</string>
|
||||||
<string name="prefs_category_general">Allgemein</string>
|
<string name="prefs_category_general">Allgemein</string>
|
||||||
<string name="prefs_category_more">Mehr</string>
|
<string name="prefs_category_more">Mehr</string>
|
||||||
<string name="prefs_accounts">Konten</string>
|
<string name="prefs_accounts">Konten</string>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<string name="actionbar_mkdir">Ordner anlegen</string>
|
<string name="actionbar_mkdir">Ordner anlegen</string>
|
||||||
<string name="actionbar_settings">Einstellungen</string>
|
<string name="actionbar_settings">Einstellungen</string>
|
||||||
<string name="actionbar_see_details">Details</string>
|
<string name="actionbar_see_details">Details</string>
|
||||||
|
<string name="actionbar_share_file">Teile Datei</string>
|
||||||
<string name="prefs_category_general">Allgemein</string>
|
<string name="prefs_category_general">Allgemein</string>
|
||||||
<string name="prefs_category_more">Mehr</string>
|
<string name="prefs_category_more">Mehr</string>
|
||||||
<string name="prefs_accounts">Konten</string>
|
<string name="prefs_accounts">Konten</string>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<string name="actionbar_mkdir">Ordner anlegen</string>
|
<string name="actionbar_mkdir">Ordner anlegen</string>
|
||||||
<string name="actionbar_settings">Einstellungen</string>
|
<string name="actionbar_settings">Einstellungen</string>
|
||||||
<string name="actionbar_see_details">Details</string>
|
<string name="actionbar_see_details">Details</string>
|
||||||
|
<string name="actionbar_share_file">Teile Datei</string>
|
||||||
<string name="prefs_category_general">Allgemein</string>
|
<string name="prefs_category_general">Allgemein</string>
|
||||||
<string name="prefs_category_more">Mehr</string>
|
<string name="prefs_category_more">Mehr</string>
|
||||||
<string name="prefs_accounts">Konten</string>
|
<string name="prefs_accounts">Konten</string>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<string name="actionbar_mkdir">Create directory</string>
|
<string name="actionbar_mkdir">Create directory</string>
|
||||||
<string name="actionbar_settings">Settings</string>
|
<string name="actionbar_settings">Settings</string>
|
||||||
<string name="actionbar_see_details">Details</string>
|
<string name="actionbar_see_details">Details</string>
|
||||||
|
<string name="actionbar_share_file">Share</string>
|
||||||
<string name="prefs_category_general">General</string>
|
<string name="prefs_category_general">General</string>
|
||||||
<string name="prefs_category_more">More</string>
|
<string name="prefs_category_more">More</string>
|
||||||
<string name="prefs_accounts">Accounts</string>
|
<string name="prefs_accounts">Accounts</string>
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<string name="actionbar_mkdir">Create directory</string>
|
<string name="actionbar_mkdir">Create directory</string>
|
||||||
<string name="actionbar_settings">Settings</string>
|
<string name="actionbar_settings">Settings</string>
|
||||||
<string name="actionbar_see_details">Details</string>
|
<string name="actionbar_see_details">Details</string>
|
||||||
|
<string name="actionbar_share_file">Share</string>
|
||||||
<string name="prefs_category_general">General</string>
|
<string name="prefs_category_general">General</string>
|
||||||
<string name="prefs_category_more">More</string>
|
<string name="prefs_category_more">More</string>
|
||||||
<string name="prefs_accounts">Accounts</string>
|
<string name="prefs_accounts">Accounts</string>
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- Dialogs -->
|
<!-- Dialogs -->
|
||||||
<style name="Theme.ownCloud.Dialog" parent="style/Theme.Sherlock.Light.Dialog">
|
<style name="Theme.ownCloud.Dialog" parent="@android:style/Theme.Dialog">
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<!-- PopDownMenu -->
|
<!-- PopDownMenu -->
|
||||||
|
|
|
@ -42,9 +42,10 @@ import com.owncloud.android.ui.preview.PreviewImageFragment;
|
||||||
import com.owncloud.android.ui.preview.PreviewMediaFragment;
|
import com.owncloud.android.ui.preview.PreviewMediaFragment;
|
||||||
import com.owncloud.android.utils.Log_OC;
|
import com.owncloud.android.utils.Log_OC;
|
||||||
|
|
||||||
|
|
||||||
import android.accounts.Account;
|
import android.accounts.Account;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.view.ContextMenu;
|
import android.view.ContextMenu;
|
||||||
|
@ -221,6 +222,7 @@ public class OCFileListFragment extends ExtendedListFragment implements EditName
|
||||||
toHide.add(R.id.action_cancel_upload);
|
toHide.add(R.id.action_cancel_upload);
|
||||||
toHide.add(R.id.action_sync_file);
|
toHide.add(R.id.action_sync_file);
|
||||||
toHide.add(R.id.action_see_details);
|
toHide.add(R.id.action_see_details);
|
||||||
|
toHide.add(R.id.action_share_file);
|
||||||
if ( mContainerActivity.getFileDownloaderBinder().isDownloading(AccountUtils.getCurrentOwnCloudAccount(getActivity()), targetFile) ||
|
if ( mContainerActivity.getFileDownloaderBinder().isDownloading(AccountUtils.getCurrentOwnCloudAccount(getActivity()), targetFile) ||
|
||||||
mContainerActivity.getFileUploaderBinder().isUploading(AccountUtils.getCurrentOwnCloudAccount(getActivity()), targetFile) ) {
|
mContainerActivity.getFileUploaderBinder().isUploading(AccountUtils.getCurrentOwnCloudAccount(getActivity()), targetFile) ) {
|
||||||
toDisable.add(R.id.action_rename_file);
|
toDisable.add(R.id.action_rename_file);
|
||||||
|
@ -359,6 +361,14 @@ public class OCFileListFragment extends ExtendedListFragment implements EditName
|
||||||
((FileFragment.ContainerActivity)getActivity()).showDetails(mTargetFile);
|
((FileFragment.ContainerActivity)getActivity()).showDetails(mTargetFile);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
case R.id.action_share_file: {
|
||||||
|
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||||
|
// set MimeType
|
||||||
|
sharingIntent.setType(mTargetFile.getMimetype());
|
||||||
|
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+mTargetFile.getStoragePath()));
|
||||||
|
startActivity(Intent.createChooser(sharingIntent, "Share via"));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return super.onContextItemSelected(item);
|
return super.onContextItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,11 +310,23 @@ public class PreviewImageFragment extends FileFragment implements OnRemoteOper
|
||||||
seeDetails();
|
seeDetails();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
case R.id.action_share_file: {
|
||||||
|
shareFile();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void shareFile(){
|
||||||
|
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
|
||||||
|
// set MimeType
|
||||||
|
sharingIntent.setType(getFile().getMimetype());
|
||||||
|
sharingIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+getFile().getStoragePath()));
|
||||||
|
startActivity(Intent.createChooser(sharingIntent, "Share via"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue