diff options
| author | Léo Lam <leo@leolam.fr> | 2019-01-16 22:23:40 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-01-16 22:23:40 +0100 |
| commit | 2c2910c129b205fc2941c4f278b247d678953061 (patch) | |
| tree | 18b6673af3109d085efaac5eba4ae994429c2a93 /Source/Android/app/src/main/java | |
| parent | c7373701cc4ad7e3ea223aabb0556386e2671cb3 (diff) | |
| parent | 9a45c6289685c77a73995af8372ee1eb2b07c896 (diff) | |
Merge pull request #7522 from mahdihijazi/updates
Android: Bunch of cleanups & Updates
Diffstat (limited to 'Source/Android/app/src/main/java')
5 files changed, 15 insertions, 98 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java index deadc4a9e9..f5309869d5 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/activities/EmulationActivity.java @@ -183,11 +183,7 @@ public final class EmulationActivity extends AppCompatActivity launcher.putExtra(EXTRA_SELECTED_GAMES, scanForSecondDisc(gameFile)); launcher.putExtra(EXTRA_SELECTED_TITLE, gameFile.getTitle()); launcher.putExtra(EXTRA_PLATFORM, gameFile.getPlatform()); - Bundle options = new Bundle(); - - // I believe this warning is a bug. Activities are FragmentActivity from the support lib - //noinspection RestrictedApi - activity.startActivityForResult(launcher, MainPresenter.REQUEST_EMULATE_GAME, options); + activity.startActivityForResult(launcher, MainPresenter.REQUEST_EMULATE_GAME); } @Override diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java deleted file mode 100644 index 633f334c20..0000000000 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java +++ /dev/null @@ -1,83 +0,0 @@ -package org.dolphinemu.dolphinemu.dialogs; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.os.Bundle; -import android.support.design.widget.FloatingActionButton; -import android.support.v4.app.DialogFragment; -import android.view.ViewGroup; -import android.widget.ImageView; -import android.widget.TextView; - -import com.squareup.picasso.Picasso; - -import org.dolphinemu.dolphinemu.R; -import org.dolphinemu.dolphinemu.activities.EmulationActivity; -import org.dolphinemu.dolphinemu.model.GameFile; -import org.dolphinemu.dolphinemu.services.GameFileCacheService; - -import de.hdodenhof.circleimageview.CircleImageView; - -public final class GameDetailsDialog extends DialogFragment -{ - private static final String ARG_GAME_PATH = "game_path"; - - public static GameDetailsDialog newInstance(String gamePath) - { - GameDetailsDialog fragment = new GameDetailsDialog(); - - Bundle arguments = new Bundle(); - arguments.putString(ARG_GAME_PATH, gamePath); - fragment.setArguments(arguments); - - return fragment; - } - - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) - { - GameFile gameFile = GameFileCacheService.addOrGet(getArguments().getString(ARG_GAME_PATH)); - - AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); - ViewGroup contents = (ViewGroup) getActivity().getLayoutInflater() - .inflate(R.layout.dialog_game_details, null); - - final ImageView imageGameScreen = contents.findViewById(R.id.image_game_screen); - CircleImageView circleBanner = contents.findViewById(R.id.circle_banner); - - TextView textTitle = contents.findViewById(R.id.text_game_title); - TextView textDescription = contents.findViewById(R.id.text_description); - - TextView textCountry = contents.findViewById(R.id.text_country); - TextView textCompany = contents.findViewById(R.id.text_company); - - FloatingActionButton buttonLaunch = contents.findViewById(R.id.button_launch); - - String country = getResources().getStringArray(R.array.countryNames)[gameFile.getCountry()]; - - textTitle.setText(gameFile.getTitle()); - textDescription.setText(gameFile.getDescription()); - textCountry.setText(country); - textCompany.setText(gameFile.getCompany()); - - buttonLaunch.setOnClickListener(view -> - { - // Start the emulation activity and send the path of the clicked ROM to it. - EmulationActivity.launch(getActivity(), gameFile); - }); - - // Fill in the view contents. - Picasso.with(imageGameScreen.getContext()) - .load(getArguments().getString(gameFile.getScreenshotPath())) - .fit() - .centerCrop() - .noFade() - .noPlaceholder() - .into(imageGameScreen); - - circleBanner.setImageResource(R.drawable.no_banner); - - builder.setView(contents); - return builder.create(); - } -} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Action1.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Action1.java new file mode 100644 index 0000000000..9e0d3c7b7c --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Action1.java @@ -0,0 +1,6 @@ +package org.dolphinemu.dolphinemu.utils; + +public interface Action1<T> +{ + void call(T t); +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryStateReceiver.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryStateReceiver.java index fe51b41c3f..14ee85e402 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryStateReceiver.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/DirectoryStateReceiver.java @@ -6,8 +6,6 @@ import android.content.Intent; import org.dolphinemu.dolphinemu.utils.DirectoryInitialization.DirectoryInitializationState; -import rx.functions.Action1; - public class DirectoryStateReceiver extends BroadcastReceiver { Action1<DirectoryInitializationState> callback; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java index 5623670602..cc272e72f9 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/PicassoUtils.java @@ -19,7 +19,7 @@ public class PicassoUtils File cover = new File(gameFile.getCustomCoverPath()); if (cover.exists()) { - Picasso.with(imageView.getContext()) + Picasso.get() .load(cover) .noFade() .noPlaceholder() @@ -31,7 +31,7 @@ public class PicassoUtils } else if ((cover = new File(gameFile.getCoverPath())).exists()) { - Picasso.with(imageView.getContext()) + Picasso.get() .load(cover) .noFade() .noPlaceholder() @@ -47,7 +47,7 @@ public class PicassoUtils */ else { - Picasso.with(imageView.getContext()) + Picasso.get() .load(CoverHelper.buildGameTDBUrl(gameFile, CoverHelper.getRegion(gameFile))) .noFade() .noPlaceholder() @@ -65,9 +65,9 @@ public class PicassoUtils } @Override - public void onError() // Second pass using US region + public void onError(Exception ex) // Second pass using US region { - Picasso.with(imageView.getContext()) + Picasso.get() .load(CoverHelper.buildGameTDBUrl(gameFile, "US")) .fit() .noFade() @@ -87,9 +87,9 @@ public class PicassoUtils } @Override - public void onError() // Third and last pass using EN region + public void onError(Exception ex) // Third and last pass using EN region { - Picasso.with(imageView.getContext()) + Picasso.get() .load(CoverHelper.buildGameTDBUrl(gameFile, "EN")) .fit() .noFade() @@ -110,7 +110,7 @@ public class PicassoUtils } @Override - public void onError() + public void onError(Exception ex) { } }); |
