Skip to content

Commit 8ee91db

Browse files
fesaveabelgardep
authored andcommitted
CR Suggestions
1 parent fa61d12 commit 8ee91db

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

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/ui/activity/FolderPickerActivity.java

Lines changed: 19 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 ACTION_BUTTON = "ACTION_BUTTON";
72+
public static final String EXTRA_PICKER_OPTION = "EXTRA_PICKER_OPTION";
7373

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

176176
private void setActionButtonText() {
177-
FolderPickerActivity.ACTION_BUTTON actionButton = (FolderPickerActivity.ACTION_BUTTON) getIntent().getSerializableExtra(ACTION_BUTTON);
177+
PickerMode actionButton = (PickerMode) getIntent().getSerializableExtra(EXTRA_PICKER_OPTION);
178178
Button chooseButton = findViewById(R.id.folder_picker_btn_choose);
179179

180180
if (actionButton != null) {
181181
switch (actionButton) {
182182
case MOVE:
183-
chooseButton.setText(getString(R.string.folder_picker_move_here_button_text));
183+
chooseButton.setText(getString(actionButton.getButtonString(PickerMode.MOVE)));
184184
break;
185185
case COPY:
186-
chooseButton.setText(getString(R.string.folder_picker_copy_here_button_text));
186+
chooseButton.setText(getString(actionButton.getButtonString(PickerMode.COPY)));
187187
break;
188+
default:
189+
chooseButton.setText(getString(actionButton.getButtonString(PickerMode.CAMERA_FOLDER)));
188190
}
189191
}
190192
}
@@ -531,7 +533,18 @@ private void refreshList(boolean ignoreETag) {
531533
}
532534
}
533535

534-
public enum ACTION_BUTTON {
535-
MOVE, COPY
536+
public enum PickerMode {
537+
MOVE, COPY, CAMERA_FOLDER;
538+
539+
public Integer getButtonString(PickerMode pickerMode) {
540+
switch (pickerMode) {
541+
case MOVE:
542+
return R.string.folder_picker_move_here_button_text;
543+
case COPY:
544+
return R.string.folder_picker_copy_here_button_text;
545+
default:
546+
return R.string.folder_picker_choose_button_text;
547+
}
548+
}
536549
}
537550
}

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

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

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

118-
private static final String ACTION_BUTTON = "ACTION_BUTTON";
119-
120118
private static String DIALOG_CREATE_FOLDER = "DIALOG_CREATE_FOLDER";
121119

122120
private final String ALL_FILES_SAF_REGEX = "*/*";
@@ -1002,14 +1000,14 @@ private boolean onFileActionChosen(int menuId) {
10021000
}
10031001
case R.id.action_move: {
10041002
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
1005-
action.putExtra(ACTION_BUTTON, FolderPickerActivity.ACTION_BUTTON.MOVE);
1003+
action.putExtra(FolderPickerActivity.EXTRA_PICKER_OPTION, FolderPickerActivity.PickerMode.MOVE);
10061004
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, checkedFiles);
10071005
requireActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__MOVE_FILES);
10081006
return true;
10091007
}
10101008
case R.id.action_copy:
10111009
Intent action = new Intent(getActivity(), FolderPickerActivity.class);
1012-
action.putExtra(ACTION_BUTTON, FolderPickerActivity.ACTION_BUTTON.COPY);
1010+
action.putExtra(FolderPickerActivity.EXTRA_PICKER_OPTION, FolderPickerActivity.PickerMode.COPY);
10131011
action.putParcelableArrayListExtra(FolderPickerActivity.EXTRA_FILES, checkedFiles);
10141012
requireActivity().startActivityForResult(action, FileDisplayActivity.REQUEST_CODE__COPY_FILES);
10151013
return true;

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

Lines changed: 2 additions & 1 deletion
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,7 +58,7 @@ 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>

0 commit comments

Comments
 (0)