Skip to content

Instantly share code, notes, and snippets.

View Abdelsattar's full-sized avatar
🎮
Playing with code

Sattar Abdelsattar

🎮
Playing with code
View GitHub Profile
@gabrielemariotti
gabrielemariotti / README.MD
Last active March 7, 2024 07:50
How to use the ShapeableImageView.

The Material Components Library introduced with the 1.2.0-alpha03 the new ShapeableImageView.

In your layout you can use:

 <com.google.android.material.imageview.ShapeableImageView
      android:id="@+id/image_view"
      app:srcCompat="@drawable/..." />

Then in your code apply the ShapeAppearanceModel to define your custom corners:

@pablisco
pablisco / gist:da25563d57559dd1d18f165272269b57
Last active April 15, 2022 03:23
ResourcesExceptions.kt
import android.content.Context
import android.content.res.Resources
import android.graphics.drawable.Drawable
import android.support.annotation.AnyRes
import android.support.v4.app.Fragment
import android.support.v4.content.res.ResourcesCompat.*
import android.view.View
val Context.animations
get() = ResourceMapper { resources.getAnimation(it) }
@Abdelsattar
Abdelsattar / key hash for facebook
Created July 28, 2017 22:34
this is the method that will generate for you the key hash of your machine to add it to your facebook app page on developer
// will generate key hash for android for facebook
public String printKeyHash() {
PackageInfo packageInfo;
String key = null;
try {
//getting application package name, as defined in manifest
String packageName = this.getApplicationContext().getPackageName();
//Retriving package info
packageInfo = this.getPackageManager().getPackageInfo(packageName,
@srayhunter
srayhunter / retrofit-callback-string.md
Created December 30, 2015 05:16
Retrofit Callback String Example
// notice the callback here
git.getFeed(new Callback<String>() {
	@Override
	public void success(String result, Response response) {
		Log.d("success" , "Data received: " + result);
	}
	
	@Override

public void failure(RetrofitError error) {

@ssinss
ssinss / EndlessRecyclerOnScrollListener.java
Last active January 19, 2024 08:52
Endless RecyclerView OnScrollListener
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
public abstract class EndlessRecyclerOnScrollListener extends RecyclerView.OnScrollListener {
public static String TAG = EndlessRecyclerOnScrollListener.class.getSimpleName();
private int previousTotal = 0; // The total number of items in the dataset after the last load
private boolean loading = true; // True if we are still waiting for the last set of data to load.
private int visibleThreshold = 5; // The minimum amount of items to have below your current scroll position before loading more.
int firstVisibleItem, visibleItemCount, totalItemCount;
@jackgris
jackgris / build.gradle
Created June 6, 2014 18:51
Example of use from Proguard, from Android Studio
buildscript {
repositories {
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
classpath 'com.squareup.gradle:gradle-android-test-plugin:0.9.1-SNAPSHOT'
@itsmattsoria
itsmattsoria / gistfil1.textile
Last active April 22, 2024 12:37
Mac Terminal Cheat Sheet

SHORTCUTS

Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor