From 50e072bf18263f511b00025af6a44e71a17f536b Mon Sep 17 00:00:00 2001 From: Adeel Zafar Date: Thu, 15 Aug 2019 04:03:38 +0500 Subject: [PATCH] Resolve string concatenation in setText Set args in strings.xml value --- .../org/kiwix/kiwixmobile/webserver/ZimHostActivity.java | 8 ++++---- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java index 18df678db..fad01159c 100644 --- a/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java +++ b/app/src/main/java/org/kiwix/kiwixmobile/webserver/ZimHostActivity.java @@ -97,9 +97,9 @@ public class ZimHostActivity extends BaseActivity implements setUpToolbar(); if (savedInstanceState != null) { + ip = savedInstanceState.getString(IP_STATE_KEY); serverTextView.setText( - getString(R.string.server_started_message) + " " + savedInstanceState.getString( - IP_STATE_KEY)); + getString(R.string.server_started_message, ip)); startServerButton.setText(getString(R.string.stop_server_label)); startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer)); } @@ -259,7 +259,7 @@ public class ZimHostActivity extends BaseActivity implements if (isServerStarted) { ip = getAddress(); ip = ip.replaceAll("\n", ""); - serverTextView.setText(getString(R.string.server_started_message) + " " + ip); + serverTextView.setText(getString(R.string.server_started_message, ip)); startServerButton.setText(getString(R.string.stop_server_label)); startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer)); } @@ -464,7 +464,7 @@ public class ZimHostActivity extends BaseActivity implements @Override public void serverStarted(String ip) { this.ip = ip; - serverTextView.setText(getString(R.string.server_started_message) + " " + this.ip); + serverTextView.setText(getString(R.string.server_started_message, this.ip)); startServerButton.setText(getString(R.string.stop_server_label)); startServerButton.setBackgroundColor(getResources().getColor(R.color.stopServer)); isServerStarted = true; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 86a25f456..fe3d5345e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -54,7 +54,7 @@ Start server Stop server Server started - Enter this ip address into your browser to access the server + Enter this ip address into your browser to access the server %s Error: The selected ZIM file could not be found. Error: The selected file is not a valid ZIM file. Error: Loading article (Url: %1$s) failed.