23 Commits
Author SHA1 Message Date
samartnik f27ee01fce [Android] Redesign VPN profile activity (#36930)
* [Android] Redesign VPN profile activity

* [Review] Fix for close button tint on Brave News card
2026-06-02 20:08:26 +02:00
Oliver 358a9a1107 Sites and shields redux (#34451)
The following content consists of the original commits. Original HEAD
commit is b599de1bcf0702ca11466a3ae1afeac732839544

* shields: add unified panel UI resources and skeleton handler

Add the new unified Shields panel that replaces the legacy popup,
triggered from the existing toolbar Shields icon.

- BraveUnifiedPanelHandler.java (new): skeleton handler with
  popup display, basic shields status rendering, favicon display,
  and lifecycle management.
- BraveShieldsHandler.java:
  - Add mBlockedUrls tracking to BlockersInfo.
  - Add getTotalBlockedCount() and getBlockedUrls() accessors for
    the unified panel.
- BraveShieldsContentSettings.java:
  - Add resetSiteToDefaults() to reset all per-site shields
    settings to global defaults via individual JNI getter/setter
    pairs.
- BraveToolbarLayoutImpl.java:
  - Instantiate BraveUnifiedPanelHandler and route Shields button
    taps through it instead of the legacy handler.
- All XML drawables, layouts, string resources, colors, styles,
  and BUILD.gn/brave_java_sources.gni wiring.

* shields: implement advanced options and toggle controls

Wire up the expandable advanced options section and all toggle
controls in the unified Shields panel.

- BraveUnifiedPanelHandler.java:
  - Implement shields on/off toggle with observer notification.
  - Add block scripts and fingerprinting toggles with
    BraveShieldsContentSettings persistence.
  - Add advanced options expand/collapse with navigation items.
  - Add reset site shields to defaults.
  - Stub methods for sub-panel navigation.
- BraveToolbarLayoutImpl.java:
  - Extract BraveShieldsMenuObserver into a shared instance and
    register it on both the legacy and unified panel handlers so
    either can trigger toolbar icon updates and page reloads.

* shields: add sub-panel navigation for detailed settings

Implement the drill-down sub-panels accessible from the advanced
options section of the unified Shields panel.

- BraveUnifiedPanelHandler.java:
  - Fill out stub navigation methods with full implementations.
  - HTTPS upgrades panel with strict/standard/disabled radio
    options.
  - Trackers & ads panel with aggressive/standard/allow settings.
  - Cookies panel with block-all/block-third-party/allow settings.
  - Shred site data panel with auto-shred mode selection dialog
    and immediate shred with confirmation.
  - Each sub-panel persists its selection via
    BraveShieldsContentSettings and provides return navigation
    to the main panel.

* shields: display favicons for blocked trackers and ads

Add favicon display for blocked tracker domains in the unified
Shields panel, showing up to three cascaded icons with a
prohibited overlay.

- BraveUnifiedPanelHandler.java:
  - Add asynchronous favicon lookup via
    FaviconHelper.getLocalFaviconImageForURL with a multi-step
    fallback chain: exact origin -> registrable domain (via
    UrlUtilities.getDomainAndRegistry) -> alternative TLDs.
  - Prioritize successfully loaded favicons before
    letter-placeholder defaults.
  - Render circular icon containers with theme-aware backgrounds,
    negative-margin cascading, z-ordering, and a stroke-based
    prohibited overlay.
  - Use UrlFormatter for display-friendly domain names.
  - Use ViewUtils.dpToPx for density-independent measurements.

* shields: implement broken site reporting panel

Wire up the broken site reporting panel in the unified Shields UI,
accessible when shields are toggled off.

- BraveUnifiedPanelHandler.java:
  - Add showReportBrokenSitePanel() and
    setupReportBrokenSitePanel().
  - Display site favicon and domain via UrlFormatter.
  - Populate category selection from WebcompatReporterHandler.
  - Attach screenshot via BraveShieldsScreenshotUtil.
  - Pre-populate contact info from existing reporter preferences.
  - Add learn-more clickable span linking to community support.
  - Submit report via WebcompatReporterHandler with toast
    confirmation.

* shields: Add tests for suitable bits of the implementation.

Add unit tests for the new unified Shields panel logic introduced
across the preceding commits.

- BraveShieldsContentSettingsResetTest.java:
  - Verify resetSiteToDefaults() reads global defaults and applies
    them to a per-site URL for all eight setting types.
  - Verify HTTPS upgrade setter is skipped when global default is
    "default" and called when it is any other value.
- BraveUnifiedPanelHandlerStatTest.java:
  - Verify addStat() increments the correct counter for each block
    type (ads, trackers, scripts, fingerprinting).
  - Verify blocked URL recording with 50-item cap.
  - Verify clearBraveShieldsCount() resets and removeStat() deletes
    tab entries.
  - Verify getters return sensible defaults for unknown tab IDs.
  - Verify per-tab stat isolation.
- BraveUnifiedPanelFaviconPriorityTest.java:
  - Verify populateBlockedItemsContainer() prioritises successfully
    loaded favicons before letter-placeholder defaults.
  - Verify display is capped at MAX_BLOCKED_ICONS (3).
  - Verify onFaviconResult() countdown triggers population only
    after all loads complete.
  - Verify cascading negative-margin layout for overlapping icons.
- BUILD.gn (brave/android/junit, brave/test):
  - Register new robolectric_library targets for the shields and
    preferences.website test packages.

* Cleanup & Remove old Shields UI.

This commit completes the changeset by removing the old Shields UI from
the codebase.

Since only a small amount of functionality needed to be kept from the
old UI's code, it has been relocated into BraveUnifiedPanelHandler

* Apply Shields UI tweaks.

This commit applies a number of minor tweaks that were initially missed
from the Figma designs. This should make the look and feel match with
the intended UX fully.

* Shields: Task-post & Back button cleanup.

The back button has been moved to its own XML which is then included by
other dialogs. Additionally, the Shred UI has been fixed up to be
consistent with the existing dialogs.

The favicon rendering task uses PostTask now. The check for whether or
not to post the task has been removed since the callback checks it
anyway and the saving from not posting the task would require pretty
tight timing in order to actually be of benefit so it's arguably not
worth double-checking.

* Shields: Improve accessibility for toggle switches.

Since we have custom-designed toggles, TalkBack would consider them
images. We now attach a delegate to these controls that causes them to
be treated as switches.

* Shields: Improve title sizing, HTTPS reset & fix radio buttons

The title sizing now uses a standard Material style for titles along
with a few tweaks that make it dynamically downsize itself to avoid
truncation.

The HTTPS settings reset is now called unconditionally in order to
resolve a report from the puLL-Merge bot.

Finally, Since there appears to be no easy way to group the radio
buttons whilst retaining the desired style, the code now unconditionally
unchecks them after a settings reset to ensure multiple entries don't
appear to be selected.

* Shields: Remove tryAlternativeTldFavicon code.

We originally implemented a hack for verifying if favicons would load at
all. It has served its purpose and we of course can't legitimately
attempt to pull favicons for other TLDs since they could just be
flat-out wrong. There may be desire for a mechanism in future where we
alias domains, but that is largely out-of-scope for our UI.

* Shields: Support zooming/scrolling the screenshot preview.

When a user reports a site and previews the screenshot (if they choose
to send one) they can now zoom and scroll around the image.

This commit includes the implementation of a reusable class for handling
inputs and scaling the image. I didn't find any pre-existing code for
this behaviour and whilst it could be used elsewhere, I've left it
embedded as a static class since there are no other potential users at
this juncture.

* Shields: Restore code that handles WebView usage.

The old implementation of the Shields panel would ensure
`mHardwareButtonMenuAnchor`/`mContext` were initialised when in WebView
only mode. We still require this in order for the panel to still work.

* Implement more requested minor UI tweaks.

This adds animations to the toggle buttons in the new Shields UI and
fixes the ripple animation on the advanced expander which was missing a
single XML attribute that clamped the effect to the bounds of the
rounded box.

The blocked trackers (without a favicon) have also been tweaked to use
colours from Nala and the letter has been sized up to match the Figma
design.

* Switch toggles to Material UI

This commit switches the toggles to Material UI. This doesn't appear to
have any discernible issues but I'm keeping it separated just in case.

* Support Material You colours and tweak minor UI issues.

This commit alters the XML files so that Material You themes should work
out of the box once the Brave flag for dynamic colours is enabled.

Also resolves a few minor UI issues with placing/alignment/sizing.
2026-06-02 16:43:45 +02:00
Aleksei Seren 44c44a5426 Remove Brave News promoted content ads dead code on Android (#36635)
The Brave News inline promoted ads pipeline is already disabled via
https://github.com/brave/brave-core/pull/32359. This PR removes the remaining
promoted content ads Android code and mojom code that no longer has any effect.
2026-05-25 12:22:01 -05:00
Artem Samoilenko da9fb06b7f [cr149][Android] Changes for making bottom controls more generic
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/d0dca8d3d103b066d551f6713a3ab53b1072ee51

commit d0dca8d3d103b066d551f6713a3ab53b1072ee51
Author: Calder Kitagawa <ckitagawa@chromium.org>
Date:   Fri Mar 13 10:44:15 2026 -0700

    [BottomControls] Make bottom controls more generic

    * Simplify back press logic.
    * Extract LayerType so the component can be reused for multiple layers.
    * Misc. cleanup and reorganization.

    Bug: 492262214
    Change-Id: Ic35a7613f950d73470471b4b5c8b62497c535cee
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7665618
    Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org>
    Reviewed-by: Sky Malice <skym@chromium.org>
    Reviewed-by: Dan Polanco <polardz@google.com>
    Auto-Submit: Calder Kitagawa <ckitagawa@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1599163}
2026-05-22 16:57:34 -04:00
Artem Samoilenko ee0bf49c3c [cr149][Android] NTP vertical gaps for MVT
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/1527e1c0fa38dfb971603f9f59faf7de58c3f313

commit 1527e1c0fa38dfb971603f9f59faf7de58c3f313
Author: Samuel Huang <huangs@chromium.org>
Date:   Wed Apr 8 21:43:14 2026 -0700

    [Android NTP] Fix vertical gaps between adjacent main sections

    The New Tab Page (NTP) has multiple "sections" that are vertically
    stacked. Let's specify these with abbreviations:
    * FSB: Fake Search Box.
    * AIM: AI Mode Button + Incognito Button, AKA Composeplate.
    * MVT: Most Visited Tiles.
    * MS: Magic Stack, AKA New Tab Page Cards.
    * DF: Discovery Feed.

    Note that we're ignoring the Logo (above FSB) and promotion (e.g., for
    Sign in) sections.

    {MVT, MS, DF} may be absent sometimes:
    * NTP Customization can toggle {MVT, MS, DF}.
    * MS dynamically appears / disappears.

    AIM is now a permanent component of the layout and cannot be optionally
    removed.

    Let FSB-AIM be the vertical gap between the FSB bottom and AIM top.
    Similarly, define other spacings. Since {MVT, MS, DF} may be absent,
    there are 7 gap cases: FSB-AIM, AIM-{MVT,MS,DF}, MVT-{MS,DF}, MS-DF.

    Recently we found that these gap sizes are inconsistent. This CL fixes
    the inconsistency by making FSB-AIM = 8 dp, and everything else 16 dp:

      Gap          Old      Goal
      FSB-AIM     9 dp      8 dp
      AIM-MVT    25 dp     16 dp
      AIM-MS     18 dp     16 dp
      AIM-DF     18 dp     16 dp
      MVT-MS     16 dp     16 dp
      MVT-DF     16 dp     16 dp
       MS-DF     16 dp     16 dp

    Strategy:
    * Assign top margins to 12 dp for {FSB, MVT, MS, DF} and 4 dp for AIM.
    * Assign bottom margins to 4 dp. Previously this existed so that
      sections can expand to accommodate shadows. This is no longer
      needed, but we keep the margin anyway as buffer space.

    Note that 4 dp + 12 dp = 16 dp, which will be the standard spacing
    between sections; and the FSB-AIM exception is managed by 4 dp + 4 dp.

    In a previous CL (crrev.com/c/7603164), we removed the dynamic resizing
    logic that was previously required to accommodate the AIM view's shadow.
    With that logic removed, we can now rely entirely on these static
    margins, greatly simplifying the spacing definitions.

    Details:
    * For common dimensions define and use:
      @dimen/ntp_section_top_margin = 12 dp
      @dimen/ntp_section_bottom_margin = 4 dp
    * For AIM top margin define and use:
      @dimen/composeplate_view_margin_top = 4 dp
    * Define "padding" quantities to replace previous uses of
      section-specific "margin" quantities for padding.
    * Update ShowNtpAtStartupTest to expect the new standardized
      @dimen/ntp_section_bottom_margin on the MVT container.
    * Bump revisions in TabSwitcherLayoutPTTest and FeedV2NewTabPageTest to
      trigger Skia Gold rebaselines for the new spacing.

    Bug: 481717794
    Change-Id: I77adb4c8980a3bc2e0803a5b6cd0b2ac7a66d48a
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7589698
    Commit-Queue: Samuel Huang <huangs@chromium.org>
    Reviewed-by: Brandon Wylie <wylieb@google.com>
    Reviewed-by: Xi Han <hanxi@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1611969}
2026-05-22 16:18:05 -04:00
samartnik cd9dbfdef5 [Android] Unify switch style across the app (#36652) 2026-05-22 16:35:58 +01:00
Aleksei Seren bb3c4fe724 Remove Brave News inline content ads dead code on Android (#36539)
The Brave News inline content ads pipeline is already disabled via
https://github.com/brave/brave-core/pull/32359. This PR removes the
remaining inline content ads Android code and mojom code that no longer
has any effect.
2026-05-21 14:16:24 -05:00
samartnik 707ea40d02 [Android] Adjust brave buttons layout size and margins to the address bar (#36481)
[Android] Adjust brave buttons layout size and margins

This adjusts it to the size and margins of the address bar in the upstream.
2026-05-15 14:41:23 -04:00
vadims fb01221cb5 [Android] Update Shred Settings UI (#36431)
Added Shred settings UI modifications and an additional element to 
manage the browsing history shredding flag.

Resolves: https://github.com/brave/brave-browser/issues/55005

---------

Signed-off-by: Vadym Struts <vstruts@brave.com>
2026-05-15 10:09:09 +02:00
Serg 4864534b90 [Android] Migrate private NTP to Leo tokens and fix VPN icon visibility (#35905)
* [Android] Migrate private NTP to Leo tokens and fix VPN icon visibility

- Drop Brave-local duplicates of ic_product_vpn / ic_antenna /
  ic_product_private_window so the private NTP renders the Leo
  (Nala) icons via resource_overlay; tint the inner icon layer to
  primitive_private_window_60 in IncognitoNewTabPageView so the
  designed purple still wins on the fixed-dark surface.
- Remove Brave-local primitive_private_window_5/10/20/60/80/90 from
  brave_colors.xml; references now resolve through Leo's primitive
  scale (same hex for _60/80/90; slight neutral shift for _5/10/20).
- Remove the runtime setBackgroundColor on the scroll view that was
  masking the gradient drawable defined in the layout XML.
- Switch the private-tab logo to ic_social_brave_release_favicon_-
  fullheight_color (Leo) and size in dp (42 phone, 56 tablet) to
  match Figma and to stop scaling with accessibility font size.
- Resize circle drawable to 32x32 (was 32x33), constrain inner icon
  via new_tab_page_incognito_icon_inner_size (20dp / 24dp tablet),
  and grow circle to 48dp on tablets.
- Introduce per-form-factor style aliases (IncognitoNtpTitle /
  SectionTitle / SectionDescription / Cta) under values/ +
  values-sw600dp/ so phones and tablets land on the right Leo
  typography ramp without per-TextView attributes.
- Delete the now-dead ntp_bg_incognito and incognito_modern_-
  primary_color color entries.

Resolves: https://github.com/brave/brave-browser/issues/53958
2026-04-27 10:22:07 -04:00
Szilard Szaloki 8dc92ab21c Account: changes the title label for logged-in users (#34707) 2026-03-14 05:14:17 +09:00
vadims f13eac71f2 Global Shred site's data preference is not available in settings under Brave Shields & privacy (#34391)
Fixed global auto-shred settings to be displayed in Settings under
Brave Shields & Privacy when the Shred feature is enabled.

Resolves: https://github.com/brave/brave-browser/issues/53295
---------

Signed-off-by: Vadym Struts <vstruts@brave.com>
2026-03-04 11:01:13 +01:00
Simone Arpe 32a340275c Fix HeadingH1/2/3/4 by adding android:textStyle bold (#34355) 2026-03-02 16:49:20 +01:00
Simone Arpe 3f35655f1d Implement new layout for widget search promo panel (#34207)
Implements new layout for widget search promo panel and introduces better handling of activity recreations and configuration changes to redraw the widget search promo panel with correct theme (day/night) and proper position.

Other notable enhancements:

- Tweak tablet margins to better frame the onboarding cards on foldable devices after initial review with the design team.
- Fix post-FRE intent and delay activity to avoid a glitch on foldable devices by following the same strategy applied upstream.
- Accessibility: include content descriptions for widget search promo panel images.
- Nala: include new drawables from Nala tokens.
- Append new source android-widget for all searches made from the widget.
- Implement tests to verify new source android-widget.
2026-02-27 13:45:17 +01:00
Szilard Szaloki 5374ffa9c7 [Android] Account: middle-truncate email addresses (#33962) 2026-02-16 01:04:13 +00:00
Serg 5a32bc88c0 Update Android Origin payment UI from subscription to one-time purchase (#33950)
Update Android Origin paywall from subscription to one-time purchase

- Replace monthly/yearly subscription plan selectors with single "One Time Purchase" plan row
- Add 4th feature benefit: one-time purchase, no subscription cost
- Add Origin description and Brave Search Premium note sections
- Replace "Try 7 days free" with "Buy now" button
- Replace "Refresh your credentials" with "Get a login code" button
- Remove "Learn more about Origin" button and unused resources
- Update text styles per design spec
- Comment out billing integration for later hookup

Resolves: https://github.com/brave/brave-browser/issues/52855
2026-02-14 04:20:39 +00:00
Serg fc1c6e3181 [Android Origin] Update Android preferences UI and add restart snackbar (#33867)
Redesign the Origin preferences screen: add a custom restart
snackbar with dismiss button shown on toggle changes, split then
description into styled title/body/note sections, and rename
the bottom section from Subscription to Purchase.

Resolves: https://github.com/brave/brave-browser/issues/52774
2026-02-12 00:36:30 +00:00
Simone Arpe 59c4389a4b New onboarding flow study (smartphones and small screens) (#33521)
Updates the Day Zero onboarding experience on smartphones and small screen devices to a multi‑step, horizontally advancing flow driven by CTA buttons.
It introduces distinct layouts per step, a pager animation helper, and updates onboarding logic to support a scalable, multi‑step sequence with minimal duplication.

Tablet support is intentionally out of scope and will be handled in a separate PR.
2026-02-06 12:13:01 +01:00
vadims f5e7f4b14a [Shred] shred android UI changes add contextual menu (#32834)
Added an ability to start shred manually from two places:
- tab's context menu (includes support of the menu customization)
- tab switch mode
Added confirmation dialog before the site data shred operation

Resolves: https://github.com/brave/brave-browser/issues/51326

---------

Signed-off-by: Vadym Struts <vstruts@brave.com>
2025-12-17 12:49:24 +01:00
Artem Samoilenko 7c434d1acd [cr143][Android] Adjustments for menu footer to match upstream's menu header
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/bf6599b2f1cfd7569c3080f1c4ab084ecb1f72b6

commit bf6599b2f1cfd7569c3080f1c4ab084ecb1f72b6
Author: Sinan Sahin <sinansahin@google.com>
Date:   Fri Oct 3 14:20:00 2025 -0700

    [Density] Adjust app menu icon row for desktop density

    Bug: 414869569
    Change-Id: Ibaeafe4877a8a6905291e3ee0d4554ffb15118ac
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7006563
    Reviewed-by: Wenyu Fu <wenyufu@chromium.org>
    Commit-Queue: Sinan Sahin <sinansahin@google.com>
    Cr-Commit-Position: refs/heads/main@{#1525024}
2025-11-18 11:27:38 -05:00
Szilard Szaloki 8698c26abb [Android] Sync Account section with registration flow. (#32319) 2025-11-14 22:31:31 +01:00
Serg ba3e1d8232 Android origin settings screen (#31877)
* [Android] Brave Origin Settings screen

Exposes Brave Origin feature flag to Java.
Implements Brave Origin Settings screen.
Resolves: https://github.com/brave/brave-browser/issues/50270
2025-10-21 20:53:59 +01:00
samartnik 851cdf1f34 [CodeHealth] Separate Brave-specific resources from Chromium overrides (#31571)
[Android] Separate Brave-specific resources from Chromium overrides
2025-10-02 08:50:51 -04:00