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 com.sajjady.recorder.Socket | |
import android.annotation.SuppressLint | |
import android.content.Context | |
import android.media.AudioFormat | |
import android.media.AudioRecord | |
import android.media.MediaCodec | |
import android.media.MediaFormat | |
import android.media.MediaRecorder | |
import io.socket.client.Socket |
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 com.owl.Owl | |
import android.annotation.SuppressLint | |
import android.content.Context | |
import android.media.* | |
import io.socket.client.IO | |
import io.socket.client.Socket | |
import java.net.URI | |
import kotlin.concurrent.thread | |
import kotlin.experimental.or |
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 | |
public fun DualSwitch(selection: Int) { | |
CardContainer { | |
Box { | |
val scope = rememberCoroutineScope() | |
val selection = remember { | |
mutableIntStateOf(selection) | |
} |
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 Modifier.animatePlacement(): Modifier = composed { | |
val scope = rememberCoroutineScope() | |
var targetOffset by remember { mutableStateOf(IntOffset.Zero) } | |
var animatable by remember { | |
mutableStateOf<Animatable<IntOffset, AnimationVector2D>?>(null) | |
} | |
this | |
// 🔥 onPlaced should be before offset Modifier | |
.onPlaced { | |
// Calculate the position in the parent layout |
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 AlarmService : Service() { | |
val TAG = "AlarmService" | |
private val INTERVAL_TIME = 60L * 1000L | |
private val messenger = Messenger(IncomingHandler()) | |
private val binder = LocalBinder() | |
override fun onBind(intent: Intent?): IBinder? { | |
return binder |
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 com.sajjady.sleepbehavior | |
import android.app.AlarmManager | |
import android.app.PendingIntent | |
import android.content.Context | |
import android.content.Intent | |
import android.net.Uri | |
import android.os.Build | |
import android.os.Bundle | |
import android.os.PowerManager |
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.content.Context | |
import android.content.Intent | |
import android.os.PowerManager | |
import android.provider.Settings | |
import android.net.Uri | |
fun requestIgnoreBatteryOptimizations(context: Context) { | |
val powerManager = context.getSystemService(Context.POWER_SERVICE) as PowerManager | |
val packageName = context.packageName |
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 calculateDownloadSpeed( | |
oldBytes: Long, newBytes: Long, oldTimeMillis: Long, newTimeMillis: Long | |
): Double { | |
val downloadedBytes = newBytes - oldBytes | |
val timeSeconds = (newTimeMillis - oldTimeMillis) / 1000.0 | |
val speedBytesPerSecond = downloadedBytes / timeSeconds | |
return speedBytesPerSecond / 1_048_576 // Convert to megabytes per second | |
} |
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 DownloadService : Service() { | |
private val runningDownloadList = mutableListOf<DownloadModel>() | |
private var onServiceChangeListener: OnServiceChangeListener? = null | |
private val TAG = "DownloadService" | |
private val messenger = Messenger(IncomingHandler()) | |
private val binder = LocalBinder() | |
// private val notificationList = mutableListOf<Pair<Long, NotificationCompat.Builder>>() |
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 com.sands.android.Service | |
import android.app.Notification | |
import android.app.NotificationChannel | |
import android.app.NotificationManager | |
import android.app.PendingIntent | |
import android.app.Service | |
import android.content.Context | |
import android.os.Handler | |
import android.os.Message |