Skip to content

Instantly share code, notes, and snippets.

View alorma's full-sized avatar
🤡

Bernat Borrás Paronella alorma

🤡
View GitHub Profile
import com.crashlytics.android.answers.*
import io.fabric.sdk.android.Fabric
import java.math.BigDecimal
import java.util.*
@DslMarker
annotation class FabricEventDsl
@FabricEventDsl
class CustomAttribute {
[
{
"id":"5c59c40e4d76972930399ab2",
"type":"animal",
"location":{
"latitude":41.5697586228956,
"longitude":2.0374607342886923
},
"owner":false,
"found":false,
import io.reactivex.disposables.Disposable
import kotlinx.coroutines.CancellableContinuation
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.suspendCancellableCoroutine
import kotlinx.coroutines.withContext
import rx.Subscription
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import io.reactivex.Completable as Rx2Completable
import io.reactivex.Flowable as Rx2Flowable
import android.graphics.Typeface.BOLD
import android.graphics.Typeface.ITALIC
import android.support.annotation.ColorInt
import android.text.Spannable.SPAN_INCLUSIVE_EXCLUSIVE
import android.text.SpannableStringBuilder
import android.text.SpannedString
import android.text.style.*
fun spannable(block: SpannableStringBuilder.() -> Unit): SpannableStringBuilder = SpannableStringBuilder().apply(block)
android.support.test.espresso.AmbiguousViewMatcherException: '(with id: com.******.dev:id/addressView)' matches multiple views in the hierarchy.
Problem views are marked with '****MATCHES****' below.
View Hierarchy:
+>DecorView{id=-1, visibility=VISIBLE, width=1080, height=1920, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=1 fl=#81810100 wanim=0x1030465 needsMenuKey=2}, tag=null, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=3}
|
+->LinearLayout{id=-1, visibility=VISIBLE, width=1080, height=1794, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.FrameLayout$LayoutParams@e45b57d, tag=null, root-is-layout-requested=false, ha
import com.karumi.dexter.DexterBuilder
import com.karumi.dexter.PermissionToken
import com.karumi.dexter.listener.PermissionDeniedResponse
import com.karumi.dexter.listener.PermissionGrantedResponse
import com.karumi.dexter.listener.PermissionRequest
import com.karumi.dexter.listener.single.PermissionListener
@DslMarker
annotation class PermissionDsl
inline fun <reified T: View> T.asRecyclerViewCell(): T {
layoutParams = RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.WRAP_CONTENT)
return this
}
fun RecyclerView.divider(orientation: Int = DividerItemDecoration.VERTICAL,
@DrawableRes drawable : Int = R.drawable.list_divider) {
val itemDecoration = DividerItemDecoration(context, orientation).apply {
ContextCompat.getDrawable(context, drawable)?.let {
setDrawable(it)
}
}
addItemDecoration(itemDecoration)
}
import android.graphics.Canvas
import android.support.v7.widget.RecyclerView
import android.support.v7.widget.helper.ItemTouchHelper
import android.support.v7.widget.helper.ItemTouchHelper.*
import android.view.View
import com.stronix.lio.ui.features.broadcasts.BroadcastsSwipeCallback
abstract class GenericSwipeCallback(
private var swipeLeft: SwipeAction? = null,
class ResourcesProvider @Inject constructor(private val context: Context) {
fun getPlural(@PluralsRes plural: Int, number: Int, formatted: String): String
= context.resources.getQuantityString(plural, number, formatted)
fun getString(@StringRes stringId: Int): String
= context.resources.getString(stringId)
}