update mainActivity

update the method onTouch
make the method more efficient and short.