Giter Site home page Giter Site logo

quiltviewlibrary's Introduction

QuiltViewLibrary

QuiltView displays views of different sizes in a scrollable grid.

quilt quilt

Dependencies

This library depends on gridlayout_v7 ([email protected]:jacobmoncur/gridlayout_v7.git)

Setup

The QuiltView can be defined by XML:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res/com.jake.quiltviewsample"
    android:id="@+id/FrameLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.jake.quiltview.QuiltView
        android:id="@+id/quilt"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="5dip"
        app:scrollOrientation="horizontal|vertical" >
    </com.jake.quiltview.QuiltView>

</FrameLayout>

Or programmatically

boolean isVertical = true|false; //defines which direction the QuiltView will scroll: true = Vertical, false = Horizontal
QuiltView quiltView = new QuiltView(context, isVertical); //(QuiltView) findViewById(R.id.quilt);

Adding Children

Children must be added to the QuiltView programmatically as an ArrayList of ImageViews:

ArrayList<ImageView> images = new ArrayList<ImageView>();
for(int i = 0; i < num; i++){
	ImageView image = new ImageView(this.getApplicationContext());
	image.setScaleType(ScaleType.CENTER_CROP);
	image.setImageResource(R.drawable.bg);
	images.add(image);
}
quiltView.addPatchImages(images);

Or an ArrayList of Views

ArrayList<View> views = new ArrayList<View>();
for(int i = 0; i < num; i++){
    FrameLayout patch = new FrameLayout(this.getApplicationContext());
	views.add(patch);
}
quiltView.addPatchViews(views);

Goals for this view

  • Have no empty patches
  • Be sudo-random (lays out the children differently each time)
  • Looks awesome!

TODO

  • Custom Adapter to allow view recycling
  • Be able to define children in XML
  • Adapt better to different screen sizes

quiltviewlibrary's People

Contributors

jacobmoncur avatar anpez avatar caseymonc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.