summaryrefslogtreecommitdiff
path: root/app/src/main/java
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/main/java
parente5fab9c5f04dcf1438c5989a5cd1c03db5710d76 (diff)
fix tethering hint (#8979)
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/fragments/TetheringDialog.java47
1 files changed, 27 insertions, 20 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