Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
netmetr-android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
19
Issues
19
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
labs
netmetr-android
Commits
dab25bc4
Commit
dab25bc4
authored
Jan 31, 2018
by
Drahomír Karchňák
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed provider name on exported banner images.
parent
36366cc5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
8 deletions
+26
-8
RMBTStatisticServer/src/at/alladin/rmbt/statisticServer/export/ImageExport.java
...c/at/alladin/rmbt/statisticServer/export/ImageExport.java
+26
-8
No files found.
RMBTStatisticServer/src/at/alladin/rmbt/statisticServer/export/ImageExport.java
View file @
dab25bc4
...
...
@@ -31,6 +31,8 @@ import java.text.SimpleDateFormat;
import
java.util.Date
;
import
java.util.logging.Level
;
import
java.util.logging.Logger
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
javax.imageio.ImageIO
;
...
...
@@ -154,19 +156,16 @@ public class ImageExport extends ServerResource {
final
double
download
=
((
double
)
rs
.
getInt
(
"download_kbit"
))
/
1000
;
final
double
upload
=
((
double
)
rs
.
getInt
(
"upload_kbit"
))
/
1000
;
final
double
ping
=
rs
.
getFloat
(
"ping_ms"
);
final
String
isp
=
rs
.
getString
(
"provider_name"
);
final
String
typ
=
rs
.
getString
(
"network_type"
);
final
String
signal
=
rs
.
getString
(
"signal_strength"
);
final
String
os
=
rs
.
getString
(
"platform"
);
final
Timestamp
time
=
rs
.
getTimestamp
(
"time"
);
final
String
networkName
=
rs
.
getString
(
"network_name"
);
final
String
publicName
=
rs
.
getString
(
"public_name"
);
final
String
providerName
=
rs
.
getString
(
"provider_name"
);
final
String
networkName
=
rs
.
getString
(
"network_name"
);
final
String
publicName
=
rs
.
getString
(
"public_name"
);
final
StringBuilder
test
=
new
StringBuilder
();
test
.
append
(
isp
).
append
(
", "
);
test
.
append
(
networkName
).
append
(
", "
);
test
.
append
(
publicName
);
final
String
isp
=
getProviderName
(
providerName
,
networkName
,
publicName
);
final
OutputRepresentation
result
=
new
OutputRepresentation
(
MediaType
.
IMAGE_PNG
)
{
@Override
...
...
@@ -192,7 +191,7 @@ public class ImageExport extends ServerResource {
upload
,
download
,
ping
,
test
.
toString
()
,
isp
,
typ
,
signal
,
os
,
...
...
@@ -213,6 +212,25 @@ public class ImageExport extends ServerResource {
return
new
StringRepresentation
(
"invalid uuid"
);
}
}
private
String
getProviderName
(
String
providerName
,
String
networkName
,
String
publicName
)
{
if
(
providerName
!=
null
)
return
providerName
;
if
(
networkName
!=
null
)
return
networkName
;
if
(
publicName
!=
null
){
//publicName example: TMOBILE-CZ T-Mobile Czech Republic a.s.,CZ
Pattern
pattern
=
Pattern
.
compile
(
"\\S+\\s(.+),"
);
Matcher
matcher
=
pattern
.
matcher
(
publicName
);
if
(
matcher
.
find
())
{
return
matcher
.
group
();
}
else
{
return
publicName
;
}
}
return
null
;
}
public
class
ForumBannerSmallGenerator
extends
AbstractImageGenerator
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment