Exploring Spark

Today, I was reading Android Weekly and I found new library called Spark. This library is used for drawing sparklines.

build.gradle

    compile 'com.robinhood.spark:spark:1.0.0'

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   xmlns:app="http://schemas.android.com/apk/res-auto"
   android:paddingBottom="@dimen/activity_vertical_margin"
   android:paddingLeft="@dimen/activity_horizontal_margin"
   android:paddingRight="@dimen/activity_horizontal_margin"
   android:paddingTop="@dimen/activity_vertical_margin"
   tools:context="com.gayratrakhimov.sparksandbox.MainActivity">

    <com.robinhood.spark.SparkView
       android:id="@+id/sparkview"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       app:spark_lineColor="#FF0000"/>

</RelativeLayout>

MainActivity.java

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        float[] data = {1,5,6,4,2,5,7,8,6,5,56,14,4,5,16,6,14,25,14,33,5,34,14,5,14,34,15};

        SparkView sparkView = (SparkView) findViewById(R.id.sparkview);
        sparkView.setAdapter(new MyAdapter(data));

    }
}

Result:
Screenshot_2016-04-17-23-10-10