formatting and reenable toolbar in player

This commit is contained in:
Felix 2020-04-17 18:20:25 +02:00
parent f4efbdd4ae
commit 209854bddd
5 changed files with 19 additions and 20 deletions

View file

@ -26,4 +26,4 @@ object DarkmodeUtil {
}
AppCompatDelegate.setDefaultNightMode(setting)
}
}
}

View file

@ -43,13 +43,12 @@ class AboutFragment : Fragment() {
}
}
val version = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})"
val versionElement = Element()
var clickCounter = 0
versionElement.title = "Version $version"
versionElement.setOnClickListener {
when(clickCounter++){
when (clickCounter++) {
10 -> {
chaosflixPreferenceManager.debugEnabled = true
showToast(R.string.debug_enabled)
@ -59,7 +58,6 @@ class AboutFragment : Fragment() {
}
}
return AboutPage(requireContext())
.setImage(R.drawable.icon_primary_background)
.setDescription(resources.getString(R.string.about_description))

View file

@ -7,11 +7,11 @@ import android.view.ViewGroup
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import de.nicidienase.chaosflix.touch.databinding.FragmentFilterSheetBinding
class FilterBottomSheet: BottomSheetDialogFragment() {
class FilterBottomSheet : BottomSheetDialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val binding = FragmentFilterSheetBinding.inflate(inflater, container, false)
return binding.root
}
}
}

View file

@ -9,6 +9,8 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
import androidx.databinding.DataBindingUtil
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
@ -66,15 +68,15 @@ class ExoPlayerFragment : Fragment(), PlayerStateChangeListener {
val binding: FragmentExoPlayerBinding = DataBindingUtil.inflate(inflater, R.layout.fragment_exo_player, container, false)
viewModel = ViewModelProvider(this, ViewModelFactory.getInstance(requireContext())).get(PlayerViewModel::class.java)
viewModel.setEvent(args.playbackItem.eventGuid)
// val toolbar: Toolbar = binding.getRoot().findViewById(R.id.toolbar)
// toolbar.title = args.playbackItem.title
// toolbar.subtitle = args.playbackItem.subtitle
// val activity = activity as AppCompatActivity?
// if (activity != null) {
// activity.setSupportActionBar(toolbar)
// val actionBar = activity.supportActionBar
// actionBar?.setDisplayHomeAsUpEnabled(true)
// }
val toolbar: Toolbar = binding.root.findViewById(R.id.toolbar)
toolbar.title = args.playbackItem.title
toolbar.subtitle = args.playbackItem.subtitle
val activity = activity as AppCompatActivity?
if (activity != null) {
activity.setSupportActionBar(toolbar)
val actionBar = activity.supportActionBar
actionBar?.setDisplayHomeAsUpEnabled(true)
}
this.binding = binding
return binding.root
}
@ -201,8 +203,8 @@ class ExoPlayerFragment : Fragment(), PlayerStateChangeListener {
private const val ARG_item = "item"
fun newInstance(item: PlaybackItem): ExoPlayerFragment {
return ExoPlayerFragment().apply {
arguments = ExoPlayerFragmentArgs(item).toBundle()
}
arguments = ExoPlayerFragmentArgs(item).toBundle()
}
}
}
}

View file

@ -43,7 +43,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
}
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) {
if(key == getString(R.string.preference_key_darkmode_setting)){
if (key == getString(R.string.preference_key_darkmode_setting)) {
DarkmodeUtil.init(requireContext())
}
}
@ -72,7 +72,7 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.preferences, rootKey)
if(BuildConfig.DEBUG || chaosflixPreferenceManager.debugEnabled){
if (BuildConfig.DEBUG || chaosflixPreferenceManager.debugEnabled) {
addPreferencesFromResource(R.xml.debug_settings)
}
@ -201,6 +201,5 @@ class SettingsFragment : PreferenceFragmentCompat(), SharedPreferences.OnSharedP
fragment.arguments = args
return fragment
}
}
}