Merge pull request #11318 from t895/expanded-fab

Android: Use expanding Extended FAB
This commit is contained in:
Mai 2022-12-04 09:14:53 +00:00 committed by GitHub
commit 2aa25c03df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 4 deletions

View File

@ -76,6 +76,17 @@ public final class MainActivity extends AppCompatActivity
// Set up the FAB.
mBinding.buttonAddDirectory.setOnClickListener(view -> mPresenter.onFabClick());
mBinding.appbarMain.addOnOffsetChangedListener((appBarLayout, verticalOffset) ->
{
if (verticalOffset == 0)
{
mBinding.buttonAddDirectory.extend();
}
else if (appBarLayout.getTotalScrollRange() == -verticalOffset)
{
mBinding.buttonAddDirectory.shrink();
}
});
mPresenter.onCreate();

View File

@ -20,7 +20,7 @@ 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 com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import org.dolphinemu.dolphinemu.R;
@ -73,7 +73,7 @@ public class InsetsHelper
}
public static void setUpMainLayout(AppCompatActivity activity, AppBarLayout appBarLayout,
FloatingActionButton fab, ViewPager viewPager, View workaroundView)
ExtendedFloatingActionButton fab, ViewPager viewPager, View workaroundView)
{
ViewCompat.setOnApplyWindowInsetsListener(appBarLayout, (v, windowInsets) ->
{

View File

@ -50,11 +50,12 @@
android:clickable="true"
android:background="@android:color/transparent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/button_add_directory"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_add"
android:text="@string/add_games"
app:icon="@drawable/ic_add"
app:layout_anchor="@+id/pager_platforms"
app:layout_anchorGravity="bottom|right|end" />

View File

@ -440,6 +440,7 @@
<string name="platform_gamecube">GameCube Games</string>
<string name="platform_wii">Wii Games</string>
<string name="platform_wiiware">WiiWare Games</string>
<string name="add_games">Add Games</string>
<string name="add_directory_title">Add Folder to Library</string>
<string name="grid_menu_settings">Settings</string>
<string name="grid_menu_refresh">Refresh Library</string>