Skip to content

Instantly share code, notes, and snippets.

View vpaliy's full-sized avatar

Vasyl Paliy vpaliy

View GitHub Profile
public abstract class AuthFragment extends Fragment {
protected Callback callback;
@BindView(R.id.caption)
protected VerticalTextView caption;
@BindView(R.id.root)
protected ViewGroup parent;
@vpaliy
vpaliy / Factor.java
Last active September 21, 2018 03:48
public static class Adapter extends FragmentStatePagerAdapter{
//our factor value
private float factor;
public Adapter(FragmentManager manager, final ViewPager pager){
super(manager);
final float textSize = pager.getResources().getDimension(R.dimen.folded_size);
final float textPadding = pager.getResources().getDimension(R.dimen.folded_label_padding);
factor = 1 - (textSize + textPadding) / (pager.getWidth());
}
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="colorControlActivated">@color/color_input_hint</item>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.vpaliy.loginconcept.LoginActivity">
<ImageView
@Override
public boolean onTouchEvent(MotionEvent ev) {
return false;
}
public class AnimatedViewPager extends ViewPager {
private int duration;
public AnimatedViewPager(Context context) {
super(context);
postInitViewPager();
}
public AnimatedViewPager(Context context, AttributeSet attrs) {
public class AuthActivity extends AppCompatActivity {
@BindViews(value = {R.id.logo, R.id.first, R.id.second, R.id.last})
protected List<ImageView> sharedElements;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
ButterKnife.bind(this);
@vpaliy
vpaliy / Shared.java
Last active September 21, 2018 03:53
sharedElements.forEach(element -> {
@ColorRes int color = element.getId() != R.id.logo ? R.color.white_transparent : R.color.color_logo_log_in;
DrawableCompat.setTint(element.getDrawable(), ContextCompat.getColor(this, color));
});
//load a very big image and resize it, so it fits our needs
Glide.with(this)
.load(R.drawable.busy)
.asBitmap()
.override(screenSize[0]*2,screenSize[1])
.diskCacheStrategy(DiskCacheStrategy.RESULT)
.into(new ImageViewTarget<Bitmap>(background) {
@Override
protected void setResource(Bitmap resource) {
background.setImageBitmap(resource);
public abstract class AuthFragment extends Fragment {
protected Callback callback;
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View root = inflater.inflate(authLayout(), container, false);
ButterKnife.bind(this, root);
return root;