Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
KDE Connect Android
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
26
Merge Requests
26
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Network
KDE Connect Android
Commits
dbd9ece1
Commit
dbd9ece1
authored
Jun 04, 2019
by
Nicolas Fella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor getTickerText
parent
132e4e7e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
21 deletions
+17
-21
src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java
...nect/Plugins/NotificationsPlugin/NotificationsPlugin.java
+17
-21
No files found.
src/org/kde/kdeconnect/Plugins/NotificationsPlugin/NotificationsPlugin.java
View file @
dbd9ece1
...
...
@@ -489,32 +489,28 @@ public class NotificationsPlugin extends Plugin implements NotificationReceiver.
* instead the ticker text.
*/
private
String
getTickerText
(
Notification
notification
)
{
final
String
TITLE_KEY
=
"android.title"
;
final
String
TEXT_KEY
=
"android.text"
;
String
ticker
=
""
;
if
(
notification
!=
null
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
try
{
Bundle
extras
=
notification
.
extras
;
String
extraTitle
=
extractStringFromExtra
(
extras
,
TITLE_KEY
);
String
extraText
=
extractStringFromExtra
(
extras
,
TEXT_KEY
);
if
(
extraTitle
!=
null
&&
extraText
!=
null
&&
!
extraText
.
isEmpty
())
{
ticker
=
extraTitle
+
": "
+
extraText
;
}
else
if
(
extraTitle
!=
null
)
{
ticker
=
extraTitle
;
}
else
if
(
extraText
!=
null
)
{
ticker
=
extraText
;
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"problem parsing notification extras for "
+
notification
.
tickerText
,
e
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
try
{
Bundle
extras
=
notification
.
extras
;
String
extraTitle
=
extractStringFromExtra
(
extras
,
Notification
.
EXTRA_TITLE
);
String
extraText
=
extractStringFromExtra
(
extras
,
Notification
.
EXTRA_TEXT
);
if
(
extraTitle
!=
null
&&
extraText
!=
null
&&
!
extraText
.
isEmpty
())
{
ticker
=
extraTitle
+
": "
+
extraText
;
}
else
if
(
extraTitle
!=
null
)
{
ticker
=
extraTitle
;
}
else
if
(
extraText
!=
null
)
{
ticker
=
extraText
;
}
}
catch
(
Exception
e
)
{
Log
.
e
(
TAG
,
"problem parsing notification extras for "
+
notification
.
tickerText
,
e
);
}
}
if
(
ticker
.
isEmpty
())
{
ticker
=
(
notification
.
tickerText
!=
null
)
?
notification
.
tickerText
.
toString
()
:
""
;
}
if
(
ticker
.
isEmpty
())
{
ticker
=
(
notification
.
tickerText
!=
null
)
?
notification
.
tickerText
.
toString
()
:
""
;
}
return
ticker
;
...
...
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