Android: Bunch of cleanups & Updates

1. Update Picasso to latest version
2. Remove some unused code

Original commit by mahdihijazi for Dolphin-emu.
This commit is contained in:
FearlessTobi 2020-03-28 21:38:39 +01:00 committed by bunnei
parent b31e4b7e63
commit 8c5d101588
6 changed files with 8 additions and 230 deletions

View File

@ -5,7 +5,7 @@ apply plugin: 'com.android.application'
* This lets us upload a new build at most every 10 seconds for the
* next 680 years.
*/
def autoVersion = (int)(((new Date().getTime()/1000) - 1451606400) / 10)
def autoVersion = (int) (((new Date().getTime() / 1000) - 1451606400) / 10)
def buildType
android {
@ -106,6 +106,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"
@ -113,9 +114,6 @@ dependencies {
// Android TV UI libraries.
implementation "com.android.support:leanback-v17:$androidSupportVersion"
// 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'

View File

@ -112,11 +112,7 @@ public final class EmulationActivity extends AppCompatActivity {
launcher.putExtra(EXTRA_SELECTED_GAME, path);
launcher.putExtra(EXTRA_SELECTED_TITLE, title);
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);
}
private void showRunningNotification() {

View File

@ -1,89 +0,0 @@
package org.citra.citra_emu.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.citra.citra_emu.R;
import org.citra.citra_emu.activities.EmulationActivity;
import de.hdodenhof.circleimageview.CircleImageView;
public final class GameDetailsDialog extends DialogFragment {
private static final String ARG_GAME_TITLE = "game_title";
private static final String ARG_GAME_DESCRIPTION = "game_description";
private static final String ARG_GAME_COUNTRY = "game_country";
private static final String ARG_GAME_DATE = "game_date";
private static final String ARG_GAME_PATH = "game_path";
private static final String ARG_GAME_SCREENSHOT_PATH = "game_screenshot_path";
// TODO Add all of this to the Loader in GameActivity.java
public static GameDetailsDialog newInstance(String title, String description, int country,
String company, String path, String screenshotPath) {
GameDetailsDialog fragment = new GameDetailsDialog();
Bundle arguments = new Bundle();
arguments.putString(ARG_GAME_TITLE, title);
arguments.putString(ARG_GAME_DESCRIPTION, description);
arguments.putInt(ARG_GAME_COUNTRY, country);
arguments.putString(ARG_GAME_DATE, company);
arguments.putString(ARG_GAME_PATH, path);
arguments.putString(ARG_GAME_SCREENSHOT_PATH, screenshotPath);
fragment.setArguments(arguments);
return fragment;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
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_company);
TextView textCountry = contents.findViewById(R.id.text_country);
TextView textDate = contents.findViewById(R.id.text_date);
FloatingActionButton buttonLaunch = contents.findViewById(R.id.button_launch);
int countryIndex = getArguments().getInt(ARG_GAME_COUNTRY);
String country = getResources().getStringArray(R.array.countryNames)[countryIndex];
textTitle.setText(getArguments().getString(ARG_GAME_TITLE));
textDescription.setText(getArguments().getString(ARG_GAME_DESCRIPTION));
textCountry.setText(country);
textDate.setText(getArguments().getString(ARG_GAME_DATE));
buttonLaunch.setOnClickListener(view ->
{
// Start the emulation activity and send the path of the clicked ROM to it.
EmulationActivity.launch(getActivity(), getArguments().getString(ARG_GAME_PATH), getArguments().getString(ARG_GAME_TITLE));
});
// Fill in the view contents.
Picasso.get()
.load(getArguments().getString(ARG_GAME_SCREENSHOT_PATH))
.fit()
.centerCrop()
.noFade()
.noPlaceholder()
.into(imageGameScreen);
circleBanner.setImageResource(R.drawable.no_banner);
builder.setView(contents);
return builder.create();
}
}

View File

@ -0,0 +1,5 @@
package org.citra.citra_emu.utils;
public interface Action1<T> {
void call(T t);
}

View File

@ -7,8 +7,6 @@ import android.content.Intent;
import org.citra.citra_emu.utils.DirectoryInitialization;
import org.citra.citra_emu.utils.DirectoryInitialization.DirectoryInitializationState;
import rx.functions.Action1;
public class DirectoryStateReceiver extends BroadcastReceiver {
Action1<DirectoryInitializationState> callback;

View File

@ -1,130 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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_height="match_parent"
android:layout_width="match_parent"
android:transitionName="card_game">
<RelativeLayout
android:layout_width="480dp"
android:layout_height="match_parent">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circle_banner"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_below="@+id/image_game_screen"
android:layout_marginLeft="16dp"
android:layout_marginTop="24dp"
tools:src="@drawable/placeholder_banner"
app:civ_border_color="?android:colorAccent"
app:civ_border_width="2dp"/>
<ImageView
android:id="@+id/image_game_screen"
android:layout_width="match_parent"
android:layout_height="320dp"
android:layout_alignParentEnd="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:transitionName="image_game_screen"
tools:scaleType="centerCrop"
tools:src="@drawable/placeholder_screenshot"/>
<TextView
android:id="@+id/text_game_title"
style="@android:style/TextAppearance.Material.Headline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_below="@+id/image_game_screen"
android:layout_marginLeft="36dp"
android:layout_marginRight="36dp"
android:layout_marginTop="24dp"
android:layout_toEndOf="@+id/circle_banner"
android:ellipsize="end"
tools:text="Rhythm Heaven Fever"/>
<TextView
android:id="@+id/text_company"
style="@android:style/TextAppearance.Material.Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignEnd="@+id/text_game_title"
android:layout_alignStart="@+id/text_game_title"
android:layout_below="@+id/text_game_title"
android:layout_marginTop="8dp"
tools:text="Zany rhythm action!"/>
<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/text_company"
android:layout_marginTop="16dp"
android:background="#1F000000"/>
<ImageView
android:id="@+id/icon_country"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignStart="@+id/circle_banner"
android:layout_alignTop="@+id/divider"
android:layout_marginTop="24dp"
android:padding="6dp"
android:src="@drawable/ic_country"/>
<ImageView
android:id="@+id/icon_company"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_alignStart="@+id/icon_country"
android:layout_below="@+id/icon_country"
android:layout_marginTop="16dp"
android:padding="6dp"
android:src="@drawable/ic_company"
android:layout_marginBottom="16dp"/>
<TextView
android:id="@+id/text_country"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/icon_country"
android:layout_alignStart="@+id/text_company"
android:layout_alignTop="@+id/icon_country"
android:gravity="center_vertical"
tools:text="United States"/>
<TextView
android:id="@+id/text_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/icon_company"
android:layout_alignStart="@+id/text_country"
android:layout_alignTop="@+id/icon_company"
android:gravity="center_vertical"
tools:text="Nintendo"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/button_launch"
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_play"
android:stateListAnimator="@animator/button_elevation"
app:rippleColor="?android:colorPrimaryDark"
app:borderWidth="0dp"
app:elevation="6dp"
app:pressedTranslationZ="12dp"/>
</RelativeLayout>
</FrameLayout>