Skip to content

Fix Tipping conversion, editText hint, not enough warning (uplift to 1.53.x) #18899

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

Merged
merged 1 commit into from
Jun 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public class RewardsTippingPanelFragment

private TextView mUsdSymbol1;
private TextView mUsdSymbol2;
private boolean mEnoughFundWarningShown;

public static RewardsTippingPanelFragment newInstance(int tabId, String web3Url) {
RewardsTippingPanelFragment fragment = new RewardsTippingPanelFragment();
Expand Down Expand Up @@ -333,6 +334,7 @@ private void showErrorLayout() {
}

private void showNotEnoughTokens() {
mEnoughFundWarningShown = true;
showWarningMessage(mContentView, R.drawable.tipping_error_alert_message_background,
getString(R.string.not_enough_tokens),
String.format(getString(R.string.not_enough_tokens_description), mBalance));
Expand Down Expand Up @@ -533,7 +535,7 @@ void setBalanceText(View view) {
}

private void checkEnoughFund() {
if (mAmountSelected <= AMOUNT_STEP_BY) { // if it's below range
if (mAmountSelected < AMOUNT_STEP_BY) { // if it's below range
mSendButton.setEnabled(false);
return;
}
Expand All @@ -543,6 +545,12 @@ private void checkEnoughFund() {
mSendButton.setEnabled(false);
} else { // if selected amount is with in range then enable it
mSendButton.setEnabled(true);
if (mEnoughFundWarningShown) {
mEnoughFundWarningShown = false;
View warningLayout = mContentView.findViewById(R.id.tipping_warning_message_layout);
warningLayout.setVisibility(View.GONE);
setAlreadyMonthlyContributionSetMessage();
}
}
}

Expand Down Expand Up @@ -621,15 +629,20 @@ private void initTipChoice(boolean isBat) {
mCurrency1ValueEditTextView.setVisibility(View.INVISIBLE);
mCurrency1ValueTextView.setInputType(InputType.TYPE_NULL);
String s = ((TextView) view).getText().toString();
mCurrency1ValueTextView.setText(s);
mCurrency1ValueEditTextView.setText(s);
Double batValue = getBatValue(s, mIsBatCurrency);

Double batValue = getBatValue(s, true);
Double usdValue = mRate * batValue;
if (mIsBatCurrency)
mCurrency2ValueTextView.setText(String.valueOf(roundExchangeUp(usdValue)));
else
mCurrency2ValueTextView.setText(String.valueOf(roundExchangeUp(batValue)));
String usdValueString = String.valueOf(roundExchangeUp(usdValue));

if (mIsBatCurrency) {
mCurrency1ValueTextView.setText(s);
mCurrency1ValueEditTextView.setText(s);
mCurrency2ValueTextView.setText(usdValueString);
} else {
mCurrency1ValueTextView.setText(usdValueString);
mCurrency1ValueEditTextView.setText(usdValueString);
mCurrency2ValueTextView.setText(s);
}
}
for (TextView tb : mRadioTipAmount) {
if (tb.getId() == id) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,10 @@
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:hint="@string/_5"
android:hint="@null"
android:textSize="28sp"
android:importantForAutofill="no"
android:inputType="numberDecimal"
android:text="@string/_5"
android:textColor="@color/rewards_panel_notification_text_color"
android:visibility="invisible"
app:layout_constraintEnd_toStartOf="@id/currency1"
Expand All @@ -242,8 +241,6 @@
android:layout_marginEnd="8dp"
android:textSize="28sp"
android:gravity="center"
android:importantForAutofill="no"
android:text="@string/_5"
android:textColor="@color/rewards_panel_notification_text_color"
app:layout_constraintEnd_toStartOf="@id/currency1"
app:layout_constraintTop_toBottomOf="@id/tipChoiceCustom" />
Expand Down