Skip to content

Instantly share code, notes, and snippets.

View AlonsoFloo's full-sized avatar
💻
󠀠

Florian ALONSO AlonsoFloo

💻
󠀠
View GitHub Profile
@AlonsoFloo
AlonsoFloo / git-pull-all.sh
Last active September 19, 2018 10:15
Pull all branches and tags from remote
git fetch --all && for branch in `git branch -r | cut -s -d '/' -f2- | grep -v HEAD | grep -v remote | grep -v origin` ; do echo -e '\n\n\n-----START BRANCH-----' && git checkout $branch && git pull origin $branch && git status && echo '-----FINISH BRANCH-----' ; done
@AlonsoFloo
AlonsoFloo / FrameAnimatedImageView.java
Created September 19, 2018 09:49
Android Custom ImageView for animating frame by frame some bitmap or ressources
/**
* <h1>FrameAnimatedImageView</h1>
* View class to handle several images into an {@link android.widget.ImageView}
* <p>
*
* @author Florian ALONSO
* @see BitmapDrawable
* @see AnimationDrawable
* @see ContextCompat
*/
@AlonsoFloo
AlonsoFloo / BaseFactory.java
Last active July 13, 2019 13:22
Asynchronous factory for convertir some models JAVA/Kotlin
import android.content.Context;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Florian ALONSO
@AlonsoFloo
AlonsoFloo / NotificationHelper.java
Last active November 26, 2018 07:21
Android default notification template
private static void createNewNotification(@NonNull Context context, @NonNull String channelId, int notificationId, @Nullable PendingIntent pendingIntent, @NonNull String longTitle, @NonNull String description) {
if (longTitle.isEmpty()) {
return;
}
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
int icon = 0;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
icon = R.drawable.ic_notification;
@AlonsoFloo
AlonsoFloo / AndroidManifest.xml
Created September 19, 2018 10:05
Android SplashScreen templates
<activity
android:name=".ui.activity.SplashScreenActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.SplashTheme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
@AlonsoFloo
AlonsoFloo / checksum.sh
Created September 19, 2018 10:06
Checksum utility for BASH
if [ "$#" -lt 1 ]; then
echo "Usage : checksum [FILE_PATH..]"
return
fi
for f in "$@"
do
if [ -f $f ]; then
sha=`/usr/bin/openssl sha1 -sha ${f} | tr -s "=" | cut -d ' ' -f 2`
sha1=`/usr/bin/openssl sha1 -sha1 ${f} | tr -s "=" | cut -d ' ' -f 2`
sha256=`/usr/bin/openssl sha1 -sha256 ${f} | tr -s "=" | cut -d ' ' -f 2`
@AlonsoFloo
AlonsoFloo / Array.swift
Created September 19, 2018 10:10
Array util for SWIFT
import UIKit
extension Collection where Indices.Iterator.Element == Index {
/// Returns the element at the specified index iff it is within bounds, otherwise nil.
subscript (safe index: Index) -> Generator.Element? {
return indices.contains(index) ? self[index] : nil
}
}
@AlonsoFloo
AlonsoFloo / CameraUtil.java
Last active December 10, 2018 10:36
Android camera utility class
import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.net.Uri;
@AlonsoFloo
AlonsoFloo / AndroidManifest.xml
Last active November 30, 2018 11:31
Android File handling utils
<application>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
@AlonsoFloo
AlonsoFloo / Application.java
Created November 17, 2018 16:58
Android foreground and background listener and manager
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
initComponents();
}
private void initComponents() {
BackgroundManager.init(this);