-
Notifications
You must be signed in to change notification settings - Fork 909
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7745 from brave/add_set_default_browser_modal_and…
…roid Add set default browser modal
- Loading branch information
Showing
12 changed files
with
828 additions
and
4 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
66 changes: 66 additions & 0 deletions
66
android/java/org/chromium/chrome/browser/SetDefaultBrowserActivity.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,66 @@ | ||
/** | ||
* Copyright (c) 2021 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; | ||
|
||
import android.os.Bundle; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.ImageView; | ||
import android.widget.TextView; | ||
import android.widget.LinearLayout; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
|
||
import org.chromium.chrome.R; | ||
import org.chromium.chrome.browser.night_mode.GlobalNightModeStateProviderHolder; | ||
import org.chromium.chrome.browser.app.BraveActivity; | ||
|
||
import static org.chromium.ui.base.ViewUtils.dpToPx; | ||
|
||
public class SetDefaultBrowserActivity extends AppCompatActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_set_default_browser); | ||
|
||
boolean isNightMode = GlobalNightModeStateProviderHolder.getInstance().isInNightMode(); | ||
|
||
ImageView setDefaultBrowserImg = findViewById(R.id.set_default_browser_img); | ||
setDefaultBrowserImg.setImageResource(isNightMode | ||
? R.drawable.ic_setbraveasdefault_dark | ||
: R.drawable.ic_setbraveasdefault); | ||
if (isNightMode) { | ||
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) setDefaultBrowserImg.getLayoutParams(); | ||
lp.setMargins(0, dpToPx(this, 16), 0, dpToPx(this, 16)); | ||
setDefaultBrowserImg.setLayoutParams(lp); | ||
} | ||
|
||
Button btnSetDefaultBrowser = findViewById(R.id.btn_set_default_browser); | ||
btnSetDefaultBrowser.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
if (BraveActivity.getBraveActivity() != null) { | ||
BraveActivity.getBraveActivity().handleBraveSetDefaultBrowserDialog(); | ||
} | ||
finish(); | ||
} | ||
}); | ||
|
||
Button btnNotNow = findViewById(R.id.btn_not_now); | ||
btnNotNow.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View view) { | ||
finish(); | ||
} | ||
}); | ||
} | ||
|
||
@Override | ||
public void onBackPressed() {} | ||
} |
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
Oops, something went wrong.