Git Product home page Git Product logo

vorolay's Introduction

Vorolay


[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) [![](https://jitpack.io/v/Quatja/Vorolay.svg)](https://jitpack.io/#Quatja/Vorolay) [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Vorolay-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/5001#)

VoronoiView is a view (ViewGroup) that allows you to add and display views inside Voronoi diagram regions. [Voronoi diagram] (https://en.wikipedia.org/wiki/Voronoi_diagram)

Screenshots

alt text alt text alt text alt text

Import

Step 1. Add the JitPack repository to your build file

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Step 2. Add the dependency

dependencies {
        compile 'com.github.Quatja:Vorolay:1.0.1'
}

---------

Usage

Add the view into your layout. You can customize it by using xml attributes

<quatja.com.vorolay.VoronoiView
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_margin="50dp"
  custom:border_color="@color/gray"
  custom:border_round="false"
  custom:border_width="5"    />

Then add your views to the VoronoiView

VoronoiView voronoiView = (VoronoiView) findViewById(R.id.voronoi);
LayoutInflater layoutInflater = getLayoutInflater();
for (int i = 0; i < 15; i++) {
    View view = layoutInflater.inflate(R.layout.item_voronoi, null, false);
    voronoiView.addView(view);
}

Now VoronoiView children will be displayed inside the diagram regions.


---------

Customization

Attributes which you can use in customization purposes

attr value/example description
show_border true shows or hides each region borders
border_color #fff sets all borders color
border_width 5 sets borders width
border_round true makes border corners round
generation_type random sets different points generation behavior

Generation types

type description
random VoronoiView generates a random point positions inside the view bounds.
ordered points are placed like a table - rows and columns.
custom points will be placed in user defined positions.

These attributes are available programmatically too.


Warning

Children visibility GONE doesn't work
Do not use tags for the children


Acknowledgements

Steven Fortune - algorithm author
Zhenyu Pan - Forutne algorithm Java version
Bart Kiers - Graham Scan realization


License

Copyright 2016 Daniil Jurjev

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.

vorolay's People

Contributors

quatja avatar

Stargazers

 avatar

Watchers

 avatar  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.