Skip to content

Instantly share code, notes, and snippets.

Avatar
🐧
Noot-Nooting around

Mattia Pagini matpag

🐧
Noot-Nooting around
View GitHub Profile
@matpag
matpag / OnThrottleClickListener.kt
Created Dec 2, 2019
ThrottleClickListener prevent double click using OnClickListener
View OnThrottleClickListener.kt
import android.os.SystemClock
import android.view.View
/**
* This is a custom clicklistener to prevent multiple click events to happens at the same time.
*
* Each click on a button is added in the internal event handler queue, there is no way to remove
* them from there so the only thing we can do is adding a filter to prevent them to run too
* frequently
*
@matpag
matpag / run_test_emulator.sh
Last active Jul 25, 2019
Script to run test on a random-generated android emulator with a specific API level
View run_test_emulator.sh
#!/bin/bash
#Usage:
#You need to have installed the API images you are going to start or you can change the createGoogleEmulator function to start the image you want
#For example to start an Android API 28 emulator and perform the app test with Google Apis you just need to call
#./run_test_emulator.sh 28 :app:connectedCheck
#unlock for debugging purposes
# set -ex
#global vars
View DialogNavigator.kt
package com.geekorum.geekdroid.navigation
import android.content.Context
import android.os.Bundle
import android.util.AttributeSet
import androidx.core.content.res.use
import androidx.core.os.bundleOf
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
@matpag
matpag / BaseActivity.java
Last active Sep 9, 2019
Implement Zebra EMDK 7.0 on BaseActivity for multiple Activities
View BaseActivity.java
//the others Android import....
import com.symbol.emdk.EMDKManager;
import com.symbol.emdk.barcode.BarcodeManager;
import com.symbol.emdk.barcode.ScanDataCollection;
import com.symbol.emdk.barcode.Scanner;
import com.symbol.emdk.barcode.ScannerConfig;
import com.symbol.emdk.barcode.ScannerException;
import com.symbol.emdk.barcode.ScannerInfo;
@matpag
matpag / README.md
Created May 20, 2017 — forked from lopspower/README.md
Publish AAR to jCenter and Maven Central
View README.md

Publish AAR to jCenter and Maven Central

Twitter

Now I'm going to list how to publish an Android libray to jCenter and then syncronize it with Maven Central:

  1. I use "Android Studio" and I have this simple android lib that I would like to be available on maven: CircularImageView

  2. In the library folder(module) I have the lib code abovementioned. And applying in the build.gradle of this folder apply plugin: 'com.android.library' I got as output an .aar in the build/outputs/aar/ directory of the module's directory

@matpag
matpag / TextViewDrawableSize.java
Last active Dec 14, 2016 — forked from hrules6872/TextViewDrawableSize.java
TextViewDrawableSize - CompoundDrawable size
View TextViewDrawableSize.java
/**
* Original source from here : http://stackoverflow.com/a/31916731
*/
public class TextViewDrawableSize extends TextView {
private static final int DEFAULT_COMPOUND_DRAWABLE_SIZE = -1;
private int compoundDrawableWidth;
private int compoundDrawableHeight;
public TextViewDrawableSize(Context context) {
this(context, null);
View DBFlow project build.gradle jack test
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
View DBFlow module build.gradle jack test
apply plugin: 'com.android.application'
def dbflow_version = "3.1.1"
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.testpackage.test"
@matpag
matpag / Database.cs
Created Apr 15, 2016
Xamarin Forms SQLite database upgrade strategy
View Database.cs
using ProjectTest.MyModels;
using SQLite.Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace ProjectTest.Database
You can’t perform that action at this time.