diff --git a/android/brave_java_resources.gni b/android/brave_java_resources.gni index eb4977560a94..58ac8f84e3a2 100644 --- a/android/brave_java_resources.gni +++ b/android/brave_java_resources.gni @@ -382,6 +382,7 @@ brave_java_resources = [ "java/res/drawable/crypto_wallet_hollow_button.xml", "java/res/drawable/crypto_wallet_onboarding_blue_button.xml", "java/res/drawable/custodian_text_background.xml", + "java/res/drawable/dapps_permission_dialog_background.xml", "java/res/drawable/default_dot.xml", "java/res/drawable/default_indicator.xml", "java/res/drawable/ellipse_217.xml", diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/permission/BraveDappPermissionPromptDialog.java b/android/java/org/chromium/chrome/browser/crypto_wallet/permission/BraveDappPermissionPromptDialog.java index a5604afadb80..13556a6474a7 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/permission/BraveDappPermissionPromptDialog.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/permission/BraveDappPermissionPromptDialog.java @@ -10,6 +10,7 @@ import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; +import android.view.Window; import android.widget.ImageView; import android.widget.TextView; @@ -60,6 +61,7 @@ public class BraveDappPermissionPromptDialog private final ModalDialogManager mModalDialogManager; private final int mCoinType; private final Context mContext; + private final Window mWindow; private long mNativeDialogController; private PropertyModel mPropertyModel; private String mFavIconURL; @@ -85,13 +87,13 @@ private static BraveDappPermissionPromptDialog create( public BraveDappPermissionPromptDialog( long nativeDialogController, - WindowAndroid windowAndroid, + @NonNull WindowAndroid windowAndroid, String favIconURL, @CoinType.EnumType int coinType) { mNativeDialogController = nativeDialogController; mFavIconURL = favIconURL; mContext = windowAndroid.getActivity().get(); - + mWindow = windowAndroid.getWindow(); mModalDialogManager = windowAndroid.getModalDialogManager(); mCoinType = coinType; mMojoServicesClosed = false; @@ -113,7 +115,7 @@ public BraveDappPermissionPromptDialog( void show() { View customView = LayoutInflaterUtils.inflate( - mContext, R.layout.brave_permission_prompt_dialog, null); + mWindow, R.layout.brave_permission_prompt_dialog, null, false); mFavIconImage = customView.findViewById(R.id.favicon); mCvFavContainer = customView.findViewById(R.id.permission_prompt_fav_container); @@ -142,7 +144,7 @@ void show() { R.string.permissions_connect_brave_wallet_back_button_text)) .with(ModalDialogProperties.FILTER_TOUCH_FOR_SECURITY, true) .build(); - mModalDialogManager.showDialog(mPropertyModel, ModalDialogType.APP); + mModalDialogManager.showDialog(mPropertyModel, ModalDialogType.TAB); initKeyringService(); try { BraveActivity activity = BraveActivity.getBraveActivity(); @@ -160,7 +162,7 @@ void show() { mPermissionDialogPositiveButton.setEnabled(false); } } catch (BraveActivity.BraveActivityNotFoundException e) { - Log.e(TAG, "show " + e); + Log.e(TAG, "show", e); } initAccounts(); } @@ -172,7 +174,7 @@ int getPermissionLifetimeOption() { @NonNull private ViewGroup getPermissionModalViewContainer(@NonNull View customView) { - ViewParent viewParent = customView.getParent(); + ViewParent viewParent = (ViewParent) customView; while (viewParent.getParent() != null) { viewParent = viewParent.getParent(); if (viewParent instanceof ModalDialogView) { diff --git a/android/java/res/drawable/dapps_permission_dialog_background.xml b/android/java/res/drawable/dapps_permission_dialog_background.xml new file mode 100644 index 000000000000..eb21822f36e3 --- /dev/null +++ b/android/java/res/drawable/dapps_permission_dialog_background.xml @@ -0,0 +1,13 @@ + + + + + + diff --git a/android/java/res/layout/brave_permission_prompt_dialog.xml b/android/java/res/layout/brave_permission_prompt_dialog.xml index cc1bf369d329..0e4beb9332ff 100644 --- a/android/java/res/layout/brave_permission_prompt_dialog.xml +++ b/android/java/res/layout/brave_permission_prompt_dialog.xml @@ -8,7 +8,7 @@ xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" style="@style/AlertDialogContent" - android:background="@color/brave_wallet_dn_panel_bg" + android:background="@drawable/dapps_permission_dialog_background" android:gravity="start">