Bumps compile API to 29 (Q) removes unecessary casts and deprecated

calls
This commit is contained in:
Rafael Toledo 2019-03-07 00:14:58 -03:00
parent a9cf8670e0
commit 2d1f32efb4
17 changed files with 42 additions and 62 deletions

View File

@ -1,7 +1,7 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
compileSdkVersion 29
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
@ -75,15 +75,11 @@ android {
}
}
ext {
androidSupportVersion = '28.0.0'
}
dependencies {
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.exifinterface:exifinterface:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.exifinterface:exifinterface:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
// Android TV UI libraries.
@ -91,12 +87,12 @@ dependencies {
implementation 'androidx.tvprovider:tvprovider:1.0.0'
// For REST calls
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.volley:volley:1.1.1'
// For loading huge screenshots from the disk.
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.nononsenseapps:filepicker:4.1.0'
implementation 'com.nononsenseapps:filepicker:4.2.1'
}
def getVersion() {

View File

@ -3,6 +3,7 @@ package org.dolphinemu.dolphinemu.adapters;
import android.app.AlertDialog;
import android.graphics.Rect;
import androidx.annotation.NonNull;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;
@ -161,8 +162,9 @@ public final class GameAdapter extends RecyclerView.Adapter<GameViewHolder> impl
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
RecyclerView.State state)
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
@NonNull RecyclerView parent,
@NonNull RecyclerView.State state)
{
outRect.left = space;
outRect.right = space;

View File

@ -2,19 +2,13 @@ package org.dolphinemu.dolphinemu.dialogs;
import android.app.AlertDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Vibrator;
import android.preference.PreferenceManager;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.settings.model.view.InputBindingSetting;
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
import org.dolphinemu.dolphinemu.utils.Log;
import org.dolphinemu.dolphinemu.utils.Rumble;
import org.dolphinemu.dolphinemu.utils.TvUtil;
import java.util.ArrayList;

View File

@ -1,7 +1,5 @@
package org.dolphinemu.dolphinemu.features.settings.model.view;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Vibrator;
import android.view.InputDevice;
import android.view.KeyEvent;

View File

@ -89,20 +89,6 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
mPresenter.onAttach();
}
/**
* This version of onAttach is needed for versions below Marshmallow.
*
* @param activity
*/
@Override
public void onAttach(Activity activity)
{
super.onAttach(activity);
mActivity = (SettingsActivityView) activity;
mPresenter.onAttach();
}
@Override
public void onCreate(Bundle savedInstanceState)
{
@ -139,11 +125,11 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
LinearLayoutManager manager = new LinearLayoutManager(getActivity());
RecyclerView recyclerView = (RecyclerView) view.findViewById(R.id.list_settings);
RecyclerView recyclerView = view.findViewById(R.id.list_settings);
recyclerView.setAdapter(mAdapter);
recyclerView.setLayoutManager(manager);
recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), null));
recyclerView.addItemDecoration(new DividerItemDecoration(requireActivity(), null));
SettingsActivityView activity = (SettingsActivityView) getActivity();
mPresenter.onViewCreated(menuTag, activity.getSettings());

View File

@ -30,8 +30,8 @@ public final class InputBindingSettingViewHolder extends SettingViewHolder
@Override
protected void findViews(View root)
{
mTextSettingName = (TextView) root.findViewById(R.id.text_setting_name);
mTextSettingDescription = (TextView) root.findViewById(R.id.text_setting_description);
mTextSettingName = root.findViewById(R.id.text_setting_name);
mTextSettingDescription = root.findViewById(R.id.text_setting_description);
}
@Override

View File

@ -6,6 +6,7 @@ import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -23,7 +24,6 @@ public final class DividerItemDecoration extends RecyclerView.ItemDecoration
private boolean mShowFirstDivider = false;
private boolean mShowLastDivider = false;
public DividerItemDecoration(Context context, AttributeSet attrs)
{
final TypedArray a = context
@ -54,15 +54,16 @@ public final class DividerItemDecoration extends RecyclerView.ItemDecoration
}
@Override
public void getItemOffsets(Rect outRect, View view, RecyclerView parent,
RecyclerView.State state)
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view,
@NonNull RecyclerView parent,
@NonNull RecyclerView.State state)
{
super.getItemOffsets(outRect, view, parent, state);
if (mDivider == null)
{
return;
}
if (parent.getChildPosition(view) < 1)
if (parent.getChildAdapterPosition(view) < 1)
{
return;
}
@ -78,7 +79,8 @@ public final class DividerItemDecoration extends RecyclerView.ItemDecoration
}
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state)
public void onDrawOver(@NonNull Canvas c, @NonNull RecyclerView parent,
@NonNull RecyclerView.State state)
{
if (mDivider == null)
{

View File

@ -112,10 +112,10 @@ public final class MainActivity extends AppCompatActivity implements MainView
// TODO: Replace with a ButterKnife injection.
private void findViews()
{
mToolbar = (Toolbar) findViewById(R.id.toolbar_main);
mViewPager = (ViewPager) findViewById(R.id.pager_platforms);
mTabLayout = (TabLayout) findViewById(R.id.tabs_platforms);
mFab = (FloatingActionButton) findViewById(R.id.button_add_directory);
mToolbar = findViewById(R.id.toolbar_main);
mViewPager = findViewById(R.id.pager_platforms);
mTabLayout = findViewById(R.id.tabs_platforms);
mFab = findViewById(R.id.button_add_directory);
}
@Override

View File

@ -4,6 +4,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.leanback.app.BrowseFragment;
import androidx.leanback.app.BrowseSupportFragment;
import androidx.leanback.widget.ArrayObjectAdapter;
@ -100,7 +101,7 @@ public final class TvMainActivity extends FragmentActivity implements MainView
.commit();
// Set display parameters for the BrowseFragment
mBrowseFragment.setHeadersState(BrowseFragment.HEADERS_ENABLED);
mBrowseFragment.setHeadersState(BrowseSupportFragment.HEADERS_ENABLED);
mBrowseFragment.setBrandColor(ContextCompat.getColor(this, R.color.dolphin_blue_dark));
buildRowsAdapter();
@ -191,7 +192,8 @@ public final class TvMainActivity extends FragmentActivity implements MainView
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults)
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults)
{
switch (requestCode)
{

View File

@ -39,7 +39,6 @@ public final class PlatformGamesFragment extends Fragment implements PlatformGam
super.onCreate(savedInstanceState);
}
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{

View File

@ -14,6 +14,8 @@ import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.features.settings.model.Settings;
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
public class Analytics
{
private static final String analyticsAsked =

View File

@ -24,7 +24,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.util.concurrent.atomic.AtomicBoolean;
/**
* A service that spawns its own thread in order to copy several binary and shader files
* from the Dolphin APK to the external file system.

View File

@ -13,8 +13,6 @@ import org.dolphinemu.dolphinemu.features.settings.model.Settings;
import org.dolphinemu.dolphinemu.features.settings.model.StringSetting;
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
import java.util.HashMap;
public class Rumble
{
private static Vibrator phoneVibrator;

View File

@ -2,7 +2,7 @@
<resources>
<!-- Inherit from the material theme -->
<style name="DolphinBase" parent="Theme.AppCompat.Light.NoActionBar">
<style name="DolphinBase" parent="Theme.MaterialComponents.Light.NoActionBar">
<!-- Main theme colors -->
<!-- Branding color for the app bar -->
<item name="colorPrimary">@color/dolphin_blue</item>
@ -19,7 +19,7 @@
</style>
<!-- Same as above, but use default action bar, and mandate margins. -->
<style name="DolphinSettingsBase" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="DolphinSettingsBase" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_purple</item>
@ -29,7 +29,7 @@
<!-- Inherit from the Base Dolphin Dialog Theme -->
<style name="DolphinEmulationBase" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="DolphinEmulationBase" parent="Theme.MaterialComponents.Light.DarkActionBar">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_purple</item>
@ -43,7 +43,7 @@
<item name="android:windowAllowReturnTransitionOverlap">true</item>
</style>
<style name="DolphinEmulationTvBase" parent="Theme.AppCompat.Light.NoActionBar">
<style name="DolphinEmulationTvBase" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_purple</item>
@ -111,7 +111,7 @@
<item name="nnf_toolbarTheme">@style/ThemeOverlay.AppCompat.Dark.ActionBar</item>
</style>
<style name="FilePickerAlertDialogTheme" parent="Theme.AppCompat.Dialog.Alert">
<style name="FilePickerAlertDialogTheme" parent="Theme.MaterialComponents.Dialog.Alert">
<item name="colorPrimary">@color/dolphin_blue</item>
<item name="colorPrimaryDark">@color/dolphin_blue_dark</item>
<item name="colorAccent">@color/dolphin_accent_gamecube</item>

View File

@ -1,7 +1,7 @@
buildscript {
repositories {
jcenter()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
@ -10,7 +10,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
jcenter()
}
}

View File

@ -13,4 +13,6 @@ 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
# org.gradle.parallel=true
android.useAndroidX=true
android.enableJetifier=true

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip