This file contains hidden or 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
private inner class ConnectingProcessCallback : ConnectionLifecycleCallback() { | |
override fun onConnectionInitiated(endPointId: String, info: ConnectionInfo) { | |
MaterialAlertDialogBuilder(context) | |
.setTitle(Strings.get(R.string.accept_connection, info.endpointName)) | |
.setMessage(Strings.get(R.string.confirm_code, info.authenticationDigits)) | |
.setPositiveButton(Strings.get(R.string.accept)) { _: DialogInterface, _: Int -> | |
Nearby.getConnectionsClient(context) | |
.acceptConnection(endPointId, DataReceivedCallback()) | |
} | |
.setNegativeButton(Strings.get(R.string.cancel)) { _: DialogInterface, _: Int -> |
This file contains hidden or 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
fun startDiscovering() { | |
val discoveryOptions = | |
DiscoveryOptions.Builder().setStrategy(Strategy.P2P_POINT_TO_POINT).build() | |
client | |
.startDiscovery(SERVICE_ID, object : EndpointDiscoveryCallback() { | |
override fun onEndpointFound(endPointId: String, info: DiscoveredEndpointInfo) { | |
client.requestConnection(android.os.Build.MODEL, endPointId, ConnectingProcessCallback()) | |
.addOnSuccessListener { | |
} |
This file contains hidden or 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
fun startAdvertising() { | |
val advertisingOptions = | |
AdvertisingOptions.Builder().setStrategy(Strategy.P2P_POINT_TO_POINT).build() | |
client.startAdvertising( | |
android.os.Build.MODEL, SERVICE_ID, ConnectingProcessCallback(), advertisingOptions | |
) | |
.addOnSuccessListener { | |
Log.d(GENERAL, "advertising...") | |
} | |
.addOnFailureListener { |
This file contains hidden or 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
Glide | |
.with(context) | |
.load("someURL") | |
.diskCacheStrategy(DiskCacheStrategy.NONE) | |
.into(someView) |
This file contains hidden or 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
private const val SIZE_IN_BYTES: Long = 1024 * 1024 * 10 | |
@GlideModule | |
class MyGlideModule : AppGlideModule() { | |
override fun registerComponents(context: Context, glide: Glide, registry: Registry) { | |
val client = OkHttpClient.Builder() | |
.cache(Cache(context.cacheDir, SIZE_IN_BYTES)) | |
.build() | |
val factory = OkHttpUrlLoader.Factory(client) |
This file contains hidden or 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
depedencies { | |
implementation 'com.github.bumptech.glide:glide:4.13.2' | |
kapt 'com.github.bumptech.glide:compiler:4.13.2' | |
implementation 'com.squareup.okhttp3:okhttp:4.9.3' | |
implementation ("com.github.bumptech.glide:okhttp3-integration:4.0.0") { | |
exclude group: 'glide-parent' | |
} | |
} |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.molidev.splashapisample"> | |
<application | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:roundIcon="@mipmap/ic_launcher_round" | |
android:supportsRtl="true" |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<resources xmlns:tools="http://schemas.android.com/tools"> | |
<style name="Theme.AppSplash" parent="Theme.SplashScreen"> | |
<item name="windowSplashScreenBackground">@color/white</item> | |
<item name="windowSplashScreenAnimatedIcon">@drawable/icon_animated</item> | |
<item name="windowSplashScreenAnimationDuration">1000</item> | |
<item name="postSplashScreenTheme">@style/Theme.SplashAPISample</item> | |
<item name="android:windowSplashScreenBrandingImage">@drawable/branding</item> | |
<!-- Status bar and Nav bar configs --> |
NewerOlder