Skip to content

Instantly share code, notes, and snippets.

View shakil807g's full-sized avatar
👋

Shakil Karim shakil807g

👋
View GitHub Profile
@shakil807g
shakil807g / Custom Setter
Created December 23, 2015 12:03
DataBinding in Recycleview Android
@BindingAdapter("bind:imageUrl")
public static void loadImage(ImageView imageView, String v) {
Picasso.with(imageView.getContext()).load(v).into(imageView);
}
app:imageUrl="@{movie.image}"
@shakil807g
shakil807g / MainAcitivity.java
Last active September 19, 2022 16:51
Multiple Image Upload Using okhttp3 android
@OnClick(R.id.fabupload)
public void upload(){
Toast.makeText(MainActivity.this, "click", Toast.LENGTH_SHORT).show();
MultipartBody.Builder builder = new MultipartBody.Builder()
.setType(MultipartBody.FORM);
for(int i = 0 ; i < images_path.size() ; i++) {
@shakil807g
shakil807g / BaseAdapter.java
Created June 22, 2016 17:08
Recycleview Setup
public abstract class BaseAdapter< T extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<T> {
protected static final int ITEM_VIEW_TYPE_ITEM = 1;
protected boolean animateItemsOnScroll = true;
protected int defaultItemAnimationDuration = 0;
protected int lastAnimatedPosition = -1;
protected long nextAnimationStartTime;
protected static final int ANIMATION_DELAY_INTERVAL = 50;
protected final Handler handler = new Handler(Looper.getMainLooper());
public class AppPref {
private static final String SETTINGS_NAME = "com.example.shakil.finalproject.appsettings";
private static AppPref sSharedPrefs;
private SharedPreferences mPref;
private SharedPreferences.Editor mEditor;
public enum Key {
@shakil807g
shakil807g / fixMediaDir.java
Created July 24, 2016 08:17
MediaDirectory
void fixMediaDir() {
File sdcard = Environment.getExternalStorageDirectory();
if (sdcard != null) {
File mediaDir = new File(sdcard, "DCIM/Camera");
if (!mediaDir.exists()) {
mediaDir.mkdirs();
}
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
// Apply plugin
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.fernandocejas.frodo'
apply plugin: 'realm-android'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
@shakil807g
shakil807g / OkHttpStack.java
Created January 22, 2017 11:23 — forked from bryanstern/OkHttpStack.java
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@shakil807g
shakil807g / CarTrackerActivity.java
Last active February 1, 2017 18:31
Car Tracking in Google Map
public class carTrackerActivity extends LocationTrackerActivity {
private GoogleMap mMap;
private static final LatLng MELBOURNE = new LatLng(-37.81319, 144.96298);
private static final LatLng SYDNEY = new LatLng(-33.87365, 151.20689);
private static final LatLng ADELAIDE = new LatLng(-34.92873, 138.59995);
@shakil807g
shakil807g / RxFirebase.java
Created January 28, 2017 22:55 — forked from gsoltis/RxFirebase.java
RxJava Bindings for Firebase
package com.firebase.client;
import com.firebase.client.core.Constants;
import rx.Observable;
import rx.Subscriber;
import rx.functions.Action0;
import rx.functions.Func1;
import rx.subscriptions.Subscriptions;
public class RxFirebase {
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
Picasso picasso = new Picasso.Builder(getApplicationContext())
.downloader(new OkHttp3Downloader(this))
.build();
//picasso.setIndicatorsEnabled(true);