-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Android 13 showWarning modal condition update
- Loading branch information
1 parent
f4a981b
commit b5574ae
Showing
8 changed files
with
221 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
.../chrome/browser/notifications/permissions/BraveNotificationPermissionRationaleDialog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package org.chromium.chrome.browser.notifications.permissions; | ||
|
||
import org.chromium.chrome.browser.BraveDialogFragment; | ||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.view.LayoutInflater; | ||
import android.view.ViewGroup; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
import org.chromium.chrome.R; | ||
import android.graphics.drawable.ColorDrawable; | ||
import android.graphics.Color; | ||
import android.view.Window; | ||
import android.widget.Button; | ||
import org.chromium.chrome.browser.notifications.BravePermissionUtils; | ||
|
||
|
||
public class BraveNotificationPermissionRationaleDialog extends BraveDialogFragment { | ||
|
||
public static BraveNotificationPermissionRationaleDialog newInstance() { | ||
BraveNotificationPermissionRationaleDialog fragment = new BraveNotificationPermissionRationaleDialog(); | ||
return fragment; | ||
} | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
} | ||
|
||
@Override | ||
public View onCreateView( | ||
LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | ||
View view = inflater.inflate(R.layout.brave_notification_permission_rationale_dialog, container, false); | ||
if (getDialog() != null && getDialog().getWindow() != null) { | ||
getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); | ||
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE); | ||
} | ||
return view; | ||
} | ||
|
||
@Override | ||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | ||
super.onViewCreated(view, savedInstanceState); | ||
clickOnContinueButton(view); | ||
clickOnNotNow(view); | ||
} | ||
|
||
private void clickOnContinueButton(View view) { | ||
Button primaryButton = view.findViewById(R.id.notification_continue_button); | ||
primaryButton.setOnClickListener(v -> { | ||
dismiss(); | ||
BravePermissionUtils.requestPermission(getActivity()); | ||
}); | ||
} | ||
|
||
private void clickOnNotNow(View view) { | ||
Button notNowButton = view.findViewById(R.id.notification_not_now_button); | ||
notNowButton.setOnClickListener(v -> { dismiss(); }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.