• Stars
    star
    4,763
  • Rank 8,456 (Top 0.2 %)
  • Language
    Java
  • Created over 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An Android staggered grid view which supports multiple columns with rows of varying sizes.

AndroidStaggeredGrid

##Notice - Deprecated - 09-2015

This library has been deprecated. We will no longer be shipping any updates or approving community pull requests for this project.

While the code will remain for anyone who wishes to use it, we suggest you prefer using Google's own RecyclerView with their StaggeredGridLayoutManager. We are doing the same internally at Etsy.

Thanks to everyone who used the library and submitted code or issues to improve it.

##About

An Android staggered grid view which supports multiple columns with rows of varying sizes.

The StaggeredGridView was developed due to requirements for the Etsy app not met by any existing Android libraries. Namely a stable implementation with the ability to have a different number of columns in landscape & portrait, to sync grid position across orientation changes and support for headers & footers.

Staggered Grid Sample Image

##Features

  • Configurable column count for portrait and landscape orientations.
  • Sync'd row position across orientation changes.
  • Configurable item margin.
  • Support for headers & footers.
  • Internal padding that does not affect the header & footer.
  • Extends AbsListView - "mostly"
  • Supports AbsListView.OnScrollListener

##Setup

The library was built for and tested on Android version 2.3.3(SDK 10) and above. It could be modified to support older versions if required.

The simplest way to use AndroidStaggeredGrid is to add the library as a gradle aar dependency to your build. See the CHANGELOG.md for the latest version number.

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.etsy.android.grid:library:x.x.x' // see changelog
}

Alternatively import the /library project into your Android Studio project and add it as a dependency in your build.gradle.

The library is currently configured to be built via Gradle only. It has the following dependencies:

  • Android Gradle plugin v0.9.2 - com.android.tools.build:gradle:0.9.2
  • Android Support Library v19.1 - com.android.support:support-v4:19.1.+

Still use Eclipse/building with Ant? You can still use AndroidStaggeredGrid, it's just a few extra steps (left up to the reader).

##Usage

Please see the /sample app for a more detailed code example of how to use the library.

  1. Add the StaggeredGridView to the layout you want to show.
        <com.etsy.android.grid.StaggeredGridView
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:id="@+id/grid_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:item_margin="8dp"
            app:column_count="@integer/column_count" />
  2. Configure attributes.
  • item_margin - The margin around each grid item (default 0dp).
  • column_count - The number of columns displayed. Will override column_count_portrait and column_count_landscape if present (default 0)
  • column_count_portrait - The number of columns displayed when the grid is in portrait (default 2).
  • column_count_landscape - The number of columns displayed when the grid is in landscape (default 3).
  • grid_paddingLeft - Padding to the left of the grid. Does not apply to headers and footers (default 0).
  • grid_paddingRight - Padding to the right of the grid. Does not apply to headers and footers (default 0).
  • grid_paddingTop - Padding to the top of the grid. Does not apply to headers and footers (default 0).
  • grid_paddingBottom - Padding to the bottom of the grid. Does not apply to headers and footers (default 0).
  1. Setup an adapter just like you would with a GridView/ListView.
    ListAdapter adapter = ...;
    
    StaggeredGridView gridView = (StaggeredGridView) findViewById(R.id.grid_view);
    
    gridView.setAdapter(adapter);

NOTE: As column widths change on orientation change, the grid view expects that all children maintain their own width to height ratio. To assist with this the project includes the DynamicHeightImageView as an example of a view that measures its height based on its width.

##TODO

The StaggeredGridView does not support the following:

  • Item selector drawables
  • Item long press event
  • Scroll bars
  • Row dividers
  • Edge effect
  • Fading edge
  • Overscroll

##License

Copyright (c) 2013 Etsy

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
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

skyline

It'll detect your anomalies! Part of the Kale stack.
Python
2,131
star
2

logster

Parse log files, generate metrics for Graphite and Ganglia
Python
1,965
star
3

deployinator

Deployinate!
Ruby
1,879
star
4

morgue

post mortem tracker
PHP
1,011
star
5

411

An Alert Management Web Application
PHP
968
star
6

feature

Etsy's Feature flagging API used for operational rampups and A/B testing.
PHP
864
star
7

MIDAS

Mac Intrusion Detection Analysis System
831
star
8

opsweekly

On call alert classification and reporting
JavaScript
761
star
9

oculus

The metric correlation component of Etsy's Kale system
Java
706
star
10

mctop

a top like tool for inspecting memcache key values in realtime
Ruby
504
star
11

supergrep

realtime log streamer
JavaScript
410
star
12

Conjecture

Scalable Machine Learning in Scalding
Java
358
star
13

statsd-jvm-profiler

Simple JVM Profiler Using StatsD and Other Metrics Backends
Java
328
star
14

nagios-herald

Add context to Nagios alerts
Ruby
324
star
15

dashboard

JavaScript
308
star
16

Testing101

Etsy's educational materials on testing and design
PHP
262
star
17

boundary-layer

Builds Airflow DAGs from configuration files. Powers all DAGs on the Etsy Data Platform
Python
261
star
18

DebriefingFacilitationGuide

Leading Groups at Etsy to Learn From Accidents
245
star
19

phpunit-extensions

Etsy PHPUnit Extensions
PHP
228
star
20

nagios_tools

Tools for use with Nagios
Python
174
star
21

TryLib

TryLib is a simple php library that helps you generate a diff of your working copy and send it to Jenkins to run the test suite(s) on the latest code patched with your changes.
PHP
155
star
22

open-api

We are working on a new version of Etsyโ€™s Open API and want feedback from developers like you.
149
star
23

BugHunt-iOS

Objective-C
145
star
24

ab

Etsy's little framework for A/B testing, feature ramp up, and more.
129
star
25

mod_realdoc

Apache module to support atomic deploys - http://codeascraft.com/2013/07/01/atomic-deploys-at-etsy/
C
126
star
26

wpt-script

Scripts to generate WebPagetest tests and download results
PHP
121
star
27

applepay-php

A PHP extension that verifies and decrypts Apple Pay payment tokens
C
119
star
28

foodcritic-rules

Etsy's foodcritic rules
Ruby
117
star
29

kevin-middleware

This is an Express middleware that makes developing javascript in a monorepo easier.
JavaScript
110
star
30

mixer

a tool to initiate meetings by randomly pairing individuals
Go
100
star
31

cloud-jewels

Estimate energy consumption using GCP Billing Data
TSQL
93
star
32

jenkins-master-project

Jenkins Plugin: Master Project. Jenkins project type that allows for selection of sub-jobs to execute, watch, and report worst status of all sub-projects.
Java
84
star
33

Sahale

A Cascading Workflow Visualizer
JavaScript
83
star
34

cdncontrol

CLI tool for working with multiple CDNs
Ruby
80
star
35

PushBot

An IRC Bot for organizing code pushes
Java
79
star
36

chef-whitelist

Simple library to enable host based rollouts of changes
Ruby
68
star
37

rules_grafana

Bazel rules for building Grafana dashboards
Starlark
66
star
38

rfid-checkout

Low Frequency RFID check out/in client for Raspberry Pi
Python
63
star
39

Etsy-Engineering-Career-Ladder

Etsy's Engineering Career Ladder
HTML
61
star
40

Evokit

Rust
59
star
41

ELK-utils

Utilities for working with the ELK (Elasticsearch, Logstash, Kibana) stack
Ruby
58
star
42

incpath

PHP extension to support atomic deploys
C
52
star
43

arbiter

A utility for generating Oozie workflows from a YAML definition
Java
48
star
44

chef-handlers

Chef handlers we use at Etsy
Ruby
41
star
45

VIPERBuilder

Scaffolding for building apps in a clean way with VIPER architecture
Swift
41
star
46

sbt-checkstyle-plugin

SBT Plugin for Running Checkstyle on Java Sources
Scala
32
star
47

es-restlog

Plugin for logging Elasticsearch REST requests
Java
29
star
48

yubigpgkeyer

Script to make RSA authentication key generation on Yubikeys differently painful
Python
28
star
49

Apotheosis

Python
28
star
50

jenkins-deployinator

Jenkins Plugin: Deployinator. Links key deployinator information to Jenkins builds via the CLI.
Java
25
star
51

sbt-compile-quick-plugin

SBT Plugin for Compiling a Single File
Scala
25
star
52

geonames

Scripts for using Geonames
PHP
24
star
53

jading

cascading.jruby build and execution tool
16
star
54

etsy.github.com

Etsy! on Github!
HTML
16
star
55

divertsy-client

The Android client for running DIVERTsy, a waste stream recording tool to help track diversion rates.
Java
13
star
56

cdncontrol_ui

A web UI for Etsy's cdncontrol tool
CSS
13
star
57

terraform-demux

A user-friendly launcher (ร  la bazelisk) for Terraform.
Go
12
star
58

logstash-plugins

Ruby
11
star
59

jenkins-triggering-user

Jenkins Plugin: Triggering User. Populates a $TRIGGERING_USER environment variable from the build cause and other sources, a best guess.
10
star
60

EtsyCompositionalLayoutBridge

iOS framework that allows for simultaneously leveraging flow layout and compositional layout in collection views
Swift
3
star
61

soft-circuits-workshop

Etsy Soft Circuits Workshop
Arduino
1
star