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
[Ll]ibrary/ | |
[Tt]emp/ | |
[Oo]bj/ | |
[Bb]uild/ | |
[Bb]uilds/ | |
[Ll]ogs/ | |
# Never ignore Asset meta data | |
![Aa]ssets/**/*.meta |
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 Api { | |
companion object { | |
private val BASE_URL = "http://domain/" | |
private var apiService: ApiInterface? = null | |
fun getService(): ApiInterface { | |
if (apiService == null) { | |
apiService = setApiService() |
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 ZoomView extends FrameLayout { | |
public interface ZoomViewListener { | |
void onZoomStarted(float zoom, float zoomx, float zoomy); | |
void onZooming(float zoom, float zoomx, float zoomy); | |
void onZoomEnded(float zoom, float zoomx, float zoomy); | |
} |
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 DeepScrollView extends ScrollView { | |
public ShrinkWatchScrollView(Context context, AttributeSet attrs, | |
int defStyle) { | |
super(context, attrs, defStyle); | |
} | |
public ShrinkWatchScrollView(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); |
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
@TargetApi(Build.VERSION_CODES.LOLLIPOP) | |
public static ActivityOptionsCompat getTransitionOptions(View... views) { | |
Activity activity = (Activity) views[0].getContext(); | |
Pair<View, String>[] pairs = new Pair[views.length]; | |
for (int i = 0; i < views.length; i++) { | |
View view = views[i]; | |
pairs[i] = Pair.create(view, view.getTransitionName()); | |
} | |
return ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs); |
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 RatioFrameLayout extends FrameLayout { | |
private int widthRatio; | |
private int heightRatio; | |
private boolean widthStandards; | |
public RatioFrameLayout(Context context) { | |
super(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 class RestError { | |
@SerializedName("toast_message") | |
public String toast_message; | |
} | |
public static void setErrorToast(Context context, Throwable throwable) { | |
try { | |
if (throwable instanceof HttpException) { | |
HttpException exception = (HttpException) throwable; | |
// Api.retrofit == Retrofit object |
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 KeyboardUtils { | |
public static void hideKeyboard(Context context) { | |
try { | |
((Activity) context).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); | |
if ((((Activity) context).getCurrentFocus() != null) && (((Activity) context).getCurrentFocus().getWindowToken() != null)) { | |
((InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE)).hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), 0); | |
} | |
} catch (Exception e) { | |
e.printStackTrace(); |
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
if (throwable instanceof HttpException) { | |
HttpException exception = (HttpException) throwable; | |
RestError restError = (RestError) retrofit.responseBodyConverter( | |
RestError.class, RestError.class.getAnnotations()).convert(exception.response().errorBody()); | |
String errorMessage = restError.message; | |
if (!TextUtils.isEmpty(errorMessage)) { | |
Toast.makeText(context, errorMessage, Toast.LENGTH_SHORT).show(); | |
} else { | |
Toast.makeText(context, context.getResources().getString(R.string.default_error), Toast.LENGTH_LONG).show(); | |
} |
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 abstract class BaseViewHolder<T> extends RecyclerView.ViewHolder { | |
protected Context context; | |
protected View parent; | |
public BaseViewHolder(View itemView, Context context) { | |
super(itemView); | |
ButterKnife.bind(this, itemView); | |
this.context = context; | |
parent = itemView; |
NewerOlder