mirror of
https://github.com/nextcloud/android.git
synced 2024-11-27 17:46:37 +03:00
Merge branch 'develop' into send_file_pr311_with_develop
This commit is contained in:
commit
af1f880b27
21 changed files with 211 additions and 68 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
@ -3,4 +3,4 @@
|
||||||
url = git://github.com/JakeWharton/ActionBarSherlock.git
|
url = git://github.com/JakeWharton/ActionBarSherlock.git
|
||||||
[submodule "owncloud-android-library"]
|
[submodule "owncloud-android-library"]
|
||||||
path = owncloud-android-library
|
path = owncloud-android-library
|
||||||
url = git@github.com:owncloud/android-library.git
|
url = git://github.com/owncloud/android-library.git
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
<manifest package="com.owncloud.android"
|
<manifest package="com.owncloud.android"
|
||||||
android:versionCode="105003"
|
android:versionCode="105004"
|
||||||
android:versionName="1.5.3" xmlns:android="http://schemas.android.com/apk/res/android">
|
android:versionName="1.5.4" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||||
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
|
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
|
||||||
|
@ -80,12 +80,10 @@
|
||||||
<category android:name="android.intent.category.DEFAULT" >
|
<category android:name="android.intent.category.DEFAULT" >
|
||||||
</category>
|
</category>
|
||||||
|
|
||||||
<data android:mimeType="*/*" android:scheme="content">
|
<data android:mimeType="*/*" >
|
||||||
</data>
|
</data>
|
||||||
|
|
||||||
<data android:mimeType="*/*" android:scheme="file">
|
</intent-filter>
|
||||||
</data>
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ui.activity.Preferences"
|
android:name=".ui.activity.Preferences"
|
||||||
|
@ -183,6 +181,11 @@
|
||||||
</receiver>
|
</receiver>
|
||||||
<service android:name=".files.services.FileObserverService"/>
|
<service android:name=".files.services.FileObserverService"/>
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name=".ui.activity.CopyToClipboardActivity"
|
||||||
|
android:label="@string/copy_link"
|
||||||
|
android:icon="@drawable/copy_link" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.owncloud.android.workaround.accounts"
|
package="com.owncloud.android.workaround.accounts"
|
||||||
android:versionCode="0100012"
|
android:versionCode="0100013"
|
||||||
android:versionName="1.0.12" >
|
android:versionName="1.0.13" >
|
||||||
|
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
android:minSdkVersion="16"
|
android:minSdkVersion="16"
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1df8349e216bd264b9e4e48f32b4c839ef973870
|
Subproject commit cd4414a7bda686c84e1ca75dd10bcbf9b3f57f83
|
BIN
res/drawable-hdpi/copy_link.png
Normal file
BIN
res/drawable-hdpi/copy_link.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
res/drawable-ldpi/copy_link.png
Normal file
BIN
res/drawable-ldpi/copy_link.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
BIN
res/drawable-mdpi/copy_link.png
Normal file
BIN
res/drawable-mdpi/copy_link.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
res/drawable-xhdpi/copy_link.png
Normal file
BIN
res/drawable-xhdpi/copy_link.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.1 KiB |
|
@ -8,7 +8,7 @@
|
||||||
<string name ="db_name">ownCloud</string>
|
<string name ="db_name">ownCloud</string>
|
||||||
<string name ="data_folder">owncloud</string>
|
<string name ="data_folder">owncloud</string>
|
||||||
<string name ="log_name">Owncloud_</string>
|
<string name ="log_name">Owncloud_</string>
|
||||||
<string name ="default_display_name_for_root_folder">/</string>
|
<string name ="default_display_name_for_root_folder">ownCloud</string>
|
||||||
|
|
||||||
<!-- URLs and flags related -->
|
<!-- URLs and flags related -->
|
||||||
<string name="server_url"></string>
|
<string name="server_url"></string>
|
||||||
|
@ -39,11 +39,11 @@
|
||||||
<bool name="multiaccount_support">true</bool>
|
<bool name="multiaccount_support">true</bool>
|
||||||
|
|
||||||
<!-- Help, imprint and feedback -->
|
<!-- Help, imprint and feedback -->
|
||||||
<bool name="help_enabled">false</bool>
|
<bool name="help_enabled">true</bool>
|
||||||
<bool name="imprint_enabled">false</bool>
|
<bool name="imprint_enabled">false</bool>
|
||||||
<bool name="recommend_enabled">false</bool>
|
<bool name="recommend_enabled">true</bool>
|
||||||
<bool name="feedback_enabled">false</bool>
|
<bool name="feedback_enabled">true</bool>
|
||||||
<string name="url_help">https://owncloud.com/mobile/help</string>
|
<string name="url_help">http://owncloud.com/mobile/help</string>
|
||||||
<string name="url_imprint"></string>
|
<string name="url_imprint"></string>
|
||||||
<string name="mail_recommend">"mailto:"</string>
|
<string name="mail_recommend">"mailto:"</string>
|
||||||
<string name="mail_feedback">"mailto:apps@owncloud.com"</string>
|
<string name="mail_feedback">"mailto:apps@owncloud.com"</string>
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
<string name="sync_fail_in_favourites_content">Contents of %1$d files could not be sync\'ed (%2$d conflicts)</string>
|
<string name="sync_fail_in_favourites_content">Contents of %1$d files could not be sync\'ed (%2$d conflicts)</string>
|
||||||
<string name="sync_foreign_files_forgotten_ticker">Some local files were forgotten</string>
|
<string name="sync_foreign_files_forgotten_ticker">Some local files were forgotten</string>
|
||||||
<string name="sync_foreign_files_forgotten_content">%1$d files out of the %2$s directory could not be copied into</string>
|
<string name="sync_foreign_files_forgotten_content">%1$d files out of the %2$s directory could not be copied into</string>
|
||||||
<string name="sync_foreign_files_forgotten_explanation">As of version 1.3.16, files uploaded from this device are copied into the local %1$s folder to prevent data loss when a single file is synced with multiple accounts.\n\nDue to this change, all files uploaded in previous versions of this app were copied into the %2$s folder. However, an error prevented the completion of this operation during account synchronization. You may either leave the file(s) as is and remove the link to %3$s, or move the file(s) into the %1$s directory and retain the link to %4$s.\n\nListed below are the local file(s), and the the remote file(s) in %5$s they were linked to.</string>
|
<string name="sync_foreign_files_forgotten_explanation">As of version 1.3.16, files uploaded from this device are copied into the local %1$s folder to prevent data loss when a single file is synced with multiple accounts.\n\nDue to this change, all files uploaded in previous versions of this app were copied into the %2$s folder. However, an error prevented the completion of this operation during account synchronization. You may either leave the file(s) as is and remove the link to %3$s, or move the file(s) into the %1$s directory and retain the link to %4$s.\n\nListed below are the local file(s), and the remote file(s) in %5$s they were linked to.</string>
|
||||||
<string name="sync_current_folder_was_removed">Folder %1$s does not exist anymore</string>
|
<string name="sync_current_folder_was_removed">Folder %1$s does not exist anymore</string>
|
||||||
<string name="foreign_files_move">"Move all"</string>
|
<string name="foreign_files_move">"Move all"</string>
|
||||||
<string name="foreign_files_success">"All files were moved"</string>
|
<string name="foreign_files_success">"All files were moved"</string>
|
||||||
|
@ -252,6 +252,9 @@
|
||||||
<string name="share_link_file_error">An error occurred while trying to share this file or folder</string>
|
<string name="share_link_file_error">An error occurred while trying to share this file or folder</string>
|
||||||
<string name="unshare_link_file_no_exist">Unable to unshare this file or folder. It does not exist.</string>
|
<string name="unshare_link_file_no_exist">Unable to unshare this file or folder. It does not exist.</string>
|
||||||
<string name="unshare_link_file_error">An error occurred while trying to unshare this file or folder</string>
|
<string name="unshare_link_file_error">An error occurred while trying to unshare this file or folder</string>
|
||||||
|
|
||||||
<string name="activity_chooser_send_file_title">Send</string>
|
<string name="activity_chooser_send_file_title">Send</string>
|
||||||
|
|
||||||
|
<string name="copy_link">Copy link</string>
|
||||||
|
<string name="clipboard_text_copied">Copied to clipboard</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -36,7 +36,6 @@ import android.support.v4.app.Fragment;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -95,6 +94,7 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
private static final String KEY_AUTH_MESSAGE_TEXT = "AUTH_MESSAGE_TEXT";
|
private static final String KEY_AUTH_MESSAGE_TEXT = "AUTH_MESSAGE_TEXT";
|
||||||
private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";
|
private static final String KEY_HOST_URL_TEXT = "HOST_URL_TEXT";
|
||||||
private static final String KEY_OC_VERSION = "OC_VERSION";
|
private static final String KEY_OC_VERSION = "OC_VERSION";
|
||||||
|
private static final String KEY_OC_VERSION_STRING = "OC_VERSION_STRING";
|
||||||
private static final String KEY_ACCOUNT = "ACCOUNT";
|
private static final String KEY_ACCOUNT = "ACCOUNT";
|
||||||
private static final String KEY_SERVER_VALID = "SERVER_VALID";
|
private static final String KEY_SERVER_VALID = "SERVER_VALID";
|
||||||
private static final String KEY_SERVER_CHECKED = "SERVER_CHECKED";
|
private static final String KEY_SERVER_CHECKED = "SERVER_CHECKED";
|
||||||
|
@ -106,7 +106,7 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
private static final String KEY_AUTH_STATUS_TEXT = "AUTH_STATUS_TEXT";
|
private static final String KEY_AUTH_STATUS_TEXT = "AUTH_STATUS_TEXT";
|
||||||
private static final String KEY_AUTH_STATUS_ICON = "AUTH_STATUS_ICON";
|
private static final String KEY_AUTH_STATUS_ICON = "AUTH_STATUS_ICON";
|
||||||
private static final String KEY_REFRESH_BUTTON_ENABLED = "KEY_REFRESH_BUTTON_ENABLED";
|
private static final String KEY_REFRESH_BUTTON_ENABLED = "KEY_REFRESH_BUTTON_ENABLED";
|
||||||
private static final String KEY_IS_SHARED_SUPPORTED = "KEY_IS_SHARE_SUPPORTED";
|
//private static final String KEY_IS_SHARED_SUPPORTED = "KEY_IS_SHARE_SUPPORTED";
|
||||||
|
|
||||||
private static final String AUTH_ON = "on";
|
private static final String AUTH_ON = "on";
|
||||||
private static final String AUTH_OFF = "off";
|
private static final String AUTH_OFF = "off";
|
||||||
|
@ -124,7 +124,6 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
|
|
||||||
private String mHostBaseUrl;
|
private String mHostBaseUrl;
|
||||||
private OwnCloudVersion mDiscoveredVersion;
|
private OwnCloudVersion mDiscoveredVersion;
|
||||||
private boolean mIsSharedSupported;
|
|
||||||
|
|
||||||
private String mAuthMessageText;
|
private String mAuthMessageText;
|
||||||
private int mAuthMessageVisibility, mServerStatusText, mServerStatusIcon;
|
private int mAuthMessageVisibility, mServerStatusText, mServerStatusIcon;
|
||||||
|
@ -235,20 +234,19 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
mServerIsChecked = false;
|
mServerIsChecked = false;
|
||||||
mIsSslConn = false;
|
mIsSslConn = false;
|
||||||
mAuthStatusText = mAuthStatusIcon = 0;
|
mAuthStatusText = mAuthStatusIcon = 0;
|
||||||
mIsSharedSupported = false;
|
|
||||||
|
|
||||||
/// retrieve extras from intent
|
/// retrieve extras from intent
|
||||||
mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);
|
mAccount = getIntent().getExtras().getParcelable(EXTRA_ACCOUNT);
|
||||||
if (mAccount != null) {
|
if (mAccount != null) {
|
||||||
String ocVersion = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION);
|
String ocVersion = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION);
|
||||||
|
String ocVersionString = mAccountMgr.getUserData(mAccount, Constants.KEY_OC_VERSION_STRING);
|
||||||
if (ocVersion != null) {
|
if (ocVersion != null) {
|
||||||
mDiscoveredVersion = new OwnCloudVersion(ocVersion);
|
mDiscoveredVersion = new OwnCloudVersion(ocVersion, ocVersionString);
|
||||||
}
|
}
|
||||||
mHostBaseUrl = normalizeUrl(mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL));
|
mHostBaseUrl = normalizeUrl(mAccountMgr.getUserData(mAccount, Constants.KEY_OC_BASE_URL));
|
||||||
mHostUrlInput.setText(mHostBaseUrl);
|
mHostUrlInput.setText(mHostBaseUrl);
|
||||||
String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));
|
String userName = mAccount.name.substring(0, mAccount.name.lastIndexOf('@'));
|
||||||
mUsernameInput.setText(userName);
|
mUsernameInput.setText(userName);
|
||||||
mIsSharedSupported = Boolean.getBoolean(mAccountMgr.getUserData(mAccount, Constants.KEY_SUPPORTS_SHARE_API));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
initAuthorizationMethod(); // checks intent and setup.xml to determine mCurrentAuthorizationMethod
|
initAuthorizationMethod(); // checks intent and setup.xml to determine mCurrentAuthorizationMethod
|
||||||
|
@ -276,9 +274,9 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
|
|
||||||
/// server data
|
/// server data
|
||||||
String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);
|
String ocVersion = savedInstanceState.getString(KEY_OC_VERSION);
|
||||||
mIsSharedSupported = savedInstanceState.getBoolean(KEY_IS_SHARED_SUPPORTED, false);
|
String ocVersionString = savedInstanceState.getString(KEY_OC_VERSION_STRING);
|
||||||
if (ocVersion != null) {
|
if (ocVersion != null) {
|
||||||
mDiscoveredVersion = new OwnCloudVersion(ocVersion);
|
mDiscoveredVersion = new OwnCloudVersion(ocVersion, ocVersionString);
|
||||||
}
|
}
|
||||||
mHostBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);
|
mHostBaseUrl = savedInstanceState.getString(KEY_HOST_URL_TEXT);
|
||||||
|
|
||||||
|
@ -453,10 +451,10 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
|
|
||||||
/// server data
|
/// server data
|
||||||
if (mDiscoveredVersion != null) {
|
if (mDiscoveredVersion != null) {
|
||||||
outState.putString(KEY_OC_VERSION, mDiscoveredVersion.toString());
|
outState.putString(KEY_OC_VERSION, mDiscoveredVersion.getVersion());
|
||||||
|
outState.putString(KEY_OC_VERSION_STRING, mDiscoveredVersion.getVersionString());
|
||||||
}
|
}
|
||||||
outState.putString(KEY_HOST_URL_TEXT, mHostBaseUrl);
|
outState.putString(KEY_HOST_URL_TEXT, mHostBaseUrl);
|
||||||
outState.putBoolean(KEY_IS_SHARED_SUPPORTED, mIsSharedSupported);
|
|
||||||
|
|
||||||
/// account data, if updating
|
/// account data, if updating
|
||||||
if (mAccount != null) {
|
if (mAccount != null) {
|
||||||
|
@ -591,7 +589,6 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
|
|
||||||
mServerIsValid = false;
|
mServerIsValid = false;
|
||||||
mServerIsChecked = false;
|
mServerIsChecked = false;
|
||||||
mIsSharedSupported = false;
|
|
||||||
mOkButton.setEnabled(false);
|
mOkButton.setEnabled(false);
|
||||||
mDiscoveredVersion = null;
|
mDiscoveredVersion = null;
|
||||||
hideRefreshButton();
|
hideRefreshButton();
|
||||||
|
@ -906,9 +903,6 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
/// allow or not the user try to access the server
|
/// allow or not the user try to access the server
|
||||||
mOkButton.setEnabled(mServerIsValid);
|
mOkButton.setEnabled(mServerIsValid);
|
||||||
|
|
||||||
/// retrieve if is supported the Share API
|
|
||||||
mIsSharedSupported = operation.isSharedSupported();
|
|
||||||
|
|
||||||
} // else nothing ; only the last check operation is considered;
|
} // else nothing ; only the last check operation is considered;
|
||||||
// multiple can be triggered if the user amends a URL before a previous check can be triggered
|
// multiple can be triggered if the user amends a URL before a previous check can be triggered
|
||||||
}
|
}
|
||||||
|
@ -1298,10 +1292,11 @@ implements OnRemoteOperationListener, OnSslValidatorListener, OnFocusChangeList
|
||||||
if (isOAuth || isSaml) {
|
if (isOAuth || isSaml) {
|
||||||
mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);
|
mAccountMgr.setAuthToken(mAccount, mAuthTokenType, mAuthToken);
|
||||||
}
|
}
|
||||||
/// add user data to the new account; TODO probably can be done in the last parameter addAccountExplicitly, or in KEY_USERDATA
|
/// add user data to the new account; TODO probably can be done in the last parameter addAccountExplicitly, or in KEY_USERDATA
|
||||||
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION, mDiscoveredVersion.toString());
|
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION, mDiscoveredVersion.getVersion());
|
||||||
|
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_VERSION_STRING, mDiscoveredVersion.getVersionString());
|
||||||
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_BASE_URL, mHostBaseUrl);
|
mAccountMgr.setUserData(mAccount, Constants.KEY_OC_BASE_URL, mHostBaseUrl);
|
||||||
mAccountMgr.setUserData(mAccount, Constants.KEY_SUPPORTS_SHARE_API, Boolean.toString(mIsSharedSupported));
|
|
||||||
if (isSaml) {
|
if (isSaml) {
|
||||||
mAccountMgr.setUserData(mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO, "TRUE");
|
mAccountMgr.setUserData(mAccount, Constants.KEY_SUPPORTS_SAML_WEB_SSO, "TRUE");
|
||||||
} else if (isOAuth) {
|
} else if (isOAuth) {
|
||||||
|
|
|
@ -858,8 +858,33 @@ public class FileDataStorageManager {
|
||||||
return share;
|
return share;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OCShare getShareByPath(String path) {
|
public OCShare getFirstShareByPathAndType(String path, ShareType type) {
|
||||||
Cursor c = getShareCursorForValue(ProviderTableMeta.OCSHARES_PATH, path);
|
Cursor c = null;
|
||||||
|
if (getContentResolver() != null) {
|
||||||
|
c = getContentResolver().query(
|
||||||
|
ProviderTableMeta.CONTENT_URI_SHARE,
|
||||||
|
null,
|
||||||
|
ProviderTableMeta.OCSHARES_PATH + "=? AND "
|
||||||
|
+ ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? AND "
|
||||||
|
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
|
||||||
|
new String[] { path, Integer.toString(type.getValue()), mAccount.name },
|
||||||
|
null);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
c = getContentProviderClient().query(
|
||||||
|
ProviderTableMeta.CONTENT_URI_SHARE,
|
||||||
|
null,
|
||||||
|
ProviderTableMeta.OCSHARES_PATH + "=? AND "
|
||||||
|
+ ProviderTableMeta.OCSHARES_SHARE_TYPE + "=? AND "
|
||||||
|
+ ProviderTableMeta.OCSHARES_ACCOUNT_OWNER + "=?",
|
||||||
|
new String[] { path, Integer.toString(type.getValue()), mAccount.name },
|
||||||
|
null);
|
||||||
|
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Log_OC.e(TAG, "Could not get file details: " + e.getMessage());
|
||||||
|
c = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
OCShare share = null;
|
OCShare share = null;
|
||||||
if (c.moveToFirst()) {
|
if (c.moveToFirst()) {
|
||||||
share = createShareInstance(c);
|
share = createShareInstance(c);
|
||||||
|
|
|
@ -28,11 +28,13 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import com.owncloud.android.R;
|
import com.owncloud.android.R;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
|
import com.owncloud.android.lib.common.accounts.AccountUtils.Constants;
|
||||||
import com.owncloud.android.lib.common.network.WebdavUtils;
|
import com.owncloud.android.lib.common.network.WebdavUtils;
|
||||||
|
import com.owncloud.android.lib.resources.status.OwnCloudVersion;
|
||||||
import com.owncloud.android.services.OperationsService;
|
import com.owncloud.android.services.OperationsService;
|
||||||
import com.owncloud.android.ui.activity.FileActivity;
|
import com.owncloud.android.ui.activity.FileActivity;
|
||||||
import com.owncloud.android.ui.dialog.ActivityChooserDialog;
|
import com.owncloud.android.ui.dialog.ShareLinkToDialog;
|
||||||
import com.owncloud.android.utils.Log_OC;
|
import com.owncloud.android.utils.Log_OC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,7 +90,7 @@ public class FileOperationsHelper {
|
||||||
String link = "https://fake.url";
|
String link = "https://fake.url";
|
||||||
Intent intent = createShareWithLinkIntent(link);
|
Intent intent = createShareWithLinkIntent(link);
|
||||||
String[] packagesToExclude = new String[] { callerActivity.getPackageName() };
|
String[] packagesToExclude = new String[] { callerActivity.getPackageName() };
|
||||||
DialogFragment chooserDialog = ActivityChooserDialog.newInstance(intent, packagesToExclude, file);
|
DialogFragment chooserDialog = ShareLinkToDialog.newInstance(intent, packagesToExclude, file);
|
||||||
chooserDialog.show(callerActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
|
chooserDialog.show(callerActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -135,7 +137,11 @@ public class FileOperationsHelper {
|
||||||
public boolean isSharedSupported(FileActivity callerActivity) {
|
public boolean isSharedSupported(FileActivity callerActivity) {
|
||||||
if (callerActivity.getAccount() != null) {
|
if (callerActivity.getAccount() != null) {
|
||||||
AccountManager accountManager = AccountManager.get(callerActivity);
|
AccountManager accountManager = AccountManager.get(callerActivity);
|
||||||
return Boolean.parseBoolean(accountManager.getUserData(callerActivity.getAccount(), Constants.KEY_SUPPORTS_SHARE_API));
|
|
||||||
|
String version = accountManager.getUserData(callerActivity.getAccount(), Constants.KEY_OC_VERSION);
|
||||||
|
String versionString = accountManager.getUserData(callerActivity.getAccount(), Constants.KEY_OC_VERSION_STRING);
|
||||||
|
return (new OwnCloudVersion(version, versionString)).isSharedSupported();
|
||||||
|
//return Boolean.parseBoolean(accountManager.getUserData(callerActivity.getAccount(), OwnCloudAccount.Constants.KEY_SUPPORTS_SHARE_API));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +177,7 @@ public class FileOperationsHelper {
|
||||||
|
|
||||||
// Show dialog, without the own app
|
// Show dialog, without the own app
|
||||||
String[] packagesToExclude = new String[] { callerActivity.getPackageName() };
|
String[] packagesToExclude = new String[] { callerActivity.getPackageName() };
|
||||||
DialogFragment chooserDialog = ActivityChooserDialog.newInstance(sendIntent, packagesToExclude, file);
|
DialogFragment chooserDialog = ShareLinkToDialog.newInstance(sendIntent, packagesToExclude, file);
|
||||||
chooserDialog.show(callerActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
|
chooserDialog.show(callerActivity.getSupportFragmentManager(), FTAG_CHOOSER_DIALOG);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.owncloud.android.MainApp;
|
||||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
|
import com.owncloud.android.db.ProviderMeta.ProviderTableMeta;
|
||||||
|
@ -141,7 +142,7 @@ public class FileObserverService extends Service {
|
||||||
null);
|
null);
|
||||||
if (c == null || !c.moveToFirst()) return;
|
if (c == null || !c.moveToFirst()) return;
|
||||||
AccountManager acm = AccountManager.get(this);
|
AccountManager acm = AccountManager.get(this);
|
||||||
Account[] accounts = acm.getAccounts();
|
Account[] accounts = acm.getAccountsByType(MainApp.getAccountType());
|
||||||
do {
|
do {
|
||||||
Account account = null;
|
Account account = null;
|
||||||
for (Account a : accounts)
|
for (Account a : accounts)
|
||||||
|
|
|
@ -253,7 +253,11 @@ public class FileUploader extends Service implements OnDatatransferProgressListe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OwnCloudVersion ocv = new OwnCloudVersion(AccountManager.get(this).getUserData(account, Constants.KEY_OC_VERSION));
|
AccountManager aMgr = AccountManager.get(this);
|
||||||
|
String version = aMgr.getUserData(account, Constants.KEY_OC_VERSION);
|
||||||
|
String versionString = aMgr.getUserData(account, Constants.KEY_OC_VERSION_STRING);
|
||||||
|
OwnCloudVersion ocv = new OwnCloudVersion(version, versionString);
|
||||||
|
|
||||||
boolean chunked = FileUploader.chunkedUploadIsSupported(ocv);
|
boolean chunked = FileUploader.chunkedUploadIsSupported(ocv);
|
||||||
AbstractList<String> requestedUploads = new Vector<String>();
|
AbstractList<String> requestedUploads = new Vector<String>();
|
||||||
String uploadKey = null;
|
String uploadKey = null;
|
||||||
|
|
|
@ -37,15 +37,18 @@ import android.content.Intent;
|
||||||
|
|
||||||
import com.owncloud.android.datamodel.FileDataStorageManager;
|
import com.owncloud.android.datamodel.FileDataStorageManager;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||||
import com.owncloud.android.lib.resources.shares.OCShare;
|
import com.owncloud.android.lib.resources.shares.OCShare;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
import com.owncloud.android.lib.common.operations.RemoteOperation;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
||||||
import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
|
import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
|
||||||
|
import com.owncloud.android.lib.resources.files.FileUtils;
|
||||||
import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
|
import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
|
||||||
import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
|
import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
|
||||||
import com.owncloud.android.lib.resources.files.RemoteFile;
|
import com.owncloud.android.lib.resources.files.RemoteFile;
|
||||||
|
|
||||||
import com.owncloud.android.syncadapter.FileSyncAdapter;
|
import com.owncloud.android.syncadapter.FileSyncAdapter;
|
||||||
import com.owncloud.android.utils.FileStorageUtils;
|
import com.owncloud.android.utils.FileStorageUtils;
|
||||||
import com.owncloud.android.utils.Log_OC;
|
import com.owncloud.android.utils.Log_OC;
|
||||||
|
@ -101,7 +104,7 @@ public class SynchronizeFolderOperation extends RemoteOperation {
|
||||||
private boolean mSyncFullAccount;
|
private boolean mSyncFullAccount;
|
||||||
|
|
||||||
/** 'True' means that Share resources bound to the files into the folder should be refreshed also */
|
/** 'True' means that Share resources bound to the files into the folder should be refreshed also */
|
||||||
private boolean mRefreshShares;
|
private boolean mIsShareSupported;
|
||||||
|
|
||||||
/** 'True' means that the remote folder changed from last synchronization and should be fetched */
|
/** 'True' means that the remote folder changed from last synchronization and should be fetched */
|
||||||
private boolean mRemoteFolderChanged;
|
private boolean mRemoteFolderChanged;
|
||||||
|
@ -122,14 +125,14 @@ public class SynchronizeFolderOperation extends RemoteOperation {
|
||||||
public SynchronizeFolderOperation( OCFile folder,
|
public SynchronizeFolderOperation( OCFile folder,
|
||||||
long currentSyncTime,
|
long currentSyncTime,
|
||||||
boolean syncFullAccount,
|
boolean syncFullAccount,
|
||||||
boolean refreshShares,
|
boolean isShareSupported,
|
||||||
FileDataStorageManager dataStorageManager,
|
FileDataStorageManager dataStorageManager,
|
||||||
Account account,
|
Account account,
|
||||||
Context context ) {
|
Context context ) {
|
||||||
mLocalFolder = folder;
|
mLocalFolder = folder;
|
||||||
mCurrentSyncTime = currentSyncTime;
|
mCurrentSyncTime = currentSyncTime;
|
||||||
mSyncFullAccount = syncFullAccount;
|
mSyncFullAccount = syncFullAccount;
|
||||||
mRefreshShares = refreshShares;
|
mIsShareSupported = isShareSupported;
|
||||||
mStorageManager = dataStorageManager;
|
mStorageManager = dataStorageManager;
|
||||||
mAccount = account;
|
mAccount = account;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
@ -171,6 +174,10 @@ public class SynchronizeFolderOperation extends RemoteOperation {
|
||||||
mConflictsFound = 0;
|
mConflictsFound = 0;
|
||||||
mForgottenLocalFiles.clear();
|
mForgottenLocalFiles.clear();
|
||||||
|
|
||||||
|
if (FileUtils.PATH_SEPARATOR.equals(mLocalFolder.getRemotePath()) && !mSyncFullAccount) {
|
||||||
|
updateOCVersion(client);
|
||||||
|
}
|
||||||
|
|
||||||
result = checkForChanges(client);
|
result = checkForChanges(client);
|
||||||
|
|
||||||
if (result.isSuccess()) {
|
if (result.isSuccess()) {
|
||||||
|
@ -185,7 +192,7 @@ public class SynchronizeFolderOperation extends RemoteOperation {
|
||||||
sendLocalBroadcast(EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), result);
|
sendLocalBroadcast(EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.isSuccess() && mRefreshShares) {
|
if (result.isSuccess() && mIsShareSupported) {
|
||||||
RemoteOperationResult shareResult = refreshSharesForFolder(client);
|
RemoteOperationResult shareResult = refreshSharesForFolder(client);
|
||||||
if (shareResult.getCode() != ResultCode.FILE_NOT_FOUND) {
|
if (shareResult.getCode() != ResultCode.FILE_NOT_FOUND) {
|
||||||
result = shareResult;
|
result = shareResult;
|
||||||
|
@ -200,6 +207,16 @@ public class SynchronizeFolderOperation extends RemoteOperation {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void updateOCVersion(OwnCloudClient client) {
|
||||||
|
UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext);
|
||||||
|
RemoteOperationResult result = update.execute(client);
|
||||||
|
if (result.isSuccess()) {
|
||||||
|
mIsShareSupported = update.getOCVersion().isSharedSupported();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private RemoteOperationResult checkForChanges(OwnCloudClient client) {
|
private RemoteOperationResult checkForChanges(OwnCloudClient client) {
|
||||||
mRemoteFolderChanged = false;
|
mRemoteFolderChanged = false;
|
||||||
RemoteOperationResult result = null;
|
RemoteOperationResult result = null;
|
||||||
|
|
|
@ -20,12 +20,15 @@ package com.owncloud.android.operations;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
|
|
||||||
import com.owncloud.android.lib.common.OwnCloudClient;
|
import com.owncloud.android.lib.common.OwnCloudClient;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
|
||||||
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
|
||||||
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
|
import com.owncloud.android.lib.resources.files.ExistenceCheckRemoteOperation;
|
||||||
import com.owncloud.android.lib.resources.shares.OCShare;
|
import com.owncloud.android.lib.resources.shares.OCShare;
|
||||||
import com.owncloud.android.lib.resources.shares.RemoveRemoteShareOperation;
|
import com.owncloud.android.lib.resources.shares.RemoveRemoteShareOperation;
|
||||||
|
import com.owncloud.android.lib.resources.shares.ShareType;
|
||||||
|
|
||||||
import com.owncloud.android.operations.common.SyncOperation;
|
import com.owncloud.android.operations.common.SyncOperation;
|
||||||
import com.owncloud.android.utils.Log_OC;
|
import com.owncloud.android.utils.Log_OC;
|
||||||
|
|
||||||
|
@ -53,7 +56,7 @@ public class UnshareLinkOperation extends SyncOperation {
|
||||||
RemoteOperationResult result = null;
|
RemoteOperationResult result = null;
|
||||||
|
|
||||||
// Get Share for a file
|
// Get Share for a file
|
||||||
OCShare share = getStorageManager().getShareByPath(mRemotePath);
|
OCShare share = getStorageManager().getFirstShareByPathAndType(mRemotePath, ShareType.PUBLIC_LINK);
|
||||||
|
|
||||||
if (share != null) {
|
if (share != null) {
|
||||||
RemoveRemoteShareOperation operation = new RemoveRemoteShareOperation((int) share.getIdRemoteShared());
|
RemoveRemoteShareOperation operation = new RemoveRemoteShareOperation((int) share.getIdRemoteShared());
|
||||||
|
|
|
@ -47,11 +47,13 @@ public class UpdateOCVersionOperation extends RemoteOperation {
|
||||||
|
|
||||||
private Account mAccount;
|
private Account mAccount;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
private OwnCloudVersion mOwnCloudVersion;
|
||||||
|
|
||||||
|
|
||||||
public UpdateOCVersionOperation(Account account, Context context) {
|
public UpdateOCVersionOperation(Account account, Context context) {
|
||||||
mAccount = account;
|
mAccount = account;
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mOwnCloudVersion = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,10 +76,15 @@ public class UpdateOCVersionOperation extends RemoteOperation {
|
||||||
if (response != null) {
|
if (response != null) {
|
||||||
JSONObject json = new JSONObject(response);
|
JSONObject json = new JSONObject(response);
|
||||||
if (json != null && json.getString("version") != null) {
|
if (json != null && json.getString("version") != null) {
|
||||||
OwnCloudVersion ocver = new OwnCloudVersion(json.getString("version"));
|
|
||||||
if (ocver.isVersionValid()) {
|
String version = json.getString("version");
|
||||||
accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION, ocver.toString());
|
String versionstring = json.getString("versionstring");
|
||||||
Log_OC.d(TAG, "Got new OC version " + ocver.toString());
|
mOwnCloudVersion = new OwnCloudVersion(version, versionstring);
|
||||||
|
if (mOwnCloudVersion.isVersionValid()) {
|
||||||
|
accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION, mOwnCloudVersion.getVersion());
|
||||||
|
accountMngr.setUserData(mAccount, Constants.KEY_OC_VERSION_STRING, mOwnCloudVersion.getVersionString());
|
||||||
|
Log_OC.d(TAG, "Got new OC version " + mOwnCloudVersion.toString());
|
||||||
|
|
||||||
result = new RemoteOperationResult(ResultCode.OK);
|
result = new RemoteOperationResult(ResultCode.OK);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -107,4 +114,9 @@ public class UpdateOCVersionOperation extends RemoteOperation {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public OwnCloudVersion getOCVersion() {
|
||||||
|
return mOwnCloudVersion;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
||||||
private SyncResult mSyncResult;
|
private SyncResult mSyncResult;
|
||||||
|
|
||||||
/** 'True' means that the server supports the share API */
|
/** 'True' means that the server supports the share API */
|
||||||
private boolean mIsSharedSupported;
|
private boolean mIsShareSupported;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -156,9 +156,6 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
||||||
this.setContentProviderClient(providerClient);
|
this.setContentProviderClient(providerClient);
|
||||||
this.setStorageManager(new FileDataStorageManager(account, providerClient));
|
this.setStorageManager(new FileDataStorageManager(account, providerClient));
|
||||||
|
|
||||||
AccountManager accountManager = getAccountManager();
|
|
||||||
mIsSharedSupported = Boolean.parseBoolean(accountManager.getUserData(account, Constants.KEY_SUPPORTS_SHARE_API));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.initClientForCurrentAccount();
|
this.initClientForCurrentAccount();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -235,6 +232,8 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
||||||
RemoteOperationResult result = update.execute(getClient());
|
RemoteOperationResult result = update.execute(getClient());
|
||||||
if (!result.isSuccess()) {
|
if (!result.isSuccess()) {
|
||||||
mLastFailedResult = result;
|
mLastFailedResult = result;
|
||||||
|
} else {
|
||||||
|
mIsShareSupported = update.getOCVersion().isSharedSupported();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +268,7 @@ public class FileSyncAdapter extends AbstractOwnCloudSyncAdapter {
|
||||||
SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation( folder,
|
SynchronizeFolderOperation synchFolderOp = new SynchronizeFolderOperation( folder,
|
||||||
mCurrentSyncTime,
|
mCurrentSyncTime,
|
||||||
true,
|
true,
|
||||||
mIsSharedSupported,
|
mIsShareSupported,
|
||||||
getStorageManager(),
|
getStorageManager(),
|
||||||
getAccount(),
|
getAccount(),
|
||||||
getContext()
|
getContext()
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* ownCloud Android client application
|
||||||
|
* Copyright (C) 2012-2014 ownCloud Inc.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2,
|
||||||
|
* as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.owncloud.android.ui.activity;
|
||||||
|
|
||||||
|
import com.owncloud.android.R;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.ClipData;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.text.ClipboardManager;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Activity copying the text of the received Intent into the system clibpoard.
|
||||||
|
*
|
||||||
|
* @author David A. Velasco
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
public class CopyToClipboardActivity extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
// get the clipboard system service
|
||||||
|
ClipboardManager clipboardManager = (ClipboardManager) this.getSystemService(CLIPBOARD_SERVICE);
|
||||||
|
|
||||||
|
// get the text to copy into the clipboard
|
||||||
|
Intent intent = getIntent();
|
||||||
|
CharSequence text = intent.getCharSequenceExtra(Intent.EXTRA_TEXT);
|
||||||
|
|
||||||
|
// and put the text the clipboard
|
||||||
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
|
||||||
|
// API level >= 11 -> modern Clipboard
|
||||||
|
ClipData clip = ClipData.newPlainText("ownCloud was here", text);
|
||||||
|
((android.content.ClipboardManager)clipboardManager).setPrimaryClip(clip);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// API level >= 11 -> legacy Clipboard
|
||||||
|
clipboardManager.setText(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// alert the user that the text is in the clipboard and we're done
|
||||||
|
Toast.makeText(this, R.string.clipboard_text_copied, Toast.LENGTH_SHORT).show();
|
||||||
|
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -43,6 +43,7 @@ import com.actionbarsherlock.app.SherlockDialogFragment;
|
||||||
import com.owncloud.android.R;
|
import com.owncloud.android.R;
|
||||||
import com.owncloud.android.datamodel.OCFile;
|
import com.owncloud.android.datamodel.OCFile;
|
||||||
import com.owncloud.android.files.FileOperationsHelper;
|
import com.owncloud.android.files.FileOperationsHelper;
|
||||||
|
import com.owncloud.android.ui.activity.CopyToClipboardActivity;
|
||||||
import com.owncloud.android.ui.activity.FileActivity;
|
import com.owncloud.android.ui.activity.FileActivity;
|
||||||
import com.owncloud.android.utils.Log_OC;
|
import com.owncloud.android.utils.Log_OC;
|
||||||
|
|
||||||
|
@ -52,19 +53,19 @@ import com.owncloud.android.utils.Log_OC;
|
||||||
*
|
*
|
||||||
* @author David A. Velasco
|
* @author David A. Velasco
|
||||||
*/
|
*/
|
||||||
public class ActivityChooserDialog extends SherlockDialogFragment {
|
public class ShareLinkToDialog extends SherlockDialogFragment {
|
||||||
|
|
||||||
private final static String TAG = ActivityChooserDialog.class.getSimpleName();
|
private final static String TAG = ShareLinkToDialog.class.getSimpleName();
|
||||||
private final static String ARG_INTENT = ActivityChooserDialog.class.getSimpleName() + ".ARG_INTENT";
|
private final static String ARG_INTENT = ShareLinkToDialog.class.getSimpleName() + ".ARG_INTENT";
|
||||||
private final static String ARG_PACKAGES_TO_EXCLUDE = ActivityChooserDialog.class.getSimpleName() + ".ARG_PACKAGES_TO_EXCLUDE";
|
private final static String ARG_PACKAGES_TO_EXCLUDE = ShareLinkToDialog.class.getSimpleName() + ".ARG_PACKAGES_TO_EXCLUDE";
|
||||||
private final static String ARG_FILE_TO_SHARE = ActivityChooserDialog.class.getSimpleName() + ".FILE_TO_SHARE";
|
private final static String ARG_FILE_TO_SHARE = ShareLinkToDialog.class.getSimpleName() + ".FILE_TO_SHARE";
|
||||||
|
|
||||||
private ActivityAdapter mAdapter;
|
private ActivityAdapter mAdapter;
|
||||||
private OCFile mFile;
|
private OCFile mFile;
|
||||||
private Intent mIntent;
|
private Intent mIntent;
|
||||||
|
|
||||||
public static ActivityChooserDialog newInstance(Intent intent, String[] packagesToExclude, OCFile fileToShare) {
|
public static ShareLinkToDialog newInstance(Intent intent, String[] packagesToExclude, OCFile fileToShare) {
|
||||||
ActivityChooserDialog f = new ActivityChooserDialog();
|
ShareLinkToDialog f = new ShareLinkToDialog();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putParcelable(ARG_INTENT, intent);
|
args.putParcelable(ARG_INTENT, intent);
|
||||||
args.putStringArray(ARG_PACKAGES_TO_EXCLUDE, packagesToExclude);
|
args.putStringArray(ARG_PACKAGES_TO_EXCLUDE, packagesToExclude);
|
||||||
|
@ -73,7 +74,7 @@ public class ActivityChooserDialog extends SherlockDialogFragment {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActivityChooserDialog() {
|
public ShareLinkToDialog() {
|
||||||
super();
|
super();
|
||||||
Log_OC.d(TAG, "constructor");
|
Log_OC.d(TAG, "constructor");
|
||||||
}
|
}
|
||||||
|
@ -95,6 +96,14 @@ public class ActivityChooserDialog extends SherlockDialogFragment {
|
||||||
it.remove();
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add activity for copy to clipboard
|
||||||
|
Intent copyToClipboardIntent = new Intent(getSherlockActivity(), CopyToClipboardActivity.class);
|
||||||
|
List<ResolveInfo> copyToClipboard = pm.queryIntentActivities(copyToClipboardIntent, 0);
|
||||||
|
if (!copyToClipboard.isEmpty()) {
|
||||||
|
activities.add(copyToClipboard.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
Collections.sort(activities, new ResolveInfo.DisplayNameComparator(pm));
|
Collections.sort(activities, new ResolveInfo.DisplayNameComparator(pm));
|
||||||
mAdapter = new ActivityAdapter(getSherlockActivity(), pm, activities);
|
mAdapter = new ActivityAdapter(getSherlockActivity(), pm, activities);
|
||||||
|
|
||||||
|
@ -103,7 +112,7 @@ public class ActivityChooserDialog extends SherlockDialogFragment {
|
||||||
if (sendAction) {
|
if (sendAction) {
|
||||||
|
|
||||||
return new AlertDialog.Builder(getSherlockActivity())
|
return new AlertDialog.Builder(getSherlockActivity())
|
||||||
.setTitle(R.string.activity_chooser_title)
|
.setTitle(R.string.activity_chooser_send_file_title)
|
||||||
.setAdapter(mAdapter, new DialogInterface.OnClickListener() {
|
.setAdapter(mAdapter, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
@ -121,7 +130,7 @@ public class ActivityChooserDialog extends SherlockDialogFragment {
|
||||||
.create();
|
.create();
|
||||||
} else {
|
} else {
|
||||||
return new AlertDialog.Builder(getSherlockActivity())
|
return new AlertDialog.Builder(getSherlockActivity())
|
||||||
.setTitle(R.string.activity_chooser_send_file_title)
|
.setTitle(R.string.activity_chooser_title)
|
||||||
.setAdapter(mAdapter, new DialogInterface.OnClickListener() {
|
.setAdapter(mAdapter, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
Loading…
Reference in a new issue