Skip to content

Instantly share code, notes, and snippets.

Jorge Garrido FireZenk

Block or report user

Report or block FireZenk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@FireZenk
FireZenk / TimberExt.kt
Created Mar 29, 2019
Dumps the Android Intent content on Timber
View TimberExt.kt
import android.content.Intent
import timber.log.Timber
fun dumpIntent(intent: Intent) {
val bundle = intent.extras
if (bundle != null) {
val keys = bundle.keySet()
val it = keys.iterator()
Timber.e("------->>> Dumping Intent start")
while (it.hasNext()) {
@FireZenk
FireZenk / TextViewExt.kt
Created Nov 15, 2018
A collection of TexView extension functions (justify fun for now)
View TextViewExt.kt
import android.text.Spanned
import android.text.style.ImageSpan
import android.graphics.drawable.ColorDrawable
import android.text.SpannableString
import android.text.SpannableStringBuilder
import android.widget.TextView
import java.util.concurrent.atomic.AtomicBoolean
fun TextView.justify() {
@FireZenk
FireZenk / gzip.kts
Last active Nov 22, 2018 — forked from sgdan/gzip.kts
Kotlin code to compress/uncompress a string with gzip
View gzip.kts
import java.io.ByteArrayOutputStream
import java.io.File
import java.nio.charset.StandardCharsets.UTF_8
import java.util.zip.GZIPInputStream
import java.util.zip.GZIPOutputStream
fun String.gzip(): ByteArray {
val bos = ByteArrayOutputStream()
GZIPOutputStream(bos).bufferedWriter(UTF_8).use { it.write(this) }
return bos.toByteArray()
@FireZenk
FireZenk / ToolbarSearchDsl.kt
Created Apr 26, 2018
Toolbar Search dsl kotlin-android
View ToolbarSearchDsl.kt
import android.support.annotation.IdRes
import android.support.v7.widget.SearchView
import android.support.v7.widget.Toolbar
import android.view.MenuItem
@DslMarker
annotation class ToolbarSearchDsl
@ToolbarSearchDsl
@FireZenk
FireZenk / GenericSwipeCallback.kt
Created Apr 26, 2018
Swipe DSL kotlin-android
View GenericSwipeCallback.kt
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
abstract class GenericSwipeCallback(
private var swipeLeft: SwipeAction? = null,
private var swipeRight: SwipeAction? = null
) : ItemTouchHelper.Callback() {
@FireZenk
FireZenk / WebSocket.kt
Created Jan 11, 2018
websocket.org rx implementation
View WebSocket.kt
object WebSocket : WebSocketListener() {
private lateinit var broadcaster: FlowableEmitter<String>
private lateinit var disposable: Disposable
private lateinit var webSocket: WebSocket
private val flowable = Flowable.create(FlowableOnSubscribe<String> { emitter -> broadcaster = emitter }, BackpressureStrategy.BUFFER)
fun subscribe(): Flowable<String> {
val client = OkHttpClient.Builder()
.readTimeout(0, TimeUnit.MILLISECONDS)
@FireZenk
FireZenk / SignalrSocket.kt
Created Jan 11, 2018
Signalr socket rx implementation
View SignalrSocket.kt
object SignalrSocket {
private lateinit var broadcaster: FlowableEmitter<String>
private lateinit var disposable: Disposable
private val flowable = Flowable.create(FlowableOnSubscribe<String> { emitter -> broadcaster = emitter }, BackpressureStrategy.BUFFER)
private lateinit var mHubConnection: HubConnection
private lateinit var mHubProxy: HubProxy
@Throws(InterruptedException::class, ExecutionException::class)
View FragmentVsCustomView4.xml
<my.package.MyCustomView
android:id="@+id/my_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
View FragmentVsCustomView3.xml
<fragment android:name="my.package.MyFragment"
android:id="@+id/my_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
View FragmentVsCustomView2.java
MyCustomView customView = new MyCustomView(context);
parentView.removeAllViews();
parentView.add(customView);
You can’t perform that action at this time.