Merge pull request #8482 from rafaeltoledo/rt/material-fix
Moves AlertDialogs imports to AndroidX and fix tabs background color
This commit is contained in:
commit
4305a9ac57
|
@ -6,9 +6,10 @@
|
||||||
|
|
||||||
package org.dolphinemu.dolphinemu;
|
package org.dolphinemu.dolphinemu;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||||
import org.dolphinemu.dolphinemu.utils.Log;
|
import org.dolphinemu.dolphinemu.utils.Log;
|
||||||
import org.dolphinemu.dolphinemu.utils.Rumble;
|
import org.dolphinemu.dolphinemu.utils.Rumble;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.dolphinemu.dolphinemu.activities;
|
package org.dolphinemu.dolphinemu.activities;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -12,6 +11,8 @@ import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
@ -326,7 +327,7 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState)
|
protected void onSaveInstanceState(@NonNull Bundle outState)
|
||||||
{
|
{
|
||||||
if (!isChangingConfigurations())
|
if (!isChangingConfigurations())
|
||||||
{
|
{
|
||||||
|
@ -384,6 +385,7 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
@Override
|
@Override
|
||||||
protected void onActivityResult(int requestCode, int resultCode, Intent result)
|
protected void onActivityResult(int requestCode, int resultCode, Intent result)
|
||||||
{
|
{
|
||||||
|
super.onActivityResult(requestCode, resultCode, result);
|
||||||
switch (requestCode)
|
switch (requestCode)
|
||||||
{
|
{
|
||||||
case REQUEST_CHANGE_DISC:
|
case REQUEST_CHANGE_DISC:
|
||||||
|
@ -795,9 +797,9 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
LayoutInflater inflater = LayoutInflater.from(this);
|
LayoutInflater inflater = LayoutInflater.from(this);
|
||||||
View view = inflater.inflate(R.layout.dialog_seekbar, null);
|
View view = inflater.inflate(R.layout.dialog_seekbar, null);
|
||||||
|
|
||||||
final SeekBar seekbar = (SeekBar) view.findViewById(R.id.seekbar);
|
final SeekBar seekbar = view.findViewById(R.id.seekbar);
|
||||||
final TextView value = (TextView) view.findViewById(R.id.text_value);
|
final TextView value = view.findViewById(R.id.text_value);
|
||||||
final TextView units = (TextView) view.findViewById(R.id.text_units);
|
final TextView units = view.findViewById(R.id.text_units);
|
||||||
|
|
||||||
seekbar.setMax(150);
|
seekbar.setMax(150);
|
||||||
seekbar.setProgress(mPreferences.getInt("controlScale", 50));
|
seekbar.setProgress(mPreferences.getInt("controlScale", 50));
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.dolphinemu.dolphinemu.adapters;
|
package org.dolphinemu.dolphinemu.adapters;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.recyclerview.widget.RecyclerView;
|
import androidx.recyclerview.widget.RecyclerView;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package org.dolphinemu.dolphinemu.adapters;
|
package org.dolphinemu.dolphinemu.adapters;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.leanback.widget.ImageCardView;
|
import androidx.leanback.widget.ImageCardView;
|
||||||
import androidx.leanback.widget.Presenter;
|
import androidx.leanback.widget.Presenter;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package org.dolphinemu.dolphinemu.dialogs;
|
package org.dolphinemu.dolphinemu.dialogs;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.DialogFragment;
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -34,15 +35,16 @@ public class GameSettingsDialog extends DialogFragment
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public Dialog onCreateDialog(Bundle savedInstanceState)
|
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);
|
String gameId = requireArguments().getString(ARG_GAMEID);
|
||||||
int platform = getArguments().getInt(ARG_PLATFORM);
|
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() ?
|
.setItems(platform == Platform.GAMECUBE.toInt() ?
|
||||||
R.array.gameSettingsMenusGC :
|
R.array.gameSettingsMenusGC :
|
||||||
R.array.gameSettingsMenusWii, (dialog, which) ->
|
R.array.gameSettingsMenusWii, (dialog, which) ->
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package org.dolphinemu.dolphinemu.dialogs;
|
package org.dolphinemu.dolphinemu.dialogs;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.InputDevice;
|
import android.view.InputDevice;
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.MotionEvent;
|
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.features.settings.model.view.InputBindingSetting;
|
||||||
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
|
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
|
||||||
import org.dolphinemu.dolphinemu.utils.Log;
|
import org.dolphinemu.dolphinemu.utils.Log;
|
||||||
|
@ -59,7 +61,7 @@ public final class MotionAlertDialog extends AlertDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
// Option to clear by long back is only needed on the TV interface
|
||||||
if (TvUtil.isLeanback(getContext()) && keyCode == KeyEvent.KEYCODE_BACK)
|
if (TvUtil.isLeanback(getContext()) && keyCode == KeyEvent.KEYCODE_BACK)
|
||||||
|
@ -79,7 +81,7 @@ public final class MotionAlertDialog extends AlertDialog
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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
|
// Handle this event if we care about it, otherwise pass it down the framework
|
||||||
return onMotionEvent(event) || super.dispatchGenericMotionEvent(event);
|
return onMotionEvent(event) || super.dispatchGenericMotionEvent(event);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.dolphinemu.dolphinemu.features.settings.ui;
|
package org.dolphinemu.dolphinemu.features.settings.ui;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -8,6 +7,8 @@ import android.content.IntentFilter;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
@ -67,7 +68,7 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSaveInstanceState(Bundle outState)
|
protected void onSaveInstanceState(@NonNull Bundle outState)
|
||||||
{
|
{
|
||||||
// Critical: If super method is not called, rotations will be busted.
|
// Critical: If super method is not called, rotations will be busted.
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package org.dolphinemu.dolphinemu.utils;
|
package org.dolphinemu.dolphinemu.utils;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Build;
|
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.model.Settings;
|
||||||
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
import org.dolphinemu.dolphinemu.features.settings.utils.SettingsFile;
|
||||||
|
|
||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
|
||||||
public class Analytics
|
public class Analytics
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package org.dolphinemu.dolphinemu.utils;
|
package org.dolphinemu.dolphinemu.utils;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
android:id="@+id/coordinator_main"
|
android:id="@+id/coordinator_main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
android:id="@+id/appbar"
|
android:id="@+id/appbar"
|
||||||
|
@ -15,16 +15,18 @@
|
||||||
android:id="@+id/toolbar_main"
|
android:id="@+id/toolbar_main"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
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
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/tabs_platforms"
|
android:id="@+id/tabs_platforms"
|
||||||
|
style="@style/Widget.Design.TabLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:tabTextAppearance="@style/MyCustomTextAppearance"
|
app:tabBackground="?colorPrimary"
|
||||||
|
app:tabGravity="fill"
|
||||||
app:tabMode="fixed"
|
app:tabMode="fixed"
|
||||||
app:tabGravity="fill"/>
|
app:tabTextAppearance="@style/MyCustomTextAppearance" />
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
@ -32,17 +34,17 @@
|
||||||
android:id="@+id/pager_platforms"
|
android:id="@+id/pager_platforms"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="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
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
android:id="@+id/button_add_directory"
|
android:id="@+id/button_add_directory"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="16dp"
|
android:layout_margin="16dp"
|
||||||
android:src="@drawable/ic_add"
|
android:src="@drawable/ic_add"
|
||||||
app:borderWidth="0dp"
|
app:borderWidth="0dp"
|
||||||
app:rippleColor="?android:colorPrimaryDark"
|
|
||||||
app:layout_anchor="@+id/pager_platforms"
|
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>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
|
|
Loading…
Reference in New Issue