-
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
Notification permission dialog dark mode
- Loading branch information
1 parent
99288a5
commit 1a27a1a
Showing
16 changed files
with
280 additions
and
59 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
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
73 changes: 73 additions & 0 deletions
73
.../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,73 @@ | ||
/** | ||
* Copyright (c) 2022 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package org.chromium.chrome.browser.notifications.permissions; | ||
|
||
import android.content.Context; | ||
import android.graphics.Color; | ||
import android.graphics.drawable.ColorDrawable; | ||
import android.os.Bundle; | ||
import android.view.LayoutInflater; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
import android.view.Window; | ||
import android.widget.Button; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.Nullable; | ||
|
||
import org.chromium.chrome.R; | ||
import org.chromium.chrome.browser.BraveDialogFragment; | ||
import org.chromium.chrome.browser.notifications.BravePermissionUtils; | ||
|
||
public class BraveNotificationPermissionRationaleDialog extends BraveDialogFragment { | ||
public static final String NOTIFICATION_RATIONALE_DIALOG_TAG = | ||
"notification_rationale_dialog_tag"; | ||
|
||
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(); }); | ||
} | ||
} |
Oops, something went wrong.