GithubHelp home page GithubHelp logo

dingdangmao123 / gitgreenrect Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 108 KB

a android rectangle view like github contributions

License: MIT License

Java 100.00%
android java view github rectangle color

gitgreenrect's Introduction

GitGreenRect

a android rectangle view like github contributions

snap

GitGreenRect

introduction

  • size - the size of rectangle
  • space - the space between rectangles
  • cStart - left color
  • cEnd - right color

demo

    <com.dingdangmao.gitgreenrect.GitGreenRect
        android:id="@+id/git1"
        app:size="30dp"
        app:space="5dp"
        android:background="#FFFFFF"
        android:layout_width="match_parent"
        android:layout_height="200dp" />
        git1=(GitGreenRect)findViewById(R.id.git1);
        /*
        set the listener of the single rectangle
        */
        git1.addListener(new onListener() {
            @Override
            public void onDown(int row, int col) {
                Toast.makeText(Main.this,"onDown "+L.o(row)+" "+L.o(col),Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onUp(int row, int col) {
                Toast.makeText(Main.this,"onUp "+L.o(row)+" "+L.o(col),Toast.LENGTH_SHORT).show();
            }
            /*
            if two single are different
            */
            @Override
            public void onDiff(int row1, int col1, int row2, int col2) { if 
                Toast.makeText(Main.this,"onDiff",Toast.LENGTH_SHORT).show();
            }
        });
        /*
        add the color data
        */
        git1.addData(new int[][]{ 
                {1,2,0,4,2,2,3},
                {0,2,2,4,3,7,3},
                {0,4,3,4,3,0,0},
                {2,1,1,0,5,0,7}});

        git2=(GitGreenRect)findViewById(R.id.git2);
        /*
        set the color array you will use
        */
        git2.addColor(new String[]{"#ffffcc","#ffcc99","#99ccff","#99cc99","#009966","#336699"});
        
        git2.addData(new int[][]{
                {1,2,0,4,2,2,3,17,5},
                {0,2,2,4,3,7,3,1,3},
                {0,4,3,4,3,0,0,10,3},
                {2,1,1,0,5,0,7,5,3},
                {2,1,10,0,6,0,7,5,3}
        });

gitgreenrect's People

Contributors

dingdangmao123 avatar

Stargazers

hyl87 avatar

Watchers

James Cloos 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.