Merge pull request #3493 from sigmabeta/android-tv-screenshot-bugfix
[Android] Minor refactor + bugfix
This commit is contained in:
commit
bd31b1411b
|
@ -39,7 +39,7 @@
|
|||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".activities.TvMainActivity"
|
||||
android:name=".ui.main.TvMainActivity"
|
||||
android:theme="@style/DolphinTvGamecube">
|
||||
|
||||
<!-- This intentfilter marks this Activity as the one that gets launched from Home screen. -->
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package org.dolphinemu.dolphinemu.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.Fragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
@ -30,6 +32,7 @@ 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 org.dolphinemu.dolphinemu.ui.main.MainPresenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -662,4 +665,21 @@ public final class EmulationActivity extends AppCompatActivity
|
|||
{
|
||||
return mSelectedTitle;
|
||||
}
|
||||
|
||||
public static void launch(Activity activity, String path, String title, String screenshotPath, int position, View sharedView)
|
||||
{
|
||||
Intent launcher = new Intent(activity, EmulationActivity.class);
|
||||
|
||||
launcher.putExtra("SelectedGame", path);
|
||||
launcher.putExtra("SelectedTitle", title);
|
||||
launcher.putExtra("ScreenPath", screenshotPath);
|
||||
launcher.putExtra("GridPosition", position);
|
||||
|
||||
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
activity,
|
||||
sharedView,
|
||||
"image_game_screenshot");
|
||||
|
||||
activity.startActivityForResult(launcher, MainPresenter.REQUEST_EMULATE_GAME, options.toBundle());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package org.dolphinemu.dolphinemu.adapters;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityOptions;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.DataSetObserver;
|
||||
import android.graphics.Bitmap;
|
||||
|
@ -19,7 +17,6 @@ import org.dolphinemu.dolphinemu.R;
|
|||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.dialogs.GameDetailsDialog;
|
||||
import org.dolphinemu.dolphinemu.model.GameDatabase;
|
||||
import org.dolphinemu.dolphinemu.ui.main.MainPresenter;
|
||||
import org.dolphinemu.dolphinemu.viewholders.GameViewHolder;
|
||||
|
||||
/**
|
||||
|
@ -217,22 +214,12 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
|
|||
{
|
||||
GameViewHolder holder = (GameViewHolder) view.getTag();
|
||||
|
||||
// Start the emulation activity and send the path of the clicked ISO to it.
|
||||
Intent intent = new Intent(view.getContext(), EmulationActivity.class);
|
||||
|
||||
intent.putExtra("SelectedGame", holder.path);
|
||||
intent.putExtra("SelectedTitle", holder.title);
|
||||
intent.putExtra("ScreenPath", holder.screenshotPath);
|
||||
intent.putExtra("GridPosition", holder.getAdapterPosition());
|
||||
|
||||
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
(Activity) view.getContext(),
|
||||
holder.imageScreenshot,
|
||||
"image_game_screenshot");
|
||||
|
||||
((Activity) view.getContext()).startActivityForResult(intent,
|
||||
MainPresenter.REQUEST_EMULATE_GAME,
|
||||
options.toBundle());
|
||||
EmulationActivity.launch((Activity) view.getContext(),
|
||||
holder.path,
|
||||
holder.title,
|
||||
holder.screenshotPath,
|
||||
holder.getAdapterPosition(),
|
||||
holder.imageScreenshot);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.dolphinemu.dolphinemu.viewholders.TvGameViewHolder;
|
|||
|
||||
/**
|
||||
* The Leanback library / docs call this a Presenter, but it works very
|
||||
* similarly to a RecyclerView.ViewHolder.
|
||||
* similarly to a RecyclerView.Adapter.
|
||||
*/
|
||||
public final class GameRowPresenter extends Presenter
|
||||
{
|
||||
|
|
|
@ -4,7 +4,6 @@ package org.dolphinemu.dolphinemu.dialogs;
|
|||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.app.DialogFragment;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.view.View;
|
||||
|
@ -70,18 +69,19 @@ public final class GameDetailsDialog extends DialogFragment
|
|||
textDescription.setText(getArguments().getString(ARGUMENT_GAME_DESCRIPTION));
|
||||
textCountry.setText(country);
|
||||
textDate.setText(getArguments().getString(ARGUMENT_GAME_DATE));
|
||||
|
||||
buttonLaunch.setOnClickListener(new View.OnClickListener()
|
||||
{
|
||||
@Override
|
||||
public void onClick(View view)
|
||||
{
|
||||
// Start the emulation activity and send the path of the clicked ROM to it.
|
||||
Intent intent = new Intent(view.getContext(), EmulationActivity.class);
|
||||
|
||||
intent.putExtra("SelectedGame", getArguments().getString(ARGUMENT_GAME_PATH));
|
||||
intent.putExtra("SelectedTitle", getArguments().getString(ARGUMENT_GAME_TITLE));
|
||||
|
||||
startActivity(intent);
|
||||
EmulationActivity.launch(getActivity(),
|
||||
getArguments().getString(ARGUMENT_GAME_PATH),
|
||||
getArguments().getString(ARGUMENT_GAME_TITLE),
|
||||
getArguments().getString(ARGUMENT_GAME_SCREENSHOT_PATH),
|
||||
-1,
|
||||
imageGameScreen);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.dolphinemu.dolphinemu.activities;
|
||||
package org.dolphinemu.dolphinemu.ui.main;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityOptions;
|
||||
import android.app.FragmentManager;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
|
@ -19,12 +18,13 @@ import android.support.v17.leanback.widget.Row;
|
|||
import android.support.v17.leanback.widget.RowPresenter;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
import org.dolphinemu.dolphinemu.activities.AddDirectoryActivity;
|
||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||
import org.dolphinemu.dolphinemu.activities.SettingsActivity;
|
||||
import org.dolphinemu.dolphinemu.adapters.GameRowPresenter;
|
||||
import org.dolphinemu.dolphinemu.adapters.SettingsRowPresenter;
|
||||
import org.dolphinemu.dolphinemu.model.Game;
|
||||
import org.dolphinemu.dolphinemu.model.TvSettingsItem;
|
||||
import org.dolphinemu.dolphinemu.ui.main.MainPresenter;
|
||||
import org.dolphinemu.dolphinemu.ui.main.MainView;
|
||||
import org.dolphinemu.dolphinemu.utils.StartupHandler;
|
||||
import org.dolphinemu.dolphinemu.viewholders.TvGameViewHolder;
|
||||
|
||||
|
@ -72,19 +72,14 @@ public final class TvMainActivity extends Activity implements MainView
|
|||
else
|
||||
{
|
||||
TvGameViewHolder holder = (TvGameViewHolder) itemViewHolder;
|
||||
|
||||
// Start the emulation activity and send the path of the clicked ISO to it.
|
||||
Intent intent = new Intent(TvMainActivity.this, EmulationActivity.class);
|
||||
|
||||
intent.putExtra("SelectedGame", holder.path);
|
||||
intent.putExtra("SelectedTitle", holder.title);
|
||||
intent.putExtra("ScreenPath", holder.screenshotPath);
|
||||
|
||||
ActivityOptions options = ActivityOptions.makeSceneTransitionAnimation(
|
||||
TvMainActivity.this,
|
||||
holder.imageScreenshot,
|
||||
"image_game_screenshot");
|
||||
|
||||
startActivity(intent, options.toBundle());
|
||||
EmulationActivity.launch(TvMainActivity.this,
|
||||
holder.path,
|
||||
holder.title,
|
||||
holder.screenshotPath,
|
||||
-1,
|
||||
holder.imageScreenshot);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -113,7 +108,7 @@ public final class TvMainActivity extends Activity implements MainView
|
|||
@Override
|
||||
public void refreshFragmentScreenshot(int fragmentPosition)
|
||||
{
|
||||
// No-op (For now)
|
||||
mRowsAdapter.notifyArrayItemRangeChanged(0, mRowsAdapter.size());
|
||||
}
|
||||
|
||||
@Override
|
Loading…
Reference in New Issue