From 1da69811b8a15a31d7db9573dbe57a2dba6cf6e8 Mon Sep 17 00:00:00 2001 From: mahdihijazi Date: Sat, 27 Oct 2018 16:05:09 +0200 Subject: [PATCH 1/6] Android: Update Picasso lib to latest version --- Source/Android/app/build.gradle | 2 +- .../dolphinemu/dialogs/GameDetailsDialog.java | 2 +- .../dolphinemu/utils/PicassoUtils.java | 16 ++++++++-------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index aed67294da..e84718e460 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -96,7 +96,7 @@ dependencies { implementation 'de.hdodenhof:circleimageview:2.1.0' // For loading huge screenshots from the disk. - implementation 'com.squareup.picasso:picasso:2.5.2' + implementation 'com.squareup.picasso:picasso:2.71828' // Allows FRP-style asynchronous operations in Android. implementation 'io.reactivex:rxandroid:1.2.1' 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 index 633f334c20..be254a4b7c 100644 --- 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 @@ -67,7 +67,7 @@ public final class GameDetailsDialog extends DialogFragment }); // Fill in the view contents. - Picasso.with(imageGameScreen.getContext()) + Picasso.get() .load(getArguments().getString(gameFile.getScreenshotPath())) .fit() .centerCrop() 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) { } }); From 5e1a3f11a522a9363659578e3d4d120a7a984df4 Mon Sep 17 00:00:00 2001 From: mahdihijazi Date: Sat, 27 Oct 2018 16:15:12 +0200 Subject: [PATCH 2/6] Android: Remove rxjava lib No need to keep rxjava lib around for one simple use case --- Source/Android/app/build.gradle | 2 -- .../main/java/org/dolphinemu/dolphinemu/utils/Action1.java | 6 ++++++ .../dolphinemu/dolphinemu/utils/DirectoryStateReceiver.java | 2 -- 3 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Action1.java diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index e84718e460..9765e7fbbf 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -98,8 +98,6 @@ dependencies { // For loading huge screenshots from the disk. implementation 'com.squareup.picasso:picasso:2.71828' - // Allows FRP-style asynchronous operations in Android. - implementation 'io.reactivex:rxandroid:1.2.1' implementation 'com.nononsenseapps:filepicker:4.1.0' } 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 +{ + 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 callback; From 593b69728d7e7813a3e3bbd1bfea2f2f56f3a38e Mon Sep 17 00:00:00 2001 From: mahdihijazi Date: Sat, 27 Oct 2018 16:37:34 +0200 Subject: [PATCH 3/6] Android: Remove dead code and related lib --- Source/Android/app/build.gradle | 3 - .../dolphinemu/dialogs/GameDetailsDialog.java | 83 ----------- .../main/res/layout/dialog_game_details.xml | 130 ------------------ 3 files changed, 216 deletions(-) delete mode 100644 Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/dialogs/GameDetailsDialog.java delete mode 100644 Source/Android/app/src/main/res/layout/dialog_game_details.xml diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index 9765e7fbbf..47b5ec4603 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -92,9 +92,6 @@ dependencies { // For REST calls implementation 'com.android.volley:volley:1.1.0' - // For showing the banner as a circle a-la Material Design Guidelines - implementation 'de.hdodenhof:circleimageview:2.1.0' - // For loading huge screenshots from the disk. implementation 'com.squareup.picasso:picasso:2.71828' 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 be254a4b7c..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.get() - .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/res/layout/dialog_game_details.xml b/Source/Android/app/src/main/res/layout/dialog_game_details.xml deleted file mode 100644 index 61cc212f55..0000000000 --- a/Source/Android/app/src/main/res/layout/dialog_game_details.xml +++ /dev/null @@ -1,130 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 6be72e8cbb50f9c554006eaa8f42df64fd8d008d Mon Sep 17 00:00:00 2001 From: mahdihijazi Date: Sat, 27 Oct 2018 16:58:38 +0200 Subject: [PATCH 4/6] Android: Fix gradle warning Picasso is using an old version of the support lib which creates a conflict for the exifinterface support librar, this will make sure to use the version Dolphin is using which is 27.1.1 --- Source/Android/app/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/Android/app/build.gradle b/Source/Android/app/build.gradle index 47b5ec4603..848d5ec390 100644 --- a/Source/Android/app/build.gradle +++ b/Source/Android/app/build.gradle @@ -81,6 +81,7 @@ ext { dependencies { implementation "com.android.support:support-v13:$androidSupportVersion" + implementation "com.android.support:exifinterface:$androidSupportVersion" implementation "com.android.support:cardview-v7:$androidSupportVersion" implementation "com.android.support:recyclerview-v7:$androidSupportVersion" implementation "com.android.support:design:$androidSupportVersion" From fe9212a515c83ec5edeacae86c37fa7c773ec207 Mon Sep 17 00:00:00 2001 From: mahdihijazi Date: Sat, 27 Oct 2018 19:06:48 +0200 Subject: [PATCH 5/6] Android: Remove legacy hack that is not needed anymore --- Source/Android/gradle.properties | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Android/gradle.properties b/Source/Android/gradle.properties index 7978b61894..f85a73bae2 100644 --- a/Source/Android/gradle.properties +++ b/Source/Android/gradle.properties @@ -11,5 +11,4 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -android.useDeprecatedNdk=true \ No newline at end of file +# org.gradle.parallel=true \ No newline at end of file From 9a45c6289685c77a73995af8372ee1eb2b07c896 Mon Sep 17 00:00:00 2001 From: mahdihijazi Date: Mon, 29 Oct 2018 21:52:29 +0100 Subject: [PATCH 6/6] Android: Remove the use of restericted API and give AS a break --- .../dolphinemu/dolphinemu/activities/EmulationActivity.java | 6 +----- 1 file changed, 1 insertion(+), 5 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 1c9ac12953..bf3f1589a6 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 @@ -173,11 +173,7 @@ public final class EmulationActivity extends AppCompatActivity launcher.putExtra(EXTRA_SELECTED_GAME, gameFile.getPath()); 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