Skip to content

Instantly share code, notes, and snippets.

View nitrico's full-sized avatar

Miguel Ángel Moreno nitrico

View GitHub Profile
@AlexBlokh
AlexBlokh / RatioViewPager.java
Last active March 31, 2017 11:36
ViewPager with custom aspect ratio
public class RatioViewPager extends ViewPager {
private float mRatio = 1f;
public RatioViewPager(Context context) {
super(context);
}
public RatioViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* 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
@pgloaguen
pgloaguen / gist:10b69882a6f721ce98f6
Last active January 12, 2023 04:52
PhotographicPrintAnimator realize a beautiful photographic print animation as described in the Material design spec (http://www.google.com/design/spec/patterns/loading-images.html#loading-images-loading-images)
import android.animation.ValueAnimator;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.ImageView;
import java.lang.ref.SoftReference;
public class PhotographicPrintAnimator {
@gabrielemariotti
gabrielemariotti / Readme.md
Last active March 2, 2024 23:10
A SimpleSectionedRecyclerViewAdapter: use this class to realize a simple sectioned `RecyclerView.Adapter`.

You can use this class to realize a simple sectioned RecyclerView.Adapter without changing your code.

The RecyclerView should use a LinearLayoutManager. You can use this code also with the TwoWayView with the ListLayoutManager (https://github.com/lucasr/twoway-view)

This is a porting of the class SimpleSectionedListAdapter provided by Google

Screen

Example:

@chrisbanes
chrisbanes / FloatLabelLayout.java
Last active March 15, 2024 06:39
FloatLabelLayout
/*
* Copyright 2014 Chris Banes
*
* 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
@Frikish
Frikish / SwipeRefreshLayout and StickyListHeaders.md
Last active February 23, 2017 08:57
SwipeRefreshLayout with StickyListHeaders

Trying to find a solution

I had a problem getting the new fancy SwipeRefreshLayout from the appcompat lib to work with a custom listview, in this case the StickyListHeaders. Since the First child of the SwipeRefreshLayout should be either a ScrollView or a pure List, some workaround had to be done.

/*
Combine tab into actionbar,
i'm using pager sliding tab strinb (https://github.com/astuetz/PagerSlidingTabStrip)
*/
package com.srin.flores;
import android.app.ActionBar;
import android.content.Context;
import android.os.Bundle;
@PrashamTrivedi
PrashamTrivedi / android embed tabs
Created December 3, 2013 03:29
android : Embed tabs as a part of actionbar.... as done in shazaam apps
//In onCreate after initializing actionbar
int currentapiVersion = android.os.Build.VERSION.SDK_INT;
if (currentapiVersion >= VERSION_CODES.ICE_CREAM_SANDWICH) {
// Do something for froyo and above versions
try {
Field actionBarField = actionBar.getClass().getDeclaredField("mActionBar");
actionBarField.setAccessible(true);
enableEmbeddedTabs(actionBarField.get(actionBar));
} catch (Exception e) {
Log.e(TAG, "Error enabling embedded tabs", e);
@itsalif
itsalif / SimpleXmlRequest.java
Last active February 25, 2019 16:03 — forked from ficusk/GsonRequest.java
Volley adapter for making XML Requests. It uses Simple-XML for serializing XML to Objects (http://simple.sourceforge.net/). Code is based of GsonRequest. Hope someone finds it useful.
import java.io.UnsupportedEncodingException;
import java.util.Map;
import org.simpleframework.xml.Serializer;
import org.simpleframework.xml.core.Persister;
import com.android.volley.AuthFailureError;
import com.android.volley.NetworkResponse;
import com.android.volley.ParseError;
import com.android.volley.Request;