Merge pull request #2688 from sigmabeta/android-tv-ingame-menu
Android TV: Replace toolbar on EmulationActivity with a full-screen menu
This commit is contained in:
commit
3163602157
|
@ -1,5 +1,6 @@
|
|||
package org.dolphinemu.dolphinemu.activities;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
|
@ -13,8 +14,12 @@ import android.view.MenuItem;
|
|||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.animation.AccelerateInterpolator;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.animation.Interpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.squareup.picasso.Callback;
|
||||
import com.squareup.picasso.Picasso;
|
||||
|
@ -22,6 +27,9 @@ import com.squareup.picasso.Picasso;
|
|||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.fragments.EmulationFragment;
|
||||
import org.dolphinemu.dolphinemu.fragments.LoadStateFragment;
|
||||
import org.dolphinemu.dolphinemu.fragments.MenuFragment;
|
||||
import org.dolphinemu.dolphinemu.fragments.SaveStateFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -29,14 +37,22 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
{
|
||||
private View mDecorView;
|
||||
private ImageView mImageView;
|
||||
private FrameLayout mFrameEmulation;
|
||||
|
||||
private boolean mDeviceHasTouchScreen;
|
||||
private boolean mSystemUiVisible;
|
||||
private FrameLayout mFrameEmulation;
|
||||
private LinearLayout mMenuLayout;
|
||||
|
||||
private String mSubmenuFragmentTag;
|
||||
|
||||
// So that MainActivity knows which view to invalidate before the return animation.
|
||||
private int mPosition;
|
||||
|
||||
private boolean mDeviceHasTouchScreen;
|
||||
private boolean mSystemUiVisible;
|
||||
private boolean mMenuVisible;
|
||||
|
||||
private static Interpolator sDecelerator = new DecelerateInterpolator();
|
||||
private static Interpolator sAccelerator = new AccelerateInterpolator();
|
||||
|
||||
/**
|
||||
* Handlers are a way to pass a message to an Activity telling it to do something
|
||||
* on the UI thread. This Handler responds to any message, even blank ones, by
|
||||
|
@ -52,57 +68,70 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
};
|
||||
private String mScreenPath;
|
||||
private FrameLayout mFrameContent;
|
||||
private String mSelectedTitle;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
mDeviceHasTouchScreen = getPackageManager().hasSystemFeature("android.hardware.touchscreen");
|
||||
|
||||
int themeId;
|
||||
if (mDeviceHasTouchScreen)
|
||||
{
|
||||
themeId = R.style.DolphinEmulationGamecube;
|
||||
|
||||
// Get a handle to the Window containing the UI.
|
||||
mDecorView = getWindow().getDecorView();
|
||||
|
||||
// Set these options now so that the SurfaceView the game renders into is the right size.
|
||||
mDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
|
||||
// Set the ActionBar to follow the navigation/status bar's visibility changes.
|
||||
mDecorView.setOnSystemUiVisibilityChangeListener(
|
||||
new View.OnSystemUiVisibilityChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int flags)
|
||||
{
|
||||
mSystemUiVisible = (flags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
|
||||
|
||||
if (mSystemUiVisible)
|
||||
{
|
||||
getSupportActionBar().show();
|
||||
hideSystemUiAfterDelay();
|
||||
}
|
||||
else
|
||||
{
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
themeId = R.style.DolphinEmulationTvGamecube;
|
||||
}
|
||||
|
||||
setTheme(themeId);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
// Picasso will take a while to load these big-ass screenshots. So don't run
|
||||
// the animation until we say so.
|
||||
postponeEnterTransition();
|
||||
|
||||
mDeviceHasTouchScreen = getPackageManager().hasSystemFeature("android.hardware.touchscreen");
|
||||
|
||||
// Get a handle to the Window containing the UI.
|
||||
mDecorView = getWindow().getDecorView();
|
||||
|
||||
// Set these options now so that the SurfaceView the game renders into is the right size.
|
||||
mDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION |
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
|
||||
|
||||
// Set the ActionBar to follow the navigation/status bar's visibility changes.
|
||||
mDecorView.setOnSystemUiVisibilityChangeListener(
|
||||
new View.OnSystemUiVisibilityChangeListener()
|
||||
{
|
||||
@Override
|
||||
public void onSystemUiVisibilityChange(int flags)
|
||||
{
|
||||
mSystemUiVisible = (flags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) == 0;
|
||||
|
||||
if (mSystemUiVisible)
|
||||
{
|
||||
getSupportActionBar().show();
|
||||
hideSystemUiAfterDelay();
|
||||
}
|
||||
else
|
||||
{
|
||||
getSupportActionBar().hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
setContentView(R.layout.activity_emulation);
|
||||
|
||||
mImageView = (ImageView) findViewById(R.id.image_screenshot);
|
||||
mFrameContent = (FrameLayout) findViewById(R.id.frame_content);
|
||||
mFrameEmulation = (FrameLayout) findViewById(R.id.frame_emulation_fragment);
|
||||
mMenuLayout = (LinearLayout) findViewById(R.id.layout_ingame_menu);
|
||||
|
||||
Intent gameToEmulate = getIntent();
|
||||
String path = gameToEmulate.getStringExtra("SelectedGame");
|
||||
String title = gameToEmulate.getStringExtra("SelectedTitle");
|
||||
mSelectedTitle = gameToEmulate.getStringExtra("SelectedTitle");
|
||||
mScreenPath = gameToEmulate.getStringExtra("ScreenPath");
|
||||
mPosition = gameToEmulate.getIntExtra("GridPosition", -1);
|
||||
|
||||
|
@ -148,8 +177,6 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
}
|
||||
});
|
||||
|
||||
setTitle(title);
|
||||
|
||||
// Instantiate an EmulationFragment.
|
||||
EmulationFragment emulationFragment = EmulationFragment.newInstance(path);
|
||||
|
||||
|
@ -157,6 +184,21 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
getFragmentManager().beginTransaction()
|
||||
.add(R.id.frame_emulation_fragment, emulationFragment, EmulationFragment.FRAGMENT_TAG)
|
||||
.commit();
|
||||
|
||||
if (mDeviceHasTouchScreen)
|
||||
{
|
||||
setTitle(mSelectedTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuFragment menuFragment = (MenuFragment) getFragmentManager()
|
||||
.findFragmentById(R.id.fragment_menu);
|
||||
|
||||
if (menuFragment != null)
|
||||
{
|
||||
menuFragment.setTitleText(mSelectedTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -181,8 +223,11 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
{
|
||||
super.onPostCreate(savedInstanceState);
|
||||
|
||||
// Give the user a few seconds to see what the controls look like, then hide them.
|
||||
hideSystemUiAfterDelay();
|
||||
if (mDeviceHasTouchScreen)
|
||||
{
|
||||
// Give the user a few seconds to see what the controls look like, then hide them.
|
||||
hideSystemUiAfterDelay();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -190,36 +235,91 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
{
|
||||
super.onWindowFocusChanged(hasFocus);
|
||||
|
||||
if (hasFocus)
|
||||
if (mDeviceHasTouchScreen)
|
||||
{
|
||||
hideSystemUiAfterDelay();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the window loses focus (i.e. a dialog box, or a popup menu is on screen
|
||||
// stop hiding the UI.
|
||||
mSystemUiHider.removeMessages(0);
|
||||
if (hasFocus)
|
||||
{
|
||||
hideSystemUiAfterDelay();
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the window loses focus (i.e. a dialog box, or a popup menu is on screen
|
||||
// stop hiding the UI.
|
||||
mSystemUiHider.removeMessages(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
if (!mDeviceHasTouchScreen && !mSystemUiVisible)
|
||||
if (!mDeviceHasTouchScreen)
|
||||
{
|
||||
showSystemUI();
|
||||
if (mSubmenuFragmentTag != null)
|
||||
{
|
||||
removeMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
toggleMenu();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let the system handle it; i.e. quit the activity TODO or show "are you sure?" dialog.
|
||||
EmulationFragment fragment = (EmulationFragment) getFragmentManager()
|
||||
.findFragmentByTag(EmulationFragment.FRAGMENT_TAG);
|
||||
fragment.notifyEmulationStopped();
|
||||
|
||||
NativeLibrary.StopEmulation();
|
||||
stopEmulation();
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleMenu()
|
||||
{
|
||||
if (mMenuVisible)
|
||||
{
|
||||
mMenuVisible = false;
|
||||
|
||||
mMenuLayout.animate()
|
||||
.withLayer()
|
||||
.setDuration(200)
|
||||
.setInterpolator(sAccelerator)
|
||||
.alpha(0.0f)
|
||||
.translationX(-400.0f)
|
||||
.withEndAction(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (mMenuVisible)
|
||||
{
|
||||
mMenuLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
mMenuVisible = true;
|
||||
mMenuLayout.setVisibility(View.VISIBLE);
|
||||
|
||||
// mMenuLayout.setTranslationX(-400.0f);
|
||||
mMenuLayout.setAlpha(0.0f);
|
||||
|
||||
mMenuLayout.animate()
|
||||
.withLayer()
|
||||
.setDuration(300)
|
||||
.setInterpolator(sDecelerator)
|
||||
.alpha(1.0f)
|
||||
.translationX(0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void stopEmulation()
|
||||
{
|
||||
EmulationFragment fragment = (EmulationFragment) getFragmentManager()
|
||||
.findFragmentByTag(EmulationFragment.FRAGMENT_TAG);
|
||||
fragment.notifyEmulationStopped();
|
||||
|
||||
NativeLibrary.StopEmulation();
|
||||
}
|
||||
|
||||
public void exitWithAnimation()
|
||||
{
|
||||
runOnUiThread(new Runnable()
|
||||
|
@ -257,7 +357,7 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
mImageView.setVisibility(View.VISIBLE);
|
||||
mImageView.animate()
|
||||
.withLayer()
|
||||
.setDuration(500)
|
||||
.setDuration(100)
|
||||
.alpha(1.0f)
|
||||
.withEndAction(afterShowingScreenshot);
|
||||
}
|
||||
|
@ -284,7 +384,13 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item)
|
||||
{
|
||||
switch (item.getItemId())
|
||||
onMenuItemClicked(item.getItemId());
|
||||
return true;
|
||||
}
|
||||
|
||||
public void onMenuItemClicked(int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
// Enable/Disable input overlay.
|
||||
case R.id.menu_emulation_input_overlay:
|
||||
|
@ -294,67 +400,78 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
|
||||
emulationFragment.toggleInputOverlayVisibility();
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Screenshot capturing
|
||||
case R.id.menu_emulation_screenshot:
|
||||
NativeLibrary.SaveScreenShot();
|
||||
return true;
|
||||
return;
|
||||
|
||||
// Quicksave / Load
|
||||
case R.id.menu_quicksave:
|
||||
NativeLibrary.SaveState(9);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_quickload:
|
||||
NativeLibrary.LoadState(9);
|
||||
return true;
|
||||
return;
|
||||
|
||||
// TV Menu only
|
||||
case R.id.menu_emulation_save_root:
|
||||
showMenu(SaveStateFragment.FRAGMENT_ID);
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_load_root:
|
||||
showMenu(LoadStateFragment.FRAGMENT_ID);
|
||||
return;
|
||||
|
||||
// Save state slots
|
||||
case R.id.menu_emulation_save_1:
|
||||
NativeLibrary.SaveState(0);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_save_2:
|
||||
NativeLibrary.SaveState(1);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_save_3:
|
||||
NativeLibrary.SaveState(2);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_save_4:
|
||||
NativeLibrary.SaveState(3);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_save_5:
|
||||
NativeLibrary.SaveState(4);
|
||||
return true;
|
||||
return;
|
||||
|
||||
// Load state slots
|
||||
case R.id.menu_emulation_load_1:
|
||||
NativeLibrary.LoadState(0);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_load_2:
|
||||
NativeLibrary.LoadState(1);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_load_3:
|
||||
NativeLibrary.LoadState(2);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_load_4:
|
||||
NativeLibrary.LoadState(3);
|
||||
return true;
|
||||
return;
|
||||
|
||||
case R.id.menu_emulation_load_5:
|
||||
NativeLibrary.LoadState(4);
|
||||
return true;
|
||||
return;
|
||||
|
||||
default:
|
||||
return super.onOptionsItemSelected(item);
|
||||
case R.id.menu_exit:
|
||||
toggleMenu();
|
||||
stopEmulation();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -362,6 +479,11 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event)
|
||||
{
|
||||
if (mMenuVisible)
|
||||
{
|
||||
return super.dispatchKeyEvent(event);
|
||||
}
|
||||
|
||||
int action = 0;
|
||||
|
||||
switch (event.getAction())
|
||||
|
@ -391,6 +513,11 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
@Override
|
||||
public boolean dispatchGenericMotionEvent(MotionEvent event)
|
||||
{
|
||||
if (mMenuVisible)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0))
|
||||
{
|
||||
return super.dispatchGenericMotionEvent(event);
|
||||
|
@ -458,4 +585,78 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showMenu(int menuId)
|
||||
{
|
||||
Fragment fragment;
|
||||
|
||||
switch (menuId)
|
||||
{
|
||||
case SaveStateFragment.FRAGMENT_ID:
|
||||
fragment = SaveStateFragment.newInstance();
|
||||
mSubmenuFragmentTag = SaveStateFragment.FRAGMENT_TAG;
|
||||
break;
|
||||
|
||||
case LoadStateFragment.FRAGMENT_ID:
|
||||
fragment = LoadStateFragment.newInstance();
|
||||
mSubmenuFragmentTag = LoadStateFragment.FRAGMENT_TAG;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
getFragmentManager().beginTransaction()
|
||||
.setCustomAnimations(R.animator.menu_slide_in, R.animator.menu_slide_out)
|
||||
.replace(R.id.frame_submenu, fragment, mSubmenuFragmentTag)
|
||||
.commit();
|
||||
}
|
||||
|
||||
private void removeMenu()
|
||||
{
|
||||
if (mSubmenuFragmentTag != null)
|
||||
{
|
||||
final Fragment fragment = getFragmentManager().findFragmentByTag(mSubmenuFragmentTag);
|
||||
|
||||
if (fragment != null)
|
||||
{
|
||||
// When removing a fragment without replacement, its aniimation must be done
|
||||
// manually beforehand.
|
||||
fragment.getView().animate()
|
||||
.withLayer()
|
||||
.setDuration(200)
|
||||
.setInterpolator(sAccelerator)
|
||||
.alpha(0.0f)
|
||||
.translationX(600.0f)
|
||||
.withEndAction(new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (mMenuVisible)
|
||||
{
|
||||
getFragmentManager().beginTransaction()
|
||||
.remove(fragment)
|
||||
.commit();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.e("DolphinEmu", "[EmulationActivity] Fragment not found, can't remove.");
|
||||
}
|
||||
|
||||
mSubmenuFragmentTag = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.e("DolphinEmu", "[EmulationActivity] Fragment Tag empty.");
|
||||
}
|
||||
}
|
||||
|
||||
public String getSelectedTitle()
|
||||
{
|
||||
return mSelectedTitle;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,9 +81,12 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
|||
mSurfaceView.getHolder().addCallback(this);
|
||||
|
||||
// If the input overlay was previously disabled, then don't show it.
|
||||
if (!mPreferences.getBoolean("showInputOverlay", true))
|
||||
if (mInputOverlay != null)
|
||||
{
|
||||
mInputOverlay.setVisibility(View.GONE);
|
||||
if (!mPreferences.getBoolean("showInputOverlay", true))
|
||||
{
|
||||
mInputOverlay.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package org.dolphinemu.dolphinemu.fragments;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.GridLayout;
|
||||
|
||||
import org.dolphinemu.dolphinemu.BuildConfig;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
|
||||
public final class LoadStateFragment extends Fragment implements View.OnClickListener
|
||||
{
|
||||
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".load_state";
|
||||
public static final int FRAGMENT_ID = R.layout.fragment_state_load;
|
||||
|
||||
public static LoadStateFragment newInstance()
|
||||
{
|
||||
LoadStateFragment fragment = new LoadStateFragment();
|
||||
|
||||
// TODO Add any appropriate arguments to this fragment.
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View rootView = inflater.inflate(FRAGMENT_ID, container, false);
|
||||
|
||||
GridLayout grid = (GridLayout) rootView.findViewById(R.id.grid_state_slots);
|
||||
for (int childIndex = 0; childIndex < grid.getChildCount(); childIndex++)
|
||||
{
|
||||
Button button = (Button) grid.getChildAt(childIndex);
|
||||
|
||||
button.setOnClickListener(this);
|
||||
}
|
||||
|
||||
// So that item clicked to start this Fragment is no longer the focused item.
|
||||
grid.requestFocus();
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View button)
|
||||
{
|
||||
((EmulationActivity) getActivity()).onMenuItemClicked(button.getId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package org.dolphinemu.dolphinemu.fragments;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.dolphinemu.dolphinemu.BuildConfig;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
|
||||
public final class MenuFragment extends Fragment implements View.OnClickListener
|
||||
{
|
||||
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".ingame_menu";
|
||||
public static final int FRAGMENT_ID = R.layout.fragment_ingame_menu;
|
||||
private TextView mTitleText;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View rootView = inflater.inflate(FRAGMENT_ID, container, false);
|
||||
|
||||
LinearLayout options = (LinearLayout) rootView.findViewById(R.id.layout_options);
|
||||
for (int childIndex = 0; childIndex < options.getChildCount(); childIndex++)
|
||||
{
|
||||
Button button = (Button) options.getChildAt(childIndex);
|
||||
|
||||
button.setOnClickListener(this);
|
||||
}
|
||||
|
||||
mTitleText = (TextView) rootView.findViewById(R.id.text_game_title);
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View button)
|
||||
{
|
||||
((EmulationActivity) getActivity()).onMenuItemClicked(button.getId());
|
||||
}
|
||||
|
||||
public void setTitleText(String title)
|
||||
{
|
||||
mTitleText.setText(title);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package org.dolphinemu.dolphinemu.fragments;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.GridLayout;
|
||||
|
||||
import org.dolphinemu.dolphinemu.BuildConfig;
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
|
||||
public final class SaveStateFragment extends Fragment implements View.OnClickListener
|
||||
{
|
||||
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".save_state";
|
||||
public static final int FRAGMENT_ID = R.layout.fragment_state_save;
|
||||
|
||||
public static SaveStateFragment newInstance()
|
||||
{
|
||||
SaveStateFragment fragment = new SaveStateFragment();
|
||||
|
||||
// TODO Add any appropriate arguments to this fragment.
|
||||
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View rootView = inflater.inflate(FRAGMENT_ID, container, false);
|
||||
|
||||
GridLayout grid = (GridLayout) rootView.findViewById(R.id.grid_state_slots);
|
||||
for (int childIndex = 0; childIndex < grid.getChildCount(); childIndex++)
|
||||
{
|
||||
Button button = (Button) grid.getChildAt(childIndex);
|
||||
|
||||
button.setOnClickListener(this);
|
||||
}
|
||||
|
||||
// So that item clicked to start this Fragment is no longer the focused item.
|
||||
grid.requestFocus();
|
||||
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View button)
|
||||
{
|
||||
((EmulationActivity) getActivity()).onMenuItemClicked(button.getId());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<objectAnimator
|
||||
android:propertyName="translationX"
|
||||
android:valueType="floatType"
|
||||
android:valueFrom="1280"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:interpolator/decelerate_quad"
|
||||
android:duration="300"/>
|
||||
<objectAnimator
|
||||
android:propertyName="alpha"
|
||||
android:valueType="floatType"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1"
|
||||
android:interpolator="@android:interpolator/accelerate_quad"
|
||||
android:duration="300"/>
|
||||
</set>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<!-- This animation is used ONLY when a submenu is replaced. -->
|
||||
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:propertyName="translationX"
|
||||
android:valueType="floatType"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="1280"
|
||||
android:interpolator="@android:interpolator/decelerate_quad"
|
||||
android:duration="300"/>
|
||||
<objectAnimator xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:propertyName="alpha"
|
||||
android:valueType="floatType"
|
||||
android:valueFrom="1"
|
||||
android:valueTo="0"
|
||||
android:interpolator="@android:interpolator/decelerate_quad"
|
||||
android:duration="300"/>
|
||||
</set>
|
|
@ -0,0 +1,44 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/frame_content">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_emulation_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/image_screenshot"
|
||||
android:transitionName="image_game_screenshot"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_ingame_menu"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:baselineAligned="false">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/fragment_menu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:name="org.dolphinemu.dolphinemu.fragments.MenuFragment"
|
||||
tools:layout="@layout/fragment_ingame_menu"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/frame_submenu"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
|
@ -0,0 +1,14 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="org.dolphinemu.dolphinemu.fragments.EmulationFragment">
|
||||
|
||||
<!-- This is what everything is rendered to during emulation -->
|
||||
<SurfaceView
|
||||
android:id="@+id/surface_emulation"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:focusable="false"
|
||||
android:focusableInTouchMode="false"/>
|
||||
</FrameLayout>
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/dolphin_blue_dark"
|
||||
tools:layout_width="250dp"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_game_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="The Legend of Zelda: The Wind Waker"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="20sp"
|
||||
android:layout_margin="32dp"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_options"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_take_screenshot"
|
||||
android:text="@string/overlay_screenshot"
|
||||
style="@style/InGameMenuOption"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_quicksave"
|
||||
android:text="@string/emulation_quicksave"
|
||||
style="@style/InGameMenuOption"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_quickload"
|
||||
android:text="@string/emulation_quickload"
|
||||
style="@style/InGameMenuOption"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_save_root"
|
||||
android:text="@string/overlay_savestate"
|
||||
style="@style/InGameMenuOption"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_load_root"
|
||||
android:text="@string/overlay_loadstate"
|
||||
style="@style/InGameMenuOption"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_ingame_settings"
|
||||
android:text="@string/settings"
|
||||
style="@style/InGameMenuOption"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_exit"
|
||||
android:text="@string/overlay_exit_emulation"
|
||||
style="@style/InGameMenuOption"/>
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#af000000"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<GridLayout
|
||||
android:id="@+id/grid_state_slots"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:columnCount="3"
|
||||
android:rowCount="2"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_load_1"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot1"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_load_2"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot2"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_load_3"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot3"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_load_4"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot4"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_load_5"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot5"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_load_6"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot6"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
</GridLayout>
|
||||
</FrameLayout>
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#af000000"
|
||||
android:orientation="vertical"
|
||||
>
|
||||
|
||||
<GridLayout
|
||||
android:id="@+id/grid_state_slots"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:columnCount="3"
|
||||
android:rowCount="2"
|
||||
android:layout_gravity="center">
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_save_1"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot1"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_save_2"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot2"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_save_3"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot3"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_save_4"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot4"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_save_5"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot5"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/menu_emulation_save_6"
|
||||
android:layout_width="128dp"
|
||||
android:layout_height="128dp"
|
||||
android:text="@string/overlay_slot6"
|
||||
style="@style/InGameMenuOption"
|
||||
/>
|
||||
</GridLayout>
|
||||
</FrameLayout>
|
|
@ -66,6 +66,7 @@
|
|||
<string name="overlay_slot3">Slot 3</string>
|
||||
<string name="overlay_slot4">Slot 4</string>
|
||||
<string name="overlay_slot5">Slot 5</string>
|
||||
<string name="overlay_slot6">Slot 6</string>
|
||||
|
||||
<!-- Input Config Fragment -->
|
||||
<string name="input_settings">Input</string>
|
||||
|
|
|
@ -95,9 +95,48 @@
|
|||
<item name="colorAccent">@color/dolphin_accent_wiiware</item>
|
||||
</style>
|
||||
|
||||
<style name="DolphinEmulationTvBase" parent="Theme.AppCompat.NoActionBar">
|
||||
<item name="colorPrimary">@color/dolphin_blue</item>
|
||||
<item name="colorPrimaryDark">@color/dolphin_blue_dark</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>
|
||||
|
||||
<!-- Inherit from the Base Dolphin Emulation Theme-->
|
||||
<style name="DolphinEmulationTvWii" parent="DolphinEmulationTvBase">
|
||||
<item name="colorAccent">@color/dolphin_accent_wii</item>
|
||||
</style>
|
||||
|
||||
<style name="DolphinEmulationTvGamecube" parent="DolphinEmulationTvBase">
|
||||
<item name="colorAccent">@color/dolphin_accent_gamecube</item>
|
||||
</style>
|
||||
|
||||
<style name="DolphinEmulationTvWiiware" parent="DolphinEmulationTvBase">
|
||||
<item name="colorAccent">@color/dolphin_accent_wiiware</item>
|
||||
</style>
|
||||
|
||||
<!-- Hax to make Tablayout render icons -->
|
||||
<style name="MyCustomTextAppearance" parent="TextAppearance.Design.Tab">
|
||||
<item name="textAllCaps">false</item>
|
||||
</style>
|
||||
|
||||
<style name="InGameMenuOption" parent="Widget.AppCompat.Button.Borderless">
|
||||
<item name="android:textSize">16sp</item>
|
||||
<item name="android:fontFamily">sans-serif-condensed</item>
|
||||
<item name="android:textColor">@android:color/white</item>
|
||||
<item name="android:textAllCaps">false</item>
|
||||
<item name="android:layout_width">match_parent</item>
|
||||
<item name="android:layout_height">48dp</item>
|
||||
<item name="android:gravity">center_vertical|left</item>
|
||||
<item name="android:paddingLeft">32dp</item>
|
||||
<item name="android:paddingRight">32dp</item>
|
||||
<item name="android:layout_margin">0dp</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
Loading…
Reference in New Issue