Skip to content

Commit

Permalink
Merge pull request #6375 from brave/pr6275_inconsistent_decimal_dp_1.…
Browse files Browse the repository at this point in the history
…13.x

Inconsistent decimal dp (uplift to 1.13.x)
  • Loading branch information
srirambv authored Aug 10, 2020
2 parents 8ab4840 + 1d9e139 commit 68b6bb9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private void SetData() {
mMonthly_tip_ = IntentUtils.safeGetBooleanExtra (intent, BraveRewardsSiteBannerActivity.TIP_MONTHLY_EXTRA, false);

//set the data
String strAmount = String.format(getDefault(), "%.1f "+(BraveRewardsHelper.isAnonWallet() ? getResources().getString(R.string.brave_ui_bap_text) : getResources().getString(R.string.brave_ui_bat_text)), (float)mAmount_);
String strAmount = String.format(getDefault(), "%.3f "+(BraveRewardsHelper.isAnonWallet() ? getResources().getString(R.string.brave_ui_bap_text) : getResources().getString(R.string.brave_ui_bat_text)), (float)mAmount_);
((TextView)findViewById(R.id.txt_pub_name)).setText(mPublisher_name_);

if (true == mMonthly_tip_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1124,8 +1124,7 @@ public void OnFetchPromotions() {
if (grant.length < 3) {
continue;
}

String toInsert = "<b><font color=#ffffff>" + grant[0] + " " + batPointsText + "</font></b> ";
String toInsert = "<b><font color=#ffffff>" + String.format(Locale.getDefault(), "%.3f", Double.parseDouble(grant[0])) + " " + batPointsText + "</font></b> ";

if (grant[2].equals(BraveRewardsPanelPopup.ADS_GRANT_TYPE) == false) {
Calendar calTime = Calendar.getInstance();
Expand Down Expand Up @@ -1510,9 +1509,9 @@ public void OnRewardsParameters(int errorCode) {
walletBalance = balance_obj.mTotal;
}

DecimalFormat df = new DecimalFormat("#.#");
DecimalFormat df = new DecimalFormat("#.###");
df.setRoundingMode(RoundingMode.FLOOR);
df.setMinimumFractionDigits(1);
df.setMinimumFractionDigits(3);
((TextView) this.root.findViewById(R.id.br_bat_wallet))
.setText(df.format(walletBalance));
((TextView) this.root.findViewById(R.id.br_bat)).setText(batPointsText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void onClick(View view) {

DecimalFormat df = new DecimalFormat("#.###");
df.setRoundingMode(RoundingMode.FLOOR);
df.setMinimumFractionDigits(1);
df.setMinimumFractionDigits(3);
String walletAmount = df.format(balance) + " "+(isAnonWallet ? getResources().getString(R.string.brave_ui_bat_points_text) : getResources().getString(R.string.brave_ui_bat_text));

((TextView)findViewById(R.id.wallet_amount_text)).setText(walletAmount);
Expand Down Expand Up @@ -470,7 +470,7 @@ public void OnRewardsParameters(int errorCode) {
}
DecimalFormat df = new DecimalFormat("#.###");
df.setRoundingMode(RoundingMode.FLOOR);
df.setMinimumFractionDigits(1);
df.setMinimumFractionDigits(3);
String walletAmount = df.format(balance) + " "
+ (isAnonWallet ? getResources().getString(
R.string.brave_ui_bat_points_text)
Expand Down
6 changes: 3 additions & 3 deletions android/java/res/layout/brave_rewards_site_banner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@

<ToggleButton
android:id="@+id/one_bat_option"
android:layout_width="86dp"
android:layout_width="wrap_content"
android:layout_height="34dp"
app:layout_row="0"
app:layout_rowWeight="2"
Expand Down Expand Up @@ -345,7 +345,7 @@

<ToggleButton
android:id="@+id/five_bat_option"
android:layout_width="86dp"
android:layout_width="wrap_content"
android:layout_height="34dp"
app:layout_row="0"
app:layout_rowWeight="2"
Expand Down Expand Up @@ -379,7 +379,7 @@

<ToggleButton
android:id="@+id/ten_bat_option"
android:layout_width="86dp"
android:layout_width="wrap_content"
android:layout_height="34dp"
app:layout_row="0"
app:layout_rowWeight="2"
Expand Down
6 changes: 3 additions & 3 deletions browser/ui/android/strings/android_brave_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -895,13 +895,13 @@ until they verify, or until 90 days have passed.
point
</message>
<message name="IDS_ONE_TIP_OPTION" desc="Text for one tip option">
1 <ph name="TIP">%1$s<ex>BAT</ex></ph>
1.000 <ph name="TIP">%1$s<ex>BAT</ex></ph>
</message>
<message name="IDS_FIVE_TIP_OPTION" desc="Text for five tip option">
5 <ph name="TIP">%1$s<ex>BAT</ex></ph>
5.000 <ph name="TIP">%1$s<ex>BAT</ex></ph>
</message>
<message name="IDS_TEN_TIP_OPTION" desc="Text for ten tip option">
10 <ph name="TIP">%1$s<ex>BAT</ex></ph>
10.000 <ph name="TIP">%1$s<ex>BAT</ex></ph>
</message>
<message name="IDS_PREFS_NEW_TAB_PAGE" desc="Title of New Tab Page settings.">
New Tab Page
Expand Down

0 comments on commit 68b6bb9

Please sign in to comment.