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
| /* ----------------------------------------- Activity ------------------------------------------ */ | |
| /* make sure you have at least 'androidx.activity:activity-ktx:1.6.0-rc01' at your dependencies | |
| (just to let you know this dependency is not stable yet ) | |
| */ | |
| implementation 'androidx.activity:activity-ktx:1.6.0-rc01' | |
| fun AppCompatActivity.onBackPressed(isEnabled: Boolean, callback: () -> Unit) { | |
| onBackPressedDispatcher.addCallback(this, |
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
| // Snippet one: This code creates an ImageView control inside of a Pane. | |
| val root = pane { | |
| imageview { | |
| image = Image("/bucket.png") | |
| isPreserveRatio = true | |
| } | |
| } | |
| // Snippet two: This is the signature of the function imageview that's being called in the above snippet |
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
| class AppActivity : BaseActivity() { | |
| private val viewModel: AppViewModel by viewModel() | |
| override fun onNewIntent(intent: Intent?) { | |
| super.onNewIntent(intent) | |
| tryOpenScreenChain(intent) | |
| } | |
| private fun tryOpenScreenChain(intent: Intent?) { |
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"?> | |
| <project version="4"> | |
| <component name="JavaProjectCodeInsightSettings"> | |
| <excluded-names> | |
| <name>android.app.LauncherActivity.ListItem</name> | |
| <name>android.graphics.drawable.Icon</name> | |
| <name>android.graphics.fonts.FontFamily</name> | |
| <name>android.inputmethodservice.Keyboard.Row</name> | |
| <name>android.text.layout.Alignment</name> | |
| <name>android.widget.GridLayout.Alignment</name> |
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
| /* | |
| Reference link: https://developer.here.com/documentation/identity-access-management/dev_guide/topics/sdk.html | |
| */ | |
| class OAuthInterceptor : Interceptor { | |
| override fun intercept(chain: Interceptor.Chain): Response { | |
| val timeStampInMillis = System.currentTimeMillis() | |
| val request = chain.request() |
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
| /** | |
| * Create and return a new [Painter] that wraps [painter] with its [alpha], [colorFilter], or [onDraw] overwritten. | |
| */ | |
| fun forwardingPainter( | |
| painter: Painter, | |
| alpha: Float = DefaultAlpha, | |
| colorFilter: ColorFilter? = null, | |
| onDraw: DrawScope.(ForwardingDrawInfo) -> Unit = DefaultOnDraw, | |
| ): Painter = ForwardingPainter(painter, alpha, colorFilter, onDraw) |
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
| var isOriginalImageLoaded = false | |
| // Thumbnail Request | |
| val thumbRequest = ImageRequest.Builder(ctx) | |
| .data(thumbUrl) | |
| .target( | |
| onSuccess = { result -> | |
| // If highRes image is not loaded yet, | |
| // show the thumbnail | |
| if (!isOriginalImageLoaded) { |
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
| sealed class UiText { | |
| class DynamicText(val text: String) : UiText() | |
| class ResourceText(@StringRes val stringRes: Int) : UiText() | |
| } | |
| fun UiText.getString(context: Context) = when (this) { | |
| is UiText.DynamicText -> text | |
| is UiText.ResourceText -> context.getString(stringRes) |
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
| package cu.spin.catalog.ui.components | |
| import android.annotation.SuppressLint | |
| import androidx.compose.animation.core.animateFloat | |
| import androidx.compose.animation.core.updateTransition | |
| import androidx.compose.runtime.State | |
| import androidx.compose.ui.Modifier | |
| import androidx.compose.ui.composed | |
| import androidx.compose.ui.draw.drawWithCache | |
| import androidx.compose.ui.geometry.Offset |