diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FilePicker.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FilePicker.java index 35e974a818..a198556574 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FilePicker.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/FilePicker.java @@ -4,16 +4,21 @@ import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting; import org.dolphinemu.dolphinemu.features.settings.model.AbstractStringSetting; import org.dolphinemu.dolphinemu.features.settings.model.Settings; +import androidx.annotation.Nullable; + public final class FilePicker extends SettingsItem { private AbstractStringSetting mSetting; private int mRequestType; + private String mDefaultPathRelativeToUserDirectory; - public FilePicker(AbstractStringSetting setting, int titleId, int descriptionId, int requestType) + public FilePicker(AbstractStringSetting setting, int titleId, int descriptionId, int requestType, + @Nullable String defaultPathRelativeToUserDirectory) { super(titleId, descriptionId); mSetting = setting; mRequestType = requestType; + mDefaultPathRelativeToUserDirectory = defaultPathRelativeToUserDirectory; } public String getSelectedValue(Settings settings) @@ -31,6 +36,12 @@ public final class FilePicker extends SettingsItem return mRequestType; } + @Nullable + public String getDefaultPathRelativeToUserDirectory() + { + return mDefaultPathRelativeToUserDirectory; + } + @Override public int getType() { diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java index ceb8cc577e..e36a960179 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java @@ -342,17 +342,17 @@ public final class SettingsFragmentPresenter sl.add(new CheckBoxSetting(BooleanSetting.MAIN_RECURSIVE_ISO_PATHS, R.string.search_subfolders, 0)); sl.add(new FilePicker(StringSetting.MAIN_DEFAULT_ISO, R.string.default_ISO, 0, - MainPresenter.REQUEST_GAME_FILE)); + MainPresenter.REQUEST_GAME_FILE, null)); sl.add(new FilePicker(StringSetting.MAIN_FS_PATH, R.string.wii_NAND_root, 0, - MainPresenter.REQUEST_DIRECTORY)); + MainPresenter.REQUEST_DIRECTORY, "/Wii")); sl.add(new FilePicker(StringSetting.MAIN_DUMP_PATH, R.string.dump_path, 0, - MainPresenter.REQUEST_DIRECTORY)); + MainPresenter.REQUEST_DIRECTORY, "/Dump")); sl.add(new FilePicker(StringSetting.MAIN_LOAD_PATH, R.string.load_path, 0, - MainPresenter.REQUEST_DIRECTORY)); + MainPresenter.REQUEST_DIRECTORY, "/Load")); sl.add(new FilePicker(StringSetting.MAIN_RESOURCEPACK_PATH, R.string.resource_pack_path, 0, - MainPresenter.REQUEST_DIRECTORY)); + MainPresenter.REQUEST_DIRECTORY, "/ResourcePacks")); sl.add(new FilePicker(StringSetting.MAIN_SD_PATH, R.string.SD_card_path, 0, - MainPresenter.REQUEST_SD_FILE)); + MainPresenter.REQUEST_SD_FILE, "/Wii/sd.raw")); sl.add(new ConfirmRunnable(R.string.reset_paths, 0, R.string.reset_paths_confirmation, 0, mView.getAdapter()::resetPaths)); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.java index 67266d8c64..39b17d587a 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/FilePickerViewHolder.java @@ -1,5 +1,6 @@ package org.dolphinemu.dolphinemu.features.settings.ui.viewholder; +import android.text.TextUtils; import android.view.View; import android.widget.TextView; @@ -8,6 +9,7 @@ import org.dolphinemu.dolphinemu.features.settings.model.view.FilePicker; import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; import org.dolphinemu.dolphinemu.features.settings.ui.SettingsAdapter; import org.dolphinemu.dolphinemu.ui.main.MainPresenter; +import org.dolphinemu.dolphinemu.utils.DirectoryInitialization; public final class FilePickerViewHolder extends SettingViewHolder { @@ -43,7 +45,18 @@ public final class FilePickerViewHolder extends SettingViewHolder } else { - mTextSettingDescription.setText(mFilePicker.getSelectedValue(getAdapter().getSettings())); + String path = mFilePicker.getSelectedValue(getAdapter().getSettings()); + + if (TextUtils.isEmpty(path)) + { + String defaultPathRelative = mFilePicker.getDefaultPathRelativeToUserDirectory(); + if (defaultPathRelative != null) + { + path = DirectoryInitialization.getUserDirectory() + defaultPathRelative; + } + } + + mTextSettingDescription.setText(path); } setStyle(mTextSettingName, mItem);