This repository has been archived on 2026-05-26. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
weserplaner/app/src/main/java/com/denizk0461/studip/sheet/AppSheet.kt
T

34 lines
1.0 KiB
Kotlin
Raw Normal View History

package com.denizk0461.studip.sheet
import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.annotation.LayoutRes
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
/**
* Bottom sheet super class providing common functionality. All bottom sheets should inherit from
* this.
*
* @param layoutId ID of the layout of the bottom sheet
*/
open class AppSheet(@LayoutRes private val layoutId: Int) : BottomSheetDialogFragment() {
// Internal context object
private lateinit var _context: Context
/**
* Get non-null context. Only valid after onAttach().
*/
override fun getContext(): Context = _context
override fun onAttach(context: Context) {
super.onAttach(context)
_context = context
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
LayoutInflater.from(context).inflate(layoutId, container, false)
}