Repository: thunderbird/thunderbird-android
File: legacy/ui/legacy/src/main/java/com/fsck/k9/ui/messageview/MessageTopView.kt (Kotlin)

Code before:
        val superState = super.onSaveInstanceState()
        val savedState = SavedState(superState)
        savedState.showPicturesButtonClicked = showPicturesButtonClicked
        return savedState
    }

    public override fun onRestoreInstanceState(state: Parcelable) {
        val savedState = state as SavedState
        super.onRestoreInstanceState(savedState.superState)
        showPicturesButtonClicked = savedState.showPicturesButtonClicked
    }

    fun refreshAttachmentThumbnail(attachment: AttachmentViewInfo) {
        val messageContainerViewCandidate = containerView.getChildAt(0)
        if (messageContainerViewCandidate is MessageContainerView) {
            messageContainerViewCandidate.refreshAttachmentThumbnail(attachment)
        }
    }

    public fun setRenderPlainFormat(b: Boolean) {
        renderPlainFormat = b
    }

    public fun getRenderPlainFormat(): Boolean {
        return renderPlainFormat
    }

    private class SavedState : BaseSavedState {
        var showPicturesButtonClicked = false

        constructor(superState: Parcelable?) : super(superState)

        private constructor(`in`: Parcel) : super(`in`) {
            showPicturesButtonClicked = `in`.readInt() != 0
        }

        override fun writeToParcel(out: Parcel, flags: Int) {
            super.writeToParcel(out, flags)
            out.writeInt(if (showPicturesButtonClicked) 1 else 0)
        }

        companion object {
            @JvmField
            val CREATOR: Parcelable.Creator<SavedState?> = object : Parcelable.Creator<SavedState?> {
                override fun createFromParcel(`in`: Parcel): SavedState {
                    return SavedState(`in`)
                }

                override fun newArray(size: Int): Array<SavedState?> {
                    return arrayOfNulls(size)
                }

Review comment (suggestion):
There is no custom logic to either get or set the value of `renderPlainFormat`. Use '`var renderPlainFormat`' instead.

```suggestion
```

Code after:
        val savedState = SavedState(superState)
        savedState.showPicturesButtonClicked = showPicturesButtonClicked
        return savedState
    }

    public override fun onRestoreInstanceState(state: Parcelable) {
        val savedState = state as SavedState
        super.onRestoreInstanceState(savedState.superState)
        showPicturesButtonClicked = savedState.showPicturesButtonClicked
    }

    fun refreshAttachmentThumbnail(attachment: AttachmentViewInfo) {
        val messageContainerViewCandidate = containerView.getChildAt(0)
        if (messageContainerViewCandidate is MessageContainerView) {
            messageContainerViewCandidate.refreshAttachmentThumbnail(attachment)
        }
    }

    private class SavedState : BaseSavedState {
        var showPicturesButtonClicked = false

        constructor(superState: Parcelable?) : super(superState)

        private constructor(`in`: Parcel) : super(`in`) {
            showPicturesButtonClicked = `in`.readInt() != 0
        }

        override fun writeToParcel(out: Parcel, flags: Int) {
            super.writeToParcel(out, flags)
            out.writeInt(if (showPicturesButtonClicked) 1 else 0)
        }

        companion object {
            @JvmField
            val CREATOR: Parcelable.Creator<SavedState?> = object : Parcelable.Creator<SavedState?> {
                override fun createFromParcel(`in`: Parcel): SavedState {
                    return SavedState(`in`)
                }

                override fun newArray(size: Int): Array<SavedState?> {
                    return arrayOfNulls(size)
                }
            }
        }
    }

    companion object {
        const val PROGRESS_MAX = 1000
        const val PROGRESS_MAX_WITH_MARGIN = 950
        const val PROGRESS_STEP_DURATION = 180
    }