Skip to content

Instantly share code, notes, and snippets.

@gavelez
gavelez / build.gradle
Created Dec 21, 2020
Execute a command line statement from build.gradle script
View build.gradle
def gitHash = 'git rev-parse --short HEAD'.execute().text.trim()
@gavelez
gavelez / Repository.kt
Created Dec 9, 2020
Empty secondary constructor for Data Class
View Repository.kt
data class Repository(
var updated_on: String,
var tags: List<String>,
var description: String,
var user_id: List<Int>,
var status_id: Int,
var title: String,
var created_at: String,
var data: HashMap<*, *>,
var id: Int,
@gavelez
gavelez / FragmentCheck.java
Created Oct 29, 2020
Validate if a Fragment is active
View FragmentCheck.java
public static boolean isSafeFragment( Fragment frag )
{
return !(frag.isRemoving() || frag.getActivity() == null || frag.isDetached() || !frag.isAdded() || frag.getView() == null );
}
@gavelez
gavelez / RV.java
Created Oct 15, 2020
Scroll Multiple RecyclerViews
View RV.java
recyclerView.addOnScrollListener(
new RecyclerView.OnScrollListener() {
@Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (isLastItemDisplaying(recyclerView)) {
//Calling the method getdata again getData();
}
}
}
);
@gavelez
gavelez / PlayingWithPaths.kt
Created Sep 2, 2020 — forked from alexjlockwood/PlayingWithPaths.kt
Implementation of a 'Playing with Paths' polygon animation
View PlayingWithPaths.kt
package com.alexjlockwood.playingwithpaths
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.animation.animatedFloat
import androidx.compose.animation.core.AnimationConstants
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.repeatable
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
View PR_Template.md
View RegisterActivity.kt
package com.example.monpfe
import android.app.ProgressDialog
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.widget.Button
import android.widget.EditText
@gavelez
gavelez / AndroidManifest.xml
Created Apr 20, 2020
How to detect call state Android
View AndroidManifest.xml
<receiver android:name=".CallReceiver" >
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
</intent-filter>
</receiver>
@gavelez
gavelez / AndroidManifest.xml
Last active Dec 23, 2019
ExoPlayer multiformat playing
View AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2017 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@gavelez
gavelez / CollectionWrapper.kt
Last active Nov 28, 2019
Use of Generics with Gson
View CollectionWrapper.kt
package com.example.util
import com.example.MyList
class CollectionWrapper<T> {
var type: Class<T>
var list: MyList<T>
constructor(valueType: Class<T>, list: MyList<T>) {
You can’t perform that action at this time.