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 / 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);
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
Picasso picasso = new Picasso.Builder(getApplicationContext())
.downloader(new OkHttp3Downloader(this))
.build();
//picasso.setIndicatorsEnabled(true);
@shakil807g
shakil807g / README.md
Created February 20, 2017 10:32 — forked from lapastillaroja/README.md
Don't break the chain: use RxJava's compose() operator -> Android + Retrolambda + Observable.Transformer cannot find symbol method
http://stackoverflow.com/questions/4811920/why-getspeed-always-return-0-on-android?rq=1
new LocationListener() {
private Location mLastLocation;
@Override
public void onLocationChanged(Location pCurrentLocation) {
//calcul manually speed
double speed = 0;
if (this.mLastLocation != null)
public class GPSService extends Service implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, com.google.android.gms.location.LocationListener {
private LocationRequest mLocationRequest;
private GoogleApiClient mGoogleApiClient;
private static final String LOGSERVICE = "#######";
@Override
public void onCreate() {
super.onCreate();
buildGoogleApiClient();
Log.i(LOGSERVICE, "onCreate");
public class LocationTrackerActivity extends AppCompatActivity implements
GoogleApiClient.ConnectionCallbacks,
GoogleApiClient.OnConnectionFailedListener,
LocationListener
{
private static final String TAG = "LocationTrackerActivity";
private static final int REQUEST_CHECK_SETTINGS = 0x1;