Skip to content

Instantly share code, notes, and snippets.

Avatar

Carlo Marinangeli carlonzo

View GitHub Profile
@carlonzo
carlonzo / PopupHighlightItems.java
Last active November 2, 2018 10:20
Centered Window Android. It will align the contentView at the center of the anchor. It has a addOnGlobalLayoutListener to refresh the position when the size of the contentview changes
View PopupHighlightItems.java
public class PopupHighlightItems {
private WindowManager windowManager;
private final View contentView;
private WeakReference<View> anchor;
private int direction = Gravity.TOP;
private boolean isShowing = false;
private WindowManager.LayoutParams layoutParams;
@carlonzo
carlonzo / PopupHighlightItems.java
Created April 18, 2017 16:35
Centered Window Android
View PopupHighlightItems.java
public class PopupHighlightItems {
private WindowManager windowManager;
private final View contentView;
private WeakReference<View> anchor;
private int direction = Gravity.TOP;
private boolean isShowing = false;
private WindowManager.LayoutParams layoutParams;
@carlonzo
carlonzo / ParallaxScrollingImages.java
Created March 3, 2017 22:07
ParallaxScrollingImages yahoo weather like
View ParallaxScrollingImages.java
package it.carlom.bubutranslater;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@carlonzo
carlonzo / CacheFragmentStatePagerAdapter.java
Created August 2, 2015 17:08
FragmentStatePagerAdapter that caches each pages.
View CacheFragmentStatePagerAdapter.java
/*
* Copyright 2014 Soichiro Kashima
*
* 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