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
29
Merge Requests
29
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
d7c8f61c
Commit
d7c8f61c
authored
Apr 19, 2019
by
Nicolas Fella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unify coding style
parent
7da63109
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
36 deletions
+36
-36
src/org/kde/kdeconnect/Device.java
src/org/kde/kdeconnect/Device.java
+6
-6
src/org/kde/kdeconnect/Helpers/SMSHelper.java
src/org/kde/kdeconnect/Helpers/SMSHelper.java
+26
-26
src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java
src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java
+4
-4
No files found.
src/org/kde/kdeconnect/Device.java
View file @
d7c8f61c
...
...
@@ -77,7 +77,7 @@ public class Device implements BaseLink.PacketReceiver {
private
final
CopyOnWriteArrayList
<
BaseLink
>
links
=
new
CopyOnWriteArrayList
<>();
private
List
<
String
>
m_
supportedPlugins
=
new
ArrayList
<>();
private
List
<
String
>
supportedPlugins
=
new
ArrayList
<>();
private
final
ConcurrentHashMap
<
String
,
Plugin
>
plugins
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentHashMap
<
String
,
Plugin
>
pluginsWithoutPermissions
=
new
ConcurrentHashMap
<>();
private
final
ConcurrentHashMap
<
String
,
Plugin
>
pluginsWithoutOptionalPermissions
=
new
ConcurrentHashMap
<>();
...
...
@@ -147,7 +147,7 @@ public class Device implements BaseLink.PacketReceiver {
this
.
deviceType
=
DeviceType
.
FromString
(
settings
.
getString
(
"deviceType"
,
"desktop"
));
//Assume every plugin is supported until addLink is called and we can get the actual list
m_
supportedPlugins
=
new
Vector
<>(
PluginFactory
.
getAvailablePlugins
());
supportedPlugins
=
new
Vector
<>(
PluginFactory
.
getAvailablePlugins
());
//Do not load plugins yet, the device is not present
//reloadPluginsFromSettings();
...
...
@@ -494,9 +494,9 @@ public class Device implements BaseLink.PacketReceiver {
Set
<
String
>
outgoingCapabilities
=
identityPacket
.
getStringSet
(
"outgoingCapabilities"
,
null
);
Set
<
String
>
incomingCapabilities
=
identityPacket
.
getStringSet
(
"incomingCapabilities"
,
null
);
if
(
incomingCapabilities
!=
null
&&
outgoingCapabilities
!=
null
)
{
m_
supportedPlugins
=
new
Vector
<>(
PluginFactory
.
pluginsForCapabilities
(
incomingCapabilities
,
outgoingCapabilities
));
supportedPlugins
=
new
Vector
<>(
PluginFactory
.
pluginsForCapabilities
(
incomingCapabilities
,
outgoingCapabilities
));
}
else
{
m_
supportedPlugins
=
new
Vector
<>(
PluginFactory
.
getAvailablePlugins
());
supportedPlugins
=
new
Vector
<>(
PluginFactory
.
getAvailablePlugins
());
}
link
.
addPacketReceiver
(
this
);
...
...
@@ -757,7 +757,7 @@ public class Device implements BaseLink.PacketReceiver {
HashMap
<
String
,
ArrayList
<
String
>>
newPluginsByIncomingInterface
=
new
HashMap
<>();
for
(
String
pluginKey
:
m_
supportedPlugins
)
{
for
(
String
pluginKey
:
supportedPlugins
)
{
PluginFactory
.
PluginInfo
pluginInfo
=
PluginFactory
.
getPluginInfo
(
pluginKey
);
...
...
@@ -837,7 +837,7 @@ public class Device implements BaseLink.PacketReceiver {
}
public
List
<
String
>
getSupportedPlugins
()
{
return
m_
supportedPlugins
;
return
supportedPlugins
;
}
}
src/org/kde/kdeconnect/Helpers/SMSHelper.java
View file @
d7c8f61c
...
...
@@ -146,7 +146,7 @@ public class SMSHelper {
}
Message
message
=
new
Message
(
messageInfo
);
ThreadID
threadID
=
new
ThreadID
(
message
.
m_
threadID
);
ThreadID
threadID
=
new
ThreadID
(
message
.
threadID
);
if
(!
toReturn
.
containsKey
(
threadID
))
{
toReturn
.
put
(
threadID
,
new
ArrayList
<>());
...
...
@@ -224,12 +224,12 @@ public class SMSHelper {
@NonNull
public
String
toString
()
{
return
th
is
.
th
readID
.
toString
();
return
threadID
.
toString
();
}
@Override
public
int
hashCode
()
{
return
th
is
.
th
readID
.
hashCode
();
return
threadID
.
hashCode
();
}
@Override
...
...
@@ -243,13 +243,13 @@ public class SMSHelper {
*/
public
static
class
Message
{
final
String
m_
address
;
final
String
m_
body
;
public
final
long
m_
date
;
final
int
m_
type
;
final
int
m_
read
;
final
long
m_
threadID
;
// ThreadID is *int* for SMS messages but *long* for MMS
final
int
m_
uID
;
final
String
address
;
final
String
body
;
public
final
long
date
;
final
int
type
;
final
int
read
;
final
long
threadID
;
// ThreadID is *int* for SMS messages but *long* for MMS
final
int
uID
;
/**
* Named constants which are used to construct a Message
...
...
@@ -285,40 +285,40 @@ public class SMSHelper {
};
Message
(
final
HashMap
<
String
,
String
>
messageInfo
)
{
m_
address
=
messageInfo
.
get
(
Message
.
ADDRESS
);
m_
body
=
messageInfo
.
get
(
Message
.
BODY
);
m_
date
=
Long
.
parseLong
(
messageInfo
.
get
(
Message
.
DATE
));
address
=
messageInfo
.
get
(
Message
.
ADDRESS
);
body
=
messageInfo
.
get
(
Message
.
BODY
);
date
=
Long
.
parseLong
(
messageInfo
.
get
(
Message
.
DATE
));
if
(
messageInfo
.
get
(
Message
.
TYPE
)
==
null
)
{
// To be honest, I have no idea why this happens. The docs say the TYPE field is mandatory.
// Just stick some junk in here and hope we can figure it out later.
// Quick investigation suggests that these are multi-target MMSes
m_
type
=
-
1
;
type
=
-
1
;
}
else
{
m_
type
=
Integer
.
parseInt
(
messageInfo
.
get
(
Message
.
TYPE
));
type
=
Integer
.
parseInt
(
messageInfo
.
get
(
Message
.
TYPE
));
}
m_
read
=
Integer
.
parseInt
(
messageInfo
.
get
(
Message
.
READ
));
m_
threadID
=
Long
.
parseLong
(
messageInfo
.
get
(
Message
.
THREAD_ID
));
m_
uID
=
Integer
.
parseInt
(
messageInfo
.
get
(
Message
.
U_ID
));
read
=
Integer
.
parseInt
(
messageInfo
.
get
(
Message
.
READ
));
threadID
=
Long
.
parseLong
(
messageInfo
.
get
(
Message
.
THREAD_ID
));
uID
=
Integer
.
parseInt
(
messageInfo
.
get
(
Message
.
U_ID
));
}
public
JSONObject
toJSONObject
()
throws
JSONException
{
JSONObject
json
=
new
JSONObject
();
json
.
put
(
Message
.
ADDRESS
,
m_
address
);
json
.
put
(
Message
.
BODY
,
m_
body
);
json
.
put
(
Message
.
DATE
,
m_
date
);
json
.
put
(
Message
.
TYPE
,
m_
type
);
json
.
put
(
Message
.
READ
,
m_
read
);
json
.
put
(
Message
.
THREAD_ID
,
m_
threadID
);
json
.
put
(
Message
.
U_ID
,
m_
uID
);
json
.
put
(
Message
.
ADDRESS
,
address
);
json
.
put
(
Message
.
BODY
,
body
);
json
.
put
(
Message
.
DATE
,
date
);
json
.
put
(
Message
.
TYPE
,
type
);
json
.
put
(
Message
.
READ
,
read
);
json
.
put
(
Message
.
THREAD_ID
,
threadID
);
json
.
put
(
Message
.
U_ID
,
uID
);
return
json
;
}
@Override
public
String
toString
()
{
return
this
.
m_
body
;
return
body
;
}
}
...
...
src/org/kde/kdeconnect/Plugins/SMSPlugin/SMSPlugin.java
View file @
d7c8f61c
...
...
@@ -204,8 +204,8 @@ public class SMSPlugin extends Plugin {
// Update the most recent counter
mostRecentTimestampLock
.
lock
();
for
(
SMSHelper
.
Message
message
:
messages
)
{
if
(
message
.
m_
date
>
mostRecentTimestamp
)
{
mPlugin
.
mostRecentTimestamp
=
message
.
m_
date
;
if
(
message
.
date
>
mostRecentTimestamp
)
{
mPlugin
.
mostRecentTimestamp
=
message
.
date
;
}
}
mostRecentTimestampLock
.
unlock
();
...
...
@@ -374,8 +374,8 @@ public class SMSPlugin extends Plugin {
// recent in every conversation
mostRecentTimestampLock
.
lock
();
for
(
SMSHelper
.
Message
message
:
conversations
.
values
())
{
if
(
message
.
m_
date
>
mostRecentTimestamp
)
{
mostRecentTimestamp
=
message
.
m_
date
;
if
(
message
.
date
>
mostRecentTimestamp
)
{
mostRecentTimestamp
=
message
.
date
;
}
}
mostRecentTimestampLock
.
unlock
();
...
...
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