Skip to content

Commit 55a0068

Browse files
fesaveabelgardep
authored andcommitted
Improved copy/move dialog
1 parent 19c06c4 commit 55a0068

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

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

Lines changed: 16 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+
private static final String IS_ACTION_COPY = "IS_ACTION_COPY";
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,17 @@ public void setBackgroundText() {
168173
}
169174
}
170175

176+
private void setActionButtonText() {
177+
boolean isActionCopy = getIntent().getBooleanExtra(IS_ACTION_COPY, false);
178+
Button chooseButton = findViewById(R.id.folder_picker_btn_choose);
179+
180+
if (isActionCopy) {
181+
chooseButton.setText(getString(android.R.string.copy));
182+
} else {
183+
chooseButton.setText(getString(R.string.actionbar_move));
184+
}
185+
}
186+
171187
protected OCFileListFragment getListOfFilesFragment() {
172188
Fragment listOfFiles = getSupportFragmentManager().findFragmentByTag(FolderPickerActivity.TAG_LIST_OF_FOLDERS);
173189
if (listOfFiles != null) {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ 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";
119+
118120
private static String DIALOG_CREATE_FOLDER = "DIALOG_CREATE_FOLDER";
119121

120122
private final String ALL_FILES_SAF_REGEX = "*/*";
@@ -1006,6 +1008,7 @@ private boolean onFileActionChosen(int menuId) {
10061008
}
10071009
case R.id.action_copy:
10081010
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
1011+
action.putExtra(IS_ACTION_COPY, true);
10091012
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, checkedFiles);
10101013
requireActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__COPY_FILES);
10111014
return true;
@@ -1269,7 +1272,7 @@ private void showSnackMessage(int messageResource) {
12691272
snackbar.show();
12701273
}
12711274

1272-
public void setSearchListener(SearchView searchView){
1275+
public void setSearchListener(SearchView searchView) {
12731276
searchView.setOnQueryTextFocusChangeListener(this);
12741277
searchView.setOnQueryTextListener(this);
12751278
}

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

Lines changed: 4 additions & 3 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-
android:theme="@style/Button.Primary" />
61+
android:theme="@style/Button.Primary"
62+
tools:text="@string/upload_copy_files" />
6263

6364
</LinearLayout>
6465

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

0 commit comments

Comments
 (0)