-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compatibility on Android platforms below Android API 28 (#543)
- Loading branch information
Showing
383 changed files
with
3,901 additions
and
1,306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
android_test/app/src/main/java/org/stellar/javastellarsdkdemoapp/AndroidSdkProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.stellar.javastellarsdkdemoapp | ||
|
||
import org.stellar.sdk.Base32 | ||
import org.stellar.sdk.Base64 | ||
import org.stellar.sdk.spi.SdkProvider | ||
|
||
class AndroidSdkProvider : SdkProvider { | ||
override fun createBase64(): Base64 { | ||
return AndroidBase64() | ||
} | ||
|
||
override fun createBase32(): Base32 { | ||
return AndroidBase32() | ||
} | ||
|
||
class AndroidBase64 : Base64 { | ||
override fun encodeToString(data: ByteArray?): String { | ||
return android.util.Base64.encodeToString(data, android.util.Base64.NO_WRAP) | ||
} | ||
|
||
override fun encode(data: ByteArray?): ByteArray { | ||
return android.util.Base64.encode(data, android.util.Base64.NO_WRAP) | ||
} | ||
|
||
override fun decode(data: String?): ByteArray { | ||
return android.util.Base64.decode(data, android.util.Base64.NO_WRAP) | ||
} | ||
} | ||
|
||
class AndroidBase32 : Base32 { | ||
private val base32: ApacheCodec.Base32 = ApacheCodec.Base32() | ||
|
||
override fun encode(data: ByteArray?): ByteArray? { | ||
return base32.encode(data) | ||
} | ||
|
||
override fun decode(data: String?): ByteArray? { | ||
return base32.decode(data) | ||
} | ||
|
||
override fun decode(data: ByteArray?): ByteArray? { | ||
return base32.decode(data) | ||
} | ||
|
||
} | ||
} |
Oops, something went wrong.