Was this guy flirting with me?

we were sitting on my friends bed and he was leaning towards me, he laid his head on my shoulder while laughing at something. He also would lightly touch my leg/thigh or arm to get mt attention. As he was sitting next to me at one point he reached over me (to my other side) to get something out of my hair, it startled me a bit because I didn't see it coming. He also took my phone and just started taking pictures of me randomly? The last time I saw him a few months ago he got my number and he always hugs me and touches me on my arms/legs or even leans over on me. I guess u can say he's teased me before too, he's called me "good weird", and would do things like block me from getting into a room without a magic word, or just take my phone sometimes.
Was this guy flirting with me?
Post Opinion