Skip to content

Instantly share code, notes, and snippets.

View shakil807g's full-sized avatar
👋

Shakil Karim shakil807g

👋
View GitHub Profile
@shakil807g
shakil807g / combineLatestExample.java
Last active August 21, 2017 19:52
Rxjava 2 combineLatest example
/* Rxjava combineLastest Example */
disposable.add(RxFirebase.observeChildEvent(mDatabase.child(AppConstant.USERS)
.child(Utils.fireUserId(getUser().getUserId())).child(AppConstant.GROUPS))
.filter(event -> event.getEventType() == RxFirebaseChildEvent.EventType.ADDED)
.flatMap(event -> {
Log.d(TAG, "setFirebaseListener: "+event.getValue());
public class DBMainAppointmentAdapter extends MyBaseAdapter<MainAppointment,ItemDashboardBinding> {
private VideoClickListener videoClickListener;
public DBMainAppointmentAdapter(Context context) {
super(context);
}
public abstract class MyBaseAdapter<T,B extends ViewDataBinding> extends RecyclerView.Adapter<MyBaseAdapter.MyViewHolder> {
public List<T> data;
public Context context;
protected ItemClickListner<T> itemClickListner;
public MyBaseAdapter(Context context) {
this.data = new ArrayList<T>();
this.context = context;
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import java.util.List;
import butterknife.ButterKnife;
@shakil807g
shakil807g / OkHttpProgressGlideModule.java
Created March 10, 2017 21:31 — forked from TWiStErRob/OkHttpProgressGlideModule.java
Full POC for showing progress of loading in Glide v3 via OkHttp v2
// TODO add <meta-data android:value="GlideModule" android:name="....OkHttpProgressGlideModule" />
// TODO add <meta-data android:value="GlideModule" tools:node="remove" android:name="com.bumptech.glide.integration.okhttp.OkHttpGlideModule" />
// or not use 'okhttp@aar' in Gradle depdendencies
public class OkHttpProgressGlideModule implements GlideModule {
@Override public void applyOptions(Context context, GlideBuilder builder) { }
@Override public void registerComponents(Context context, Glide glide) {
OkHttpClient client = new OkHttpClient();
client.networkInterceptors().add(createInterceptor(new DispatchingProgressListener()));
glide.register(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(client));
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.READ_CONTACTS" />
<application android:label="@string/app_name">
public class PluseView extends FrameLayout {
@BindView(R.id.circleview)
CircleView circleview;
@BindView(R.id.circleview2)
CircleView circleview2;
@BindView(R.id.circleview3)
CircleView circleview3;
@BindView(R.id.profile_image)
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;
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");
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)