Skip to content

Instantly share code, notes, and snippets.

View kennyung6's full-sized avatar

Kenny Dabiri kennyung6

View GitHub Profile
@haerulmuttaqin
haerulmuttaqin / ApiClient.java
Created December 25, 2018 18:50
Android CRUD Tutorial | • RETROFIT • PHP • MYSQL (https://youtu.be/Vh92eSAEu5c)
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class ApiClient {
private static final String BASE_URL = "http://your-domain-name.000webhostapp.com/";
private static Retrofit retrofit;
public static Retrofit getApiClient() {
@f3401pal
f3401pal / ListShimmerView.java
Last active August 5, 2021 16:37
ListShimmerView
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.LinearGradient;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
@Ferrmolina
Ferrmolina / SomeActivityClass.java
Created May 24, 2016 03:56
Get Name, ID and Email - Facebook SDK - Android
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
callbackManager.onActivityResult(requestCode, resultCode, data);
GraphRequest request = GraphRequest.newMeRequest(
accessToken,
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(
@sourabh86
sourabh86 / ContactActivity.java
Last active November 21, 2021 06:35
Code to send data to Google Docs sheet from Android activity
package in.codesmith.contactusexample;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
@meoyawn
meoyawn / EmptyRecyclerView.java
Created November 1, 2014 11:20
RecyclerView doesn't have an emptyView support, we gotta fix that
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.View;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class EmptyRecyclerView extends RecyclerView {
@Nullable View emptyView;
@cesco89
cesco89 / MaterialDialog.java
Last active July 31, 2020 01:58
A custom AlertDialog that follows Material Design guidelines
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ScrollView;
@lucasr
lucasr / GridAndListLayout.java
Last active March 29, 2017 15:35
Mixed grid/list layout built with the new TwoWayView API
public class GridAndListLayout extends TwoWayLayoutManager {
private final int NUM_LANES = 2;
public GridAndListLayout(Context context, Orientation orientation) {
super(context, orientation);
}
private boolean isGridItem(int position) {
return position < 4;
}
@lucasr
lucasr / sample.java
Last active March 5, 2016 03:41
Using ItemClickSupport from TwoWayView
ItemClickSupport itemClick = ItemClickSupport.addTo(recyclerView);
itemclick.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(RecyclerView p, View c, int pos, long id) {
...
}
});
itemClick.setOnItemLongClickListener(new OnItemLongClickListener() {