Removed old settings fragment; added licences button; added ColorPickerView dependency, to be used to pick colours for text and highlight; removed transparency settings in favour of ColorPickerView

This commit is contained in:
denizk0461
2023-05-16 11:38:04 +02:00
parent eca9594a7e
commit 4dfc2a2df6
16 changed files with 239 additions and 1112 deletions
@@ -0,0 +1,34 @@
package com.denizd.textbasic.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)
}
@@ -0,0 +1,35 @@
package com.denizd.textbasic.sheet
import android.os.Bundle
import android.view.View
import com.denizd.textbasic.R
import com.denizd.textbasic.databinding.SheetTextBinding
import com.denizd.textbasic.util.viewBinding
/**
* Bottom sheet used for displaying any sort of text to the user.
*/
class TextSheet : AppSheet(R.layout.sheet_text) {
// View binding
private val binding: SheetTextBinding by viewBinding(SheetTextBinding::bind)
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// Retrieve headline for the window
val header = arguments?.getString("header") ?: ""
// Check whether an ID has passed to use LiveData
val content = arguments?.getString("content") ?: ""
binding.textHeader.text = header
binding.textContent.text = content
// Set up a simple X button to be able to close the sheet
binding.buttonCancel.setOnClickListener {
// Do nothing and dismiss the sheet
dismiss()
}
}
}