Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
bitmask_android
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Chirayu Desai
bitmask_android
Commits
bfeff9f9
Commit
bfeff9f9
authored
2 years ago
by
cyberta
Browse files
Options
Downloads
Patches
Plain Diff
take extra care for wrongly formatted strings when using spannables in TetheringDialog
parent
51e2e18f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/src/main/java/se/leap/bitmaskclient/base/fragments/TetheringDialog.java
+9
-1
9 additions, 1 deletion
...se/leap/bitmaskclient/base/fragments/TetheringDialog.java
with
9 additions
and
1 deletion
app/src/main/java/se/leap/bitmaskclient/base/fragments/TetheringDialog.java
+
9
−
1
View file @
bfeff9f9
...
@@ -209,10 +209,18 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer
...
@@ -209,10 +209,18 @@ public class TetheringDialog extends AppCompatDialogFragment implements Observer
int
endIndex
=
0
;
int
endIndex
=
0
;
if
(
matcher
.
matches
())
{
if
(
matcher
.
matches
())
{
startIndex
=
matcher
.
start
(
2
);
startIndex
=
matcher
.
start
(
2
);
try
{
endIndex
=
startIndex
+
matcher
.
group
(
3
).
length
();
endIndex
=
startIndex
+
matcher
.
group
(
3
).
length
();
}
catch
(
NullPointerException
npe
)
{
endIndex
=
-
1
;
}
}
}
systemSettingsMessage
=
systemSettingsMessage
.
replace
(
"<b>"
,
""
).
replace
(
"</b>"
,
""
);
systemSettingsMessage
=
systemSettingsMessage
.
replace
(
"<b>"
,
""
).
replace
(
"</b>"
,
""
);
String
wholeMessage
=
systemSettingsMessage
+
"\n\n"
+
tetheringMessage
;
String
wholeMessage
=
systemSettingsMessage
+
"\n\n"
+
tetheringMessage
;
if
(
startIndex
==
-
1
||
endIndex
==
-
1
)
{
Log
.
e
(
TAG
,
"Tethering string has wrong formatting!"
);
return
wholeMessage
;
}
Spannable
spannable
=
new
SpannableString
(
wholeMessage
);
Spannable
spannable
=
new
SpannableString
(
wholeMessage
);
spannable
.
setSpan
(
new
ClickableSpan
()
{
spannable
.
setSpan
(
new
ClickableSpan
()
{
@Override
@Override
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment