@Override       

public void onSensorChanged(SensorEvent event) {

if(mCtx.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {

// 0점 조정

if(portBaseX > event.values[0]){

event.values[0]=360-(portBaseX-event.values[0]);

}

else if(portBaseX <= event.values[0]){

event.values[0]=event.values[0]-portBaseX;

}

if(event.values[0]<340 && event.values[0]>=270){

//오른쪽

currType = 4;

if(!TypeCheck(currType,lastType)){

imageView.setImageDrawable(images.get(currType));

lastType = 4;

}

else if(event.values[0]>20 && event.values[0]<270){

//왼쪽

currType = 3;

if(!TypeCheck(currType,lastType)){

imageView.setImageDrawable(images.get(currType));

lastType = 3;

}

}

else{

//가운데

currType = 0;

if(!TypeCheck(currType,lastType)){

imageView.setImageDrawable(images.get(currType));

lastType = 0;

}

}

}

}

저작자 표시 비영리 변경 금지
신고
Posted by DoDo4989

댓글을 달아 주세요