package com.example.my.first.app;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.util.AttributeSet;
import android.view.Menu;
import android.view.View;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import android.widget.Toast;
import android.graphics.*;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RectShape;

public class MainActivity extends Activity implements OnSeekBarChangeListener{
    private SeekBar bar; 
    private TextView textProgress,textAction;
    //CustomDrawableView mCustomDrawableView;
        
    /*public class CustomDrawableView extends View {
        private ShapeDrawable mDrawable;
        
        public CustomDrawableView(Context context, AttributeSet attrs) {
            super(context, attrs);
        


        int x = 10;
        int y = 10;
        int width = 300;
        int height = 50;

        mDrawable = new ShapeDrawable(new RectShape());
        mDrawable.getPaint().setColor(0xff74AC23);
        mDrawable.setBounds(x, y, x + width, y + height);
        }

        protected void onDraw(Canvas canvas) {
        mDrawable.draw(canvas);
        }
    }*/
    
    @Override
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toast.makeText(MainActivity.this,"You clicked me!", Toast.LENGTH_LONG).show();
        bar = (SeekBar)findViewById(R.id.seekBar1); // make seekbar object
        bar.setOnSeekBarChangeListener(this); // set seekbar listener.
        // since we are using this class as the listener the class is "this"

        // make text label for progress value
        textProgress = (TextView)findViewById(R.id.textViewProgress);
        // make text label for action
        textAction = (TextView)findViewById(R.id.textViewAction);

        //Bitmap b = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
        //Canvas c = new Canvas(b);
        //mCustomDrawableView = (CustomDrawableView) findViewById(R.id.custom_drawable_view);
        
    }
 

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress,
    		boolean fromUser) 
    {
    	// change progress text label with current seekbar value
    	textProgress.setText("The value is: "+progress);
    	// change action text label to changing
    	textAction.setText("changing");
    	//drawPoints()
    }
    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    	// TODO Auto-generated method stub
    	textAction.setText("starting to track touch");

    }
    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
    	// TODO Auto-generated method stub
    	seekBar.setSecondaryProgress(seekBar.getProgress()); // set the shade of the previous value.
    	textAction.setText("ended tracking touch");
    }
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    




}

    


