package kr.pe.knobtestactivity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    private TextView txtView;

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

        //
        txtView = (TextView)findViewById(R.id.txtView);

        RotaryKnobView jogView = (RotaryKnobView)findViewById(R.id.jogView);

        //
        jogView.setKnobMaxMin(135.0f, -135.0f);
        txtView.setText("최대 138  최소 -138");

        jogView.setKnobListener(new RotaryKnobView.RotaryKnobListener() {

            @Override
            public void onKnobChanged(int arg, float value) {
                // TODO Auto-generated method stub

                txtView.setText(String.valueOf(value));

                if( arg > 0 ) {
                    Log.w("...", "오른쪽 회전");

                } else {
                    Log.w("...", "왼쪽 회전");

                }

            }
        });

    }

}
