One Paragraph of project description goes here
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
package com.example; | |
import android.content.Context; | |
import android.support.v7.widget.GridLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.util.AttributeSet; | |
import android.view.ViewGroup; | |
public class SpanningGridLayoutManager extends GridLayoutManager { | |
/* | |
* Copyright 2015 Yuriy Mysochenko | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
import android.content.Context; | |
import android.graphics.Rect; | |
import android.support.annotation.NonNull; | |
import android.support.v7.widget.RecyclerView; | |
import android.util.DisplayMetrics; | |
import android.util.TypedValue; | |
import android.view.View; | |
/** | |
* Adds 8dp padding to the top of the first and the bottom of the last item in the list, |
/** | |
_____ _____ _ | |
| __ \ / ____| | | | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __ | |
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__| | |
| |__| | __/ |____| | | |_| | |_) | || (_) | | | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_| | |
__/ | | | |
|___/|_| | |
*/ |
inline fun SharedPreferences.edit(changes: SharedPreferences.Editor.() -> SharedPreferences.Editor) { | |
edit().changes().apply() | |
} | |
fun ImageView.tintSrc(@ColorRes colorRes: Int) { | |
val drawable = DrawableCompat.wrap(drawable) | |
DrawableCompat.setTint(drawable, ContextCompat.getColor(context, colorRes)) | |
setImageDrawable(drawable) | |
if (drawable is TintAwareDrawable) invalidate() // Because in this case setImageDrawable will not call invalidate() | |
} |
import android.content.Context | |
import android.content.res.Resources | |
import android.graphics.drawable.Drawable | |
import android.support.annotation.AnyRes | |
import android.support.v4.app.Fragment | |
import android.support.v4.content.res.ResourcesCompat.* | |
import android.view.View | |
val Context.animations | |
get() = ResourceMapper { resources.getAnimation(it) } |
To keep the arguments and examples to the point there are few helpful rules:
package ru.mobileup.businessnavigator.ui.base.dialog | |
import android.app.Dialog | |
import android.content.Context | |
import android.os.Bundle | |
import android.support.annotation.LayoutRes | |
import android.support.annotation.StringRes | |
import android.support.v7.app.AlertDialog | |
import android.support.v7.app.AppCompatDialogFragment | |
import android.text.Editable |