diff options
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/xapek/andiodine/FragmentStatus.java | 39 | ||||
-rw-r--r-- | src/main/java/org/xapek/andiodine/IodinePref.java | 24 |
2 files changed, 33 insertions, 30 deletions
diff --git a/src/main/java/org/xapek/andiodine/FragmentStatus.java b/src/main/java/org/xapek/andiodine/FragmentStatus.java index db6e5ad..b678360 100644 --- a/src/main/java/org/xapek/andiodine/FragmentStatus.java +++ b/src/main/java/org/xapek/andiodine/FragmentStatus.java @@ -18,6 +18,8 @@ import android.widget.Button; import android.widget.ScrollView; import android.widget.TextView; +import java.util.Locale; + public class FragmentStatus extends Fragment { public static final String TAG = "FRAGMENT_STATUS"; @@ -31,24 +33,25 @@ public class FragmentStatus extends Fragment { public void onReceive(Context context, Intent intent) { Log.d(TAG, "Got intent: " + intent); if (IodineVpnService.ACTION_STATUS_ERROR.equals(intent.getAction())) { - final TextView message = new TextView(context); - final String stringMessage = intent.getStringExtra(IodineVpnService.EXTRA_ERROR_MESSAGE); - final SpannableString s = new SpannableString(stringMessage); - Linkify.addLinks(s, Linkify.WEB_URLS); - message.setText(s); - message.setMovementMethod(LinkMovementMethod.getInstance()); - new AlertDialog.Builder(FragmentStatus.this.getActivity())// - .setIcon(R.drawable.error) // - .setTitle("Error") // - .setView(message) - .create() // - .show(); + final TextView message = new TextView(context); + final String stringMessage = intent.getStringExtra(IodineVpnService.EXTRA_ERROR_MESSAGE); + final SpannableString s = new SpannableString(stringMessage); + Linkify.addLinks(s, Linkify.WEB_URLS); + message.setText(s); + message.setMovementMethod(LinkMovementMethod.getInstance()); + new AlertDialog.Builder(FragmentStatus.this.getActivity())// + .setIcon(R.drawable.error) // + .setTitle(R.string.error) // + .setView(message) + .create() // + .show(); } else if (IodineVpnService.ACTION_STATUS_CONNECT.equals(intent.getAction())) { mStatus.setText(R.string.connect); } else if (IodineVpnService.ACTION_STATUS_CONNECTED.equals(intent.getAction())) { - mStatus.setText("Connected: " + IodineClient.getIp() + '/' - + IodineClient.getNetbits() + " MTU: " - + IodineClient.getMtu() + '\n'); + mStatus.setText(String.format(Locale.getDefault(), getString(R.string.vpnservice_connected_with_info), + IodineClient.getIp(), + IodineClient.getNetbits(), + IodineClient.getMtu())); } else if (IodineVpnService.ACTION_STATUS_DISCONNECT.equals(intent.getAction())) { mStatus.setText(R.string.disconnect); } @@ -59,10 +62,10 @@ public class FragmentStatus extends Fragment { @Override public void onReceive(Context context, Intent intent) { if (IodineClient.ACTION_LOG_MESSAGE.equals(intent.getAction())) { - final String newLogEntry = intent.getStringExtra(IodineClient.EXTRA_MESSAGE); + final String newLogEntry = intent.getStringExtra(IodineClient.EXTRA_MESSAGE); if (!".".equals(newLogEntry)) // Suppress newline for progress indicator'.' - mLogmessages.append("\n"); - mLogmessages.append(newLogEntry); + mLogmessages.append("\n"); + mLogmessages.append(newLogEntry); mScrollview.fullScroll(View.FOCUS_DOWN); } } diff --git a/src/main/java/org/xapek/andiodine/IodinePref.java b/src/main/java/org/xapek/andiodine/IodinePref.java index 11c79fb..864f597 100644 --- a/src/main/java/org/xapek/andiodine/IodinePref.java +++ b/src/main/java/org/xapek/andiodine/IodinePref.java @@ -42,42 +42,42 @@ public class IodinePref extends org.xapek.andiodine.preferences.PreferenceActivi setContentValues(mIodineConfiguration.getContentValues()); // Name - addPreference(ConfigDatabase.COLUMN_CONF_NAME, "Name", R.string.pref_help_name, "New Connection"); + addPreference(ConfigDatabase.COLUMN_CONF_NAME, getString(R.string.pref_text_name_label_short), R.string.pref_help_name, "New Connection"); // Topdomain - addPreference(ConfigDatabase.COLUMN_CONF_TOP_DOMAIN, "Tunnel Topdomain", R.string.pref_help_topdomain, + addPreference(ConfigDatabase.COLUMN_CONF_TOP_DOMAIN, getString(R.string.pref_text_topdomain_label), R.string.pref_help_topdomain, "tun.example.com"); // Password - addPreference(ConfigDatabase.COLUMN_CONF_PASSWORD, "Password", R.string.pref_help_password, ""); + addPreference(ConfigDatabase.COLUMN_CONF_PASSWORD, getString(R.string.pref_text_password_label), R.string.pref_help_password, ""); // Tunnel Nameserver - addPreference(ConfigDatabase.COLUMN_CONF_TUNNEL_NAMESERVER, "Tunnel Nameserver (or empty)", + addPreference(ConfigDatabase.COLUMN_CONF_TUNNEL_NAMESERVER, getString(R.string.pref_text_tunnel_nameserver_label_or_empty), R.string.pref_help_tunnel_nameserver, ""); // Nameserver Mode String[] nameserverModes = new String[NameserverMode.values().length]; for (int i = 0; i < NameserverMode.values().length; i++) { nameserverModes[i] = NameserverMode.values()[i].name(); } - addPreference(ConfigDatabase.COLUMN_CONF_NAMESERVER_MODE, "Nameserver Mode", + addPreference(ConfigDatabase.COLUMN_CONF_NAMESERVER_MODE, getString(R.string.pref_text_nameserver_mode_label), R.string.pref_help_nameserver_mode, nameserverModes, NameserverMode.LEAVE_DEFAULT.name()); // Nameserver - addPreference(ConfigDatabase.COLUMN_CONF_NAMESERVER, "Nameserver", R.string.pref_help_nameserver, ""); + addPreference(ConfigDatabase.COLUMN_CONF_NAMESERVER, getString(R.string.pref_text_nameserver_label), R.string.pref_help_nameserver, ""); // Request Type String[] requestTypes = new String[RequestType.values().length]; for (int i = 0; i < RequestType.values().length; i++) { requestTypes[i] = RequestType.values()[i].name(); } - addPreference(ConfigDatabase.COLUMN_CONF_REQUEST_TYPE, "Request Type", R.string.pref_help_request_type, + addPreference(ConfigDatabase.COLUMN_CONF_REQUEST_TYPE, getString(R.string.pref_text_request_type_label), R.string.pref_help_request_type, requestTypes, RequestType.AUTODETECT.name()); // Lazy Mode - addPreference(ConfigDatabase.COLUMN_CONF_LAZY_MODE, "Lazy mode", R.string.pref_help_lazy, true); + addPreference(ConfigDatabase.COLUMN_CONF_LAZY_MODE, getString(R.string.pref_text_lazy_mode_label), R.string.pref_help_lazy, true); // Raw Mode - addPreference(ConfigDatabase.COLUMN_CONF_RAW_MODE, "Raw Mode", R.string.pref_help_raw, false); + addPreference(ConfigDatabase.COLUMN_CONF_RAW_MODE, getString(R.string.pref_text_raw_mode_label), R.string.pref_help_raw, false); // Default Route - addPreference(ConfigDatabase.COLUMN_CONF_DEFAULT_ROUTE, "Default Route", R.string.pref_help_default_route, true); + addPreference(ConfigDatabase.COLUMN_CONF_DEFAULT_ROUTE, getString(R.string.pref_text_default_route_label), R.string.pref_help_default_route, true); addPreference(ConfigDatabase.COLUMN_CONF_REQUEST_HOSTNAME_SIZE, - "Request Hostname Size", R.string.pref_request_hostname_size, "255"); + getString(R.string.pref_text_request_hostname_size_label), R.string.pref_request_hostname_size, "255"); addPreference(ConfigDatabase.COLUMN_CONF_RESPONSE_FRAGMENT_SIZE, - "Response Fragment Size", R.string.pref_response_fragment_size, "0"); + getString(R.string.pref_text_response_fragment_size_label), R.string.pref_response_fragment_size, "0"); } @Override |