mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Android Refactor: GameGridActivity is now MainActivity, and uses a Toolbar that reacts to the game grid scrolling.
This commit is contained in:
parent
fa2d06e7a4
commit
8b5b83c29a
@ -26,7 +26,7 @@
|
||||
android:banner="@drawable/banner_tv">
|
||||
|
||||
<activity
|
||||
android:name=".activities.GameGridActivity"
|
||||
android:name=".activities.MainActivity"
|
||||
android:theme="@style/DolphinGamecube">
|
||||
|
||||
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
|
||||
|
@ -12,12 +12,12 @@ import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.GridLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.Log;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.Toolbar;
|
||||
|
||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
@ -27,10 +27,10 @@ import org.dolphinemu.dolphinemu.model.GameProvider;
|
||||
import org.dolphinemu.dolphinemu.services.AssetCopyService;
|
||||
|
||||
/**
|
||||
* The main Activity of the Lollipop style UI. Shows a grid of games on tablets & landscape phones,
|
||||
* shows a list of games on portrait phones.
|
||||
* The main Activity of the Lollipop style UI. Manages several PlatformGamesFragments, which
|
||||
* individually display a grid of available games for each Fragment, in a tabbed layout.
|
||||
*/
|
||||
public final class GameGridActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor>
|
||||
public final class MainActivity extends AppCompatActivity implements LoaderManager.LoaderCallbacks<Cursor>
|
||||
{
|
||||
private static final int REQUEST_ADD_DIRECTORY = 1;
|
||||
|
||||
@ -43,10 +43,10 @@ public final class GameGridActivity extends AppCompatActivity implements LoaderM
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_game_grid);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_game_list);
|
||||
setActionBar(toolbar);
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_main);
|
||||
setSupportActionBar(toolbar);
|
||||
|
||||
FloatingActionButton buttonAddDirectory = (FloatingActionButton) findViewById(R.id.button_add_directory);
|
||||
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.grid_games);
|
||||
@ -73,7 +73,7 @@ public final class GameGridActivity extends AppCompatActivity implements LoaderM
|
||||
@Override
|
||||
public void onClick(View view)
|
||||
{
|
||||
Intent fileChooser = new Intent(GameGridActivity.this, AddDirectoryActivity.class);
|
||||
Intent fileChooser = new Intent(MainActivity.this, AddDirectoryActivity.class);
|
||||
|
||||
// The second argument to this method is read below in onActivityResult().
|
||||
startActivityForResult(fileChooser, REQUEST_ADD_DIRECTORY);
|
@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Toolbar
|
||||
android:id="@+id/toolbar_game_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?android:colorPrimary"
|
||||
android:minHeight="?android:attr/actionBarSize"
|
||||
android:theme="@android:style/ThemeOverlay.Material.Dark.ActionBar"
|
||||
android:elevation="6dp"/>
|
||||
|
||||
<FrameLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/grid_games"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/grid_card_game"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/button_add_directory"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_alignBottom="@+id/image_game_screen"
|
||||
android:layout_alignEnd="@+id/text_game_title"
|
||||
android:layout_marginBottom="28dp"
|
||||
android:src="@drawable/ic_add"
|
||||
app:borderWidth="0dp"
|
||||
app:rippleColor="?android:colorPrimaryDark"
|
||||
app:elevation="6dp"
|
||||
app:pressedTranslationZ="12dp"
|
||||
android:layout_gravity="bottom|right"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"/>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
44
Source/Android/app/src/main/res/layout/activity_main.xml
Normal file
44
Source/Android/app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/coordinator_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:id="@+id/appbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/main_appbar_height"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
|
||||
app:layout_scrollFlags="scroll|enterAlways"/>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/grid_games"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:listitem="@layout/grid_card_game"
|
||||
android:layout_marginLeft="@dimen/activity_horizontal_margin"
|
||||
android:layout_marginRight="@dimen/activity_horizontal_margin"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
|
||||
|
||||
<android.support.design.widget.FloatingActionButton
|
||||
android:id="@+id/button_add_directory"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:src="@drawable/ic_add"
|
||||
app:borderWidth="0dp"
|
||||
app:rippleColor="?android:colorPrimaryDark"
|
||||
app:layout_anchor="@+id/grid_games"
|
||||
app:layout_anchorGravity="bottom|right|end"/>
|
||||
</android.support.design.widget.CoordinatorLayout>
|
@ -1,14 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
<item
|
||||
android:id="@+id/menu_refresh"
|
||||
android:title="@string/grid_menu_refresh"
|
||||
android:icon="@drawable/ic_refresh"
|
||||
android:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/menu_settings"
|
||||
android:title="@string/grid_menu_settings"
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:showAsAction="ifRoom"/>
|
||||
app:showAsAction="ifRoom"/>
|
||||
|
||||
</menu>
|
@ -7,4 +7,6 @@
|
||||
<dimen name="elevation_low">1dp</dimen>
|
||||
<dimen name="elevation_high">4dp</dimen>
|
||||
<dimen name="add_button_margin">16dp</dimen>
|
||||
|
||||
<dimen name="main_appbar_height">128dp</dimen>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user