android: Fix "Format string ... is not valid format string..." error
The linter complained that two of the strings don't actually contain any printf-specifiers (i.e. don't expect any arguments) and therefore shouldn't be used with String.format().
This commit is contained in:
+4
-4
@@ -453,20 +453,20 @@ public class VpnProfileControlActivity extends AppCompatActivity
|
|||||||
{
|
{
|
||||||
final Bundle profileInfo = getArguments();
|
final Bundle profileInfo = getArguments();
|
||||||
int icon = android.R.drawable.ic_dialog_alert;
|
int icon = android.R.drawable.ic_dialog_alert;
|
||||||
int title = R.string.connect_profile_question;
|
String title = String.format(getString(R.string.connect_profile_question), profileInfo.getString(PROFILE_NAME));
|
||||||
int message = R.string.replaces_active_connection;
|
int message = R.string.replaces_active_connection;
|
||||||
int button = R.string.connect;
|
int button = R.string.connect;
|
||||||
|
|
||||||
if (profileInfo.getBoolean(PROFILE_RECONNECT))
|
if (profileInfo.getBoolean(PROFILE_RECONNECT))
|
||||||
{
|
{
|
||||||
icon = android.R.drawable.ic_dialog_info;
|
icon = android.R.drawable.ic_dialog_info;
|
||||||
title = R.string.vpn_connected;
|
title = getString(R.string.vpn_connected);
|
||||||
message = R.string.vpn_profile_connected;
|
message = R.string.vpn_profile_connected;
|
||||||
button = R.string.reconnect;
|
button = R.string.reconnect;
|
||||||
}
|
}
|
||||||
else if (profileInfo.getBoolean(PROFILE_DISCONNECT))
|
else if (profileInfo.getBoolean(PROFILE_DISCONNECT))
|
||||||
{
|
{
|
||||||
title = R.string.disconnect_question;
|
title = getString(R.string.disconnect_question);
|
||||||
message = R.string.disconnect_active_connection;
|
message = R.string.disconnect_active_connection;
|
||||||
button = R.string.disconnect;
|
button = R.string.disconnect;
|
||||||
}
|
}
|
||||||
@@ -504,7 +504,7 @@ public class VpnProfileControlActivity extends AppCompatActivity
|
|||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity())
|
||||||
.setIcon(icon)
|
.setIcon(icon)
|
||||||
.setTitle(String.format(getString(title), profileInfo.getString(PROFILE_NAME)))
|
.setTitle(title)
|
||||||
.setMessage(message);
|
.setMessage(message);
|
||||||
|
|
||||||
if (profileInfo.getBoolean(PROFILE_DISCONNECT))
|
if (profileInfo.getBoolean(PROFILE_DISCONNECT))
|
||||||
|
|||||||
Reference in New Issue
Block a user