Don't interpolate the app name into strings.

This commit is contained in:
akwizgran
2022-06-14 10:30:05 +01:00
parent 1551142e98
commit 40086ffde2
5 changed files with 17 additions and 23 deletions

View File

@@ -25,6 +25,7 @@ import javax.annotation.Nullable;
import javax.inject.Inject;
import androidx.annotation.RequiresApi;
import androidx.annotation.StringRes;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
@@ -104,7 +105,7 @@ public abstract class BriarActivity extends BaseActivity {
LOG.info("Not signed in, launching StartupActivity");
Intent i = new Intent(this, StartupActivity.class);
startActivityForResult(i, REQUEST_PASSWORD);
} else if (lockManager.isLocked() && !isFinishing()) {
} else if (SDK_INT >= 21 && lockManager.isLocked() && !isFinishing()) {
// Also check that the activity isn't finishing already.
// This is possible if we finished in onActivityResult().
// Launching another UnlockActivity would cause a loop.
@@ -115,10 +116,7 @@ public abstract class BriarActivity extends BaseActivity {
briarController.hasDozed(new UiResultHandler<Boolean>(this) {
@Override
public void onResultUi(Boolean result) {
if (result) {
showDozeDialog(getString(R.string.dnkm_warning_dozed,
getString(R.string.app_name)));
}
if (result) showDozeDialog(R.string.dnkm_warning_dozed_1);
}
});
}
@@ -175,7 +173,7 @@ public abstract class BriarActivity extends BaseActivity {
return toolbar;
}
protected void showDozeDialog(String message) {
protected void showDozeDialog(@StringRes int message) {
AlertDialog.Builder b =
new AlertDialog.Builder(this, R.style.BriarDialogTheme);
b.setMessage(message);

View File

@@ -175,13 +175,8 @@ public class AddNearbyContactActivity extends BriarActivity
showErrorFragment();
} else {
String msg;
if (qrCodeTooOld) {
msg = getString(R.string.qr_code_too_old,
getString(R.string.app_name));
} else {
msg = getString(R.string.qr_code_too_new,
getString(R.string.app_name));
}
if (qrCodeTooOld) msg = getString(R.string.qr_code_too_old_1);
else msg = getString(R.string.qr_code_too_new_1);
showNextFragment(AddNearbyContactErrorFragment.newInstance(msg));
}
}

View File

@@ -78,16 +78,15 @@ class WebServer extends NanoHTTPD {
try (InputStream is = ctx.getAssets().open(FILE_HTML)) {
doc = Jsoup.parse(is, UTF_8.name(), "");
}
String app = ctx.getString(R.string.app_name);
String appV = app + " " + VERSION_NAME;
String filename = getApkFileName();
doc.select("#download_title").first()
.text(ctx.getString(R.string.website_download_title, appV));
.text(ctx.getString(R.string.website_download_title_1,
VERSION_NAME));
doc.select("#download_intro").first()
.text(ctx.getString(R.string.website_download_intro, app));
.text(ctx.getString(R.string.website_download_intro_1));
doc.select(".button").first().attr("href", filename);
doc.select("#download_button").first()
.text(ctx.getString(R.string.website_download_title, app));
.text(ctx.getString(R.string.website_download_button));
doc.select("#download_outro").first()
.text(ctx.getString(R.string.website_download_outro));
doc.select("#troubleshooting_title").first()

View File

@@ -147,7 +147,7 @@ public class NavDrawerActivity extends BriarActivity implements
}
}
navDrawerViewModel.shouldAskForDozeWhitelisting().observe(this, ask -> {
if (ask) showDozeDialog(getString(R.string.dnkm_doze_intro));
if (ask) showDozeDialog(R.string.dnkm_doze_intro);
});
Toolbar toolbar = setUpCustomToolbar(false);

View File

@@ -34,6 +34,7 @@
<string name="dnkm_xiaomi_dialog_body_new">1. Open the recent apps list (also called the app switcher)\n\n2. If Briar has a small image of a padlock next to its name then you don\'t need to do anything\n\n3. If there\'s no padlock, press and hold the image of Briar until the padlock button appears, then tap it</string>
<string name="dnkm_xiaomi_lock_apps_text">Please tap the button below to open the security settings. Tap \"Boost speed\", then tap \"Lock apps\", and make sure Briar is set to \"Locked\".</string>
<string name="dnkm_xiaomi_lock_apps_help">If Briar is not set to \"Locked\" in the \"Lock apps\" screen, it will be unable to run in the background.</string>
<string name="dnkm_warning_dozed_1">Briar was unable to run in the background</string>
<!-- Login -->
<string name="enter_password">Password</string>
@@ -247,8 +248,8 @@
<string name="contact_added_toast">Contact added: %s</string>
<string name="contact_already_exists">Contact %s already exists</string>
<string name="qr_code_invalid">The QR code is invalid</string>
<string name="qr_code_too_old">The QR code you have scanned comes from an older version of %s.\n\nPlease ask your contact to upgrade to the latest version and then try again.</string>
<string name="qr_code_too_new">The QR code you have scanned comes from a newer version of %s.\n\nPlease upgrade to the latest version and then try again.</string>
<string name="qr_code_too_old_1">The QR code you have scanned comes from an older version of Briar.\n\nPlease ask your contact to upgrade to the latest version and then try again.</string>
<string name="qr_code_too_new_1">The QR code you have scanned comes from a newer version of Briar.\n\nPlease upgrade to the latest version and then try again.</string>
<string name="camera_error">Camera error</string>
<string name="connecting_to_device">Connecting to device\u2026</string>
<string name="authenticating_with_device">Authenticating with device\u2026</string>
@@ -812,8 +813,9 @@
<string name="hotspot_qr_site">Your phone is providing a Wi-Fi hotspot. People who are connected to the hotspot can download Briar by scanning this QR code.</string>
<!-- e.g. Download Briar 1.2.20 -->
<string name="website_download_title">Download %s</string>
<string name="website_download_intro">Someone nearby shared %s with you.</string>
<string name="website_download_title_1">Download Briar %s</string>
<string name="website_download_intro_1">Someone nearby shared Briar with you.</string>
<string name="website_download_button">Download Briar</string>
<string name="website_download_outro">After the download is complete, open the downloaded file and install it.</string>
<string name="website_troubleshooting_title">Troubleshooting</string>
<string name="website_troubleshooting_1">If you cannot download the app, try it with a different web browser app.</string>