summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2020-03-16 23:49:13 +0100
committercyBerta <cyberta@riseup.net>2020-03-16 23:49:13 +0100
commit05205190ee65a5fa14f18d12f86f5427368bea44 (patch)
treef64e00605839274149389d24fb530e4863a43fc3 /app/src
parente5fab9c5f04dcf1438c5989a5cd1c03db5710d76 (diff)
fix tethering hint (#8979)
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java47
-rw-r--r--app/src/main/res/values/strings.xml3
2 files changed, 28 insertions, 22 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
index 900d1885..77acb657 100644
--- a/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
+++ b/app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java
@@ -22,35 +22,37 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import java.util.Observable;
+import java.util.Observer;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import butterknife.ButterKnife;
+import butterknife.InjectView;
+import de.blinkt.openvpn.core.VpnStatus;
+import se.leap.bitmaskclient.R;
+import se.leap.bitmaskclient.firewall.FirewallManager;
+import se.leap.bitmaskclient.tethering.TetheringObservable;
+import se.leap.bitmaskclient.utils.PreferenceHelper;
+import se.leap.bitmaskclient.views.IconCheckboxEntry;
+
/**
* Copyright (c) 2020 LEAP Encryption Access Project and contributers
- *
+ * <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
- *
+ * <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ * <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import java.util.Observable;
-import java.util.Observer;
-
-import butterknife.ButterKnife;
-import butterknife.InjectView;
-import de.blinkt.openvpn.core.VpnStatus;
-import se.leap.bitmaskclient.R;
-import se.leap.bitmaskclient.firewall.FirewallManager;
-import se.leap.bitmaskclient.tethering.TetheringObservable;
-import se.leap.bitmaskclient.utils.PreferenceHelper;
-import se.leap.bitmaskclient.views.IconCheckboxEntry;
-
public class TetheringDialog extends AppCompatDialogFragment implements Observer {
public final static String TAG = TetheringDialog.class.getName();
@@ -191,12 +193,17 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer
private CharSequence createUserMessage() {
String tetheringMessage = getString(R.string.tethering_message);
- String systemSettings = getString(R.string.tethering_system_settings);
- String systemSettingsMessage = getString(R.string.tethering_enabled_message, systemSettings);
+ String systemSettingsMessage = getString(R.string.tethering_enabled_message);
+ Pattern pattern = Pattern.compile("([\\w .]*)(<b>)+([\\w ]*)(</b>)([\\w .]*)");
+ Matcher matcher = pattern.matcher(systemSettingsMessage);
+ int startIndex = 0;
+ int endIndex = 0;
+ if (matcher.matches()) {
+ startIndex = matcher.start(2);
+ endIndex = startIndex + matcher.group(3).length();
+ }
+ systemSettingsMessage = systemSettingsMessage.replace("<b>", "").replace("</b>", "");
String wholeMessage = systemSettingsMessage + "\n\n" + tetheringMessage;
- int startIndex = wholeMessage.indexOf(systemSettings, 0);
- int endIndex = startIndex + systemSettings.length();
-
Spannable spannable = new SpannableString(wholeMessage);
spannable.setSpan(new ClickableSpan() {
@Override
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 661a9fcf..7ec78b70 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -111,8 +111,7 @@
<string name="require_root">Requires root permissions</string>
<string name="show_experimental">Show experimental features</string>
<string name="hide_experimental">Hide experimental features</string>
- <string name="tethering_enabled_message">Please make sure to enable tethering in the %s first!</string>
- <string name="tethering_system_settings">system settings</string>
+ <string name="tethering_enabled_message">Please make sure to enable tethering in the <![CDATA[<b>system settings</b>]]> first.</string>
<string name="tethering_message">Share your VPN with other devices via:</string>
<string name="tethering_wifi">Wifi hotspot</string>
<string name="tethering_usb">USB tethering</string>