Skip to content

Instantly share code, notes, and snippets.

View cp-radhika-s's full-sized avatar
🎯
Focusing

Radhika canopas cp-radhika-s

🎯
Focusing
View GitHub Profile
class MainViewModelTest {
@get:Rule
val mainCoroutineRule = MainCoroutineRule()
private val userServices = mock<UserServices>()
private lateinit var viewModel: MainViewModel
private val testDispatcher = AppDispatchers(
class MainViewModelTest {
@get:Rule
val mainCoroutineRule = MainCoroutineRule()
private val userServices = mock<UserServices>()
private lateinit var viewModel: MainViewModel
private val testDispatcher = AppDispatchers(
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0'
//For runBlockingTest, CoroutineDispatcher etc.
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.5.2'
@Composable
fun ShowcaseSample() {
val targets = remember {
mutableStateMapOf<String, ShowcaseProperty>()
}
Box {
Scaffold(
modifier = Modifier.fillMaxSize(),
topBar = {
TopAppBar(
@Composable
fun IntroShowCase(
targets: SnapshotStateMap<String, ShowcaseProperty>,
backgroundColor: Color = Color.Black,
onShowcaseCompleted: () -> Unit
) {
val uniqueTargets = targets.values.sortedBy { it.index }
var currentTargetIndex by remember { mutableStateOf(0) }
val currentTarget =
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
//okhttp
implementation("com.squareup.okhttp3:okhttp:4.9.3")
//coroutine
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9")
private const val RECORDER_SAMPLERATE = 44100
private val RECORDER_CHANNELS: Int = AudioFormat.CHANNEL_IN_STEREO
private val RECORDER_AUDIO_ENCODING: Int = AudioFormat.ENCODING_PCM_16BIT
class AudioStreamManager {
private var audioRecord: AudioRecord? = null
val BUFFER_SIZE_RECORDING = AudioRecord.getMinBufferSize(
RECORDER_SAMPLERATE,
val okHttpClient = OkHttpClient.Builder()
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.build()
val request = Request.Builder().url("our ws:// url").build()