This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DefaultErrorConverter implements ErrorConverter { | |
@NonNull | |
@Override | |
public Exception processServerError(HttpException httpException) { | |
ResponseBody body = httpException.response().errorBody(); | |
Gson gson = new Gson(); | |
TypeAdapter adapter = gson.getAdapter(ErrorResponse.class);//your error response class | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface CancelFunction<T> { | |
void onCancel(T data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BroadcastDisposable implements Disposable { | |
private BroadcastReceiver receiver; | |
private Context ctx; | |
private boolean isDisposed = false; | |
BroadcastDisposable(@NonNull BroadcastReceiver receiver, @NonNull Context ctx) { | |
this.receiver = receiver; | |
this.ctx = ctx; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.app.Activity; | |
import android.os.Build; | |
import android.support.annotation.IdRes; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.StringRes; | |
import android.support.v4.app.ActivityOptionsCompat; | |
import android.support.v4.util.Pair; | |
import android.util.Log; | |
import android.view.View; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EndlessPagerAdapter extends PagerAdapter { | |
private PagerAdapter adapter; | |
public EndlessPagerAdapter(PagerAdapter adapter, ViewPager viewPager) { | |
this.adapter = adapter; | |
viewPager.addOnPageChangeListener(new SwapPageListener(viewPager)); | |
} | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.support.annotation.NonNull; | |
import android.support.annotation.Nullable; | |
import android.support.design.widget.AppBarLayout; | |
import android.support.design.widget.BottomSheetBehavior; | |
import android.support.design.widget.CoordinatorLayout; | |
import android.util.AttributeSet; | |
import android.view.View; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BoundServiceWrapper<T extends IBinder> { | |
private Context context; | |
private Class serviceClass; | |
private int serviceFlags; | |
private T binder; | |
private Action<T> deferAction; | |
public BoundServiceWrapper(Context context, Class serviceClass, int serviceFlags) { | |
this.context = context; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Field { | |
SOMETHING | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings("WeakerAccess") | |
public class AndroidUtils { | |
public static int getColorFromAttr(Context ctx, int attributeId) { | |
int colorId = getResourceIdFromAttr(ctx, attributeId); | |
return ContextCompat.getColor(ctx, colorId); | |
} | |
public static int dpToPx(int dp, Context ctx) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior { | |
private static final int TRANSLATE_HIDE_DURATION_MILLIS = 200; | |
private static final int TRANSLATE_SHOW_DURATION_MILLIS = 170; | |
private Animator hideAnimator; | |
private Animator showAnimator; | |
public ScrollAwareFABBehavior(Context context, AttributeSet attrs) { |
OlderNewer