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
@Composable | |
fun KeyboardListener( | |
onKeyboardVisibilityChanged: (Boolean, Int) -> Unit | |
) { | |
val view = LocalView.current | |
val density = LocalDensity.current | |
DisposableEffect(view) { | |
ViewCompat.setOnApplyWindowInsetsListener(view) { _, insets -> | |
val imeVisible = insets.isVisible(WindowInsetsCompat.Type.ime()) |
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
val uiColor = MaterialTheme.colors.surface.toUIColor() | |
@OptIn(ExperimentalForeignApi::class) | |
fun Color.toUIColor(): UIColor { | |
val colorSpace = CGColorSpaceCreateDeviceRGB() | |
val components = nativeHeap.allocArray<DoubleVar>(4) | |
components[0] = red.toDouble() | |
components[1] = green.toDouble() | |
components[2] = blue.toDouble() | |
components[3] = alpha.toDouble() |
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
import android.view.ViewGroup | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.viewbinding.ViewBinding | |
abstract class MyBaseAdapter(): | |
RecyclerView.Adapter<MyBaseAdapter.MyBaseViewHolder>() { | |
inner class MyBaseViewHolder(private val itemViewBinding: ViewBinding) : | |
RecyclerView.ViewHolder(itemViewBinding.root) { |
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 repository{ | |
fun getItems( result : (humans: List<Humans>, birds: List<Birds> , | |
reptiles: List<Reptiles> )-> Unit) { | |
try { | |
CoroutineScope(Dispatchers.IO).launch { | |
val humanResponse = async { | |
apiService.getHumans() | |
} | |
val reptileResponse = async { |
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 repository{ | |
fun getItems( ) { | |
try { | |
CoroutineScope(Dispatchers.IO).launch { | |
val humanResponse = async { | |
apiService.getHumans() | |
} | |
val reptileResponse = async { | |
apiServices.getReptiles() |
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 repository{ | |
fun getItems( ) { | |
try { | |
} catch (e: Exception) { | |
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
# Add project specific ProGuard rules here. | |
# You can control the set of applied configuration files using the | |
# proguardFiles setting in build.gradle. | |
# | |
# For more details, see | |
# http://developer.android.com/guide/developing/tools/proguard.html | |
# If your project uses WebView with JS, uncomment the following | |
# and specify the fully qualified class name to the JavaScript interface | |
# class: |
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
override suspend fun doNetworkCallsInParallel() { | |
try { | |
CoroutineScope(Dispatchers.IO).launch { | |
val usNewsResponse = async { | |
apiServices.getHeadLines(country = "us") | |
} | |
val healthNewsResponse = async { | |
apiServices.getHeadLines(category = "health") } | |
val x = usNewsResponse.await() |
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
//Dependencies | |
// implementation 'com.sun.mail:android-mail:1.6.0' | |
// implementation'com.sun.mail:android-activation:1.6.0' | |
fun sendEmail(){ | |
val prop = Properties().apply { | |
put("mail.smtp.auth", "true") | |
put("mail.smtp.starttls.enable","true") | |
put("mail.smtp.host","smtp.gmail.com") |
NewerOlder