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
package com.yourpackage | |
import android.accessibilityservice.AccessibilityService | |
import android.accessibilityservice.AccessibilityServiceInfo | |
import android.content.BroadcastReceiver | |
import android.content.Context | |
import android.content.Intent | |
import android.content.IntentFilter | |
import android.net.Uri | |
import android.os.Handler |
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
////*************************************************************************************************************************************************** | |
////*************************************************************************************************************************************************** | |
private var continueToRun: Boolean = true | |
private var minimumBufferSize: Int = -1 | |
private var audioRecord: AudioRecord? = null | |
private var audioEncoder: MediaCodec? = null | |
private var socket: Socket? = null | |
// private val serverUrl = AppConstants.apiBaseURL |
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
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 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 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 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 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 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 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 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 | |
} |
NewerOlder