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
@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 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 html = """ | |
<h5>Requesting a refund on markaz</h5> | |
<p>Ap Delivery partner ke issue ke baray main hamin mukhtalif tareeqo se bta skta hain?</p> | |
<ul> | |
<li> Pehla order laganay k baad verification call ka intezar karain aur call receive kar kay apna order confirm karwayen. Orders ke tadaad ziada honay ki surat mei verification ko 2 days bhi lag sakte hain </li> | |
<li>Agar apke order ka status shipping booked likha ajai tou iska matlab apki verification ho chuki hai</li> | |
<li>Agar aap pehli dafa order kar rahay hain tou aap bara order nahi laga sakte. Ap ka pehla order deliver hone ke baad ap 2-3 multiple order laga sakte hain</li> | |
</ul> | |
<ol> |
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
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 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 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 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 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 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 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 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