mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 21:18:33 +00:00
Specify locale in some String.formats.
This commit is contained in:
parent
c7bfede74c
commit
80d0ba31ca
@ -36,7 +36,6 @@ import android.os.Bundle;
|
|||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.RequiresApi;
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.Fragment;
|
||||||
import androidx.fragment.app.FragmentTransaction;
|
import androidx.fragment.app.FragmentTransaction;
|
||||||
import androidx.appcompat.widget.SwitchCompat;
|
import androidx.appcompat.widget.SwitchCompat;
|
||||||
@ -89,6 +88,7 @@ import org.whispersystems.libsignal.fingerprint.NumericFingerprintGenerator;
|
|||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
import static org.whispersystems.libsignal.SessionCipher.SESSION_LOCK;
|
import static org.whispersystems.libsignal.SessionCipher.SESSION_LOCK;
|
||||||
|
|
||||||
@ -487,11 +487,10 @@ public class VerifyIdentityActivity extends PassphraseRequiredActionBarActivity
|
|||||||
valueAnimator.setObjectValues(0, Integer.parseInt(segment));
|
valueAnimator.setObjectValues(0, Integer.parseInt(segment));
|
||||||
|
|
||||||
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
|
||||||
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationUpdate(ValueAnimator animation) {
|
public void onAnimationUpdate(ValueAnimator animation) {
|
||||||
int value = (int) animation.getAnimatedValue();
|
int value = (int) animation.getAnimatedValue();
|
||||||
codeView.setText(String.format("%05d", value));
|
codeView.setText(String.format(Locale.getDefault(), "%05d", value));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,6 +33,7 @@ import org.thoughtcrime.securesms.mms.AudioSlide;
|
|||||||
import org.thoughtcrime.securesms.mms.SlideClickListener;
|
import org.thoughtcrime.securesms.mms.SlideClickListener;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ public class AudioView extends FrameLayout implements AudioSlidePlayer.Listener
|
|||||||
if (seekProgress > seekBar.getProgress() || backwardsCounter > 3) {
|
if (seekProgress > seekBar.getProgress() || backwardsCounter > 3) {
|
||||||
backwardsCounter = 0;
|
backwardsCounter = 0;
|
||||||
this.seekBar.setProgress(seekProgress);
|
this.seekBar.setProgress(seekProgress);
|
||||||
this.timestamp.setText(String.format("%02d:%02d",
|
this.timestamp.setText(String.format(Locale.getDefault(), "%02d:%02d",
|
||||||
TimeUnit.MILLISECONDS.toMinutes(millis),
|
TimeUnit.MILLISECONDS.toMinutes(millis),
|
||||||
TimeUnit.MILLISECONDS.toSeconds(millis)));
|
TimeUnit.MILLISECONDS.toSeconds(millis)));
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,6 +15,7 @@ import java.util.Collections;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class CameraUtils {
|
public class CameraUtils {
|
||||||
@ -30,7 +31,8 @@ public class CameraUtils {
|
|||||||
final int targetHeight = displayOrientation % 180 == 90 ? width : height;
|
final int targetHeight = displayOrientation % 180 == 90 ? width : height;
|
||||||
final double targetRatio = (double) targetWidth / targetHeight;
|
final double targetRatio = (double) targetWidth / targetHeight;
|
||||||
|
|
||||||
Log.d(TAG, String.format("getPreferredPreviewSize(%d, %d, %d) -> target %dx%d, AR %.02f",
|
Log.d(TAG, String.format(Locale.US,
|
||||||
|
"getPreferredPreviewSize(%d, %d, %d) -> target %dx%d, AR %.02f",
|
||||||
displayOrientation, width, height,
|
displayOrientation, width, height,
|
||||||
targetWidth, targetHeight, targetRatio));
|
targetWidth, targetHeight, targetRatio));
|
||||||
|
|
||||||
@ -39,7 +41,7 @@ public class CameraUtils {
|
|||||||
List<Size> bigEnough = new LinkedList<>();
|
List<Size> bigEnough = new LinkedList<>();
|
||||||
|
|
||||||
for (Size size : sizes) {
|
for (Size size : sizes) {
|
||||||
Log.d(TAG, String.format(" %dx%d (%.02f)", size.width, size.height, (float)size.width / size.height));
|
Log.d(TAG, String.format(Locale.US, " %dx%d (%.02f)", size.width, size.height, (float)size.width / size.height));
|
||||||
|
|
||||||
if (size.height == size.width * targetRatio && size.height >= targetHeight && size.width >= targetWidth) {
|
if (size.height == size.width * targetRatio && size.height >= targetHeight && size.width >= targetWidth) {
|
||||||
ideals.add(size);
|
ideals.add(size);
|
||||||
|
@ -4,6 +4,7 @@ import org.thoughtcrime.securesms.logging.Log;
|
|||||||
import org.thoughtcrime.securesms.util.LRUCache;
|
import org.thoughtcrime.securesms.util.LRUCache;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class EarlyReceiptCache {
|
public class EarlyReceiptCache {
|
||||||
@ -14,7 +15,7 @@ public class EarlyReceiptCache {
|
|||||||
|
|
||||||
public synchronized void increment(long timestamp, Address origin) {
|
public synchronized void increment(long timestamp, Address origin) {
|
||||||
Log.i(TAG, this+"");
|
Log.i(TAG, this+"");
|
||||||
Log.i(TAG, String.format("Early receipt: (%d, %s)", timestamp, origin.serialize()));
|
Log.i(TAG, String.format(Locale.US, "Early receipt: (%d, %s)", timestamp, origin.serialize()));
|
||||||
|
|
||||||
Map<Address, Long> receipts = cache.get(timestamp);
|
Map<Address, Long> receipts = cache.get(timestamp);
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ public class EarlyReceiptCache {
|
|||||||
Map<Address, Long> receipts = cache.remove(timestamp);
|
Map<Address, Long> receipts = cache.remove(timestamp);
|
||||||
|
|
||||||
Log.i(TAG, this+"");
|
Log.i(TAG, this+"");
|
||||||
Log.i(TAG, String.format("Checking early receipts (%d): %d", timestamp, receipts == null ? 0 : receipts.size()));
|
Log.i(TAG, String.format(Locale.US, "Checking early receipts (%d): %d", timestamp, receipts == null ? 0 : receipts.size()));
|
||||||
|
|
||||||
return receipts != null ? receipts : new HashMap<>();
|
return receipts != null ? receipts : new HashMap<>();
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package org.thoughtcrime.securesms.jobmanager;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
public class JobLogger {
|
public class JobLogger {
|
||||||
|
|
||||||
public static String format(@NonNull Job job, @NonNull String event) {
|
public static String format(@NonNull Job job, @NonNull String event) {
|
||||||
@ -18,7 +20,8 @@ public class JobLogger {
|
|||||||
: String.valueOf(job.getParameters().getMaxAttempts());
|
: String.valueOf(job.getParameters().getMaxAttempts());
|
||||||
String lifespan = job.getParameters().getLifespan() == Job.Parameters.IMMORTAL ? "Immortal"
|
String lifespan = job.getParameters().getLifespan() == Job.Parameters.IMMORTAL ? "Immortal"
|
||||||
: String.valueOf(job.getParameters().getLifespan()) + " ms";
|
: String.valueOf(job.getParameters().getLifespan()) + " ms";
|
||||||
return String.format("[%s][%s]%s %s (Time Since Submission: %d ms, Lifespan: %s, Run Attempt: %d/%s)",
|
return String.format(Locale.US,
|
||||||
|
"[%s][%s]%s %s (Time Since Submission: %d ms, Lifespan: %s, Run Attempt: %d/%s)",
|
||||||
id, job.getClass().getSimpleName(), tag, event, timeSinceSubmission, lifespan, runAttempt, maxAttempts);
|
id, job.getClass().getSimpleName(), tag, event, timeSinceSubmission, lifespan, runAttempt, maxAttempts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ import org.thoughtcrime.securesms.util.CommunicationActions;
|
|||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
||||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -103,7 +104,7 @@ public class AppProtectionPreferenceFragment extends CorrectedPreferenceFragment
|
|||||||
|
|
||||||
findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT)
|
findPreference(TextSecurePreferences.SCREEN_LOCK_TIMEOUT)
|
||||||
.setSummary(timeoutSeconds <= 0 ? getString(R.string.AppProtectionPreferenceFragment_none) :
|
.setSummary(timeoutSeconds <= 0 ? getString(R.string.AppProtectionPreferenceFragment_none) :
|
||||||
String.format("%02d:%02d:%02d", hours, minutes, seconds));
|
String.format(Locale.getDefault(), "%02d:%02d:%02d", hours, minutes, seconds));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeVisibility() {
|
private void initializeVisibility() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user