Skip to content

Commit

Permalink
Remove estimated earning text [Uplift to 1.74.x] (#26825)
Browse files Browse the repository at this point in the history
Merge pull request #26821 from brave/remove_estimated_earning_android

Remove estimated earning text
  • Loading branch information
deeppandya authored Dec 4, 2024
1 parent 12080da commit e104ce7
Show file tree
Hide file tree
Showing 57 changed files with 71 additions and 247 deletions.
4 changes: 0 additions & 4 deletions android/brave_java_resources.gni
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,6 @@ brave_java_resources = [
"java/res/drawable/brave_privacy_tabs_unlock_image.xml",
"java/res/drawable/brave_rating_emoji_bg.xml",
"java/res/drawable/brave_rating_rate_now_bg.xml",
"java/res/drawable/brave_rewards_ads_month_background.xml",
"java/res/drawable/brave_rewards_circle.xml",
"java/res/drawable/brave_rewards_onboarding_default.xml",
"java/res/drawable/brave_rewards_onboarding_selected.xml",
Expand All @@ -378,7 +377,6 @@ brave_java_resources = [
"java/res/drawable/brave_sync_tab_layout_bg.xml",
"java/res/drawable/brave_sync_top_rounded.xml",
"java/res/drawable/brave_sync_top_rounded_light.xml",
"java/res/drawable/carat_right.xml",
"java/res/drawable/card_bg.xml",
"java/res/drawable/checked_circle_filled.xml",
"java/res/drawable/circular_progress.xml",
Expand Down Expand Up @@ -576,7 +574,6 @@ brave_java_resources = [
"java/res/drawable/ic_rate.xml",
"java/res/drawable/ic_readermode.xml",
"java/res/drawable/ic_refresh_20.xml",
"java/res/drawable/ic_reward_info_outline.xml",
"java/res/drawable/ic_rewards.xml",
"java/res/drawable/ic_rewards_external_link.xml",
"java/res/drawable/ic_rewards_noti_warning_circle.xml",
Expand Down Expand Up @@ -738,7 +735,6 @@ brave_java_resources = [
"java/res/drawable/tipping_send_button_background_disabled.xml",
"java/res/drawable/tipping_send_button_background_selector.xml",
"java/res/drawable/tipping_verified_creator_tooltip_background.xml",
"java/res/drawable/tooltip_arrow.xml",
"java/res/drawable/transparent_bg_bordered.xml",
"java/res/drawable/transparent_shadow_background.xml",
"java/res/drawable/unverified_48_rounded_bg.xml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
package org.chromium.chrome.browser.rewards;

import android.Manifest;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
Expand All @@ -22,7 +21,6 @@
import android.text.method.LinkMovementMethod;
import android.text.style.UnderlineSpan;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.URLUtil;
Expand Down Expand Up @@ -219,7 +217,6 @@ public enum NotificationClickAction {

private View mWalletBalanceProgress;
private View mBalanceDataViewGroups;
private View mEstimatedToolTip;
private PopupWindowTippingTabletUI mPopupWindowTippingTabletUI;
private boolean mIsTablet;

Expand All @@ -240,23 +237,6 @@ public BraveRewardsPanel(View anchorView) {
}
mIconFetcher =
new BraveRewardsHelper(BraveRewardsHelper.currentActiveChromeTabbedActivityTab());

mPopupWindow.setTouchInterceptor(new View.OnTouchListener() {
@SuppressLint("ClickableViewAccessibility")
@Override
public boolean onTouch(View v, MotionEvent event) {
View estimatedTooltipGroup = mPopupView.findViewById(R.id.estimated_tooltip_group);
if (mEstimatedToolTip != null && mEstimatedToolTip.isShown()
&& !isWithinViewBounds((int) event.getRawX(), (int) event.getRawY())) {
estimatedTooltipGroup.setVisibility(View.GONE);
}
if (event.getAction() == MotionEvent.ACTION_OUTSIDE) {
dismiss();
return true;
}
return false;
}
});
mPopupWindow.setOnDismissListener(
new PopupWindow.OnDismissListener() {
@Override
Expand Down Expand Up @@ -296,17 +276,6 @@ public void onDismiss() {
setUpViews();
}

private Boolean isWithinViewBounds(int xPoint, int yPoint) {
View estimatedTooltip = mPopupView.findViewById(R.id.estimated_earnings_tooltip);
int[] location = new int[2];
estimatedTooltip.getLocationOnScreen(location);
int x = location[0];
int y = location[1];
int w = estimatedTooltip.getWidth();
int h = estimatedTooltip.getHeight();
return !(xPoint < x || xPoint > x + w || yPoint < y || yPoint > y + h);
}

public void showLikePopDownMenu() {
mPopupWindow.setTouchable(true);
mPopupWindow.setFocusable(true);
Expand Down Expand Up @@ -375,8 +344,6 @@ private void showRewardsMainUI() {
return;
}
mRewardsMainLayout.setVisibility(View.VISIBLE);
mEstimatedToolTip = mPopupView.findViewById(R.id.estimated_earnings_tooltip);
maybeShowEstimatedToolTip();

TextView loggedOutStateText = mPopupView.findViewById(R.id.logged_out_state_text);
if (mExternalWallet != null) {
Expand Down Expand Up @@ -449,48 +416,11 @@ public void onClick(View v) {
mBtnTip.setEnabled(false);

String monthName = (String) android.text.format.DateFormat.format("MMMM", new Date());
String monthNameShort = (String) android.text.format.DateFormat.format("MMM", new Date());
int lastDate = Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH);
int currentYear = Calendar.getInstance().get(Calendar.YEAR);

String adsMonthlyStatement = monthNameShort.replaceAll("\\.", "");
String monthYear = monthName + " " + currentYear;

TextView adsMonthlyStatementText = mPopupView.findViewById(R.id.ads_monthly_statement_text);
adsMonthlyStatementText.setText(adsMonthlyStatement);

TextView monthYearText = mPopupView.findViewById(R.id.month_year_text);
monthYearText.setText(monthYear);
}
@SuppressLint("ClickableViewAccessibility")
private void maybeShowEstimatedToolTip() {
View estimatedEarningsText = mPopupView.findViewById(R.id.estimated_earnings);
View estimatedTooltipGroup = mPopupView.findViewById(R.id.estimated_tooltip_group);
clickManageAds();
clickOnCloseButton();
estimatedEarningsText.setOnClickListener(
v -> { estimatedTooltipGroup.setVisibility(View.VISIBLE); });
}

private void clickManageAds() {
View manageAds = mPopupView.findViewById(R.id.manage_ads_text);
manageAds.setOnClickListener(v -> {
if (mBraveActivity != null) {
mBraveActivity.openNewOrSelectExistingTab(BraveActivity.BRAVE_REWARDS_SETTINGS_URL);
View estimatedTooltipGroup = mPopupView.findViewById(R.id.estimated_tooltip_group);
estimatedTooltipGroup.setVisibility(View.GONE);
dismiss();
}
});
}

private void clickOnCloseButton() {
View closeButton = mPopupView.findViewById(R.id.manage_ads_close_button);
closeButton.setOnClickListener(v -> {
View estimatedTooltipGroup = mPopupView.findViewById(R.id.estimated_tooltip_group);
estimatedTooltipGroup.setVisibility(View.GONE);
});
}

private void setVisibilityForLoggedOutState() {
View balanceText = mPopupView.findViewById(R.id.balance_text);
Expand Down Expand Up @@ -952,8 +882,8 @@ public void onGetAdsAccountStatement(
if (mExternalWallet != null
&& mExternalWallet.getStatus() == WalletStatus.NOT_CONNECTED
&& !PackageUtils.isFirstInstall(mActivity)) {
mPopupView.findViewById(R.id.estimated_earnings_range_group).setVisibility(View.GONE);
mPopupView.findViewById(R.id.estimated_not_connected_group).setVisibility(View.VISIBLE);
mPopupView.findViewById(R.id.ads_seen_group).setVisibility(View.GONE);
mPopupView.findViewById(R.id.rewards_not_connected_group).setVisibility(View.VISIBLE);
TextView batAdsBalanceLearnMoreText =
mPopupView.findViewById(R.id.bat_ads_balance_learn_more_text);
batAdsBalanceLearnMoreText.setOnClickListener(
Expand All @@ -964,16 +894,8 @@ public void onClick(View v) {
}
});
} else {
TextView estimatedRange = mPopupView.findViewById(R.id.estimated_range);
String minValue = BraveRewardsHelper.getFormattedAmount(minEarningsThisMonth);
String maxValue = BraveRewardsHelper.getFormattedAmount(maxEarningsThisMonth);

if (maxEarningsThisMonth == 0.0) { // don't show range just show 0.000
estimatedRange.setText(maxValue);
} else {
final String estimatedValue = minValue + " - " + maxValue;
estimatedRange.setText(estimatedValue);
}
TextView adsCountText = mPopupView.findViewById(R.id.ads_count_text);
adsCountText.setText(String.valueOf(adsReceivedThisMonth));
}

if (minEarningsLastMonth > 0) {
Expand Down Expand Up @@ -2334,7 +2256,8 @@ private int getWalletIcon(String walletType) {
}

private void adjustTouchTargets() {
BraveTouchUtils.ensureMinTouchTarget(mPopupView.findViewById(R.id.estimated_earnings));
BraveTouchUtils.ensureMinTouchTarget(
mPopupView.findViewById(R.id.ads_seen_this_month_text));
BraveTouchUtils.ensureMinTouchTarget(
mPopupView.findViewById(R.id.bat_ads_balance_learn_more_text));
BraveTouchUtils.ensureMinTouchTarget(mPopupView.findViewById(R.id.btn_verify_wallet));
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions android/java/res/drawable/carat_right.xml

This file was deleted.

12 changes: 0 additions & 12 deletions android/java/res/drawable/ic_reward_info_outline.xml

This file was deleted.

9 changes: 0 additions & 9 deletions android/java/res/drawable/tooltip_arrow.xml

This file was deleted.

Loading

0 comments on commit e104ce7

Please sign in to comment.