Merge pull request #10608 from t895/theme-refactor

Android: Modernize theming system
This commit is contained in:
JosJuice 2022-05-08 11:37:35 +02:00 committed by GitHub
commit 31232f8c23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 120 additions and 145 deletions

View File

@ -49,7 +49,7 @@
<activity <activity
android:name=".ui.main.MainActivity" android:name=".ui.main.MainActivity"
android:exported="true" android:exported="true"
android:theme="@style/DolphinBase"> android:theme="@style/Theme.Dolphin.Main">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. --> <!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
<intent-filter> <intent-filter>
@ -62,7 +62,7 @@
<activity <activity
android:name=".ui.main.TvMainActivity" android:name=".ui.main.TvMainActivity"
android:exported="true" android:exported="true"
android:theme="@style/DolphinTvBase"> android:theme="@style/Theme.Dolphin.TV">
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. --> <!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
<intent-filter> <intent-filter>
@ -76,26 +76,26 @@
android:name=".features.settings.ui.SettingsActivity" android:name=".features.settings.ui.SettingsActivity"
android:exported="false" android:exported="false"
android:configChanges="orientation|screenSize" android:configChanges="orientation|screenSize"
android:theme="@style/DolphinSettingsBase" android:theme="@style/Theme.Dolphin.Settings"
android:label="@string/settings"/> android:label="@string/settings"/>
<activity <activity
android:name=".features.cheats.ui.CheatsActivity" android:name=".features.cheats.ui.CheatsActivity"
android:exported="false" android:exported="false"
android:theme="@style/DolphinSettingsBase" android:theme="@style/Theme.Dolphin.Settings"
android:label="@string/cheats"/> android:label="@string/cheats"/>
<activity <activity
android:name=".activities.EmulationActivity" android:name=".activities.EmulationActivity"
android:exported="false" android:exported="false"
android:theme="@style/DolphinEmulationBase" android:theme="@style/Theme.Dolphin.Main.Emulation"
android:preferMinimalPostProcessing="true"/> android:preferMinimalPostProcessing="true"/>
<activity <activity
android:name=".activities.CustomFilePickerActivity" android:name=".activities.CustomFilePickerActivity"
android:exported="false" android:exported="false"
android:label="@string/app_name" android:label="@string/app_name"
android:theme="@style/FilePickerTheme"> android:theme="@style/Theme.Dolphin.FilePicker">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.GET_CONTENT"/> <action android:name="android.intent.action.GET_CONTENT"/>
@ -119,18 +119,18 @@
<activity <activity
android:name=".activities.ConvertActivity" android:name=".activities.ConvertActivity"
android:exported="false" android:exported="false"
android:theme="@style/DolphinBase" /> android:theme="@style/Theme.Dolphin.Main" />
<activity <activity
android:name=".activities.UserDataActivity" android:name=".activities.UserDataActivity"
android:exported="false" android:exported="false"
android:label="@string/user_data_submenu" android:label="@string/user_data_submenu"
android:theme="@style/DolphinSettingsBase" /> android:theme="@style/Theme.Dolphin.Settings" />
<activity <activity
android:name=".features.riivolution.ui.RiivolutionBootActivity" android:name=".features.riivolution.ui.RiivolutionBootActivity"
android:exported="false" android:exported="false"
android:theme="@style/DolphinBase" /> android:theme="@style/Theme.Dolphin.Main" />
<service <service
android:name=".services.SyncChannelJobService" android:name=".services.SyncChannelJobService"

View File

@ -197,7 +197,7 @@ public final class EmulationActivity extends AppCompatActivity
} }
else else
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(activity, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setMessage(R.string.unavailable_paths); builder.setMessage(R.string.unavailable_paths);
builder.setPositiveButton(R.string.yes, (dialogInterface, i) -> builder.setPositiveButton(R.string.yes, (dialogInterface, i) ->
SettingsActivity.launch(activity, MenuTag.CONFIG_PATHS)); SettingsActivity.launch(activity, MenuTag.CONFIG_PATHS));
@ -807,7 +807,7 @@ public final class EmulationActivity extends AppCompatActivity
private void toggleControls() private void toggleControls()
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.emulation_toggle_controls); builder.setTitle(R.string.emulation_toggle_controls);
if (!NativeLibrary.IsEmulatingWii() || mPreferences.getInt("wiiController", 3) == 0) if (!NativeLibrary.IsEmulatingWii() || mPreferences.getInt("wiiController", 3) == 0)
{ {
@ -869,7 +869,7 @@ public final class EmulationActivity extends AppCompatActivity
public void chooseDoubleTapButton() public void chooseDoubleTapButton()
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(this);
int currentController = int currentController =
mPreferences.getInt("wiiController", InputOverlay.OVERLAY_WIIMOTE_NUNCHUK); mPreferences.getInt("wiiController", InputOverlay.OVERLAY_WIIMOTE_NUNCHUK);
@ -955,7 +955,7 @@ public final class EmulationActivity extends AppCompatActivity
}); });
valueOpacity.setText(seekbarOpacity.getProgress() + "%"); valueOpacity.setText(seekbarOpacity.getProgress() + "%");
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.emulation_control_adjustments); builder.setTitle(R.string.emulation_control_adjustments);
builder.setView(view); builder.setView(view);
builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> builder.setPositiveButton(R.string.ok, (dialogInterface, i) ->
@ -977,7 +977,7 @@ public final class EmulationActivity extends AppCompatActivity
private void chooseController() private void chooseController()
{ {
final SharedPreferences.Editor editor = mPreferences.edit(); final SharedPreferences.Editor editor = mPreferences.edit();
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.emulation_choose_controller); builder.setTitle(R.string.emulation_choose_controller);
builder.setSingleChoiceItems(R.array.controllersEntries, builder.setSingleChoiceItems(R.array.controllersEntries,
mPreferences.getInt("wiiController", 3), mPreferences.getInt("wiiController", 3),
@ -999,7 +999,7 @@ public final class EmulationActivity extends AppCompatActivity
private void showMotionControlsOptions() private void showMotionControlsOptions()
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.emulation_motion_controls); builder.setTitle(R.string.emulation_motion_controls);
builder.setSingleChoiceItems(R.array.motionControlsEntries, builder.setSingleChoiceItems(R.array.motionControlsEntries,
IntSetting.MAIN_MOTION_CONTROLS.getInt(mSettings), IntSetting.MAIN_MOTION_CONTROLS.getInt(mSettings),
@ -1019,7 +1019,7 @@ public final class EmulationActivity extends AppCompatActivity
private void setIRMode() private void setIRMode()
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(R.string.emulation_ir_mode); builder.setTitle(R.string.emulation_ir_mode);
builder.setSingleChoiceItems(R.array.irModeEntries, builder.setSingleChoiceItems(R.array.irModeEntries,
IntSetting.MAIN_IR_MODE.getInt(mSettings), IntSetting.MAIN_IR_MODE.getInt(mSettings),
@ -1129,7 +1129,7 @@ public final class EmulationActivity extends AppCompatActivity
} }
}); });
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle(getString(R.string.emulation_ir_sensitivity)); builder.setTitle(getString(R.string.emulation_ir_sensitivity));
builder.setView(view); builder.setView(view);
builder.setPositiveButton(R.string.ok, (dialogInterface, i) -> builder.setPositiveButton(R.string.ok, (dialogInterface, i) ->
@ -1162,7 +1162,7 @@ public final class EmulationActivity extends AppCompatActivity
private void resetOverlay() private void resetOverlay()
{ {
new AlertDialog.Builder(this, R.style.DolphinDialogBase) new AlertDialog.Builder(this)
.setTitle(getString(R.string.emulation_touch_overlay_reset)) .setTitle(getString(R.string.emulation_touch_overlay_reset))
.setPositiveButton(R.string.yes, (dialogInterface, i) -> .setPositiveButton(R.string.yes, (dialogInterface, i) ->
mEmulationFragment.resetInputOverlay()) mEmulationFragment.resetInputOverlay())

View File

@ -100,7 +100,7 @@ public class UserDataActivity extends AppCompatActivity
{ {
Uri uri = data.getData(); Uri uri = data.getData();
AlertDialog.Builder builder = new AlertDialog.Builder(this, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(R.string.user_data_import_warning); builder.setMessage(R.string.user_data_import_warning);
builder.setNegativeButton(R.string.no, (dialog, i) -> dialog.dismiss()); builder.setNegativeButton(R.string.no, (dialog, i) -> dialog.dismiss());
@ -148,7 +148,7 @@ public class UserDataActivity extends AppCompatActivity
{ {
// Activity not found. Perhaps it was removed by the OEM, or by some new Android version // Activity not found. Perhaps it was removed by the OEM, or by some new Android version
// that didn't exist at the time of writing. Not much we can do other than tell the user // that didn't exist at the time of writing. Not much we can do other than tell the user
new AlertDialog.Builder(this, R.style.DolphinDialogBase) new AlertDialog.Builder(this)
.setMessage(R.string.user_data_open_system_file_manager_failed) .setMessage(R.string.user_data_open_system_file_manager_failed)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.show(); .show();

View File

@ -47,8 +47,7 @@ public final class AlertMessage extends DialogFragment
boolean isWarning = requireArguments().getBoolean(ARG_IS_WARNING); boolean isWarning = requireArguments().getBoolean(ARG_IS_WARNING);
setCancelable(false); setCancelable(false);
AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity, AlertDialog.Builder builder = new AlertDialog.Builder(emulationActivity)
R.style.DolphinDialogBase)
.setTitle(title) .setTitle(title)
.setMessage(message); .setMessage(message);

View File

@ -38,8 +38,7 @@ public final class GameDetailsDialog extends DialogFragment
{ {
GameFile gameFile = GameFileCacheManager.addOrGet(getArguments().getString(ARG_GAME_PATH)); GameFile gameFile = GameFileCacheManager.addOrGet(getArguments().getString(ARG_GAME_PATH));
AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity(), AlertDialog.Builder builder = new AlertDialog.Builder(requireActivity());
R.style.DolphinDialogBase);
ViewGroup contents = (ViewGroup) getActivity().getLayoutInflater() ViewGroup contents = (ViewGroup) getActivity().getLayoutInflater()
.inflate(R.layout.dialog_game_details, null); .inflate(R.layout.dialog_game_details, null);

View File

@ -117,8 +117,7 @@ public class GamePropertiesDialog extends DialogFragment
itemsBuilder.add(R.string.properties_clear_game_settings, (dialog, i) -> itemsBuilder.add(R.string.properties_clear_game_settings, (dialog, i) ->
clearGameSettingsWithConfirmation(gameId)); clearGameSettingsWithConfirmation(gameId));
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext(), AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
R.style.DolphinDialogBase);
itemsBuilder.applyToBuilder(builder); itemsBuilder.applyToBuilder(builder);
builder.setTitle(requireContext() builder.setTitle(requireContext()
.getString(R.string.preferences_game_properties_with_game_id, gameId)); .getString(R.string.preferences_game_properties_with_game_id, gameId));
@ -127,7 +126,7 @@ public class GamePropertiesDialog extends DialogFragment
private void clearGameSettingsWithConfirmation(String gameId) private void clearGameSettingsWithConfirmation(String gameId)
{ {
new AlertDialog.Builder(requireContext(), R.style.DolphinDialogBase) new AlertDialog.Builder(requireContext())
.setTitle(R.string.properties_clear_game_settings) .setTitle(R.string.properties_clear_game_settings)
.setMessage(R.string.properties_clear_game_settings_confirmation) .setMessage(R.string.properties_clear_game_settings_confirmation)
.setPositiveButton(R.string.yes, (dialog, i) -> clearGameSettings(gameId)) .setPositiveButton(R.string.yes, (dialog, i) -> clearGameSettings(gameId))

View File

@ -89,7 +89,7 @@ public class CheatDetailsFragment extends Fragment
private void onDeleteClicked(View view) private void onDeleteClicked(View view)
{ {
AlertDialog.Builder builder = AlertDialog.Builder builder =
new AlertDialog.Builder(requireContext(), R.style.DolphinDialogBase); new AlertDialog.Builder(requireContext());
builder.setMessage(getString(R.string.cheats_delete_confirmation, mCheat.getName())); builder.setMessage(getString(R.string.cheats_delete_confirmation, mCheat.getName()));
builder.setPositiveButton(R.string.yes, (dialog, i) -> mViewModel.deleteSelectedCheat()); builder.setPositiveButton(R.string.yes, (dialog, i) -> mViewModel.deleteSelectedCheat());
builder.setNegativeButton(R.string.no, null); builder.setNegativeButton(R.string.no, null);

View File

@ -191,7 +191,7 @@ public class CheatsActivity extends AppCompatActivity
public void downloadGeckoCodes() public void downloadGeckoCodes()
{ {
AlertDialog progressDialog = new AlertDialog.Builder(this, R.style.DolphinDialogBase).create(); AlertDialog progressDialog = new AlertDialog.Builder(this).create();
progressDialog.setTitle(R.string.cheats_downloading); progressDialog.setTitle(R.string.cheats_downloading);
progressDialog.setCancelable(false); progressDialog.setCancelable(false);
progressDialog.show(); progressDialog.show();
@ -206,14 +206,14 @@ public class CheatsActivity extends AppCompatActivity
if (codes == null) if (codes == null)
{ {
new AlertDialog.Builder(this, R.style.DolphinDialogBase) new AlertDialog.Builder(this)
.setMessage(getString(R.string.cheats_download_failed)) .setMessage(getString(R.string.cheats_download_failed))
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.show(); .show();
} }
else if (codes.length == 0) else if (codes.length == 0)
{ {
new AlertDialog.Builder(this, R.style.DolphinDialogBase) new AlertDialog.Builder(this)
.setMessage(getString(R.string.cheats_download_empty)) .setMessage(getString(R.string.cheats_download_empty))
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.show(); .show();
@ -223,7 +223,7 @@ public class CheatsActivity extends AppCompatActivity
int cheatsAdded = mViewModel.addDownloadedGeckoCodes(codes); int cheatsAdded = mViewModel.addDownloadedGeckoCodes(codes);
String message = getString(R.string.cheats_download_succeeded, codes.length, cheatsAdded); String message = getString(R.string.cheats_download_succeeded, codes.length, cheatsAdded);
new AlertDialog.Builder(this, R.style.DolphinDialogBase) new AlertDialog.Builder(this)
.setMessage(message) .setMessage(message)
.setPositiveButton(R.string.ok, null) .setPositiveButton(R.string.ok, null)
.show(); .show();

View File

@ -228,7 +228,7 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
@Override @Override
public void showGameIniJunkDeletionQuestion() public void showGameIniJunkDeletionQuestion()
{ {
new AlertDialog.Builder(this, R.style.DolphinDialogBase) new AlertDialog.Builder(this)
.setTitle(getString(R.string.game_ini_junk_title)) .setTitle(getString(R.string.game_ini_junk_title))
.setMessage(getString(R.string.game_ini_junk_question)) .setMessage(getString(R.string.game_ini_junk_question))
.setPositiveButton(R.string.yes, (dialogInterface, i) -> mPresenter.clearSettings()) .setPositiveButton(R.string.yes, (dialogInterface, i) -> mPresenter.clearSettings())

View File

@ -195,8 +195,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
int value = getSelectionForSingleChoiceValue(item); int value = getSelectionForSingleChoiceValue(item);
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(), AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity());
R.style.DolphinDialogBase);
builder.setTitle(item.getName()); builder.setTitle(item.getName());
builder.setSingleChoiceItems(item.getChoicesId(), value, this); builder.setSingleChoiceItems(item.getChoicesId(), value, this);
@ -209,8 +208,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
mClickedItem = item; mClickedItem = item;
mClickedPosition = position; mClickedPosition = position;
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(), AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity());
R.style.DolphinDialogBase);
builder.setTitle(item.getName()); builder.setTitle(item.getName());
builder.setSingleChoiceItems(item.getChoicesId(), item.getSelectValueIndex(getSettings()), builder.setSingleChoiceItems(item.getChoicesId(), item.getSelectValueIndex(getSettings()),
@ -227,8 +225,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
int value = getSelectionForSingleChoiceDynamicDescriptionsValue(item); int value = getSelectionForSingleChoiceDynamicDescriptionsValue(item);
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(), AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity());
R.style.DolphinDialogBase);
builder.setTitle(item.getName()); builder.setTitle(item.getName());
builder.setSingleChoiceItems(item.getChoicesId(), value, this); builder.setSingleChoiceItems(item.getChoicesId(), value, this);
@ -242,8 +239,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
mClickedPosition = position; mClickedPosition = position;
mSeekbarMinValue = item.getMin(); mSeekbarMinValue = item.getMin();
mSeekbarProgress = item.getSelectedValue(getSettings()); mSeekbarProgress = item.getSelectedValue(getSettings());
AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity(), AlertDialog.Builder builder = new AlertDialog.Builder(mView.getActivity());
R.style.DolphinDialogBase);
LayoutInflater inflater = LayoutInflater.from(mView.getActivity()); LayoutInflater inflater = LayoutInflater.from(mView.getActivity());
View view = inflater.inflate(R.layout.dialog_seekbar, null); View view = inflater.inflate(R.layout.dialog_seekbar, null);
@ -303,7 +299,7 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
if (!PermissionsHandler.isExternalStorageLegacy()) if (!PermissionsHandler.isExternalStorageLegacy())
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(mContext, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setMessage(R.string.path_not_changeable_scoped_storage); builder.setMessage(R.string.path_not_changeable_scoped_storage);
builder.setPositiveButton(R.string.ok, (dialog, i) -> dialog.dismiss()); builder.setPositiveButton(R.string.ok, (dialog, i) -> dialog.dismiss());
builder.show(); builder.show();

View File

@ -54,7 +54,7 @@ public final class RunRunnableViewHolder extends SettingViewHolder
if (alertTextID > 0) if (alertTextID > 0)
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(mContext, R.style.DolphinDialogBase) AlertDialog.Builder builder = new AlertDialog.Builder(mContext)
.setTitle(mItem.getName()) .setTitle(mItem.getName())
.setMessage(alertTextID); .setMessage(alertTextID);

View File

@ -96,7 +96,7 @@ public abstract class SettingViewHolder extends RecyclerView.ViewHolder
Context context = clicked.getContext(); Context context = clicked.getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DolphinDialogBase) AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setMessage(R.string.setting_clear_confirm); .setMessage(R.string.setting_clear_confirm);
builder builder

View File

@ -23,7 +23,7 @@ public class OnlineUpdateRegionSelectDialogFragment extends DialogFragment
R.string.japan), getString(R.string.korea), getString(R.string.united_states)}; R.string.japan), getString(R.string.korea), getString(R.string.united_states)};
int checkedItem = -1; int checkedItem = -1;
return new AlertDialog.Builder(requireContext(), R.style.DolphinDialogBase) return new AlertDialog.Builder(requireContext())
.setTitle(R.string.region_select_title) .setTitle(R.string.region_select_title)
.setSingleChoiceItems(items, checkedItem, (dialog, which) -> .setSingleChoiceItems(items, checkedItem, (dialog, which) ->
{ {

View File

@ -16,7 +16,7 @@ public class SystemMenuNotInstalledDialogFragment extends DialogFragment
@Override @Override
public Dialog onCreateDialog(Bundle savedInstanceState) public Dialog onCreateDialog(Bundle savedInstanceState)
{ {
return new AlertDialog.Builder(requireContext(), R.style.DolphinDialogBase) return new AlertDialog.Builder(requireContext())
.setTitle(R.string.system_menu_not_installed_title) .setTitle(R.string.system_menu_not_installed_title)
.setMessage(R.string.system_menu_not_installed_message) .setMessage(R.string.system_menu_not_installed_message)
.setPositiveButton(R.string.yes, (dialog, which) -> .setPositiveButton(R.string.yes, (dialog, which) ->

View File

@ -88,7 +88,7 @@ public class SystemUpdateResultFragment extends DialogFragment
throw new IllegalStateException("Unexpected value: " + mResult); throw new IllegalStateException("Unexpected value: " + mResult);
} }
return new AlertDialog.Builder(requireContext(), R.style.DolphinDialogBase) return new AlertDialog.Builder(requireContext())
.setTitle(title) .setTitle(title)
.setMessage(message) .setMessage(message)
.setPositiveButton(R.string.ok, (dialog, which) -> .setPositiveButton(R.string.ok, (dialog, which) ->

View File

@ -361,7 +361,7 @@ public class ConvertFragment extends Fragment implements View.OnClickListener
return () -> return () ->
{ {
Context context = requireContext(); Context context = requireContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(warning_text) builder.setMessage(warning_text)
.setPositiveButton(R.string.yes, (dialog, i) -> action.run()) .setPositiveButton(R.string.yes, (dialog, i) -> action.run())
.setNegativeButton(R.string.no, null); .setNegativeButton(R.string.no, null);
@ -459,7 +459,7 @@ public class ConvertFragment extends Fragment implements View.OnClickListener
{ {
progressDialog.dismiss(); progressDialog.dismiss();
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(context);
if (success) if (success)
{ {
builder.setMessage(R.string.convert_success_message) builder.setMessage(R.string.convert_success_message)

View File

@ -165,7 +165,7 @@ public final class MainPresenter
if (Arrays.stream(childNames).noneMatch((name) -> FileBrowserHelper.GAME_EXTENSIONS.contains( if (Arrays.stream(childNames).noneMatch((name) -> FileBrowserHelper.GAME_EXTENSIONS.contains(
FileBrowserHelper.getExtension(name, false)))) FileBrowserHelper.getExtension(name, false))))
{ {
AlertDialog.Builder builder = new AlertDialog.Builder(mActivity, R.style.DolphinDialogBase); AlertDialog.Builder builder = new AlertDialog.Builder(mActivity);
builder.setMessage(mActivity.getString(R.string.wrong_file_extension_in_directory, builder.setMessage(mActivity.getString(R.string.wrong_file_extension_in_directory,
FileBrowserHelper.setToSortedDelimitedString(FileBrowserHelper.GAME_EXTENSIONS))); FileBrowserHelper.setToSortedDelimitedString(FileBrowserHelper.GAME_EXTENSIONS)));
builder.setPositiveButton(R.string.ok, null); builder.setPositiveButton(R.string.ok, null);
@ -204,7 +204,7 @@ public final class MainPresenter
mActivity.runOnUiThread(() -> mActivity.runOnUiThread(() ->
{ {
AlertDialog.Builder builder = AlertDialog.Builder builder =
new AlertDialog.Builder(mActivity, R.style.DolphinDialogBase); new AlertDialog.Builder(mActivity);
builder.setMessage(R.string.wii_save_exists); builder.setMessage(R.string.wii_save_exists);
builder.setCancelable(false); builder.setCancelable(false);
builder.setPositiveButton(R.string.yes, (dialog, i) -> canOverwriteFuture.complete(true)); builder.setPositiveButton(R.string.yes, (dialog, i) -> canOverwriteFuture.complete(true));
@ -250,7 +250,7 @@ public final class MainPresenter
public void importNANDBin(String path) public void importNANDBin(String path)
{ {
AlertDialog.Builder builder = AlertDialog.Builder builder =
new AlertDialog.Builder(mActivity, R.style.DolphinDialogBase); new AlertDialog.Builder(mActivity);
builder.setMessage(R.string.nand_import_warning); builder.setMessage(R.string.nand_import_warning);
builder.setNegativeButton(R.string.no, (dialog, i) -> dialog.dismiss()); builder.setNegativeButton(R.string.no, (dialog, i) -> dialog.dismiss());

View File

@ -36,7 +36,7 @@ public class Analytics
private static void showMessage(Context context) private static void showMessage(Context context)
{ {
new AlertDialog.Builder(context, R.style.DolphinDialogBase) new AlertDialog.Builder(context)
.setTitle(context.getString(R.string.analytics)) .setTitle(context.getString(R.string.analytics))
.setMessage(context.getString(R.string.analytics_desc)) .setMessage(context.getString(R.string.analytics_desc))
.setPositiveButton(R.string.yes, (dialogInterface, i) -> .setPositiveButton(R.string.yes, (dialogInterface, i) ->

View File

@ -118,7 +118,7 @@ public final class FileBrowserHelper
setToSortedDelimitedString(validExtensions)); setToSortedDelimitedString(validExtensions));
} }
new AlertDialog.Builder(context, R.style.DolphinDialogBase) new AlertDialog.Builder(context)
.setMessage(message) .setMessage(message)
.setPositiveButton(R.string.yes, (dialogInterface, i) -> runnable.run()) .setPositiveButton(R.string.yes, (dialogInterface, i) -> runnable.run())
.setNegativeButton(R.string.no, null) .setNegativeButton(R.string.no, null)

View File

@ -27,7 +27,7 @@ public class ThreadUtil
@Nullable DialogInterface.OnDismissListener onResultDismiss) @Nullable DialogInterface.OnDismissListener onResultDismiss)
{ {
Resources resources = activity.getResources(); Resources resources = activity.getResources();
AlertDialog progressDialog = new AlertDialog.Builder(activity, R.style.DolphinDialogBase) AlertDialog progressDialog = new AlertDialog.Builder(activity)
.create(); .create();
progressDialog.setTitle(progressTitle); progressDialog.setTitle(progressTitle);
if (progressMessage != 0) if (progressMessage != 0)
@ -45,7 +45,7 @@ public class ThreadUtil
if (result != null) if (result != null)
{ {
AlertDialog.Builder builder = AlertDialog.Builder builder =
new AlertDialog.Builder(activity, R.style.DolphinDialogBase); new AlertDialog.Builder(activity);
builder.setMessage(result); builder.setMessage(result);
builder.setPositiveButton(R.string.ok, (dialog, i) -> dialog.dismiss()); builder.setPositiveButton(R.string.ok, (dialog, i) -> dialog.dismiss());
builder.setOnDismissListener(onResultDismiss); builder.setOnDismissListener(onResultDismiss);

View File

@ -27,8 +27,7 @@
android:layout_height="0dp" android:layout_height="0dp"
android:layout_weight="1" android:layout_weight="1"
android:scrollbarSize="8dp" android:scrollbarSize="8dp"
android:fadeScrollbars="false" android:fadeScrollbars="false">
android:theme="@style/InGameScrollView">
<LinearLayout <LinearLayout
android:id="@+id/layout_options" android:id="@+id/layout_options"

View File

@ -1,51 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<!-- Inherit from the material theme -->
<style name="DolphinBase" parent="Theme.Material3.DayNight.NoActionBar">
<!-- Main theme colors -->
<!-- Branding color for the app bar -->
<item name="colorSurface">@color/dolphin_blue</item>
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
<!-- Enable window content transitions -->
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:colorControlHighlight">?attr/colorAccent</item>
</style>
<!-- Same as above, but use default action bar, and mandate margins. -->
<style name="DolphinSettingsBase" parent="Theme.Material3.DayNight">
<item name="colorSurface">@color/dolphin_blue</item>
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
<item name="titleTextColor">@android:color/white</item>
<item name="homeAsUpIndicator">@drawable/ic_back</item>
</style>
<!-- Themes for Dialogs -->
<style name="DolphinDialogBase" parent="Theme.Material3.DayNight.Dialog.Alert"> <style name="DolphinDialogBase" parent="Theme.Material3.DayNight.Dialog.Alert">
<item name="colorPrimary">@color/dolphin_blue</item> <item name="colorSurface">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
</style>
<style name="DolphinEmulationBase" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorPrimary">@color/dolphin_blue</item> <item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item> <item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item> <item name="colorAccent">@color/dolphin_blue_secondary</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:windowBackground">@android:color/black</item>
<!-- Enable window content transitions -->
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
</style> </style>
<!-- Hax to make Tablayout render icons --> <!-- Hax to make Tablayout render icons -->
@ -53,26 +12,7 @@
<item name="textAllCaps">false</item> <item name="textAllCaps">false</item>
</style> </style>
<!-- Android TV Themes --> <!-- Custom button styles -->
<style name="DolphinTvBase" parent="Theme.Leanback.Browse">
<item name="colorSurface">@color/dolphin_blue</item>
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
<!-- Enable window content transitions -->
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<!-- Use CustomTitleView as the leanback title view. -->
<item name="browseTitleViewLayout">@layout/titleview</item>
</style>
<style name="InGameScrollView">
<item name="android:colorEdgeEffect">@color/dolphin_blue_secondary</item>
</style>
<style name="InGameMenuOption" parent="Widget.Material3.Button.TextButton"> <style name="InGameMenuOption" parent="Widget.Material3.Button.TextButton">
<item name="android:textSize">16sp</item> <item name="android:textSize">16sp</item>
<item name="android:fontFamily">sans-serif-condensed</item> <item name="android:fontFamily">sans-serif-condensed</item>
@ -93,29 +33,4 @@
<item name="android:gravity">center</item> <item name="android:gravity">center</item>
<item name="android:layout_gravity">center</item> <item name="android:layout_gravity">center</item>
</style> </style>
<!-- Inherit from a base file picker theme that handles day/night -->
<style name="FilePickerTheme" parent="FilePickerBaseTheme">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
<!--&lt;!&ndash; Setting a divider is entirely optional &ndash;&gt;-->
<item name="nnf_list_item_divider">?android:attr/listDivider</item>
<!-- Need to set this also to style create folder dialog -->
<item name="alertDialogTheme">@style/FilePickerAlertDialogTheme</item>
<!-- If you want to set a specific toolbar theme, do it here -->
<item name="nnf_toolbarTheme">@style/ThemeOverlay.Material3.Dark.ActionBar</item>
</style>
<style name="FilePickerAlertDialogTheme" parent="Theme.Material3.DayNight.Dialog.Alert">
<item name="colorSurface">@color/dolphin_blue</item>
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
</style>
</resources> </resources>

View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Base theme -->
<style name="Theme.Dolphin.Main" parent="Theme.Material3.DayNight.NoActionBar">
<item name="colorSurface">@color/dolphin_blue</item>
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
<item name="android:colorControlHighlight">?attr/colorAccent</item>
<item name="android:colorEdgeEffect">@color/dolphin_blue_secondary</item>
<!-- Enable window content transitions -->
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<!-- Global alert dialog style -->
<item name="alertDialogTheme">@style/DolphinDialogBase</item>
</style>
<style name="Theme.Dolphin.Settings" parent="Theme.Material3.DayNight">
<item name="colorSurface">@color/dolphin_blue</item>
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
<item name="titleTextColor">@android:color/white</item>
<item name="homeAsUpIndicator">@drawable/ic_back</item>
<!-- Global alert dialog style -->
<item name="alertDialogTheme">@style/DolphinDialogBase</item>
</style>
<style name="Theme.Dolphin.Main.Emulation" parent="Theme.Dolphin.Main">
<item name="android:windowBackground">@android:color/black</item>
</style>
<!-- Inherit from a base file picker theme that handles day/night -->
<style name="Theme.Dolphin.FilePicker" parent="FilePickerBaseTheme">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue</item>
<item name="colorAccent">@color/dolphin_blue_secondary</item>
<!-- Setting a divider is entirely optional -->
<item name="nnf_list_item_divider">?android:attr/listDivider</item>
<!-- If you want to set a specific toolbar theme, do it here -->
<item name="nnf_toolbarTheme">@style/ThemeOverlay.Material3.Dark.ActionBar</item>
<!-- Global alert dialog style -->
<item name="alertDialogTheme">@style/DolphinDialogBase</item>
</style>
<style name="Theme.Dolphin.TV" parent="Theme.Leanback.Browse">
<!-- Enable window content transitions -->
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<!-- Use CustomTitleView as the leanback title view. -->
<item name="browseTitleViewLayout">@layout/titleview</item>
<!-- Global alert dialog style -->
<item name="alertDialogTheme">@style/DolphinDialogBase</item>
</style>
</resources>