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.
2023-04-23 17:13:48 +02:00
|
|
|
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
|
|
|
|
|
|
2023-04-27 20:27:42 +02:00
|
|
|
/**
|
|
|
|
|
* Get non-null context. Only valid after onAttach().
|
|
|
|
|
*/
|
2023-04-23 17:13:48 +02:00
|
|
|
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)
|
|
|
|
|
}
|