diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.java index cb8443fb30..c83d4e292e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/model/view/RunRunnable.java @@ -4,20 +4,23 @@ package org.dolphinemu.dolphinemu.features.settings.model.view; import android.content.Context; +import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.features.settings.model.AbstractSetting; public final class RunRunnable extends SettingsItem { private final int mAlertText; private final int mToastTextAfterRun; + private final boolean mWorksDuringEmulation; private final Runnable mRunnable; public RunRunnable(Context context, int titleId, int descriptionId, int alertText, - int toastTextAfterRun, Runnable runnable) + int toastTextAfterRun, boolean worksDuringEmulation, Runnable runnable) { super(context, titleId, descriptionId); mAlertText = alertText; mToastTextAfterRun = toastTextAfterRun; + mWorksDuringEmulation = worksDuringEmulation; mRunnable = runnable; } @@ -47,4 +50,10 @@ public final class RunRunnable extends SettingsItem { return null; } + + @Override + public boolean isEditable() + { + return mWorksDuringEmulation || !NativeLibrary.IsRunning(); + } } 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 83f79b3aca..cb4fcc38fb 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 @@ -270,7 +270,7 @@ public final class SettingsFragmentPresenter sl.add(new SubmenuSetting(mContext, R.string.advanced_submenu, MenuTag.CONFIG_ADVANCED)); sl.add(new SubmenuSetting(mContext, R.string.log_submenu, MenuTag.CONFIG_LOG)); sl.add(new SubmenuSetting(mContext, R.string.debug_submenu, MenuTag.DEBUG)); - sl.add(new RunRunnable(mContext, R.string.user_data_submenu, 0, 0, 0, + sl.add(new RunRunnable(mContext, R.string.user_data_submenu, 0, 0, 0, false, () -> UserDataActivity.launch(mContext))); } @@ -291,7 +291,8 @@ public final class SettingsFragmentPresenter sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_ANALYTICS_ENABLED, R.string.analytics, 0)); sl.add(new RunRunnable(mContext, R.string.analytics_new_id, 0, - R.string.analytics_new_id_confirmation, 0, NativeLibrary::GenerateNewStatisticsId)); + R.string.analytics_new_id_confirmation, 0, true, + NativeLibrary::GenerateNewStatisticsId)); sl.add(new CheckBoxSetting(mContext, BooleanSetting.MAIN_ENABLE_SAVESTATES, R.string.enable_save_states, R.string.enable_save_states_description)); } @@ -520,10 +521,10 @@ public final class SettingsFragmentPresenter sl.add(new FilePicker(mContext, StringSetting.MAIN_WII_SD_CARD_SYNC_FOLDER_PATH, R.string.wii_sd_sync_folder, 0, MainPresenter.REQUEST_DIRECTORY, "/Load/WiiSDSync/")); sl.add(new RunRunnable(mContext, R.string.wii_sd_card_folder_to_file, 0, - R.string.wii_sd_card_folder_to_file_confirmation, 0, + R.string.wii_sd_card_folder_to_file_confirmation, 0, false, () -> convertOnThread(WiiUtils::syncSdFolderToSdImage))); sl.add(new RunRunnable(mContext, R.string.wii_sd_card_file_to_folder, 0, - R.string.wii_sd_card_file_to_folder_confirmation, 0, + R.string.wii_sd_card_file_to_folder_confirmation, 0, false, () -> convertOnThread(WiiUtils::syncSdImageToSdFolder))); sl.add(new HeaderSetting(mContext, R.string.wii_wiimote_settings, 0)); @@ -858,11 +859,11 @@ public final class SettingsFragmentPresenter sl.add(new SingleChoiceSetting(mContext, IntSetting.LOGGER_VERBOSITY, R.string.log_verbosity, 0, getLogVerbosityEntries(), getLogVerbosityValues())); sl.add(new RunRunnable(mContext, R.string.log_enable_all, 0, - R.string.log_enable_all_confirmation, 0, () -> setAllLogTypes(true))); + R.string.log_enable_all_confirmation, 0, true, () -> setAllLogTypes(true))); sl.add(new RunRunnable(mContext, R.string.log_disable_all, 0, - R.string.log_disable_all_confirmation, 0, () -> setAllLogTypes(false))); + R.string.log_disable_all_confirmation, 0, true, () -> setAllLogTypes(false))); sl.add(new RunRunnable(mContext, R.string.log_clear, 0, R.string.log_clear_confirmation, 0, - SettingsAdapter::clearLog)); + true, SettingsAdapter::clearLog)); sl.add(new HeaderSetting(mContext, R.string.log_types, 0)); for (Map.Entry entry : LOG_TYPE_NAMES.entrySet()) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RunRunnableViewHolder.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RunRunnableViewHolder.java index cc78143c8c..6104a2aa2e 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RunRunnableViewHolder.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/viewholder/RunRunnableViewHolder.java @@ -40,11 +40,19 @@ public final class RunRunnableViewHolder extends SettingViewHolder mBinding.textSettingName.setText(item.getName()); mBinding.textSettingDescription.setText(item.getDescription()); + + setStyle(mBinding.textSettingName, mItem); } @Override public void onClick(View clicked) { + if (!mItem.isEditable()) + { + showNotRuntimeEditableError(); + return; + } + int alertTextID = mItem.getAlertText(); if (alertTextID > 0)