-
Notifications
You must be signed in to change notification settings - Fork 925
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redesign Brave Wallet main layout introducing latest material 2 components #19650
Conversation
Removes logic for old Android versions below Nougat (< API level 24).
Replaces tab layout in favor of bottom navigation view in Brave Wallet activity layout.
Shadows are so messed up on Android that even Google itself stopped using native support and decided to add them manually to solve the problem. We are adopting the same approach used for the Chromium bottom bar. Link: https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/ui/android/toolbar/java/res/layout/bottom_control_container.xml;l=1?q=bottom_control_container.xml
Improves layout by introducing a frame layout that will render the shadow in the correct position.
Improves performance and stability by switching to new ViewPager2 based on modern RecyclerView implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
<LinearLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical" | ||
app:layout_behavior="@string/appbar_scrolling_view_behavior"> | ||
|
||
<include layout="@layout/wallet_backup_banner" /> | ||
|
||
<androidx.viewpager2.widget.ViewPager2 | ||
android:id="@+id/navigation_view_pager" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" /> | ||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:id="@+id/bottom_view_container" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
app:tabIndicator="@drawable/tab_gradient_separator" | ||
app:tabIndicatorHeight="@dimen/brave_wallet_tab_indicator_height" | ||
app:tabIndicatorColor="@null" | ||
android:background="@color/wallet_toolbar_bg_color" | ||
app:tabTextAppearance="@style/BraveWalletTabsTextAppearance" | ||
app:tabGravity="fill" | ||
app:tabSelectedTextColor="@color/tab_color" | ||
app:tabTextColor="@color/wallet_text_color" /> | ||
<include layout="@layout/wallet_backup_banner"/> | ||
<org.chromium.chrome.browser.custom_layout.NonSwipeableViewPager | ||
android:id="@+id/navigation_view_pager" | ||
android:layout_gravity="bottom" | ||
android:orientation="vertical" | ||
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior"> | ||
|
||
<ImageView | ||
android:id="@+id/bottom_container_top_shadow" | ||
android:layout_width="match_parent" | ||
android:layout_height="@dimen/toolbar_shadow_height" | ||
android:scaleType="fitXY" | ||
android:scaleY="-1" | ||
android:src="@drawable/modern_toolbar_shadow" | ||
tools:ignore="ContentDescription" /> | ||
|
||
<org.chromium.chrome.browser.custom_layout.BottomNavigationViewWithIndicator | ||
android:id="@+id/wallet_bottom_navigation" | ||
android:layout_width="match_parent" | ||
android:layout_height="?actionBarSize" | ||
android:background="@color/wallet_toolbar_bg_color" | ||
app:itemHorizontalTranslationEnabled="false" | ||
app:itemIconTint="@color/wallet_bottom_navigation_color" | ||
app:labelVisibilityMode="labeled" | ||
app:menu="@menu/wallet_bottom_navigation_items" /> | ||
</LinearLayout> | ||
|
||
<LinearLayout | ||
android:id="@+id/fab_layout" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="top" | ||
android:orientation="vertical" | ||
app:layout_anchor="@id/bottom_view_container" | ||
app:layout_anchorGravity="top|end"> | ||
|
||
<ImageView | ||
android:id="@+id/pending_tx_notification" | ||
android:layout_width="48dp" | ||
android:layout_height="48dp" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginBottom="16dp" | ||
android:background="@drawable/ic_pending_tx_notification_bg" | ||
android:contentDescription="@null" | ||
android:elevation="10dp" | ||
android:scaleType="fitCenter" | ||
android:src="@drawable/ic_pending_tx_notification_icon" /> | ||
|
||
<ImageView | ||
android:id="@+id/buy_send_swap_button" | ||
android:layout_width="56dp" | ||
android:layout_height="56dp" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginBottom="16dp" | ||
android:background="@drawable/ic_swap_bg" | ||
android:contentDescription="@null" | ||
android:elevation="10dp" | ||
android:scaleType="center" | ||
android:src="@drawable/ic_swap_icon" /> | ||
</LinearLayout> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can be inside one constraint layout
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I should try harder to make this a constraint layout.
I'm going to tackle this task in the PR solving issue brave/brave-browser#32256
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to keep it as it is if it takes more of your time, just a nit.
public CryptoFragmentPageAdapter(FragmentActivity fm) { | ||
super(fm); | ||
Resources resources = fm.getResources(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: fm
should be activity
, no longer a FragmentManager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
if (hasPendingTx()) | ||
((BraveWalletActivity) activity).setPendingTxNotificationVisibility(View.VISIBLE); | ||
((BraveWalletActivity) activity).showPendingTxNotification(true); | ||
else | ||
((BraveWalletActivity) activity).setPendingTxNotificationVisibility(View.GONE); | ||
((BraveWalletActivity) activity).showPendingTxNotification(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with ((BraveWalletActivity) activity).showPendingTxNotification(hasPendingTx());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strings
++
Resolves brave/brave-browser#32197
demo.mov
Remove logic for old Android versions below Nougat (< API level 24).
Switch from old
ViewPager
to new and more performantViewPager2
class.Switch from deprecated
FragmentStatePagerAdapter
to newFragmentStateAdapter
.Rename
Market
section toExplore
section per Figma design.Implement
⚠️ Note: NFTs section will be removed from the bottom navigation view and it will be merged into the portfolio section in a follow up PR (Main umbrella Issue: ☂️ Main umbrella issue for Wallet 2.0 sections redesign brave-browser#32196)
BottomNavigationViewIndicator
to display sections: Portfolio, NFTs, Activity, Accounts, Explore.UI Changes
Bottom Navigation View
Remove tab layout in favor of bottom navigation view with gradient indicator that animates when tapped.
navigator-indicator.mov
App Bar Layout
Add app bar layout and rewrite layout to scroll correctly.
toolbar.mov
Tweak FAB behavior
FAB "follows" bottom navigation view
fab.mov
Banner layout
Improved layout with bottom margin and thin separator.
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: