Add background resources for payout banner

Update UI in existing rewards panel
This commit is contained in:
deeppandya
2023-09-05 09:53:55 -04:00
parent 4f2af824a2
commit 178298ca2d
8 changed files with 54 additions and 3 deletions
@@ -1025,8 +1025,32 @@ public class BraveRewardsPanel
if (mPayoutStatusBannerLayout != null && nextPaymentDate > 0
&& !TextUtils.isEmpty(payoutStatus) && mExternalWallet != null
&& mExternalWallet.getStatus() == WalletStatus.CONNECTED) {
Log.e(TAG, "payoutStatus : " + payoutStatus);
String currentDate = (String) android.text.format.DateFormat.format("MMMM", new Date());
String nextPayoutDate = (String) android.text.format.DateFormat.format(
"MMMM dd", new Date((long) nextPaymentDate));
Log.e(TAG, "payoutStatus : " + payoutStatus + " nextPayoutDate : " + nextPayoutDate);
mPayoutStatusBannerLayout.setVisibility(View.VISIBLE);
ImageView payoutBannerImg = mPopupView.findViewById(R.id.payout_banner_img);
TextView payoutBannerText = mPopupView.findViewById(R.id.payout_banner_text);
if (payoutStatus.equals("complete")) {
mPayoutStatusBannerLayout.setBackgroundDrawable(ResourcesCompat.getDrawable(
ContextUtils.getApplicationContext().getResources(),
R.drawable.rewards_panel_payout_complete_bg, null));
payoutBannerImg.setImageResource(R.drawable.ic_notification_auto_contribute);
payoutBannerText.setText(
String.format(mPopupView.getResources().getString(
R.string.rewards_panel_payout_pending_text),
currentDate, nextPayoutDate));
} else if (payoutStatus.equals("pending")) {
} else if (payoutStatus.equals("processing")) {
mPayoutStatusBannerLayout.setBackgroundDrawable(ResourcesCompat.getDrawable(
ContextUtils.getApplicationContext().getResources(),
R.drawable.rewards_panel_payout_processing_bg, null));
payoutBannerImg.setImageResource(R.drawable.ic_notification_auto_contribute);
payoutBannerText.setText(
String.format(mPopupView.getResources().getString(
R.string.rewards_panel_payout_pending_text),
currentDate, nextPayoutDate));
}
}
}
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/rewards_panel_payout_complete_bg_color" />
<corners
android:bottomRightRadius="8dp" android:bottomLeftRadius="8dp"
android:topLeftRadius="0dp" android:topRightRadius="0dp"/>
</shape>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/rewards_panel_payout_processing_bg_color" />
<corners
android:bottomRightRadius="8dp" android:bottomLeftRadius="8dp"
android:topLeftRadius="0dp" android:topRightRadius="0dp"/>
</shape>
@@ -5,4 +5,4 @@
<corners
android:bottomRightRadius="0dp" android:bottomLeftRadius="0dp"
android:topLeftRadius="8dp" android:topRightRadius="8dp"/>
</shape>
</shape>
@@ -6,8 +6,9 @@
android:id="@+id/brave_rewards_panel_payout_layout_id"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/rounded_8_top_bg"
android:background="@drawable/rewards_panel_payout_processing_bg"
android:orientation="horizontal"
android:visibility="gone"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="16dp"
+3
View File
@@ -257,6 +257,9 @@
<color name="rewards_panel_foreground_color">#80000000</color>
<color name="rewards_divider_color">#E9E9F4</color>
<color name="rewards_panel_payout_processing_bg_color">#E8F4FF</color>
<color name="rewards_panel_payout_complete_bg_color">#CBF1D1</color>
<!-- Brave Wallet DApp -->
<color name="brave_wallet_dapp_text_color">#171919</color>