N1ckn1ght / Riichit

A mobile app for training skills in riichi-mahjong
5 stars 0 forks source link

Rotate first tile discard after Riichi declaration #8

Open N1ckn1ght opened 2 years ago

N1ckn1ght commented 2 years ago

This is actually more difficult to fix than I expected...

N1ckn1ght commented 2 years ago

While it can be implemented, because it's easy to track which tile should be rotated, it still won't work as intended.

    override fun onBindViewHolder(holder: DiscardViewHolder, position: Int) {
        var x = getItem(position)
        holder.iv.layoutParams.width = width
        holder.iv.layoutParams.height = height
        if (x > logicIncrement - 1) {
            // TODO: find a way of rotating tile without changing its size or breaking the grid
            // holder.iv.rotation += 90F
            // holder.iv.layoutParams.width = height ?
            // holder.iv.layoutParams.height = width ?
            x -= logicIncrement
        }
        holder.bindTo(tiles[x / 4], x)
    }

Making height of the tile equal to width inside a grid will make the tile smaller, like this:

But if make width equal to height instead, the width of every tile inside a grid will be affected - there will be spacings between them, which is awful.

Any other methods just breaking the entire discard.

No solution so far.

N1ckn1ght commented 2 years ago

Will consider FlexboxLayoutManager

N1ckn1ght commented 2 years ago

One of the possible working solutions is to use 3 linear layouts instead of 1 grid layout, this may lead to seriously messed code.