update button label when amount is updated
This commit is contained in:
parent
6442dea016
commit
b72337f8c0
1 changed files with 26 additions and 3 deletions
|
@ -5,6 +5,8 @@ import android.content.Context;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Editable;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -111,6 +113,22 @@ public class CreateSupportDialogFragment extends BottomSheetDialogFragment imple
|
||||||
inlineBalanceContainer.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
|
inlineBalanceContainer.setVisibility(hasFocus ? View.VISIBLE : View.INVISIBLE);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
inputAmount.addTextChangedListener(new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
|
||||||
|
updateSendButtonText();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable editable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
updateInfoText();
|
updateInfoText();
|
||||||
updateSendButtonText();
|
updateSendButtonText();
|
||||||
|
|
||||||
|
@ -203,9 +221,14 @@ public class CreateSupportDialogFragment extends BottomSheetDialogFragment imple
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSendButtonText() {
|
private void updateSendButtonText() {
|
||||||
String amountString = Helper.getValue(inputAmount.getText());
|
boolean isTip = switchTip.isChecked();
|
||||||
double parsedAmount = Helper.parseDouble(amountString, 0);
|
if (!isTip) {
|
||||||
sendButton.setText(parsedAmount == 0 ? getString(R.string.send_a_tip) : getString(R.string.send_lbc_tip, amountString));
|
sendButton.setText(R.string.send_revocable_support);
|
||||||
|
} else {
|
||||||
|
String amountString = Helper.getValue(inputAmount.getText());
|
||||||
|
double parsedAmount = Helper.parseDouble(amountString, 0);
|
||||||
|
sendButton.setText(parsedAmount == 0 ? getString(R.string.send_a_tip) : getString(R.string.send_lbc_tip, amountString));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateInfoText() {
|
private void updateInfoText() {
|
||||||
|
|
Loading…
Reference in a new issue