Drop BaseToolbarScene since no user now

This commit is contained in:
Lokesh Gidra authored and nullArrayList committed 2023-11-06 18:29:48 +08:00
1 parent fb7eb64c3a
commit 34fb72707b
2 files changed
-119

No files matched your search

@@ -1,86 +0,0 @@
/*
* Copyright 2016 Hippo Seven
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hippo.ehviewer.ui.scene
import android.os.Bundle
import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import com.hippo.ehviewer.databinding.SceneToolbarBinding
abstract class BaseToolbarScene : BaseScene(), ToolBarScene {
private var _binding: SceneToolbarBinding? = null
private val binding get() = _binding!!
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?,
): View {
_binding = SceneToolbarBinding.inflate(inflater, container, false)
onCreateViewWithToolbar(inflater, binding.root, savedInstanceState)
return binding.root
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.toolbar.apply {
val menuResId = getMenuResId()
if (menuResId != 0) {
inflateMenu(menuResId)
setOnMenuItemClickListener { item: MenuItem -> onMenuItemClick(item) }
}
setNavigationOnClickListener { onNavigationClick() }
}
}
override fun getMenuResId(): Int {
return 0
}
override fun onMenuItemClick(item: MenuItem): Boolean {
return false
}
override fun onNavigationClick() {
requireActivity().onBackPressedDispatcher.onBackPressed()
}
fun setNavigationIcon(@DrawableRes resId: Int) {
binding.toolbar.setNavigationIcon(resId)
}
fun setTitle(@StringRes resId: Int) {
setTitle(getString(resId))
}
fun setTitle(title: CharSequence?) {
_binding ?: return
binding.toolbar.title = title
}
override fun setLiftOnScrollTargetView(view: View?) {
binding.appbar.setLiftOnScrollTargetView(view)
}
}
-33
View File
@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright 2016 Hippo Seven
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize" />
</com.google.android.material.appbar.AppBarLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>