Git Product home page Git Product logo

vorolay's People

Contributors

quatja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vorolay's Issues

Can't set up ListView

Not sure what's going on here but I keep getting this error
untitled

which refers to this part of the library
untitled2

This is my adapter for the listview

package com.example.frido.rando.Utilities;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.frido.rando.R;

import java.io.File;
import java.util.ArrayList;
import java.util.Random;

import butterknife.BindView;
import butterknife.ButterKnife;
import quatja.com.vorolay.VoronoiView;

public class VoronoAdapter extends BaseAdapter {
    private Context context;
    private LayoutInflater layoutInflater;
    private ArrayList<String> imageURLs;
    private File filePath;

    public VoronoAdapter(ArrayList<String> imageURLs, Context context) {
        this.imageURLs = imageURLs;
        this.context = context;
        this.layoutInflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return imageURLs.size();
    }

    @Override
    public Object getItem(int position) {
        return imageURLs.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = layoutInflater.inflate(R.layout.vorono_template, parent, false);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);


            for (int i = 0; i < 20; i++) {
                View view = layoutInflater.inflate(R.layout.vorono_item_for_template, null, false);
                holder.voronoi.addView(view);

                ImageView layout = (ImageView) view.findViewById(R.id.itemVoronoLayout);
                Random rnd = new Random();
                int color = Color.argb(255, rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256));
                layout.setBackgroundColor(color);
            }
        } else {
            holder = (ViewHolder) convertView.getTag();
        }




        return convertView;
    }


    static class ViewHolder{
        @BindView(R.id.voronoTemplateForList) VoronoiView voronoi;


        public ViewHolder(View view){
            ButterKnife.bind(this,view);
        }
    }
}
```
`

Wrong View got activated when another overlapped view is clicked

I set up a clickListener for the views in the vorolay layout. When I click a region on an imageView that's "overlapped" by another, the other imageView is activated (see attached image).

is there any settings I can configure?

the following are my codes

    for (int i = 0; i < count; i++) {
        RelativeLayout rl = (RelativeLayout) layoutInflater.inflate(R.layout.item_voronoi, null, false);

        ImageView iv = ( ImageView) rl.findViewById(R.id.image);

       //add a callback when the image is clicked
        int value = i;
        iv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.d("TEST", "item clicked: "+ value);
            }
        }); 

        loadImage(iv, uri);  //this method populates the image

        vv.addView(rl); //this is the VoronoiView
    }  

touchdetect

Null Pointer Exception

Hey I've been trying to use your library but when I add it to my layout I get this error

java.lang.NullPointerException
at quatja.com.vorolay.diagram.Voronoi.addCornerEdges(Voronoi.java:167)
at quatja.com.vorolay.diagram.Voronoi.getRegions(Voronoi.java:131)
at quatja.com.vorolay.VoronoiView.generateDiagram(VoronoiView.java:428)
at quatja.com.vorolay.VoronoiView.onSizeChanged(VoronoiView.java:321)
at android.view.View.sizeChange(View.java:17638)
at android.view.View.setFrame(View.java:17600)
at android.view.View.layout(View.java:17517)
at android.view.ViewGroup.layout(ViewGroup.java:5612)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:17520)
at android.view.ViewGroup.layout(ViewGroup.java:5612)
at android.support.design.widget.HeaderScrollingViewBehavior.layoutChild(HeaderScrollingViewBehavior.java:131)
at android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
at android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1375)
at android.support.design.widget.CoordinatorLayout.onLayout_Original(CoordinatorLayout.java:870)
at android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java)
at android.view.View.layout(View.java:17520)
at android.view.ViewGroup.layout(ViewGroup.java:5612)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:323)
at android.widget.FrameLayout.onLayout(FrameLayout.java:261)
at android.view.View.layout(View.java:17520)
at android.view.ViewGroup.layout(ViewGroup.java:5612)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1079)
at android.view.View.layout(View.java:17520)
at android.view.ViewGroup.layout(ViewGroup.java:5612)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:345)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:429)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:389)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:548)
at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:533)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:966)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:533)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$70(RenderTask.java:659)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Adjust grid

Hey, first of all I would like to say this is an amazing library :)
Is there a way to make it not random? as in the same picture will go to the same spot with the exact same shape every time? Even when playing with generation_type and setGenerationType it still adds random shapes

images not cropped in API19

device-2017-01-10-151117

app works correctly on emulator with API24, but is not properly cropped on an API19 (android 4.2.2) device.

the code for adding the view is

for (int i = 0; i < count; i++) {
        RelativeLayout rl = (RelativeLayout) layoutInflater.inflate(R.layout.item_voronoi, null, false);
        ImageView view = ( ImageView) rl.findViewById(R.id.image);  
        view.setImageURI(uri); 
        vv.addView(rl);
    }

and the xml is

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
 
    <ImageView
        android:id="@+id/image"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="centerCrop" />

</RelativeLayout>

what's wrong?

1
My code:
voronoiView = (VoronoiView) findViewById(R.id.voronoi); LayoutInflater layoutInflater = getLayoutInflater(); for (int i = 0; i < 15; i++) { ImageView view = (ImageView) layoutInflater.inflate(R.layout.item_iv, null, false); view.setImageResource(R.drawable.p2_480); voronoiView.addView(view); }

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.