correct settleAmount formatting for non-US locales (#791)

This commit is contained in:
m2049r 2021-10-26 17:36:03 +02:00 committed by GitHub
parent ac70ba8424
commit f07b439731
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 15 deletions

View File

@ -141,8 +141,6 @@ dependencies {
implementation 'org.slf4j:slf4j-nop:1.7.30' implementation 'org.slf4j:slf4j-nop:1.7.30'
implementation 'com.github.brnunes:swipeablerecyclerview:1.0.2' implementation 'com.github.brnunes:swipeablerecyclerview:1.0.2'
implementation 'com.github.aelstad:keccakj:1.1.0'
testImplementation "junit:junit:$rootProject.ext.junitVersion" testImplementation "junit:junit:$rootProject.ext.junitVersion"
testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion" testImplementation "org.mockito:mockito-all:$rootProject.ext.mockitoVersion"
testImplementation "com.squareup.okhttp3:mockwebserver:4.9.0" testImplementation "com.squareup.okhttp3:mockwebserver:4.9.0"

View File

@ -20,21 +20,21 @@ import androidx.annotation.NonNull;
import com.m2049r.xmrwallet.service.shift.NetworkCallback; import com.m2049r.xmrwallet.service.shift.NetworkCallback;
import com.m2049r.xmrwallet.service.shift.ShiftApiCall; import com.m2049r.xmrwallet.service.shift.ShiftApiCall;
import com.m2049r.xmrwallet.util.DateHelper;
import com.m2049r.xmrwallet.service.shift.sideshift.api.RequestQuote;
import com.m2049r.xmrwallet.service.shift.sideshift.api.SideShiftApi;
import com.m2049r.xmrwallet.service.shift.ShiftCallback; import com.m2049r.xmrwallet.service.shift.ShiftCallback;
import com.m2049r.xmrwallet.service.shift.sideshift.api.RequestQuote;
import com.m2049r.xmrwallet.util.DateHelper;
import com.m2049r.xmrwallet.util.ServiceHelper; import com.m2049r.xmrwallet.util.ServiceHelper;
import org.json.JSONException; import org.json.JSONException;
import org.json.JSONObject; import org.json.JSONObject;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.Locale;
import lombok.Getter; import lombok.Getter;
import timber.log.Timber;
class RequestQuoteImpl implements RequestQuote { class RequestQuoteImpl implements RequestQuote {
@Getter @Getter
@ -101,7 +101,7 @@ class RequestQuoteImpl implements RequestQuote {
/** /**
* Create JSON request object * Create JSON request object
* *
* @param xmrAmount how much XMR to shift to BTC * @param btcAmount how much XMR to shift to BTC
*/ */
static JSONObject createRequest(final double btcAmount) throws JSONException { static JSONObject createRequest(final double btcAmount) throws JSONException {
@ -114,5 +114,13 @@ class RequestQuoteImpl implements RequestQuote {
return jsonObject; return jsonObject;
} }
static DecimalFormat AmountFormatter = new DecimalFormat("#.############"); static final DecimalFormat AmountFormatter;
static {
AmountFormatter = new DecimalFormat();
AmountFormatter.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US));
AmountFormatter.setMinimumIntegerDigits(1);
AmountFormatter.setMaximumFractionDigits(12);
AmountFormatter.setGroupingUsed(false);
}
} }

View File

@ -6,19 +6,13 @@ buildscript {
google() google()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:7.0.2' classpath 'com.android.tools.build:gradle:7.0.3'
} }
} }
allprojects { allprojects {
repositories { repositories {
mavenCentral() mavenCentral()
maven {
url "https://maven.google.com"
}
maven {
url "https://repository.mulesoft.org/nexus/content/repositories/public/"
}
google() google()
} }
} }