@SuppressWarnings("WeakerAccess")
    @SuppressLint("RtlHardcoded")
    @VisibleForTesting
    static int textGravity(@NonNull Table.Alignment alignment, boolean cellTextCenterVertical) {
    """
	we will use gravity instead of textAlignment because min sdk is 16 (textAlignment starts at 17)
    """

        final int gravity;

        switch (alignment) {

            case LEFT:
                gravity = Gravity.LEFT;
                break;

            case CENTER:
                gravity = Gravity.CENTER_HORIZONTAL;
                break;

            case RIGHT:
                gravity = Gravity.RIGHT;
                break;

            default:
                throw new IllegalStateException("Unknown table alignment: " + alignment);
        }

        if (cellTextCenterVertical) {
            return gravity | Gravity.CENTER_VERTICAL;
        }

        // do not center vertically
        return gravity;
    }
@SuppressWarnings("WeakerAccess")
    @SuppressLint("RtlHardcoded")
    @VisibleForTesting
    static int textGravity(@NonNull Table.Alignment alignment, boolean cellTextCenterVertical) {

        final int gravity;

        switch (alignment) {

            case LEFT:
                gravity = Gravity.LEFT;
                break;

            case CENTER:
                gravity = Gravity.CENTER_HORIZONTAL;
                break;

            case RIGHT:
                gravity = Gravity.RIGHT;
                break;

            default:
                throw new IllegalStateException("Unknown table alignment: " + alignment);
        }

        if (cellTextCenterVertical) {
            return gravity | Gravity.CENTER_VERTICAL;
        }

        // do not center vertically
        return gravity;
    }
@ SuppressWarnings ( "WeakerAccess" ) @ SuppressLint ( "RtlHardcoded" ) @ VisibleForTesting static int textGravity ( @ NonNull Table . Alignment alignment , boolean cellTextCenterVertical ) { final int gravity ; switch ( alignment ) { case LEFT : gravity = Gravity . LEFT ; break ; case CENTER : gravity = Gravity . CENTER_HORIZONTAL ; break ; case RIGHT : gravity = Gravity . RIGHT ; break ; default : throw new IllegalStateException ( "Unknown table alignment: " + alignment ) ; } if ( cellTextCenterVertical ) { return gravity | Gravity . CENTER_VERTICAL ; } // do not center vertically return gravity ; }
we will use gravity instead of textAlignment because min sdk is 16 (textAlignment starts at 17)
we will use gravity instead of textAlignment because min sdk is 16 ( textAlignment starts at 17 )