mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Android: Use expanding Extended FAB
This adds text to the FAB when expanded and shrinks the FAB on scroll. The text will return when scrolling up as well.
This commit is contained in:
parent
af5596720f
commit
64733b2504
@ -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();
|
||||
|
||||
|
@ -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) ->
|
||||
{
|
||||
|
@ -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" />
|
||||
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user