Skip to content

Commit 0e5a23d

Browse files
committed
cleanup: Remove all star imports.
It's clearer to have explicit imports.
1 parent 5f2d200 commit 0e5a23d

File tree

12 files changed

+158
-53
lines changed

12 files changed

+158
-53
lines changed

lib/src/main/java/im/tox/tox4j/av/ToxAv.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package im.tox.tox4j.av
22

3-
import im.tox.tox4j.av.callbacks.*
4-
import im.tox.tox4j.av.data.*
3+
import im.tox.tox4j.av.callbacks.ToxAvEventListener
4+
import im.tox.tox4j.av.data.AudioChannels
5+
import im.tox.tox4j.av.data.BitRate
6+
import im.tox.tox4j.av.data.SampleCount
7+
import im.tox.tox4j.av.data.SamplingRate
58
import im.tox.tox4j.av.enums.ToxavCallControl
6-
import im.tox.tox4j.av.exceptions.*
79
import im.tox.tox4j.core.ToxCore
810
import im.tox.tox4j.core.data.ToxFriendNumber
911
import java.io.Closeable

lib/src/main/java/im/tox/tox4j/core/ToxCore.kt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
package im.tox.tox4j.core
22

33
import im.tox.core.network.Port
4-
import im.tox.tox4j.core.callbacks.*
5-
import im.tox.tox4j.core.data.*
6-
import im.tox.tox4j.core.enums.*
7-
import im.tox.tox4j.core.exceptions.*
4+
import im.tox.tox4j.core.callbacks.ToxCoreEventListener
5+
import im.tox.tox4j.core.data.ToxFileId
6+
import im.tox.tox4j.core.data.ToxFilename
7+
import im.tox.tox4j.core.data.ToxFriendAddress
8+
import im.tox.tox4j.core.data.ToxFriendMessage
9+
import im.tox.tox4j.core.data.ToxFriendNumber
10+
import im.tox.tox4j.core.data.ToxFriendRequestMessage
11+
import im.tox.tox4j.core.data.ToxLosslessPacket
12+
import im.tox.tox4j.core.data.ToxLossyPacket
13+
import im.tox.tox4j.core.data.ToxNickname
14+
import im.tox.tox4j.core.data.ToxPublicKey
15+
import im.tox.tox4j.core.data.ToxSecretKey
16+
import im.tox.tox4j.core.data.ToxStatusMessage
17+
import im.tox.tox4j.core.enums.ToxFileControl
18+
import im.tox.tox4j.core.enums.ToxMessageType
19+
import im.tox.tox4j.core.enums.ToxUserStatus
820
import im.tox.tox4j.core.options.ToxOptions
921
import java.io.Closeable
1022

lib/src/main/java/im/tox/tox4j/core/ToxCoreConstants.kt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import im.tox.tox4j.crypto.ToxCryptoConstants
55
object ToxCoreConstants {
66

77
/** The size of a Tox Public Key in bytes. */
8-
val PublicKeySize = ToxCryptoConstants.PublicKeyLength
8+
const val PublicKeySize = ToxCryptoConstants.PublicKeyLength
99

1010
/** The size of a Tox Secret Key in bytes. */
11-
val SecretKeySize = ToxCryptoConstants.SecretKeyLength
11+
const val SecretKeySize = ToxCryptoConstants.SecretKeyLength
1212

1313
/**
1414
* The size of a Tox address in bytes. Tox addresses are in the format
@@ -18,34 +18,34 @@ object ToxCoreConstants {
1818
* all the odd bytes, the second byte is an XOR of all the even bytes of the Public Key and
1919
* nospam.
2020
*/
21-
val AddressSize = PublicKeySize + 4 + 2
21+
const val AddressSize = PublicKeySize + 4 + 2
2222

2323
/** Maximum length of a nickname in bytes. */
24-
val MaxNameLength = 128
24+
const val MaxNameLength = 128
2525

2626
/** Maximum length of a status message in bytes. */
27-
val MaxStatusMessageLength = 1007
27+
const val MaxStatusMessageLength = 1007
2828

2929
/** Maximum length of a friend request message in bytes. */
30-
val MaxFriendRequestLength = 1016
30+
const val MaxFriendRequestLength = 1016
3131

3232
/** Maximum length of a single message after which it should be split. */
33-
val MaxMessageLength = 1372
33+
const val MaxMessageLength = 1372
3434

3535
/** Maximum size of custom packets. */
36-
val MaxCustomPacketSize = 1373
36+
const val MaxCustomPacketSize = 1373
3737

3838
/** Maximum file name length for file transfers. */
39-
val MaxFilenameLength = 255
39+
const val MaxFilenameLength = 255
4040

4141
/**
4242
* Maximum hostname length. This is determined by calling `getconf HOST_NAME_MAX` on the console.
4343
* The value presented here is valid for most systems.
4444
*/
45-
val MaxHostnameLength = 255
45+
const val MaxHostnameLength = 255
4646

4747
/** The number of bytes in a file id. */
48-
val FileIdLength = ToxCryptoConstants.HashLength
48+
const val FileIdLength = ToxCryptoConstants.HashLength
4949

5050
/** Default port for HTTP proxies. */
5151
val DefaultProxyPort = 8080.toUShort()

lib/src/main/java/im/tox/tox4j/crypto/ToxCrypto.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package im.tox.tox4j.crypto
22

3-
import im.tox.tox4j.crypto.exceptions.*
4-
53
/**
64
* To perform encryption, first derive an encryption key from a password with
75
* [[ToxCrypto.passKeyDerive]], and use the returned key to encrypt the data.

lib/src/main/java/im/tox/tox4j/crypto/ToxCryptoConstants.kt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,25 @@ package im.tox.tox4j.crypto
33
object ToxCryptoConstants {
44

55
/** Length of salt in bytes. */
6-
val SaltLength = 32
6+
const val SaltLength = 32
77

88
/**
99
* The number of bytes in a serialised [[ToxCrypto.PassKey]] without salt. The serialised size is
1010
* [[KeyLength]] + [[SaltLength]].
1111
*/
12-
val KeyLength = 32
12+
const val KeyLength = 32
1313

1414
/** Number of bytes added to any encrypted data. */
15-
val EncryptionExtraLength = 80
15+
const val EncryptionExtraLength = 80
1616

1717
/** The number of bytes in a hash generated by tox_hash. */
18-
val HashLength = 32
18+
const val HashLength = 32
1919

20-
val PublicKeyLength = 32
21-
val SecretKeyLength = 32
22-
val SharedKeyLength = 32
23-
val NonceLength = 24
20+
const val PublicKeyLength = 32
21+
const val SecretKeyLength = 32
22+
const val SharedKeyLength = 32
23+
const val NonceLength = 24
2424

25-
val ZeroBytes = 32
26-
val BoxZeroBytes = 16
25+
const val ZeroBytes = 32
26+
const val BoxZeroBytes = 16
2727
}

lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvEventDispatch.kt

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
package im.tox.tox4j.impl.jni
22

33
import com.google.protobuf.ByteString
4-
import im.tox.tox4j.av.callbacks.*
5-
import im.tox.tox4j.av.data.*
4+
import im.tox.tox4j.av.callbacks.AudioBitRateCallback
5+
import im.tox.tox4j.av.callbacks.AudioReceiveFrameCallback
6+
import im.tox.tox4j.av.callbacks.CallCallback
7+
import im.tox.tox4j.av.callbacks.CallStateCallback
8+
import im.tox.tox4j.av.callbacks.ToxAvEventListener
9+
import im.tox.tox4j.av.callbacks.VideoBitRateCallback
10+
import im.tox.tox4j.av.callbacks.VideoReceiveFrameCallback
11+
import im.tox.tox4j.av.data.AudioChannels
12+
import im.tox.tox4j.av.data.BitRate
13+
import im.tox.tox4j.av.data.Height
14+
import im.tox.tox4j.av.data.SamplingRate
15+
import im.tox.tox4j.av.data.Width
616
import im.tox.tox4j.av.enums.ToxavFriendCallState
7-
import im.tox.tox4j.av.proto.*
17+
import im.tox.tox4j.av.proto.AudioBitRate
18+
import im.tox.tox4j.av.proto.AudioReceiveFrame
19+
import im.tox.tox4j.av.proto.AvEvents
20+
import im.tox.tox4j.av.proto.Call
21+
import im.tox.tox4j.av.proto.CallState
22+
import im.tox.tox4j.av.proto.VideoBitRate
23+
import im.tox.tox4j.av.proto.VideoReceiveFrame
824
import im.tox.tox4j.core.data.ToxFriendNumber
925
import java.util.EnumSet
1026

lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvImpl.kt

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package im.tox.tox4j.impl.jni
22

3-
import im.tox.tox4j.av.*
4-
import im.tox.tox4j.av.callbacks.*
5-
import im.tox.tox4j.av.data.*
6-
import im.tox.tox4j.av.enums.*
7-
import im.tox.tox4j.av.exceptions.*
3+
import im.tox.tox4j.av.ToxAv
4+
import im.tox.tox4j.av.callbacks.ToxAvEventListener
5+
import im.tox.tox4j.av.data.AudioChannels
6+
import im.tox.tox4j.av.data.BitRate
7+
import im.tox.tox4j.av.data.SampleCount
8+
import im.tox.tox4j.av.data.SamplingRate
9+
import im.tox.tox4j.av.enums.ToxavCallControl
10+
import im.tox.tox4j.av.exceptions.ToxavNewException
811
import im.tox.tox4j.core.ToxCore
912
import im.tox.tox4j.core.data.ToxFriendNumber
10-
import java.util.EnumSet
1113

1214
/**
1315
* Initialise an A/V session for the existing Tox instance.
@@ -43,7 +45,12 @@ final class ToxAvImpl(private val tox: ToxCoreImpl) : ToxAv {
4345
audioBitRate: BitRate,
4446
videoBitRate: BitRate
4547
): Unit =
46-
ToxAvJni.toxavCall(instanceNumber, friendNumber.value, audioBitRate.value, videoBitRate.value)
48+
ToxAvJni.toxavCall(
49+
instanceNumber,
50+
friendNumber.value,
51+
audioBitRate.value,
52+
videoBitRate.value,
53+
)
4754

4855
// @throws[ToxavAnswerException]
4956
override fun answer(
@@ -52,7 +59,11 @@ final class ToxAvImpl(private val tox: ToxCoreImpl) : ToxAv {
5259
videoBitRate: BitRate
5360
): Unit =
5461
ToxAvJni.toxavAnswer(
55-
instanceNumber, friendNumber.value, audioBitRate.value, videoBitRate.value)
62+
instanceNumber,
63+
friendNumber.value,
64+
audioBitRate.value,
65+
videoBitRate.value,
66+
)
5667

5768
// @throws[ToxavCallControlException]
5869
override fun callControl(friendNumber: ToxFriendNumber, control: ToxavCallControl): Unit =

lib/src/main/java/im/tox/tox4j/impl/jni/ToxAvJni.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
package im.tox.tox4j.impl.jni;
22

3-
import im.tox.tox4j.av.exceptions.*;
3+
import im.tox.tox4j.av.exceptions.ToxavAnswerException;
4+
import im.tox.tox4j.av.exceptions.ToxavBitRateSetException;
5+
import im.tox.tox4j.av.exceptions.ToxavCallControlException;
6+
import im.tox.tox4j.av.exceptions.ToxavCallException;
7+
import im.tox.tox4j.av.exceptions.ToxavNewException;
8+
import im.tox.tox4j.av.exceptions.ToxavSendFrameException;
49

510
@SuppressWarnings({"checkstyle:emptylineseparator", "checkstyle:linelength"})
611
public final class ToxAvJni {

lib/src/main/java/im/tox/tox4j/impl/jni/ToxCoreEventDispatch.kt

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,39 @@
11
package im.tox.tox4j.impl.jni
22

33
import im.tox.tox4j.core.callbacks.ToxCoreEventListener
4-
import im.tox.tox4j.core.data.*
5-
import im.tox.tox4j.core.enums.*
6-
import im.tox.tox4j.core.proto.*
4+
import im.tox.tox4j.core.data.ToxFilename
5+
import im.tox.tox4j.core.data.ToxFriendMessage
6+
import im.tox.tox4j.core.data.ToxFriendNumber
7+
import im.tox.tox4j.core.data.ToxFriendRequestMessage
8+
import im.tox.tox4j.core.data.ToxLosslessPacket
9+
import im.tox.tox4j.core.data.ToxLossyPacket
10+
import im.tox.tox4j.core.data.ToxNickname
11+
import im.tox.tox4j.core.data.ToxPublicKey
12+
import im.tox.tox4j.core.data.ToxStatusMessage
13+
import im.tox.tox4j.core.enums.ToxConnection
14+
import im.tox.tox4j.core.enums.ToxFileControl
15+
import im.tox.tox4j.core.enums.ToxMessageType
16+
import im.tox.tox4j.core.enums.ToxUserStatus
17+
import im.tox.tox4j.core.proto.Connection
18+
import im.tox.tox4j.core.proto.CoreEvents
19+
import im.tox.tox4j.core.proto.FileChunkRequest
20+
import im.tox.tox4j.core.proto.FileControl
21+
import im.tox.tox4j.core.proto.FileRecv
22+
import im.tox.tox4j.core.proto.FileRecvChunk
23+
import im.tox.tox4j.core.proto.FileRecvControl
24+
import im.tox.tox4j.core.proto.FriendConnectionStatus
25+
import im.tox.tox4j.core.proto.FriendLosslessPacket
26+
import im.tox.tox4j.core.proto.FriendLossyPacket
27+
import im.tox.tox4j.core.proto.FriendMessage
28+
import im.tox.tox4j.core.proto.FriendName
29+
import im.tox.tox4j.core.proto.FriendReadReceipt
30+
import im.tox.tox4j.core.proto.FriendRequest
31+
import im.tox.tox4j.core.proto.FriendStatus
32+
import im.tox.tox4j.core.proto.FriendStatusMessage
33+
import im.tox.tox4j.core.proto.FriendTyping
34+
import im.tox.tox4j.core.proto.MessageType
35+
import im.tox.tox4j.core.proto.SelfConnectionStatus
36+
import im.tox.tox4j.core.proto.UserStatus
737

838
object ToxCoreEventDispatch {
939

lib/src/main/java/im/tox/tox4j/impl/jni/ToxCoreImpl.kt

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,25 @@
11
package im.tox.tox4j.impl.jni
22

33
import im.tox.core.network.Port
4-
import im.tox.tox4j.core.*
5-
import im.tox.tox4j.core.callbacks.*
6-
import im.tox.tox4j.core.data.*
7-
import im.tox.tox4j.core.enums.*
8-
import im.tox.tox4j.core.exceptions.*
4+
import im.tox.tox4j.core.ToxCore
5+
import im.tox.tox4j.core.ToxCoreConstants
6+
import im.tox.tox4j.core.callbacks.ToxCoreEventListener
7+
import im.tox.tox4j.core.data.ToxFileId
8+
import im.tox.tox4j.core.data.ToxFilename
9+
import im.tox.tox4j.core.data.ToxFriendAddress
10+
import im.tox.tox4j.core.data.ToxFriendMessage
11+
import im.tox.tox4j.core.data.ToxFriendNumber
12+
import im.tox.tox4j.core.data.ToxFriendRequestMessage
13+
import im.tox.tox4j.core.data.ToxLosslessPacket
14+
import im.tox.tox4j.core.data.ToxLossyPacket
15+
import im.tox.tox4j.core.data.ToxNickname
16+
import im.tox.tox4j.core.data.ToxPublicKey
17+
import im.tox.tox4j.core.data.ToxSecretKey
18+
import im.tox.tox4j.core.data.ToxStatusMessage
19+
import im.tox.tox4j.core.enums.ToxFileControl
20+
import im.tox.tox4j.core.enums.ToxMessageType
21+
import im.tox.tox4j.core.enums.ToxUserStatus
22+
import im.tox.tox4j.core.exceptions.ToxBootstrapException
923
import im.tox.tox4j.core.options.ToxOptions
1024

1125
/**

0 commit comments

Comments
 (0)