Skip to content

Instantly share code, notes, and snippets.

Avatar
🤡

Bernat Borrás Paronella alorma

🤡
View GitHub Profile
View intents.kt
private fun launchIntents(context: Context) {
val whatsappIntent = getWhatsappIntent(context)
val telegramIntent = getTelegramIntent(context)
val intents = listOfNotNull(whatsappIntent, telegramIntent)
val globalIntent = Intent()
val chooserIntent = Intent.createChooser(globalIntent, "Send message")
.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toTypedArray())
@alorma
alorma / channels
Created Jan 8, 2019
Spain channels
View channels
#EXTM3U
#EXTINF:-1,~ Spain TV ~
#EXTINF:-1,3/24
http://ccma-tva-int-abertis-live.hls.adaptive.level3.net/int/ngrp:324_mobil/chunklist_b548000.m3u8
#EXTINF:-1,101 TV Malaga
http://cls.todostreaming.eu/101tv/livestream2/chunklist.m3u8
#EXTINF:-1,7 Murcia
http://rtvmurcia_01-lh.akamaihd.net/i/rtvmurcia_1_0@507973/master.m3u8
#EXTINF:-1,25 Televisio
http://cdnlive.shooowit.net/25televisiolive/amlst:25tv/chunklist_b300000.m3u8
View GlueItemsAdapter.java
public class GlueItemsAdapter extends RecyclerArrayAdapter<GlueItem, GlueItemsAdapter.Holder> {
public GlueItemsAdapter(LayoutInflater inflater) {
super(inflater);
}
@Override
protected Holder onCreateViewHolder(LayoutInflater inflater, ViewGroup parent, int viewType) {
return new Holder(inflater.inflate(android.R.layout.simple_list_item_1, parent, false));
@alorma
alorma / DropDownComponent.kt
Created Jan 19, 2021
Dropdown component for Compose
View DropDownComponent.kt
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowDropDown
import androidx.compose.material.icons.filled.ArrowDropUp
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
@alorma
alorma / DecimalFilter.java
Created Nov 5, 2014
Show a fixed number of decimals
View DecimalFilter.java
package mt.bnpp.com.bnpp_mt_android_bleu.utils;
import android.text.InputFilter;
import android.text.Spanned;
/**
* Created by A591108 on 05/11/2014.
*/
public class DecimalFilter implements InputFilter {
View colors.kt
fun Context.attributeColorWithAlpha(
@AttrRes overlayColorAttributeResId: Int,
@FloatRange(from = 0.0, to = 1.0) overlayAlpha: Float
): Int {
val surfaceColor = MaterialColors.getColor(this, R.attr.colorSurface, "Color surface not found")
val colorWithAlpha = MaterialColors.getColor(this, overlayColorAttributeResId, "Color attribute not found").let {
MaterialColors.compositeARGBWithAlpha(it, (255 * overlayAlpha).roundToInt())
}
return MaterialColors.layer(surfaceColor, colorWithAlpha)
}
View my_flow.kt
class SearchStoresMapViewModel(
private val storeCache: StoreCache,
private val mapper: StoreUiMapper
) : ViewModel() {
private val appliedFilters: MutableSet<OpenStatus> = mutableSetOf()
private val filtersChannel = BroadcastChannel<Set<OpenStatus>>(Channel.CONFLATED)
private val queryChannel = BroadcastChannel<String>(Channel.CONFLATED)
View btn_bg_color_primary_selector.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="?colorPrimary" android:state_enabled="true" />
<item android:alpha="0.38" android:color="?colorPrimary" />
</selector>
View DialogDsl.kt
import android.content.Context
import android.content.DialogInterface
import android.support.annotation.LayoutRes
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.View
import com.alorma.R
@DslMarker
View FabricEventDsl.kt
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 {