Merge pull request #8482 from rafaeltoledo/rt/material-fix

Moves AlertDialogs imports to AndroidX and fix tabs background color
This commit is contained in:
JosJuice 2019-11-23 16:56:39 +01:00 committed by GitHub
commit 4305a9ac57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 33 deletions

View File

@ -6,9 +6,10 @@
package org.dolphinemu.dolphinemu;
import android.app.AlertDialog;
import android.view.Surface;
import androidx.appcompat.app.AlertDialog;
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
import org.dolphinemu.dolphinemu.utils.Log;
import org.dolphinemu.dolphinemu.utils.Rumble;

View File

@ -1,6 +1,5 @@
package org.dolphinemu.dolphinemu.activities;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@ -12,6 +11,8 @@ import android.os.Handler;
import android.preference.PreferenceManager;
import androidx.annotation.IntDef;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
@ -326,7 +327,7 @@ public final class EmulationActivity extends AppCompatActivity
}
@Override
protected void onSaveInstanceState(Bundle outState)
protected void onSaveInstanceState(@NonNull Bundle outState)
{
if (!isChangingConfigurations())
{
@ -384,6 +385,7 @@ public final class EmulationActivity extends AppCompatActivity
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent result)
{
super.onActivityResult(requestCode, resultCode, result);
switch (requestCode)
{
case REQUEST_CHANGE_DISC:
@ -795,9 +797,9 @@ public final class EmulationActivity extends AppCompatActivity
LayoutInflater inflater = LayoutInflater.from(this);
View view = inflater.inflate(R.layout.dialog_seekbar, null);
final SeekBar seekbar = (SeekBar) view.findViewById(R.id.seekbar);
final TextView value = (TextView) view.findViewById(R.id.text_value);
final TextView units = (TextView) view.findViewById(R.id.text_units);
final SeekBar seekbar = view.findViewById(R.id.seekbar);
final TextView value = view.findViewById(R.id.text_value);
final TextView units = view.findViewById(R.id.text_units);
seekbar.setMax(150);
seekbar.setProgress(mPreferences.getInt("controlScale", 50));

View File

@ -1,9 +1,9 @@
package org.dolphinemu.dolphinemu.adapters;
import android.app.AlertDialog;
import android.graphics.Rect;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.RecyclerView;

View File

@ -1,9 +1,9 @@
package org.dolphinemu.dolphinemu.adapters;
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.drawable.Drawable;
import androidx.appcompat.app.AlertDialog;
import androidx.leanback.widget.ImageCardView;
import androidx.leanback.widget.Presenter;
import androidx.fragment.app.FragmentActivity;

View File

@ -1,9 +1,10 @@
package org.dolphinemu.dolphinemu.dialogs;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import android.widget.Toast;
@ -34,15 +35,16 @@ public class GameSettingsDialog extends DialogFragment
return fragment;
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState)
{
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
String gameId = getArguments().getString(ARG_GAMEID);
int platform = getArguments().getInt(ARG_PLATFORM);
String gameId = requireArguments().getString(ARG_GAMEID);
int platform = requireArguments().getInt(ARG_PLATFORM);
builder.setTitle(getActivity().getString(R.string.preferences_game_settings) + ": " + gameId)
builder.setTitle(requireContext().getString(R.string.preferences_game_settings) + ": " + gameId)
.setItems(platform == Platform.GAMECUBE.toInt() ?
R.array.gameSettingsMenusGC :
R.array.gameSettingsMenusWii, (dialog, which) ->

View File

@ -1,11 +1,13 @@
package org.dolphinemu.dolphinemu.dialogs;
import android.app.AlertDialog;
import android.content.Context;
import android.view.InputDevice;
import android.view.KeyEvent;
import android.view.MotionEvent;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import org.dolphinemu.dolphinemu.features.settings.model.view.InputBindingSetting;
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
import org.dolphinemu.dolphinemu.utils.Log;
@ -59,7 +61,7 @@ public final class MotionAlertDialog extends AlertDialog
}
@Override
public boolean onKeyLongPress(int keyCode, KeyEvent event)
public boolean onKeyLongPress(int keyCode, @NonNull KeyEvent event)
{
// Option to clear by long back is only needed on the TV interface
if (TvUtil.isLeanback(getContext()) && keyCode == KeyEvent.KEYCODE_BACK)
@ -79,7 +81,7 @@ public final class MotionAlertDialog extends AlertDialog
}
@Override
public boolean dispatchGenericMotionEvent(MotionEvent event)
public boolean dispatchGenericMotionEvent(@NonNull MotionEvent event)
{
// Handle this event if we care about it, otherwise pass it down the framework
return onMotionEvent(event) || super.dispatchGenericMotionEvent(event);

View File

@ -1,6 +1,5 @@
package org.dolphinemu.dolphinemu.features.settings.ui;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
@ -8,6 +7,8 @@ import android.content.IntentFilter;
import android.os.Bundle;
import android.provider.Settings;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentTransaction;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.appcompat.app.AppCompatActivity;
@ -67,7 +68,7 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
}
@Override
protected void onSaveInstanceState(Bundle outState)
protected void onSaveInstanceState(@NonNull Bundle outState)
{
// Critical: If super method is not called, rotations will be busted.
super.onSaveInstanceState(outState);

View File

@ -1,6 +1,5 @@
package org.dolphinemu.dolphinemu.utils;
import android.app.AlertDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
@ -14,7 +13,7 @@ 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;
import androidx.appcompat.app.AlertDialog;
public class Analytics
{

View File

@ -1,12 +1,12 @@
package org.dolphinemu.dolphinemu.utils;
import android.annotation.TargetApi;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.os.Build;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.FragmentActivity;
import androidx.core.content.ContextCompat;

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordinator_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
@ -15,16 +15,18 @@
android:id="@+id/toolbar_main"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways"/>
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs_platforms"
style="@style/Widget.Design.TabLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabTextAppearance="@style/MyCustomTextAppearance"
app:tabBackground="?colorPrimary"
app:tabGravity="fill"
app:tabMode="fixed"
app:tabGravity="fill"/>
app:tabTextAppearance="@style/MyCustomTextAppearance" />
</com.google.android.material.appbar.AppBarLayout>
@ -32,17 +34,17 @@
android:id="@+id/pager_platforms"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/button_add_directory"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_add"
app:borderWidth="0dp"
app:rippleColor="?android:colorPrimaryDark"
app:layout_anchor="@+id/pager_platforms"
app:layout_anchorGravity="bottom|right|end"/>
app:layout_anchorGravity="bottom|right|end"
app:rippleColor="?android:colorPrimaryDark" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>