Skip to content
Permalink
Browse files

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

Moves AlertDialogs imports to AndroidX and fix tabs background color
  • Loading branch information
JosJuice committed Nov 23, 2019
2 parents a06da59 + 8453277 commit 4305a9ac57a4bee1e0be0c54b9df2cda385b114a
@@ -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;
@@ -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.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 @@ protected void onCreate(Bundle savedInstanceState)
}

@Override
protected void onSaveInstanceState(Bundle outState)
protected void onSaveInstanceState(@NonNull Bundle outState)
{
if (!isChangingConfigurations())
{
@@ -384,6 +385,7 @@ public void onBackPressed()
@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 @@ private void adjustScale()
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));
@@ -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;

@@ -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;
@@ -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 static GameSettingsDialog newInstance(String gameId, int platform)
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) ->
@@ -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 boolean onKeyEvent(int keyCode, KeyEvent event)
}

@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 boolean dispatchKeyEvent(KeyEvent event)
}

@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);
@@ -1,13 +1,14 @@
package org.dolphinemu.dolphinemu.features.settings.ui;

import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
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 boolean onOptionsItemSelected(MenuItem item)
}

@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);
@@ -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.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
{
@@ -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;

@@ -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,34 +15,36 @@
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>

<androidx.viewpager.widget.ViewPager
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>

0 comments on commit 4305a9a

Please sign in to comment.
You can’t perform that action at this time.