Android: Do not fit system windows

This commit is contained in:
Charles Lombardo 2022-09-22 19:03:45 -04:00
parent a056a1366f
commit 90d27be1d6
27 changed files with 548 additions and 156 deletions

View File

@ -5,8 +5,11 @@ package org.dolphinemu.dolphinemu.activities;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.WindowCompat;
import androidx.core.widget.NestedScrollView;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.CollapsingToolbarLayout; import com.google.android.material.appbar.CollapsingToolbarLayout;
@ -14,6 +17,7 @@ import com.google.android.material.appbar.MaterialToolbar;
import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.fragments.ConvertFragment; import org.dolphinemu.dolphinemu.fragments.ConvertFragment;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
import org.dolphinemu.dolphinemu.utils.ThemeHelper; import org.dolphinemu.dolphinemu.utils.ThemeHelper;
public class ConvertActivity extends AppCompatActivity public class ConvertActivity extends AppCompatActivity
@ -36,6 +40,8 @@ public class ConvertActivity extends AppCompatActivity
setContentView(R.layout.activity_convert); setContentView(R.layout.activity_convert);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
String path = getIntent().getStringExtra(ARG_GAME_PATH); String path = getIntent().getStringExtra(ARG_GAME_PATH);
ConvertFragment fragment = (ConvertFragment) getSupportFragmentManager() ConvertFragment fragment = (ConvertFragment) getSupportFragmentManager()
@ -53,7 +59,10 @@ public class ConvertActivity extends AppCompatActivity
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
AppBarLayout appBarLayout = findViewById(R.id.appbar_convert); AppBarLayout appBarLayout = findViewById(R.id.appbar_convert);
ThemeHelper.enableScrollTint(tb, appBarLayout, this); NestedScrollView scrollView = findViewById(R.id.scroll_view_convert);
View workaroundView = findViewById(R.id.workaround_view);
InsetsHelper.setUpAppBarWithScrollView(this, appBarLayout, scrollView, workaroundView);
ThemeHelper.enableScrollTint(this, tb, appBarLayout);
} }
@Override @Override

View File

@ -15,7 +15,8 @@ import android.widget.TextView;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.core.view.WindowCompat;
import androidx.core.widget.NestedScrollView;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.MaterialToolbar;
@ -23,6 +24,7 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization; import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
import org.dolphinemu.dolphinemu.utils.Log; import org.dolphinemu.dolphinemu.utils.Log;
import org.dolphinemu.dolphinemu.utils.ThemeHelper; import org.dolphinemu.dolphinemu.utils.ThemeHelper;
import org.dolphinemu.dolphinemu.utils.ThreadUtil; import org.dolphinemu.dolphinemu.utils.ThreadUtil;
@ -61,6 +63,8 @@ public class UserDataActivity extends AppCompatActivity
setContentView(R.layout.activity_user_data); setContentView(R.layout.activity_user_data);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
TextView textType = findViewById(R.id.text_type); TextView textType = findViewById(R.id.text_type);
TextView textPath = findViewById(R.id.text_path); TextView textPath = findViewById(R.id.text_path);
TextView textAndroid11 = findViewById(R.id.text_android_11); TextView textAndroid11 = findViewById(R.id.text_android_11);
@ -92,7 +96,10 @@ public class UserDataActivity extends AppCompatActivity
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
AppBarLayout appBarLayout = findViewById(R.id.appbar_user_data); AppBarLayout appBarLayout = findViewById(R.id.appbar_user_data);
ThemeHelper.enableScrollTint(tb, appBarLayout, this); NestedScrollView scrollView = findViewById(R.id.scroll_view_user_data);
View workaroundView = findViewById(R.id.workaround_view);
InsetsHelper.setUpAppBarWithScrollView(this, appBarLayout, scrollView, workaroundView);
ThemeHelper.enableScrollTint(this, tb, appBarLayout);
} }
@Override @Override

View File

@ -150,9 +150,7 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
@Override @Override
public boolean onLongClick(View view) public boolean onLongClick(View view)
{ {
FragmentActivity activity = (FragmentActivity) view.getContext();
GameViewHolder holder = (GameViewHolder) view.getTag(); GameViewHolder holder = (GameViewHolder) view.getTag();
String gameId = holder.gameFile.getGameId();
GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile); GamePropertiesDialog fragment = GamePropertiesDialog.newInstance(holder.gameFile);
((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction() ((FragmentActivity) view.getContext()).getSupportFragmentManager().beginTransaction()
@ -160,25 +158,4 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
return true; return true;
} }
public static class SpacesItemDecoration extends RecyclerView.ItemDecoration
{
private int space;
public SpacesItemDecoration(int space)
{
this.space = space;
}
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
@NonNull RecyclerView parent,
@NonNull RecyclerView.State state)
{
outRect.left = space;
outRect.right = space;
outRect.bottom = space;
outRect.top = space;
}
}
} }

View File

@ -18,6 +18,7 @@ import com.google.android.material.divider.MaterialDividerItemDecoration;
import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.cheats.model.CheatsViewModel; import org.dolphinemu.dolphinemu.features.cheats.model.CheatsViewModel;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
public class CheatListFragment extends Fragment public class CheatListFragment extends Fragment
{ {
@ -44,5 +45,7 @@ public class CheatListFragment extends Fragment
new MaterialDividerItemDecoration(requireActivity(), LinearLayoutManager.VERTICAL); new MaterialDividerItemDecoration(requireActivity(), LinearLayoutManager.VERTICAL);
divider.setLastItemDecorated(false); divider.setLastItemDecorated(false);
recyclerView.addItemDecoration(divider); recyclerView.addItemDecoration(divider);
InsetsHelper.setUpList(getContext(), recyclerView);
} }
} }

View File

@ -10,14 +10,18 @@ import android.view.MenuInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.ViewCompat; import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
import androidx.slidingpanelayout.widget.SlidingPaneLayout; import androidx.slidingpanelayout.widget.SlidingPaneLayout;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.MaterialToolbar;
import com.google.android.material.color.MaterialColors;
import com.google.android.material.dialog.MaterialAlertDialogBuilder; import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.R;
@ -27,6 +31,7 @@ import org.dolphinemu.dolphinemu.features.cheats.model.GeckoCheat;
import org.dolphinemu.dolphinemu.features.settings.model.Settings; import org.dolphinemu.dolphinemu.features.settings.model.Settings;
import org.dolphinemu.dolphinemu.ui.TwoPaneOnBackPressedCallback; import org.dolphinemu.dolphinemu.ui.TwoPaneOnBackPressedCallback;
import org.dolphinemu.dolphinemu.ui.main.MainPresenter; import org.dolphinemu.dolphinemu.ui.main.MainPresenter;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
import org.dolphinemu.dolphinemu.utils.ThemeHelper; import org.dolphinemu.dolphinemu.utils.ThemeHelper;
public class CheatsActivity extends AppCompatActivity public class CheatsActivity extends AppCompatActivity
@ -83,6 +88,8 @@ public class CheatsActivity extends AppCompatActivity
setContentView(R.layout.activity_cheats); setContentView(R.layout.activity_cheats);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
mSlidingPaneLayout = findViewById(R.id.sliding_pane_layout); mSlidingPaneLayout = findViewById(R.id.sliding_pane_layout);
mCheatList = findViewById(R.id.cheat_list); mCheatList = findViewById(R.id.cheat_list);
mCheatDetails = findViewById(R.id.cheat_details); mCheatDetails = findViewById(R.id.cheat_details);
@ -100,9 +107,18 @@ public class CheatsActivity extends AppCompatActivity
mViewModel.getOpenDetailsViewEvent().observe(this, this::openDetailsView); mViewModel.getOpenDetailsViewEvent().observe(this, this::openDetailsView);
Toolbar tb = findViewById(R.id.toolbar_cheats); MaterialToolbar tb = findViewById(R.id.toolbar_cheats);
setSupportActionBar(tb); setSupportActionBar(tb);
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
View workaroundView = findViewById(R.id.workaround_view);
AppBarLayout appBarLayout = findViewById(R.id.appbar_cheats);
InsetsHelper.setUpCheatsLayout(this, appBarLayout, mSlidingPaneLayout, mCheatDetails,
workaroundView);
@ColorInt int color = MaterialColors.getColor(tb, R.attr.colorSurfaceVariant);
tb.setBackgroundColor(color);
ThemeHelper.setStatusBarColor(this, color);
} }
@Override @Override

View File

@ -5,10 +5,13 @@ package org.dolphinemu.dolphinemu.features.riivolution.ui;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.TextView; import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.WindowCompat;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -21,6 +24,7 @@ import org.dolphinemu.dolphinemu.activities.EmulationActivity;
import org.dolphinemu.dolphinemu.features.riivolution.model.RiivolutionPatches; import org.dolphinemu.dolphinemu.features.riivolution.model.RiivolutionPatches;
import org.dolphinemu.dolphinemu.features.settings.model.StringSetting; import org.dolphinemu.dolphinemu.features.settings.model.StringSetting;
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization; import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
import org.dolphinemu.dolphinemu.utils.ThemeHelper; import org.dolphinemu.dolphinemu.utils.ThemeHelper;
public class RiivolutionBootActivity extends AppCompatActivity public class RiivolutionBootActivity extends AppCompatActivity
@ -52,6 +56,8 @@ public class RiivolutionBootActivity extends AppCompatActivity
setContentView(R.layout.activity_riivolution_boot); setContentView(R.layout.activity_riivolution_boot);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
Intent intent = getIntent(); Intent intent = getIntent();
String path = getIntent().getStringExtra(ARG_GAME_PATH); String path = getIntent().getStringExtra(ARG_GAME_PATH);
@ -89,7 +95,10 @@ public class RiivolutionBootActivity extends AppCompatActivity
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
AppBarLayout appBarLayout = findViewById(R.id.appbar_riivolution); AppBarLayout appBarLayout = findViewById(R.id.appbar_riivolution);
ThemeHelper.enableScrollTint(tb, appBarLayout, this); NestedScrollView scrollView = findViewById(R.id.scroll_view_riivolution);
View workaroundView = findViewById(R.id.workaround_view);
InsetsHelper.setUpAppBarWithScrollView(this, appBarLayout, scrollView, workaroundView);
ThemeHelper.enableScrollTint(this, tb, appBarLayout);
} }
@Override @Override

View File

@ -9,11 +9,15 @@ import android.os.Bundle;
import android.provider.Settings; import android.provider.Settings;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowCompat;
import androidx.fragment.app.FragmentTransaction; import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.ViewModelProvider; import androidx.lifecycle.ViewModelProvider;
@ -26,6 +30,7 @@ import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.ui.main.MainPresenter; import org.dolphinemu.dolphinemu.ui.main.MainPresenter;
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper; import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
import org.dolphinemu.dolphinemu.utils.ThemeHelper; import org.dolphinemu.dolphinemu.utils.ThemeHelper;
import java.util.Set; import java.util.Set;
@ -78,6 +83,8 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
setContentView(R.layout.activity_settings); setContentView(R.layout.activity_settings);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
Intent launcher = getIntent(); Intent launcher = getIntent();
String gameID = launcher.getStringExtra(ARG_GAME_ID); String gameID = launcher.getStringExtra(ARG_GAME_ID);
if (gameID == null) if (gameID == null)
@ -95,7 +102,15 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true);
AppBarLayout appBarLayout = findViewById(R.id.appbar_settings); AppBarLayout appBarLayout = findViewById(R.id.appbar_settings);
ThemeHelper.enableScrollTint(tb, appBarLayout, this); FrameLayout frameLayout = findViewById(R.id.frame_content_settings);
// TODO: Remove this when CollapsingToolbarLayouts are fixed by Google
// https://github.com/material-components/material-components-android/issues/1310
ViewCompat.setOnApplyWindowInsetsListener(mToolbarLayout, null);
View workaroundView = findViewById(R.id.workaround_view);
InsetsHelper.setUpSettingsLayout(this, appBarLayout, frameLayout, workaroundView);
ThemeHelper.enableScrollTint(this, tb, appBarLayout);
} }
@Override @Override
@ -162,8 +177,8 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
transaction.addToBackStack(null); transaction.addToBackStack(null);
} }
transaction.replace(R.id.frame_content, SettingsFragment.newInstance(menuTag, gameID, extras), transaction.replace(R.id.frame_content_settings,
FRAGMENT_TAG); SettingsFragment.newInstance(menuTag, gameID, extras), FRAGMENT_TAG);
transaction.commit(); transaction.commit();
} }

View File

@ -19,6 +19,8 @@ import com.google.android.material.divider.MaterialDividerItemDecoration;
import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.settings.model.Settings; import org.dolphinemu.dolphinemu.features.settings.model.Settings;
import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem; import org.dolphinemu.dolphinemu.features.settings.model.view.SettingsItem;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
import org.dolphinemu.dolphinemu.utils.Log;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -143,6 +145,8 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
divider.setLastItemDecorated(false); divider.setLastItemDecorated(false);
recyclerView.addItemDecoration(divider); recyclerView.addItemDecoration(divider);
InsetsHelper.setUpList(getContext(), recyclerView);
SettingsActivityView activity = (SettingsActivityView) getActivity(); SettingsActivityView activity = (SettingsActivityView) getActivity();
mPresenter.onViewCreated(menuTag, activity.getSettings()); mPresenter.onViewCreated(menuTag, activity.getSettings());
} }

View File

@ -9,15 +9,18 @@ import android.os.Bundle;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
import androidx.core.splashscreen.SplashScreen; import androidx.core.splashscreen.SplashScreen;
import androidx.core.view.WindowCompat;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.viewpager.widget.ViewPager; import androidx.viewpager.widget.ViewPager;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.tabs.TabLayout; import com.google.android.material.tabs.TabLayout;
@ -35,6 +38,7 @@ import org.dolphinemu.dolphinemu.utils.Action1;
import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner; import org.dolphinemu.dolphinemu.utils.AfterDirectoryInitializationRunner;
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization; import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper; import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
import org.dolphinemu.dolphinemu.utils.PermissionsHandler; import org.dolphinemu.dolphinemu.utils.PermissionsHandler;
import org.dolphinemu.dolphinemu.utils.StartupHandler; import org.dolphinemu.dolphinemu.utils.StartupHandler;
import org.dolphinemu.dolphinemu.utils.ThemeHelper; import org.dolphinemu.dolphinemu.utils.ThemeHelper;
@ -50,6 +54,7 @@ public final class MainActivity extends AppCompatActivity
private ViewPager mViewPager; private ViewPager mViewPager;
private Toolbar mToolbar; private Toolbar mToolbar;
private TabLayout mTabLayout; private TabLayout mTabLayout;
private AppBarLayout mAppBarLayout;
private FloatingActionButton mFab; private FloatingActionButton mFab;
private int mThemeId; private int mThemeId;
@ -70,6 +75,11 @@ public final class MainActivity extends AppCompatActivity
findViews(); findViews();
View workaroundView = findViewById(R.id.workaround_view);
WindowCompat.setDecorFitsSystemWindows(getWindow(), false);
InsetsHelper.setUpMainLayout(this, mAppBarLayout, mFab, mViewPager, workaroundView);
ThemeHelper.enableStatusBarScrollTint(this, mAppBarLayout);
setSupportActionBar(mToolbar); setSupportActionBar(mToolbar);
// Set up the FAB. // Set up the FAB.
@ -147,6 +157,7 @@ public final class MainActivity extends AppCompatActivity
// TODO: Replace with a ButterKnife injection. // TODO: Replace with a ButterKnife injection.
private void findViews() private void findViews()
{ {
mAppBarLayout = findViewById(R.id.appbar_main);
mToolbar = findViewById(R.id.toolbar_main); mToolbar = findViewById(R.id.toolbar_main);
mViewPager = findViewById(R.id.pager_platforms); mViewPager = findViewById(R.id.pager_platforms);
mTabLayout = findViewById(R.id.tabs_platforms); mTabLayout = findViewById(R.id.tabs_platforms);

View File

@ -19,6 +19,7 @@ import com.google.android.material.color.MaterialColors;
import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.adapters.GameAdapter; import org.dolphinemu.dolphinemu.adapters.GameAdapter;
import org.dolphinemu.dolphinemu.services.GameFileCacheManager; import org.dolphinemu.dolphinemu.services.GameFileCacheManager;
import org.dolphinemu.dolphinemu.utils.InsetsHelper;
public final class PlatformGamesFragment extends Fragment implements PlatformGamesView public final class PlatformGamesFragment extends Fragment implements PlatformGamesView
{ {
@ -74,7 +75,7 @@ public final class PlatformGamesFragment extends Fragment implements PlatformGam
mRecyclerView.setLayoutManager(layoutManager); mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.setAdapter(mAdapter); mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addItemDecoration(new GameAdapter.SpacesItemDecoration(8)); InsetsHelper.setUpList(getContext(), mRecyclerView);
setRefreshing(GameFileCacheManager.isLoadingOrRescanning()); setRefreshing(GameFileCacheManager.isLoadingOrRescanning());

View File

@ -0,0 +1,181 @@
package org.dolphinemu.dolphinemu.utils;
import android.content.Context;
import android.content.res.Resources;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.core.widget.NestedScrollView;
import androidx.recyclerview.widget.RecyclerView;
import androidx.slidingpanelayout.widget.SlidingPaneLayout;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.color.MaterialColors;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import org.dolphinemu.dolphinemu.R;
public class InsetsHelper
{
public static final int FAB_INSET = 16;
public static final int EXTRA_NAV_INSET = 32;
public static final int THREE_BUTTON_NAVIGATION = 0;
public static final int TWO_BUTTON_NAVIGATION = 1;
public static final int GESTURE_NAVIGATION = 2;
public static int dpToPx(Context context, int dp)
{
return (int) (dp * ((float) context.getResources().getDisplayMetrics().densityDpi /
DisplayMetrics.DENSITY_DEFAULT) + 0.5f);
}
public static void setUpAppBarWithScrollView(AppCompatActivity activity,
AppBarLayout appBarLayout, NestedScrollView nestedScrollView, View workaroundView)
{
ViewCompat.setOnApplyWindowInsetsListener(appBarLayout, (v, windowInsets) ->
{
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
insetAppBar(insets, appBarLayout);
nestedScrollView.setPadding(insets.left, 0, insets.right, insets.bottom);
applyWorkaround(insets.bottom, workaroundView);
ThemeHelper.setNavigationBarColor(activity,
MaterialColors.getColor(appBarLayout, R.attr.colorSurface));
return windowInsets;
});
}
public static void setUpList(Context context, RecyclerView recyclerView)
{
ViewCompat.setOnApplyWindowInsetsListener(recyclerView, (v, windowInsets) ->
{
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(0, 0, 0, insets.bottom + dpToPx(context, EXTRA_NAV_INSET));
return windowInsets;
});
}
public static void setUpMainLayout(AppCompatActivity activity, AppBarLayout appBarLayout,
FloatingActionButton fab, ViewPager viewPager, View workaroundView)
{
ViewCompat.setOnApplyWindowInsetsListener(appBarLayout, (v, windowInsets) ->
{
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
insetAppBar(insets, appBarLayout);
ViewGroup.MarginLayoutParams mlpFab = (ViewGroup.MarginLayoutParams) fab.getLayoutParams();
int fabPadding =
InsetsHelper.dpToPx(activity.getApplicationContext(), FAB_INSET);
mlpFab.leftMargin = insets.left + fabPadding;
mlpFab.bottomMargin = insets.bottom + fabPadding;
mlpFab.rightMargin = insets.right + fabPadding;
fab.setLayoutParams(mlpFab);
viewPager.setPadding(insets.left, 0, insets.right, 0);
applyWorkaround(insets.bottom, workaroundView);
ThemeHelper.setNavigationBarColor(activity,
MaterialColors.getColor(appBarLayout, R.attr.colorSurface));
return windowInsets;
});
}
public static void setUpSettingsLayout(AppCompatActivity activity,
AppBarLayout appBarLayout, FrameLayout frameLayout, View workaroundView)
{
ViewCompat.setOnApplyWindowInsetsListener(appBarLayout, (v, windowInsets) ->
{
Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
insetAppBar(insets, appBarLayout);
frameLayout.setPadding(insets.left, 0, insets.right, 0);
applyWorkaround(insets.bottom, workaroundView);
ThemeHelper.setNavigationBarColor(activity,
MaterialColors.getColor(appBarLayout, R.attr.colorSurface));
return windowInsets;
});
}
public static void setUpCheatsLayout(AppCompatActivity activity, AppBarLayout appBarLayout,
SlidingPaneLayout slidingPaneLayout, View cheatDetails, View workaroundView)
{
ViewCompat.setOnApplyWindowInsetsListener(appBarLayout, (v, windowInsets) ->
{
Insets barInsets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars());
Insets keyboardInsets = windowInsets.getInsets(WindowInsetsCompat.Type.ime());
insetAppBar(barInsets, appBarLayout);
slidingPaneLayout.setPadding(barInsets.left, barInsets.top, barInsets.right, 0);
if (keyboardInsets.bottom > 0)
{
cheatDetails.setPadding(0, 0, 0, keyboardInsets.bottom);
}
else
{
cheatDetails.setPadding(0, 0, 0, barInsets.bottom);
}
applyWorkaround(barInsets.bottom, workaroundView);
ThemeHelper.setNavigationBarColor(activity,
MaterialColors.getColor(appBarLayout, R.attr.colorSurface));
return windowInsets;
});
}
private static void insetAppBar(Insets insets, AppBarLayout appBarLayout)
{
ViewGroup.MarginLayoutParams mlpAppBar =
(ViewGroup.MarginLayoutParams) appBarLayout.getLayoutParams();
mlpAppBar.leftMargin = insets.left;
mlpAppBar.topMargin = insets.top;
mlpAppBar.rightMargin = insets.right;
appBarLayout.setLayoutParams(mlpAppBar);
}
// Workaround for a bug on Android 13 that allows users to interact with UI behind the
// navigation bar https://issuetracker.google.com/issues/248761842
private static void applyWorkaround(int bottomInset, View workaroundView)
{
if (bottomInset > 0)
{
ViewGroup.LayoutParams lpWorkaround = workaroundView.getLayoutParams();
lpWorkaround.height = bottomInset;
workaroundView.setLayoutParams(lpWorkaround);
}
}
public static int getSystemGestureType(Context context)
{
Resources resources = context.getResources();
int resourceId = resources.getIdentifier("config_navBarInteractionMode", "integer", "android");
if (resourceId != 0)
{
return resources.getInteger(resourceId);
}
return 0;
}
}

View File

@ -3,10 +3,15 @@ package org.dolphinemu.dolphinemu.utils;
import android.app.Activity; import android.app.Activity;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import androidx.annotation.ColorInt; import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.content.ContextCompat;
import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.appbar.AppBarLayout;
import com.google.android.material.appbar.MaterialToolbar; import com.google.android.material.appbar.MaterialToolbar;
@ -25,7 +30,9 @@ public class ThemeHelper
public static final int GREEN = 3; public static final int GREEN = 3;
public static final int PINK = 4; public static final int PINK = 4;
public static void setTheme(Activity activity) public static final float NAV_BAR_ALPHA = 0.9f;
public static void setTheme(@NonNull AppCompatActivity activity)
{ {
// We have to use shared preferences in addition to Dolphin's settings to guarantee that the // We have to use shared preferences in addition to Dolphin's settings to guarantee that the
// requested theme id is ready before the onCreate method of any given Activity. // requested theme id is ready before the onCreate method of any given Activity.
@ -35,43 +42,22 @@ public class ThemeHelper
{ {
case DEFAULT: case DEFAULT:
activity.setTheme(R.style.Theme_Dolphin_Main); activity.setTheme(R.style.Theme_Dolphin_Main);
activity.getWindow()
.setStatusBarColor(activity.getResources().getColor(R.color.dolphin_surface));
break; break;
case MONET: case MONET:
activity.setTheme(R.style.Theme_Dolphin_Main_MaterialYou); activity.setTheme(R.style.Theme_Dolphin_Main_MaterialYou);
int currentNightMode = activity.getResources().getConfiguration().uiMode &
Configuration.UI_MODE_NIGHT_MASK;
switch (currentNightMode)
{
case Configuration.UI_MODE_NIGHT_NO:
activity.getWindow().setStatusBarColor(
activity.getResources().getColor(R.color.m3_sys_color_dynamic_light_surface));
break;
case Configuration.UI_MODE_NIGHT_YES:
activity.getWindow().setStatusBarColor(
activity.getResources().getColor(R.color.m3_sys_color_dynamic_dark_surface));
break;
}
break; break;
case MATERIAL_DEFAULT: case MATERIAL_DEFAULT:
activity.setTheme(R.style.Theme_Dolphin_Main_Material); activity.setTheme(R.style.Theme_Dolphin_Main_Material);
activity.getWindow()
.setStatusBarColor(activity.getResources().getColor(R.color.dolphin_surface));
break; break;
case GREEN: case GREEN:
activity.setTheme(R.style.Theme_Dolphin_Main_Green); activity.setTheme(R.style.Theme_Dolphin_Main_Green);
activity.getWindow()
.setStatusBarColor(activity.getResources().getColor(R.color.green_surface));
break; break;
case PINK: case PINK:
activity.setTheme(R.style.Theme_Dolphin_Main_Pink); activity.setTheme(R.style.Theme_Dolphin_Main_Pink);
activity.getWindow()
.setStatusBarColor(activity.getResources().getColor(R.color.pink_surface));
break; break;
} }
@ -79,19 +65,19 @@ public class ThemeHelper
// black status bar since their icons do not adapt based on background color // black status bar since their icons do not adapt based on background color
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
{ {
activity.getWindow() activity.getWindow().setStatusBarColor(
.setStatusBarColor(activity.getResources().getColor(android.R.color.black)); ContextCompat.getColor(activity.getApplicationContext(), android.R.color.black));
} }
} }
public static void saveTheme(Activity activity, int themeValue) public static void saveTheme(@NonNull Activity activity, int themeValue)
{ {
SharedPreferences preferences = SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()); PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
preferences.edit().putInt(CURRENT_THEME, themeValue).apply(); preferences.edit().putInt(CURRENT_THEME, themeValue).apply();
} }
public static void deleteThemeKey(Activity activity) public static void deleteThemeKey(@NonNull Activity activity)
{ {
SharedPreferences preferences = SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()); PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext());
@ -100,7 +86,7 @@ public class ThemeHelper
activity.recreate(); activity.recreate();
} }
public static void setCorrectTheme(Activity activity) public static void setCorrectTheme(AppCompatActivity activity)
{ {
int currentTheme = ((ThemeProvider) activity).getThemeId(); int currentTheme = ((ThemeProvider) activity).getThemeId();
setTheme(activity); setTheme(activity);
@ -111,12 +97,12 @@ public class ThemeHelper
} }
} }
private static void setStatusBarColor(@ColorInt int color, Activity activity) public static void setStatusBarColor(AppCompatActivity activity, @ColorInt int color)
{ {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M)
{ {
activity.getWindow() activity.getWindow().setStatusBarColor(
.setStatusBarColor(activity.getResources().getColor(android.R.color.black)); ContextCompat.getColor(activity.getApplicationContext(), android.R.color.black));
} }
else else
{ {
@ -124,8 +110,42 @@ public class ThemeHelper
} }
} }
public static void enableScrollTint(MaterialToolbar toolbar, AppBarLayout appBarLayout, public static void setNavigationBarColor(Activity activity, @ColorInt int color)
Activity activity) {
int gestureType = InsetsHelper.getSystemGestureType(activity.getApplicationContext());
int orientation = activity.getResources().getConfiguration().orientation;
// Use black if the Android version is too low to support changing button colors
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O_MR1)
{
activity.getWindow().setNavigationBarColor(
ContextCompat.getColor(activity.getApplicationContext(), android.R.color.black));
}
// Use a solid color when the navigation bar is on the left/right edge of the screen
else if ((gestureType == InsetsHelper.THREE_BUTTON_NAVIGATION ||
gestureType == InsetsHelper.TWO_BUTTON_NAVIGATION) &&
orientation == Configuration.ORIENTATION_LANDSCAPE)
{
activity.getWindow().setNavigationBarColor(color);
}
// Use semi-transparent color when in portrait mode with three/two button navigation to
// partially see list items behind the navigation bar
else if (gestureType == InsetsHelper.THREE_BUTTON_NAVIGATION ||
gestureType == InsetsHelper.TWO_BUTTON_NAVIGATION)
{
activity.getWindow().setNavigationBarColor(getColorWithOpacity(color, NAV_BAR_ALPHA));
}
// Use transparent color when using gesture navigation
else
{
activity.getWindow().setNavigationBarColor(
ContextCompat.getColor(activity.getApplicationContext(),
android.R.color.transparent));
}
}
public static void enableScrollTint(AppCompatActivity activity, MaterialToolbar toolbar,
@NonNull AppBarLayout appBarLayout)
{ {
appBarLayout.addOnOffsetChangedListener((layout, verticalOffset) -> appBarLayout.addOnOffsetChangedListener((layout, verticalOffset) ->
{ {
@ -133,14 +153,42 @@ public class ThemeHelper
{ {
@ColorInt int color = MaterialColors.getColor(toolbar, R.attr.colorSurfaceVariant); @ColorInt int color = MaterialColors.getColor(toolbar, R.attr.colorSurfaceVariant);
toolbar.setBackgroundColor(color); toolbar.setBackgroundColor(color);
setStatusBarColor(color, activity); setStatusBarColor(activity, color);
} }
else else
{ {
@ColorInt int color = MaterialColors.getColor(toolbar, R.attr.colorSurface); @ColorInt int statusBarColor = ContextCompat.getColor(activity.getApplicationContext(),
toolbar.setBackgroundColor(color); android.R.color.transparent);
setStatusBarColor(color, activity); @ColorInt int appBarColor = MaterialColors.getColor(toolbar, R.attr.colorSurface);
toolbar.setBackgroundColor(appBarColor);
setStatusBarColor(activity, statusBarColor);
} }
}); });
} }
public static void enableStatusBarScrollTint(AppCompatActivity activity,
@NonNull AppBarLayout appBarLayout)
{
appBarLayout.addOnOffsetChangedListener((layout, verticalOffset) ->
{
if (-verticalOffset > 0)
{
@ColorInt int color = MaterialColors.getColor(appBarLayout, R.attr.colorSurface);
setStatusBarColor(activity, color);
}
else
{
@ColorInt int statusBarColor = ContextCompat.getColor(activity.getApplicationContext(),
android.R.color.transparent);
setStatusBarColor(activity, statusBarColor);
}
});
}
@RequiresApi(api = Build.VERSION_CODES.O_MR1) @ColorInt
private static int getColorWithOpacity(@ColorInt int color, float alphaFactor)
{
return Color.argb(Math.round(alphaFactor * Color.alpha(color)), Color.red(color),
Color.green(color), Color.blue(color));
}
} }

View File

@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_user_data" android:id="@+id/appbar_user_data"
@ -18,6 +19,7 @@
android:id="@+id/toolbar_user_data_layout" android:id="@+id/toolbar_user_data_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutMediumSize" android:layout_height="?attr/collapsingToolbarLayoutMediumSize"
app:contentScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -33,8 +35,10 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view_user_data"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -140,4 +144,12 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<View
android:id="@+id/workaround_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@android:color/transparent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_convert" android:id="@+id/appbar_convert"
@ -17,6 +18,7 @@
android:id="@+id/toolbar_convert_layout" android:id="@+id/toolbar_convert_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutMediumSize" android:layout_height="?attr/collapsingToolbarLayoutMediumSize"
app:contentScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -32,8 +34,10 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view_convert"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -79,4 +83,12 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<View
android:id="@+id/workaround_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@android:color/transparent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -3,20 +3,22 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_main" android:id="@+id/coordinator_main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_cheats" android:id="@+id/appbar_cheats"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
app:liftOnScroll="false"
app:elevation="0dp"> app:elevation="0dp">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar_cheats" android:id="@+id/toolbar_cheats"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorSurface"/> android:background="?attr/colorSurface" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
@ -24,7 +26,7 @@
android:id="@+id/sliding_pane_layout" android:id="@+id/sliding_pane_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="56dp"> android:layout_marginTop="64dp">
<androidx.fragment.app.FragmentContainerView <androidx.fragment.app.FragmentContainerView
android:id="@+id/cheat_list" android:id="@+id/cheat_list"
@ -40,4 +42,12 @@
</androidx.slidingpanelayout.widget.SlidingPaneLayout> </androidx.slidingpanelayout.widget.SlidingPaneLayout>
<View
android:id="@+id/workaround_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@android:color/transparent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_convert" android:id="@+id/appbar_convert"
@ -17,6 +18,7 @@
android:id="@+id/toolbar_convert_layout" android:id="@+id/toolbar_convert_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutMediumSize" android:layout_height="?attr/collapsingToolbarLayoutMediumSize"
app:contentScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -32,8 +34,10 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view_convert"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -77,4 +81,12 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<View
android:id="@+id/workaround_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@android:color/transparent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -4,12 +4,14 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_main" android:id="@+id/coordinator_main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_main" android:id="@+id/appbar_main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:liftOnScroll="false"
app:elevation="0dp"> app:elevation="0dp">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -40,11 +42,18 @@
android:background="?attr/colorSurface" android:background="?attr/colorSurface"
app:layout_behavior="@string/appbar_scrolling_view_behavior" /> app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<View
android:id="@+id/workaround_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@android:color/transparent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/button_add_directory" android:id="@+id/button_add_directory"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_add" android:src="@drawable/ic_add"
app:layout_anchor="@+id/pager_platforms" app:layout_anchor="@+id/pager_platforms"
app:layout_anchorGravity="bottom|right|end" /> app:layout_anchorGravity="bottom|right|end" />

View File

@ -4,7 +4,8 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_riivolution" android:id="@+id/appbar_riivolution"
@ -18,6 +19,7 @@
android:id="@+id/toolbar_riivolution_layout" android:id="@+id/toolbar_riivolution_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutMediumSize" android:layout_height="?attr/collapsingToolbarLayoutMediumSize"
app:contentScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -33,8 +35,10 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view_riivolution"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -94,4 +98,12 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<View
android:id="@+id/workaround_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@android:color/transparent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_main" android:id="@+id/coordinator_main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_settings" android:id="@+id/appbar_settings"
@ -18,6 +19,7 @@
android:id="@+id/toolbar_settings_layout" android:id="@+id/toolbar_settings_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutMediumSize" android:layout_height="?attr/collapsingToolbarLayoutMediumSize"
app:contentScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -32,9 +34,17 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<FrameLayout <FrameLayout
android:id="@+id/frame_content" android:id="@+id/frame_content_settings"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/> app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
<View
android:id="@+id/workaround_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@android:color/transparent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:background="?attr/colorSurface">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar_user_data" android:id="@+id/appbar_user_data"
@ -18,6 +19,7 @@
android:id="@+id/toolbar_user_data_layout" android:id="@+id/toolbar_user_data_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutMediumSize" android:layout_height="?attr/collapsingToolbarLayoutMediumSize"
app:contentScrim="@android:color/transparent"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap"> app:layout_scrollFlags="scroll|exitUntilCollapsed|snap">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
@ -33,8 +35,10 @@
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/scroll_view_user_data"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false"
app:layout_behavior="@string/appbar_scrolling_view_behavior"> app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
@ -117,4 +121,12 @@
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<View
android:id="@+id/workaround_view"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="bottom"
android:clickable="true"
android:background="@android:color/transparent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -8,37 +9,38 @@
android:clickable="true" android:clickable="true"
android:clipToPadding="false" android:clipToPadding="false"
android:focusable="true" android:focusable="true"
android:orientation="vertical"
android:paddingStart="4dp" android:paddingStart="4dp"
android:paddingTop="8dp" android:paddingTop="8dp"
android:paddingEnd="4dp" android:paddingEnd="4dp"
android:paddingBottom="8dp"
android:transitionName="card_game"> android:transitionName="card_game">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/card_game_art" android:id="@+id/card_game_art"
android:layout_width="115dp" android:layout_width="115dp"
android:layout_height="161dp" android:layout_height="161dp"
android:layout_gravity="center" app:cardCornerRadius="4dp"
android:layout_marginBottom="8dp" app:layout_constraintEnd_toEndOf="parent"
app:cardCornerRadius="4dp"> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView <ImageView
android:id="@+id/image_game_screen" android:id="@+id/image_game_screen"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1"/> android:layout_weight="1" />
<TextView <TextView
android:id="@+id/text_game_title_inner" android:id="@+id/text_game_title_inner"
style="@android:style/TextAppearance.Material.Subhead" style="@android:style/TextAppearance.Material.Subhead"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:paddingTop="8dp"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center|top" android:gravity="center|top"
android:maxLines="2" android:maxLines="2"
android:paddingLeft="2dp"
android:paddingRight="2dp"
android:paddingTop="8dp"
android:visibility="visible" android:visibility="visible"
tools:text="The Legend of Zelda: The Wind Waker" /> tools:text="The Legend of Zelda: The Wind Waker" />
@ -47,26 +49,28 @@
<TextView <TextView
android:id="@+id/text_game_title" android:id="@+id/text_game_title"
style="@android:style/TextAppearance.Material.Subhead" style="@android:style/TextAppearance.Material.Subhead"
android:layout_width="wrap_content" android:layout_width="115dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="2" android:maxLines="2"
tools:layout_width="140dp" android:paddingTop="8dp"
app:layout_constraintEnd_toEndOf="@+id/card_game_art"
app:layout_constraintStart_toStartOf="@+id/card_game_art"
app:layout_constraintTop_toBottomOf="@+id/card_game_art"
tools:text="The Legend of Zelda: The Wind Waker" /> tools:text="The Legend of Zelda: The Wind Waker" />
<TextView <TextView
android:id="@+id/text_game_caption" android:id="@+id/text_game_caption"
style="@android:style/TextAppearance.Material.Caption" style="@android:style/TextAppearance.Material.Caption"
android:layout_width="wrap_content" android:layout_width="115dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:ellipsize="end" android:ellipsize="end"
android:lines="1" android:lines="1"
android:maxLines="1" android:maxLines="1"
tools:layout_width="140dp" android:paddingTop="8dp"
app:layout_constraintEnd_toEndOf="@+id/card_game_art"
app:layout_constraintStart_toStartOf="@+id/card_game_art"
app:layout_constraintTop_toBottomOf="@+id/text_game_title"
tools:text="Nintendo" /> tools:text="Nintendo" />
</LinearLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -14,7 +14,7 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toTopOf="@id/barrier"> app:layout_constraintBottom_toTopOf="@id/button_layout">
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent" android:layout_width="match_parent"
@ -119,55 +119,62 @@
</ScrollView> </ScrollView>
<androidx.constraintlayout.widget.Barrier <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/barrier" android:id="@+id/button_layout"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:barrierDirection="top" android:background="@android:color/transparent"
app:constraint_referenced_ids="button_delete,button_edit,button_cancel,button_ok" /> app:layout_constraintBottom_toBottomOf="parent">
<Button <com.google.android.material.divider.MaterialDivider
android:id="@+id/button_delete" android:layout_width="match_parent"
android:layout_width="0dp" android:layout_height="0dp"
android:layout_height="wrap_content" app:layout_constraintTop_toTopOf="parent" />
android:layout_margin="@dimen/spacing_large"
android:text="@string/cheats_delete"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/button_edit"
app:layout_constraintTop_toBottomOf="@id/barrier"
app:layout_constraintBottom_toBottomOf="parent" />
<Button <Button
android:id="@+id/button_edit" android:id="@+id/button_delete"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_large" android:layout_margin="@dimen/spacing_large"
android:text="@string/cheats_edit" android:text="@string/cheats_delete"
app:layout_constraintStart_toEndOf="@id/button_delete" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/button_cancel" app:layout_constraintEnd_toStartOf="@id/button_edit"
app:layout_constraintTop_toBottomOf="@id/barrier" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<Button <Button
android:id="@+id/button_cancel" android:id="@+id/button_edit"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_large" android:layout_margin="@dimen/spacing_large"
android:text="@string/cancel" android:text="@string/cheats_edit"
app:layout_constraintStart_toEndOf="@id/button_edit" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/button_ok" app:layout_constraintEnd_toStartOf="@id/button_cancel"
app:layout_constraintTop_toBottomOf="@id/barrier" app:layout_constraintStart_toEndOf="@id/button_delete"
app:layout_constraintBottom_toBottomOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<Button <Button
android:id="@+id/button_ok" android:id="@+id/button_cancel"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_large" android:layout_margin="@dimen/spacing_large"
android:text="@string/ok" android:text="@string/cancel"
app:layout_constraintStart_toEndOf="@id/button_cancel" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toStartOf="@id/button_ok"
app:layout_constraintTop_toBottomOf="@id/barrier" app:layout_constraintStart_toEndOf="@id/button_edit"
app:layout_constraintBottom_toBottomOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button_ok"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_margin="@dimen/spacing_large"
android:text="@string/ok"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/button_cancel"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -10,6 +10,7 @@
android:name="org.dolphinemu.dolphinemu.features.cheats.ui.CheatsDisabledWarningFragment" android:name="org.dolphinemu.dolphinemu.features.cheats.ui.CheatsDisabledWarningFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorSurfaceVariant"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
@ -20,6 +21,7 @@
android:name="org.dolphinemu.dolphinemu.features.cheats.ui.GraphicsModsDisabledWarningFragment" android:name="org.dolphinemu.dolphinemu.features.cheats.ui.GraphicsModsDisabledWarningFragment"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/colorSurfaceVariant"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/cheats_warning" app:layout_constraintTop_toBottomOf="@id/cheats_warning"
@ -29,6 +31,7 @@
android:id="@+id/cheat_list" android:id="@+id/cheat_list"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
android:clipToPadding="false"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/gfx_mods_warning" app:layout_constraintTop_toBottomOf="@id/gfx_mods_warning"

View File

@ -6,8 +6,8 @@
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipe_refresh" android:id="@+id/swipe_refresh"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"> android:layout_marginRight="@dimen/activity_horizontal_margin">
@ -15,10 +15,8 @@
android:id="@+id/grid_games" android:id="@+id/grid_games"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:listitem="@layout/card_game"
android:clipToPadding="false" android:clipToPadding="false"
android:paddingTop="8dp" tools:listitem="@layout/card_game" />
android:paddingBottom="8dp"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

View File

@ -1,12 +1,14 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<org.dolphinemu.dolphinemu.features.settings.ui.SettingsFrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <org.dolphinemu.dolphinemu.features.settings.ui.SettingsFrameLayout
android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"> android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/list_settings" android:id="@+id/list_settings"
android:background="?android:attr/colorBackground" android:background="?attr/colorSurface"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"/> android:layout_height="match_parent"
android:clipToPadding="false" />
</org.dolphinemu.dolphinemu.features.settings.ui.SettingsFrameLayout> </org.dolphinemu.dolphinemu.features.settings.ui.SettingsFrameLayout>

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="Theme.V27.Dolphin" parent="Theme.Dolphin"> <style name="Theme.V27.Dolphin" parent="Theme.Dolphin">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:windowLightNavigationBar">@bool/lightSystemBars</item> <item name="android:windowLightNavigationBar">@bool/lightSystemBars</item>
</style> </style>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.V29.Dolphin" parent="Theme.V27.Dolphin">
<item name="android:enforceStatusBarContrast">false</item>
<item name="android:enforceNavigationBarContrast">false</item>
</style>
<style name="Theme.Dolphin.Main" parent="Theme.V29.Dolphin" />
</resources>