You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
--->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.owncloud.android"
- android:versionCode="10800000"
- android:versionName="1.8.0" >
+ -->
+<manifest package="com.owncloud.android"
+ android:versionName="ownCloud beta" xmlns:android="http://schemas.android.com/apk/res/android">
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="22" />
+
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<service android:name=".media.MediaService" />
<activity android:name=".ui.activity.PassCodeActivity" />
- <activity android:name=".ui.activity.ConflictsResolveActivity" />
- <activity android:name=".ui.activity.GenericExplanationActivity" />
- <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity" />
- <activity android:name=".ui.activity.LogHistoryActivity" />
-
- <receiver android:name=".files.InstantUploadBroadcastReceiver" >
+ <activity android:name=".ui.activity.ConflictsResolveActivity"/>
+ <activity android:name=".ui.activity.GenericExplanationActivity"/>
+ <activity android:name=".ui.activity.ErrorsWhileCopyingHandlerActivity"/>
+
+ <activity android:name=".ui.activity.LogHistoryActivity"/>
+ <activity android:name=".ui.activity.ErrorReportActivity"/>
+
+ <receiver android:name=".files.InstantUploadBroadcastReceiver">
<intent-filter>
+
<!-- unofficially supported by many Android phones but not by HTC devices: -->
<action android:name="com.android.camera.NEW_PICTURE" />
<!-- officially supported since Android 4.0 (SDK 14, works even for HTC devices): -->
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
+ <intent-filter>
+ <action android:name="android.intent.action.ACTION_POWER_CONNECTED"/>
+ <action android:name="android.intent.action.ACTION_POWER_DISCONNECTED"/>
+ </intent-filter>
</receiver>
- <receiver android:name=".files.BootupBroadcastReceiver">
+ <receiver android:name=".files.BootupBroadcastReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
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 {
}
}
-
+
+
+
+
+def computeVersionCode() {
+ def date = new Date()
+ def formattedDate = date.format('yyyyMMdd').toInteger()
+ return formattedDate
+}
- Subproject commit 59fb61601de4dd8bfcab1afb619e016e1a7b904d
-Subproject commit 32ab89fc308af2a51b9b7ded7fb40fc786dfd8a6
++Subproject commit fff67c91f73532229cd678cbbee19b52b0852db5
<string name="file_list__footer__files">%1$d files</string>
<string name="file_list__footer__files_and_folder">%1$d files, 1 folder</string>
<string name="file_list__footer__files_and_folders">%1$d files, %2$d folders</string>
+ <string name="action_switch_grid_view">Switch to grid view</string>
+ <string name="action_switch_list_view">Switch to list view</string>
+ <string name="common_category">Common</string>
+ <string name="pref_cache_size">Cache size</string>
+ <string name="prefs_instant_behaviour_dialogTitle">Upload file to server and ...</string>
+ <string name="prefs_instant_behaviour_title">Behaviour</string>
+ <string name="upload_copy_files">Copy file</string>
+ <string name="upload_move_files">Move file</string>
+
+ <string name="pref_behaviour_entries_do_nothing">do nothing</string>
+ <string name="pref_behaviour_entries_copy">copy file to OC folder</string>
+ <string name="pref_behaviour_entries_move">move file to OC folder</string>
+ <string name="pref_behaviour_entries_delete">delete origin file</string>
+ <string name="confirmation_remove_files_alert">Do you really want to remove selected items?</string>
+ <string name="confirmation_remove_folders_alert">Do you really want to remove a folder and its content?</string>
+ <string name="confirmation_remove_files">selected items</string>
+ <string name="error_log_exit">Exit</string>
+ <string name="error_log_send">Send Log</string>
+ <string name="error_log_title">Error Log</string>
+ <string name="action_stream_file">Stream file with external player</string>
+ <string name="stream_expose_password">Do you want to stream this file with an external app?\n\nCAUTION: This may expose your password!</string>
+ <string name="set_picture_as">Set picture as</string>
+ <string name="share_dialog_title">Sharing</string>
+ <string name="share_with_user_section_title">Share with Users and Groups</string>
+ <string name="share_no_users">No data shared with users yet</string>
+ <string name="share_add_user_or_group">Add User or Group</string>
+ <string name="share_search">Search</string>
+
+ <string name="search_users_and_groups_hint">Search users and groups</string>
+ <string name="share_group_clarification">%1$s (group)</string>
+
+ <string name="share_sharee_unavailable">Sorry, your server version does not allow share with users within clients.
+ \nPlease contact your administrator</string>
+
</resources>
}
}
return preparedOperations;
+
+ }
+
+ private ArrayList<ContentProviderOperation> prepareRemoveSharesInFile(
+ String filePath, ArrayList<ContentProviderOperation> 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<OCShare> 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<OCShare> shares = new ArrayList<OCShare>();
+ 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);
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.
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;
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;
/**
*
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));
}
/**
localStateView.setVisibility(View.VISIBLE);\r
}\r
\r
- // share with me icon\r
- ImageView sharedWithMeIconV = (ImageView)\r
- view.findViewById(R.id.sharedWithMeIcon);\r
- sharedWithMeIconV.bringToFront();\r
- if (checkIfFileIsSharedWithMe(file) &&\r
- (!file.isFolder() || !mGridMode)) {\r
- sharedWithMeIconV.setVisibility(View.VISIBLE);\r
- } else {\r
- sharedWithMeIconV.setVisibility(View.GONE);\r
- }\r
- \r
break;\r
}\r
+\r
+ ImageView checkBoxV = (ImageView) view.findViewById(R.id.custom_checkbox);\r
+ checkBoxV.setVisibility(View.GONE);\r
+\r
+ AbsListView parentList = (AbsListView)parent;\r
+ if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {\r
+ if (parentList.getChoiceMode() == AbsListView.CHOICE_MODE_NONE) {\r
+ checkBoxV.setVisibility(View.GONE);\r
+ } else if (parentList.getCheckedItemCount() > 0){\r
+ if (parentList.isItemChecked(position)) {\r
+ checkBoxV.setImageResource(\r
+ android.R.drawable.checkbox_on_background);\r
+ } else {\r
+ checkBoxV.setImageResource(\r
+ android.R.drawable.checkbox_off_background);\r
+ }\r
+ checkBoxV.setVisibility(View.VISIBLE);\r
+ }\r
+ }\r
\r
// For all Views\r
\r
((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);
}
}
}
- /**
- * {@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<OCFile> 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;
}
-
}
/**
@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 {