Skip to content

Commit fa61d12

Browse files
fesaveabelgardep
authored andcommitted
Improved copy/move dialog
1 parent 8c427b7 commit fa61d12

4 files changed

Lines changed: 22 additions & 11 deletions

File tree

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

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

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

72-
private static final String IS_ACTION_COPY = "IS_ACTION_COPY";
72+
private static final String ACTION_BUTTON = "ACTION_BUTTON";
7373

7474
private LocalBroadcastManager mLocalBroadcastManager;
7575
private SyncBroadcastReceiver mSyncBroadcastReceiver;
@@ -174,13 +174,18 @@ public void setBackgroundText() {
174174
}
175175

176176
private void setActionButtonText() {
177-
boolean isActionCopy = getIntent().getBooleanExtra(IS_ACTION_COPY, false);
177+
FolderPickerActivity.ACTION_BUTTON actionButton = (FolderPickerActivity.ACTION_BUTTON) getIntent().getSerializableExtra(ACTION_BUTTON);
178178
Button chooseButton = findViewById(R.id.folder_picker_btn_choose);
179179

180-
if (isActionCopy) {
181-
chooseButton.setText(getString(android.R.string.copy));
182-
} else {
183-
chooseButton.setText(getString(R.string.actionbar_move));
180+
if (actionButton != null) {
181+
switch (actionButton) {
182+
case MOVE:
183+
chooseButton.setText(getString(R.string.folder_picker_move_here_button_text));
184+
break;
185+
case COPY:
186+
chooseButton.setText(getString(R.string.folder_picker_copy_here_button_text));
187+
break;
188+
}
184189
}
185190
}
186191

@@ -525,4 +530,8 @@ private void refreshList(boolean ignoreETag) {
525530
}
526531
}
527532
}
533+
534+
public enum ACTION_BUTTON {
535+
MOVE, COPY
536+
}
528537
}

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public class OCFileListFragment extends ExtendedListFragment implements
115115

116116
private static final String GRID_IS_PREFERED_PREFERENCE = "gridIsPrefered";
117117

118-
private static final String IS_ACTION_COPY = "IS_ACTION_COPY";
118+
private static final String ACTION_BUTTON = "ACTION_BUTTON";
119119

120120
private static String DIALOG_CREATE_FOLDER = "DIALOG_CREATE_FOLDER";
121121

@@ -1002,13 +1002,14 @@ private boolean onFileActionChosen(int menuId) {
10021002
}
10031003
case R.id.action_move: {
10041004
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
1005+
action.putExtra(ACTION_BUTTON, FolderPickerActivity.ACTION_BUTTON.MOVE);
10051006
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, checkedFiles);
10061007
requireActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__MOVE_FILES);
10071008
return true;
10081009
}
10091010
case R.id.action_copy:
10101011
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
1011-
action.putExtra(IS_ACTION_COPY, true);
1012+
action.putExtra(ACTION_BUTTON, FolderPickerActivity.ACTION_BUTTON.COPY);
10121013
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, checkedFiles);
10131014
requireActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__COPY_FILES);
10141015
return true;

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ 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"
2019
android:id="@+id/filesFolderPickerLayout"
2120
android:layout_width="match_parent"
2221
android:layout_height="match_parent"
@@ -58,8 +57,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
5857
android:layout_width="wrap_content"
5958
android:layout_height="wrap_content"
6059
android:layout_weight="1"
61-
android:theme="@style/Button.Primary"
62-
tools:text="@string/upload_copy_files" />
60+
android:text="@string/folder_picker_choose_button_text"
61+
android:theme="@style/Button.Primary" />
6362

6463
</LinearLayout>
6564

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)