Skip to content

Instantly share code, notes, and snippets.

View RadiationX's full-sized avatar
💭
I may be slow to respond.

Evgeny Nizamiev RadiationX

💭
I may be slow to respond.
View GitHub Profile
@RadiationX
RadiationX / SearchSupportFragment_fix.kt
Last active March 12, 2024 12:26
Fix java.lang.IllegalArgumentException: Service not registered: android.speech.SpeechRecognizer$Connection
// add this to your implementation SearchSupportFragment
// put avoidSpeechRecognitinCrash() in your fragment before onPause()
override fun onPause() {
avoidSpeechRecognitinCrash()
super.onPause()
}
// "destroy" may throw java.lang.IllegalArgumentException: Service not registered: android.speech.SpeechRecognizer$Connection@dabd9b8
// do all this mehod's work and wrap "destroy" to try catch
// private void releaseRecognizer() {
@RadiationX
RadiationX / ProgressMaterialButton.kt
Created December 7, 2022 08:15
Material button with progressbar
import android.content.Context
import android.content.res.TypedArray
import android.graphics.drawable.Animatable
import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.util.TypedValue
import com.google.android.material.R
import com.google.android.material.button.MaterialButton
import kotlin.math.roundToInt
@RadiationX
RadiationX / pres-links.txt
Last active January 29, 2022 18:27
Ссылки по теме стилей в андроид
open class CustomNavigator(
activity: FragmentActivity?,
containerId: Int
) : SupportAppNavigator(activity, containerId) {
override fun createActivityIntent(context: Context?, screenKey: String?, data: Any?): Intent? {
return (data as? Screen)?.let { createActivityIntent(context, it) }
}
override fun createFragment(screenKey: String?, data: Any?): Fragment? {
@RadiationX
RadiationX / первый запрос на сайт
Created June 23, 2018 11:23
другой блейзингфаст
Кукис в ответ
BlazingWebCookie gF4mESuGqIR8M1SriTXY8crEbGaHy53mf5415G4cqVbb6lQCZ7VtRV5OdEXrfHgS .anilibria.tv / 2018-06-30T11:16:32.000Z 148
Ответ
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Just a moment please...</title>
<meta name="description" content="">
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Just a moment please...</title>
<meta name="description" content="">
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
class ChatResponse(
@SerializedName("chatId") val id: Long, // Очевидно
@SerializedName("count") val count: Int?, // Тоже в принципе
@SerializedName("lastMessage") val lastMessage: ChatMessageResponse?, // Последнее сообщение, используется в СПИСКЕ чатов. null в чате
@SerializedName("messages") val messages: List<ChatMessageResponse>?, // Сообщения в самом чате. null в списке чатов
@SerializedName("deletedIds") var deletedIds: List<Long>?, // Массив удаленных сообщений. Составляется относительно lastsync
@SerializedName("author") var author: UserResponse? // Юзер, автор чата
)
class ChatMessageResponse(
package ru.istra.rentspec.data.repository.media
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Matrix
import io.reactivex.Completable
import io.reactivex.Single
import okhttp3.MultipartBody
import okhttp3.RequestBody
import ru.istra.rentspec.data.entity.media.ImageItem
recyclerView.apply {
layoutManager = LinearLayoutManager(context)
adapter = this@ParkingVehicleFragment.adapter
val swipeHandler = ParkingVehicleItemDelegate.ItemTouchHelperExtensionCallback()
ItemTouchHelperExtension(swipeHandler).attachToRecyclerView(recyclerView)
}
class ItemTouchHelperExtensionCallback : ItemTouchHelperExtension.Callback() {
override fun getMovementFlags(recyclerView: RecyclerView?, viewHolder: RecyclerView.ViewHolder?): Int {
if (!(viewHolder is ViewHolder)) return 0