Changes after CR

This commit is contained in:
jabarros 2014-11-26 09:05:23 +01:00
parent 8005f8c6fe
commit 5c0e9ca5f2
7 changed files with 32 additions and 82 deletions

View file

@ -191,7 +191,7 @@
android:icon="@drawable/copy_link"/>
<activity
android:name=".ui.activity.MoveActivity"
android:name=".ui.activity.FolderPickerActivity"
android:label="@string/app_name"/>
<activity

View file

@ -32,7 +32,9 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/prefs_category_instant_uploading">
<com.owncloud.android.ui.PreferenceWithLongSummary android:title="@string/prefs_instant_upload_path_title" android:key="instant_upload_path" />
<com.owncloud.android.ui.PreferenceWithLongSummary
android:title="@string/prefs_instant_upload_path_title"
android:key="instant_upload_path" />
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_uploading"
android:title="@string/prefs_instant_upload"
android:summary="@string/prefs_instant_upload_summary"/>
@ -40,7 +42,9 @@
android:disableDependentsState="true"
android:title="@string/instant_upload_on_wifi"
android:key="instant_upload_on_wifi"/>
<com.owncloud.android.ui.PreferenceWithLongSummary android:title="@string/prefs_instant_video_upload_path_title" android:key="instant_video_upload_path" />
<com.owncloud.android.ui.PreferenceWithLongSummary
android:title="@string/prefs_instant_video_upload_path_title"
android:key="instant_video_upload_path" />
<com.owncloud.android.ui.CheckBoxPreferenceWithLongTitle android:key="instant_video_uploading"
android:title="@string/prefs_instant_video_upload"
android:summary="@string/prefs_instant_video_upload_summary"/>

View file

@ -615,8 +615,7 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
} else if (requestCode == ACTION_SELECT_MULTIPLE_FILES && (resultCode == RESULT_OK || resultCode == UploadFilesActivity.RESULT_OK_AND_MOVE)) {
requestMultipleUpload(data, resultCode);
} else if (requestCode == ACTION_MOVE_FILES && (resultCode == RESULT_OK ||
resultCode == MoveActivity.RESULT_OK_AND_MOVE)){
} else if (requestCode == ACTION_MOVE_FILES && resultCode == RESULT_OK){
final Intent fData = data;
final int fResultCode = resultCode;
@ -744,8 +743,8 @@ OnSslUntrustedCertListener, OnEnforceableRefreshListener {
* @param resultCode Result code received
*/
private void requestMoveOperation(Intent data, int resultCode) {
OCFile folderToMoveAt = (OCFile) data.getParcelableExtra(MoveActivity.EXTRA_CURRENT_FOLDER);
OCFile targetFile = (OCFile) data.getParcelableExtra(MoveActivity.EXTRA_TARGET_FILE);
OCFile folderToMoveAt = (OCFile) data.getParcelableExtra(FolderPickerActivity.EXTRA_CURRENT_FOLDER);
OCFile targetFile = (OCFile) data.getParcelableExtra(FolderPickerActivity.EXTRA_TARGET_FILE);
getFileOperationsHelper().moveFile(folderToMoveAt, targetFile);
}

View file

@ -65,11 +65,11 @@ import com.owncloud.android.lib.common.utils.Log_OC;
public class FolderPickerActivity extends FileActivity implements FileFragment.ContainerActivity,
OnClickListener, OnEnforceableRefreshListener {
public static final String EXTRA_CURRENT_FOLDER = UploadFilesActivity.class.getCanonicalName() + ".EXTRA_CURRENT_FOLDER";
public static final String EXTRA_TARGET_FILE = UploadFilesActivity.class.getCanonicalName() + "EXTRA_TARGET_FILE";
public static final String EXTRA_CURRENT_FOLDER = UploadFilesActivity.class.getCanonicalName()
+ ".EXTRA_CURRENT_FOLDER";
public static final String EXTRA_TARGET_FILE = UploadFilesActivity.class.getCanonicalName()
+ "EXTRA_TARGET_FILE";
public static final int RESULT_OK = 1;
private SyncBroadcastReceiver mSyncBroadcastReceiver;
private static final String TAG = FolderPickerActivity.class.getSimpleName();
@ -118,11 +118,6 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
getSupportActionBar().setIcon(DisplayUtils.getSeasonalIconId());
}
@Override
protected void onDestroy() {
super.onDestroy();
}
/**
* Called when the ownCloud {@link Account} associated to the Activity was just updated.
*/
@ -436,8 +431,10 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
Log_OC.d(TAG, "Received broadcast " + event);
String accountName = intent.getStringExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME);
String synchFolderRemotePath = intent.getStringExtra(FileSyncAdapter.EXTRA_FOLDER_PATH);
RemoteOperationResult synchResult = (RemoteOperationResult)intent.getSerializableExtra(FileSyncAdapter.EXTRA_RESULT);
boolean sameAccount = (getAccount() != null && accountName.equals(getAccount().name) && getStorageManager() != null);
RemoteOperationResult synchResult = (RemoteOperationResult)intent.
getSerializableExtra(FileSyncAdapter.EXTRA_RESULT);
boolean sameAccount = (getAccount() != null &&
accountName.equals(getAccount().name) && getStorageManager() != null);
if (sameAccount) {
@ -445,13 +442,17 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
mSyncInProgress = true;
} else {
OCFile currentFile = (getFile() == null) ? null : getStorageManager().getFileByPath(getFile().getRemotePath());
OCFile currentDir = (getCurrentFolder() == null) ? null : getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
OCFile currentFile = (getFile() == null) ? null :
getStorageManager().getFileByPath(getFile().getRemotePath());
OCFile currentDir = (getCurrentFolder() == null) ? null :
getStorageManager().getFileByPath(getCurrentFolder().getRemotePath());
if (currentDir == null) {
// current folder was removed from the server
Toast.makeText( FolderPickerActivity.this,
String.format(getString(R.string.sync_current_folder_was_removed), getCurrentFolder().getFileName()),
String.format(
getString(R.string.sync_current_folder_was_removed),
getCurrentFolder().getFileName()),
Toast.LENGTH_LONG)
.show();
browseToRoot();
@ -462,7 +463,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
currentFile = currentDir;
}
if (synchFolderRemotePath != null && currentDir.getRemotePath().equals(synchFolderRemotePath)) {
if (synchFolderRemotePath != null && currentDir.getRemotePath().
equals(synchFolderRemotePath)) {
OCFileListFragment fileListFragment = getListOfFilesFragment();
if (fileListFragment != null) {
fileListFragment.listDirectory(currentDir);
@ -471,7 +473,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
setFile(currentFile);
}
mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) && !SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
mSyncInProgress = (!FileSyncAdapter.EVENT_FULL_SYNC_END.equals(event) &&
!SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_SHARES_SYNCED.equals(event));
if (SynchronizeFolderOperation.EVENT_SINGLE_FOLDER_CONTENTS_SYNCED.
equals(event) &&

View file

@ -1,52 +0,0 @@
/* 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 android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.ui.fragment.FileFragment;
public class MoveActivity extends FolderPickerActivity implements FileFragment.ContainerActivity,
OnClickListener, OnEnforceableRefreshListener {
public static final int RESULT_OK_AND_MOVE = 1;
@Override
public void onClick(View v) {
if (v == mCancelBtn) {
finish();
} else if (v == mChooseBtn) {
Intent i = getIntent();
OCFile targetFile = (OCFile) i.getParcelableExtra(MoveActivity.EXTRA_TARGET_FILE);
Intent data = new Intent();
data.putExtra(EXTRA_CURRENT_FOLDER, getCurrentFolder());
data.putExtra(EXTRA_TARGET_FILE, targetFile);
setResult(RESULT_OK_AND_MOVE, data);
finish();
}
}
}

View file

@ -82,12 +82,8 @@ public class UploadPathActivity extends FolderPickerActivity implements FileFrag
if (v == mCancelBtn) {
finish();
} else if (v == mChooseBtn) {
Intent i = getIntent();
OCFile targetFile = (OCFile) i.getParcelableExtra(UploadPathActivity.EXTRA_TARGET_FILE);
Intent data = new Intent();
data.putExtra(EXTRA_CURRENT_FOLDER, getCurrentFolder());
data.putExtra(EXTRA_TARGET_FILE, targetFile);
setResult(RESULT_OK_SET_UPLOAD_PATH, data);
finish();
}

View file

@ -36,7 +36,7 @@ import com.owncloud.android.datamodel.OCFile;
import com.owncloud.android.files.FileMenuFilter;
import com.owncloud.android.lib.common.utils.Log_OC;
import com.owncloud.android.ui.activity.FileDisplayActivity;
import com.owncloud.android.ui.activity.MoveActivity;
import com.owncloud.android.ui.activity.FolderPickerActivity;
import com.owncloud.android.ui.activity.OnEnforceableRefreshListener;
import com.owncloud.android.ui.adapter.FileListListAdapter;
import com.owncloud.android.ui.dialog.ConfirmationDialogFragment;
@ -322,10 +322,10 @@ public class OCFileListFragment extends ExtendedListFragment {
return true;
}
case R.id.action_move: {
Intent action = new Intent(getActivity(), MoveActivity.class);
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
// Pass mTargetFile that contains info of selected file/folder
action.putExtra(MoveActivity.EXTRA_TARGET_FILE, mTargetFile);
action.putExtra(FolderPickerActivity.EXTRA_TARGET_FILE, mTargetFile);
getActivity().startActivityForResult(action, FileDisplayActivity.ACTION_MOVE_FILES);
return true;
}