Skip to content

Commit c880eed

Browse files
authored
Merge pull request #3640 from owncloud/feature/improve_copy_move
Improved copy/move dialog
2 parents 19c06c4 + 42ed297 commit c880eed

8 files changed

Lines changed: 54 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Summary
2323
* Enhancement - New option to show or not hidden files: [#2578](https://github.com/owncloud/android/issues/2578)
2424
* Enhancement - Option to allow screenshots or not in Android Enterprise: [#3625](https://github.com/owncloud/android/issues/3625)
2525
* Enhancement - Full name is shown in shares: [#1106](https://github.com/owncloud/android/issues/1106)
26+
* Enhancement - Improved copy/move dialog: [#1414](https://github.com/owncloud/android/issues/1414)
2627
* Enhancement - Thumbnail click action in file detail: [#3653](https://github.com/owncloud/android/pull/3653)
2728

2829
Details
@@ -144,6 +145,14 @@ Details
144145
https://github.com/owncloud/android/issues/1106
145146
https://github.com/owncloud/android/pull/3636
146147

148+
* Enhancement - Improved copy/move dialog: [#1414](https://github.com/owncloud/android/issues/1414)
149+
150+
Previously,they appeared exactly the same and there was no way of knowing which was which. Now
151+
they are differentiated by the text on the action button.
152+
153+
https://github.com/owncloud/android/issues/1414
154+
https://github.com/owncloud/android/pull/3640
155+
147156
* Enhancement - Thumbnail click action in file detail: [#3653](https://github.com/owncloud/android/pull/3653)
148157

149158
When a user clicks on a file's detail view thumbnail, the file is automatically downloaded and

changelog/unreleased/3640

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Enhancement: Improved copy/move dialog
2+
3+
Previously,they appeared exactly the same and there was no way of knowing which was which.
4+
Now they are differentiated by the text on the action button.
5+
6+
https://github.com/owncloud/android/issues/1414
7+
https://github.com/owncloud/android/pull/3640

owncloudApp/src/main/java/com/owncloud/android/presentation/ui/settings/fragments/SettingsPictureUploadsFragment.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import com.owncloud.android.db.PreferenceManager.PREF__CAMERA_PICTURE_UPLOADS_WI
4949
import com.owncloud.android.domain.camerauploads.model.FolderBackUpConfiguration
5050
import com.owncloud.android.extensions.showAlertDialog
5151
import com.owncloud.android.presentation.viewmodels.settings.SettingsPictureUploadsViewModel
52+
import com.owncloud.android.ui.activity.FolderPickerActivity
5253
import com.owncloud.android.ui.activity.UploadPathActivity
5354
import com.owncloud.android.utils.DisplayUtils
5455
import kotlinx.coroutines.launch
@@ -167,6 +168,7 @@ class SettingsPictureUploadsFragment : PreferenceFragmentCompat() {
167168
}
168169
val intent = Intent(activity, UploadPathActivity::class.java).apply {
169170
putExtra(UploadPathActivity.KEY_CAMERA_UPLOAD_PATH, uploadPath)
171+
putExtra(FolderPickerActivity.EXTRA_PICKER_OPTION, FolderPickerActivity.PickerMode.CAMERA_FOLDER)
170172
putExtra(UploadPathActivity.KEY_CAMERA_UPLOAD_ACCOUNT, picturesViewModel.getPictureUploadsAccount())
171173
}
172174
selectPictureUploadsPathLauncher.launch(intent)

owncloudApp/src/main/java/com/owncloud/android/presentation/ui/settings/fragments/SettingsVideoUploadsFragment.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import com.owncloud.android.db.PreferenceManager.PREF__CAMERA_VIDEO_UPLOADS_WIFI
4949
import com.owncloud.android.domain.camerauploads.model.FolderBackUpConfiguration
5050
import com.owncloud.android.extensions.showAlertDialog
5151
import com.owncloud.android.presentation.viewmodels.settings.SettingsVideoUploadsViewModel
52+
import com.owncloud.android.ui.activity.FolderPickerActivity
5253
import com.owncloud.android.ui.activity.UploadPathActivity
5354
import com.owncloud.android.utils.DisplayUtils
5455
import kotlinx.coroutines.launch
@@ -167,6 +168,7 @@ class SettingsVideoUploadsFragment : PreferenceFragmentCompat() {
167168
}
168169
val intent = Intent(activity, UploadPathActivity::class.java).apply {
169170
putExtra(UploadPathActivity.KEY_CAMERA_UPLOAD_PATH, uploadPath)
171+
putExtra(FolderPickerActivity.EXTRA_PICKER_OPTION, FolderPickerActivity.PickerMode.CAMERA_FOLDER)
170172
putExtra(UploadPathActivity.KEY_CAMERA_UPLOAD_ACCOUNT, videosViewModel.getVideoUploadsAccount())
171173
}
172174
selectVideoUploadsPathLauncher.launch(intent)

owncloudApp/src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ public class FolderPickerActivity extends FileActivity implements FileFragment.C
6969

7070
private static final String TAG_LIST_OF_FOLDERS = "LIST_OF_FOLDERS";
7171

72+
public static final String EXTRA_PICKER_OPTION = "EXTRA_PICKER_OPTION";
73+
7274
private LocalBroadcastManager mLocalBroadcastManager;
7375
private SyncBroadcastReceiver mSyncBroadcastReceiver;
7476
private boolean mSyncInProgress = false;
@@ -103,6 +105,9 @@ protected void onCreate(Bundle savedInstanceState) {
103105
// sets message for empty list of folders
104106
setBackgroundText();
105107

108+
// Set action button text
109+
setActionButtonText();
110+
106111
mLocalBroadcastManager = LocalBroadcastManager.getInstance(this);
107112

108113
Timber.d("onCreate() end");
@@ -168,6 +173,12 @@ public void setBackgroundText() {
168173
}
169174
}
170175

176+
private void setActionButtonText() {
177+
PickerMode actionButton = (PickerMode) getIntent().getSerializableExtra(EXTRA_PICKER_OPTION);
178+
Button chooseButton = findViewById(R.id.folder_picker_btn_choose);
179+
chooseButton.setText(getString(actionButton.getButtonString()));
180+
}
181+
171182
protected OCFileListFragment getListOfFilesFragment() {
172183
Fragment listOfFiles = getSupportFragmentManager().findFragmentByTag(FolderPickerActivity.TAG_LIST_OF_FOLDERS);
173184
if (listOfFiles != null) {
@@ -509,4 +520,19 @@ private void refreshList(boolean ignoreETag) {
509520
}
510521
}
511522
}
523+
524+
public enum PickerMode {
525+
MOVE, COPY, CAMERA_FOLDER;
526+
527+
public Integer getButtonString() {
528+
switch (this) {
529+
case MOVE:
530+
return R.string.folder_picker_move_here_button_text;
531+
case COPY:
532+
return R.string.folder_picker_copy_here_button_text;
533+
default:
534+
return R.string.folder_picker_choose_button_text;
535+
}
536+
}
537+
}
512538
}

owncloudApp/src/main/java/com/owncloud/android/ui/fragment/OCFileListFragment.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1000,12 +1000,14 @@ private boolean onFileActionChosen(int menuId) {
10001000
}
10011001
case R.id.action_move: {
10021002
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
1003+
action.putExtra(FolderPickerActivity.EXTRA_PICKER_OPTION, FolderPickerActivity.PickerMode.MOVE);
10031004
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, checkedFiles);
10041005
requireActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__MOVE_FILES);
10051006
return true;
10061007
}
10071008
case R.id.action_copy:
10081009
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
1010+
action.putExtra(FolderPickerActivity.EXTRA_PICKER_OPTION, FolderPickerActivity.PickerMode.COPY);
10091011
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, checkedFiles);
10101012
requireActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__COPY_FILES);
10111013
return true;
@@ -1269,7 +1271,7 @@ private void showSnackMessage(int messageResource) {
12691271
snackbar.show();
12701272
}
12711273

1272-
public void setSearchListener(SearchView searchView){
1274+
public void setSearchListener(SearchView searchView) {
12731275
searchView.setOnQueryTextFocusChangeListener(this);
12741276
searchView.setOnQueryTextListener(this);
12751277
}

owncloudApp/src/main/res/layout/files_folder_picker.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ You should have received a copy of the GNU General Public License
1616
along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
-->
1818
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
19+
xmlns:tools="http://schemas.android.com/tools"
1920
android:id="@+id/filesFolderPickerLayout"
2021
android:layout_width="match_parent"
2122
android:layout_height="match_parent"
@@ -57,9 +58,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5758
android:layout_width="wrap_content"
5859
android:layout_height="wrap_content"
5960
android:layout_weight="1"
60-
android:text="@string/folder_picker_choose_button_text"
61+
tools:text="@string/folder_picker_choose_button_text"
6162
android:theme="@style/Button.Primary" />
6263

6364
</LinearLayout>
6465

65-
</LinearLayout>
66+
</LinearLayout>

owncloudApp/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,8 @@
478478
<string name="actionbar_move">Move</string>
479479
<string name="file_list_empty_moving">Nothing in here. You can add a folder!</string>
480480
<string name="folder_picker_choose_button_text">Choose</string>
481+
<string name="folder_picker_move_here_button_text">Move Here</string>
482+
<string name="folder_picker_copy_here_button_text">Copy Here</string>
481483

482484
<string name="move_file_not_found">Unable to move. Please check whether the file exists</string>
483485
<string name="move_file_invalid_into_descendent">It is not possible to move a folder into a descendant</string>

0 commit comments

Comments
 (0)