From: tobiasKaminsky Date: Thu, 5 Nov 2015 21:26:56 +0000 (+0100) Subject: Merge remote-tracking branch 'remotes/upstream/resizedImages' into beta X-Git-Tag: beta-20151122~42 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/8e057b45041897e80e4cbfd44a14c515c0ef5605 Merge remote-tracking branch 'remotes/upstream/resizedImages' into beta --- 8e057b45041897e80e4cbfd44a14c515c0ef5605 diff --cc AndroidManifest.xml index 240d73be,e1d21f3c..17945c85 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@@ -15,10 -16,16 +16,14 @@@ You should have received a copy of the GNU General Public License along with this program. If not, see . ---> - + --> + + + @@@ -146,15 -157,14 +155,16 @@@ - - - - - - + + + + + + + + + @@@ -168,12 -180,8 +180,12 @@@ + + + + - + diff --cc build.gradle index d707b027,d96997a6..84807207 --- a/build.gradle +++ b/build.gradle @@@ -19,11 -20,10 +19,11 @@@ repositories dependencies { compile name: 'touch-image-view' - compile 'com.android.support:support-v4:22.2.1' compile project(':owncloud-android-library') + compile 'com.android.support:support-v4:22.2.1' compile 'com.jakewharton:disklrucache:2.0.2' compile 'com.android.support:appcompat-v7:22.2.1' + compile 'com.getbase:floatingactionbutton:1.10.1' } android { @@@ -73,8 -67,8 +73,12 @@@ } } + + + + - +def computeVersionCode() { + def date = new Date() + def formattedDate = date.format('yyyyMMdd').toInteger() + return formattedDate +} diff --cc owncloud-android-library index 59fb6160,32ab89fc..fff67c91 --- a/owncloud-android-library +++ b/owncloud-android-library @@@ -1,1 -1,1 +1,1 @@@ - Subproject commit 59fb61601de4dd8bfcab1afb619e016e1a7b904d -Subproject commit 32ab89fc308af2a51b9b7ded7fb40fc786dfd8a6 ++Subproject commit fff67c91f73532229cd678cbbee19b52b0852db5 diff --cc res/values/strings.xml index c4b93e05,2458d707..6f435d31 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@@ -366,27 -365,17 +367,39 @@@ %1$d files %1$d files, 1 folder %1$d files, %2$d folders + Switch to grid view + Switch to list view + Common + Cache size + Upload file to server and ... + Behaviour + Copy file + Move file + + do nothing + copy file to OC folder + move file to OC folder + delete origin file + Do you really want to remove selected items? + Do you really want to remove a folder and its content? + selected items + Exit + Send Log + Error Log + Stream file with external player + Do you want to stream this file with an external app?\n\nCAUTION: This may expose your password! + Set picture as + Sharing + Share with Users and Groups + No data shared with users yet + Add User or Group + Search + + Search users and groups + %1$s (group) + + Sorry, your server version does not allow share with users within clients. + \nPlease contact your administrator + diff --cc src/com/owncloud/android/datamodel/FileDataStorageManager.java index 7d014b03,2d353d2b..f3dd3e55 --- a/src/com/owncloud/android/datamodel/FileDataStorageManager.java +++ b/src/com/owncloud/android/datamodel/FileDataStorageManager.java @@@ -1409,9 -1495,67 +1490,67 @@@ public class FileDataStorageManager } } return preparedOperations; + + } + + private ArrayList prepareRemoveSharesInFile( + String filePath, ArrayList preparedOperations) { + + String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND " + + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?"; + String[] whereArgs = new String[]{filePath, mAccount.name}; + + preparedOperations.add( + ContentProviderOperation.newDelete(ProviderTableMeta.CONTENT_URI_SHARE). + withSelection(where, whereArgs). + build() + ); + + return preparedOperations; + + } + + public ArrayList getSharesWithForAFile(String filePath, String accountName){ + // Condition + String where = ProviderTableMeta.OCSHARES_PATH + "=?" + " AND " + + ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?"+ "AND" + + " (" + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? OR " + + ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? ) "; + String [] whereArgs = new String[]{ filePath, accountName , + Integer.toString(ShareType.USER.getValue()), + Integer.toString(ShareType.GROUP.getValue()) }; + + Cursor c = null; + if (getContentResolver() != null) { + c = getContentResolver().query( + ProviderTableMeta.CONTENT_URI_SHARE, + null, where, whereArgs, null); + } else { + try { + c = getContentProviderClient().query( + ProviderTableMeta.CONTENT_URI_SHARE, + null, where, whereArgs, null); + + } catch (RemoteException e) { + Log_OC.e(TAG, "Could not get list of shares with: " + e.getMessage()); + c = null; + } + } + ArrayList shares = new ArrayList(); + OCShare share = null; + if (c.moveToFirst()) { + do { + share = createShareInstance(c); + shares.add(share); + // } + } while (c.moveToNext()); + } + c.close(); + + return shares; } - public void triggerMediaScan(String path) { + public static void triggerMediaScan(String path) { Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); intent.setData(Uri.fromFile(new File(path))); MainApp.getAppContext().sendBroadcast(intent); diff --cc src/com/owncloud/android/datamodel/OCFile.java index bc1d7e21,a6da654d..4fcd4394 --- a/src/com/owncloud/android/datamodel/OCFile.java +++ b/src/com/owncloud/android/datamodel/OCFile.java @@@ -72,10 -76,10 +74,12 @@@ public class OCFile implements Parcelab private boolean mIsDownloading; + private boolean mShowGridView; + private String mEtagInConflict; // Save file etag in the server, when there is a conflict. No conflict = null + private boolean mShareWithSharee; + /** * Create new {@link OCFile} with given path. diff --cc src/com/owncloud/android/files/FileOperationsHelper.java index 68c5662e,a0034da6..362cada4 --- a/src/com/owncloud/android/files/FileOperationsHelper.java +++ b/src/com/owncloud/android/files/FileOperationsHelper.java @@@ -25,9 -25,9 +25,10 @@@ import android.accounts.Account import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; + import android.graphics.Bitmap; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.graphics.Bitmap; import android.net.Uri; import android.support.v4.app.DialogFragment; import android.webkit.MimeTypeMap; @@@ -47,20 -48,18 +49,24 @@@ import com.owncloud.android.services.Op import com.owncloud.android.services.observer.FileObserverService; import com.owncloud.android.ui.activity.FileActivity; import com.owncloud.android.ui.adapter.DiskLruImageCacheFileProvider; + import com.owncloud.android.ui.activity.ShareActivity; import com.owncloud.android.ui.dialog.ShareLinkToDialog; +import org.apache.http.protocol.HTTP; + +import java.io.File; +import java.util.List; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; + import org.apache.http.protocol.HTTP; + +import java.util.ArrayList; + import java.util.List; /** * @@@ -433,8 -479,8 +530,9 @@@ public class FileOperationsHelper service.putExtra(OperationsService.EXTRA_ACCOUNT, mFileActivity.getAccount()); mWaitingForOpId = mFileActivity.getOperationsServiceBinder().queueNewOperation(service); - mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext(). - getString(R.string.wait_a_moment)); + // TODO Tobi loading dialog? - // mFileActivity.showLoadingDialog(); ++// mFileActivity.showLoadingDialog(mFileActivity.getApplicationContext(). ++// getString(R.string.wait_a_moment)); } /** diff --cc src/com/owncloud/android/ui/adapter/FileListListAdapter.java index 78a66b31,2aa25eaf..48047547 --- a/src/com/owncloud/android/ui/adapter/FileListListAdapter.java +++ b/src/com/owncloud/android/ui/adapter/FileListListAdapter.java @@@ -303,38 -299,8 +310,27 @@@ public class FileListListAdapter extend localStateView.setVisibility(View.VISIBLE); } - // share with me icon - ImageView sharedWithMeIconV = (ImageView) - view.findViewById(R.id.sharedWithMeIcon); - sharedWithMeIconV.bringToFront(); - if (checkIfFileIsSharedWithMe(file) && - (!file.isFolder() || !mGridMode)) { - sharedWithMeIconV.setVisibility(View.VISIBLE); - } else { - sharedWithMeIconV.setVisibility(View.GONE); - } - break; } + + ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox); + checkBoxV.setVisibility(View.GONE); + + AbsListView parentList = (AbsListView)parent; + if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + if (parentList.getChoiceMode() == AbsListView.CHOICE_MODE_NONE) { + checkBoxV.setVisibility(View.GONE); + } else if (parentList.getCheckedItemCount() > 0){ + if (parentList.isItemChecked(position)) { + checkBoxV.setImageResource( + android.R.drawable.checkbox_on_background); + } else { + checkBoxV.setImageResource( + android.R.drawable.checkbox_off_background); + } + checkBoxV.setVisibility(View.VISIBLE); + } + } // For all Views diff --cc src/com/owncloud/android/ui/fragment/OCFileListFragment.java index 88b0dd16,44776368..2f59be46 --- a/src/com/owncloud/android/ui/fragment/OCFileListFragment.java +++ b/src/com/owncloud/android/ui/fragment/OCFileListFragment.java @@@ -494,12 -276,15 +495,12 @@@ public class OCFileListFragment extend ((FileDisplayActivity)mContainerActivity).startImagePreview(file); } else if (PreviewTextFragment.canBePreviewed(file)){ ((FileDisplayActivity)mContainerActivity).startTextPreview(file); - } else if (file.isDown()) { - if (PreviewMediaFragment.canBePreviewed(file)) { + } else if (PreviewMediaFragment.canBePreviewed(file)) { // media preview ((FileDisplayActivity) mContainerActivity).startMediaPreview(file, 0, true); - } else { + } else if (file.isDown()) { mContainerActivity.getFileOperationsHelper().openFile(file); - } else { - } - + } else { // automatic download, preview on finish ((FileDisplayActivity) mContainerActivity).startDownloadForPreview(file); } @@@ -552,127 -336,89 +553,126 @@@ } } - /** - * {@inheritDoc} - */ - @Override - public boolean onFileActionChosen(int menuId, int filePosition) { - mTargetFile = (OCFile) mAdapter.getItem(filePosition); - switch (menuId) { - case R.id.action_share_file: { - mContainerActivity.getFileOperationsHelper().shareFileWithLink(mTargetFile); - return true; - } - case R.id.action_share_with_users: { - mContainerActivity.getFileOperationsHelper().showShareFile(mTargetFile); - return true; - } - case R.id.action_open_file_with: { - mContainerActivity.getFileOperationsHelper().openFile(mTargetFile); - return true; - } - case R.id.action_unshare_file: { - mContainerActivity.getFileOperationsHelper().unshareFileWithLink(mTargetFile); - return true; - } - case R.id.action_rename_file: { - RenameFileDialogFragment dialog = RenameFileDialogFragment.newInstance(mTargetFile); - dialog.show(getFragmentManager(), FileDetailFragment.FTAG_RENAME_FILE); - return true; - } - case R.id.action_remove_file: { - RemoveFileDialogFragment dialog = RemoveFileDialogFragment.newInstance(mTargetFile); - dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION); - return true; - } - case R.id.action_download_file: - case R.id.action_sync_file: { - mContainerActivity.getFileOperationsHelper().syncFile(mTargetFile); - return true; - } - case R.id.action_cancel_sync: { - ((FileDisplayActivity)mContainerActivity).cancelTransference(mTargetFile); - return true; - } - case R.id.action_see_details: { - mContainerActivity.showDetails(mTargetFile); - return true; - } - case R.id.action_send_file: { - // Obtain the file - if (!mTargetFile.isDown()) { // Download the file - Log_OC.d(TAG, mTargetFile.getRemotePath() + " : File must be downloaded"); - ((FileDisplayActivity) mContainerActivity).startDownloadForSending(mTargetFile); + public boolean onFileActionChosen(int menuId) { + if (mAdapter.getCheckedItems().size() == 1){ + OCFile mTargetFile = mAdapter.getCheckedItems().get(0); - } else { - mContainerActivity.getFileOperationsHelper().sendDownloadedFile(mTargetFile); + switch (menuId) { + case R.id.action_share_file: { + mContainerActivity.getFileOperationsHelper().shareFileWithLink(mTargetFile); + return true; } - return true; + case R.id.action_open_file_with: { + mContainerActivity.getFileOperationsHelper().openFile(mTargetFile); + return true; + } + case R.id.action_unshare_file: { + mContainerActivity.getFileOperationsHelper().unshareFileWithLink(mTargetFile); + return true; + } + case R.id.action_rename_file: { + RenameFileDialogFragment dialog = RenameFileDialogFragment.newInstance(mTargetFile); + dialog.show(getFragmentManager(), FileDetailFragment.FTAG_RENAME_FILE); + return true; + } + case R.id.action_remove_file: { + RemoveFileDialogFragment dialog = RemoveFileDialogFragment.newInstance(mTargetFile); + dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION); + return true; + } + case R.id.action_download_file: + case R.id.action_sync_file: { + mContainerActivity.getFileOperationsHelper().syncFile(mTargetFile); + return true; + } + case R.id.action_cancel_sync: { + ((FileDisplayActivity) mContainerActivity).cancelTransference(mTargetFile); + return true; + } + case R.id.action_see_details: { + mContainerActivity.showDetails(mTargetFile); + return true; + } + case R.id.action_send_file: { + // Obtain the file + if (!mTargetFile.isDown()) { // Download the file + Log_OC.d(TAG, mTargetFile.getRemotePath() + " : File must be downloaded"); + ((FileDisplayActivity) mContainerActivity).startDownloadForSending(mTargetFile); + return true; + } else { + mContainerActivity.getFileOperationsHelper().sendDownloadedFile(mTargetFile); + } + } + case R.id.action_stream_file: { + Account account = ((FileActivity)mContainerActivity).getAccount(); + Context context = MainApp.getAppContext(); + String uri = PreviewMediaFragment.generateUrlWithCredentials(account, context, mTargetFile); + MediaService.streamWithExternalApp(uri, getActivity()).show(); + return true; + } + case R.id.action_move: { + Intent action = new Intent(getActivity(), FolderPickerActivity.class); + ArrayList files = new ArrayList(); + files.add(mTargetFile); + action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, files); + getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES); + return true; + } + case R.id.action_favorite_file: { + mContainerActivity.getFileOperationsHelper().toggleFavorite(mTargetFile, true); + return true; + } + case R.id.action_unfavorite_file: { + mContainerActivity.getFileOperationsHelper().toggleFavorite(mTargetFile, false); + return true; + } + case R.id.action_copy: + Intent action = new Intent(getActivity(), FolderPickerActivity.class); + + // Pass mTargetFile that contains info of selected file/folder + action.putExtra(FolderPickerActivity.EXTRA_FILE, mTargetFile); + getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_COPY_FILES); + return true; + default: + return false; } - case R.id.action_move: { - Intent action = new Intent(getActivity(), FolderPickerActivity.class); + } else { + ArrayList mTargetFiles = mAdapter.getCheckedItems(); - // Pass mTargetFile that contains info of selected file/folder - action.putExtra(FolderPickerActivity.EXTRA_FILE, mTargetFile); - getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES); - return true; - } - case R.id.action_favorite_file: { - mContainerActivity.getFileOperationsHelper().toggleFavorite(mTargetFile, true); - return true; - } - case R.id.action_unfavorite_file: { - mContainerActivity.getFileOperationsHelper().toggleFavorite(mTargetFile, false); - return true; + switch (menuId) { + case R.id.action_remove_file: { + RemoveFilesDialogFragment dialog = RemoveFilesDialogFragment.newInstance(mTargetFiles); + dialog.show(getFragmentManager(), ConfirmationDialogFragment.FTAG_CONFIRMATION); + return true; + } + case R.id.action_download_file: + case R.id.action_sync_file: { + mContainerActivity.getFileOperationsHelper().syncFiles(mTargetFiles); + return true; + } + case R.id.action_move: { + Intent action = new Intent(getActivity(), FolderPickerActivity.class); + action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, mTargetFiles); + getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES); + return true; + } + case R.id.action_favorite_file: { + mContainerActivity.getFileOperationsHelper().toggleFavorites(mTargetFiles, true); + return true; + } + case R.id.action_unfavorite_file: { + mContainerActivity.getFileOperationsHelper().toggleFavorites(mTargetFiles, false); + return true; + } + case R.id.action_copy: + Intent action = new Intent(getActivity(), FolderPickerActivity.class); + action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, mTargetFiles); + getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_COPY_FILES); + return true; + default: + return false; } - case R.id.action_copy: - Intent action = new Intent(getActivity(), FolderPickerActivity.class); - - // Pass mTargetFile that contains info of selected file/folder - action.putExtra(FolderPickerActivity.EXTRA_FILE, mTargetFile); - getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_COPY_FILES); - return true; - default: - return false; } - } /** @@@ -681,7 -427,8 +681,7 @@@ @Override public boolean onContextItemSelected (MenuItem item) { AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo(); - boolean matched = onFileActionChosen(item.getItemId()); - boolean matched = onFileActionChosen(item.getItemId(), - ((AdapterContextMenuInfo) item.getMenuInfo()).position); ++ boolean matched = onFileActionChosen(item.getItemId()) ; if(!matched) { return super.onContextItemSelected(item); } else {