view_toolbar_native: Switch to actual toolbar everywhere

Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
Aayush Gupta
2024-12-06 12:58:27 +08:00
parent 5d7d7c5ffa
commit 3ec134279f
18 changed files with 72 additions and 136 deletions

View File

@@ -21,7 +21,6 @@ package com.aurora.store.view.ui.commons
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.fragment.app.activityViewModels
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
@@ -30,7 +29,6 @@ import com.aurora.gplayapi.data.models.StreamBundle
import com.aurora.gplayapi.data.models.StreamCluster
import com.aurora.gplayapi.helpers.contracts.StreamContract
import com.aurora.gplayapi.utils.CategoryUtil
import com.aurora.store.R
import com.aurora.store.data.model.ViewState
import com.aurora.store.data.model.ViewState.Loading.getDataAs
import com.aurora.store.databinding.FragmentGenericWithToolbarBinding
@@ -57,9 +55,8 @@ class CategoryBrowseFragment : BaseFragment<FragmentGenericWithToolbarBinding>()
val genericCarouselController = CategoryCarouselController(this)
// Toolbar
binding.layoutToolbarNative.toolbar.apply {
binding.toolbar.apply {
title = args.title
navigationIcon = ContextCompat.getDrawable(view.context, R.drawable.ic_arrow_back)
setNavigationOnClickListener { findNavController().navigateUp() }
}

View File

@@ -21,13 +21,11 @@ package com.aurora.store.view.ui.commons
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.airbnb.epoxy.EpoxyModel
import com.aurora.gplayapi.data.models.StreamCluster
import com.aurora.store.R
import com.aurora.store.databinding.FragmentGenericWithToolbarBinding
import com.aurora.store.view.custom.recycler.EndlessRecyclerOnScrollListener
import com.aurora.store.view.epoxy.groups.CarouselHorizontalModel_
@@ -51,9 +49,8 @@ class ExpandedStreamBrowseFragment : BaseFragment<FragmentGenericWithToolbarBind
super.onViewCreated(view, savedInstanceState)
// Toolbar
binding.layoutToolbarNative.toolbar.apply {
binding.toolbar.apply {
title = args.title
navigationIcon = ContextCompat.getDrawable(view.context, R.drawable.ic_arrow_back)
setNavigationOnClickListener { findNavController().navigateUp() }
}
@@ -71,7 +68,7 @@ class ExpandedStreamBrowseFragment : BaseFragment<FragmentGenericWithToolbarBind
private fun updateTitle(streamCluster: StreamCluster) {
if (streamCluster.clusterTitle.isNotEmpty())
binding.layoutToolbarNative.toolbar.title = streamCluster.clusterTitle
binding.toolbar.title = streamCluster.clusterTitle
}
private fun attachRecycler() {

View File

@@ -21,12 +21,10 @@ package com.aurora.store.view.ui.commons
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.aurora.gplayapi.data.models.StreamCluster
import com.aurora.store.R
import com.aurora.store.databinding.FragmentGenericWithToolbarBinding
import com.aurora.store.view.custom.recycler.EndlessRecyclerOnScrollListener
import com.aurora.store.view.epoxy.views.AppProgressViewModel_
@@ -48,9 +46,8 @@ class StreamBrowseFragment : BaseFragment<FragmentGenericWithToolbarBinding>() {
streamCluster = args.cluster
// Toolbar
binding.layoutToolbarNative.toolbar.apply {
binding.toolbar.apply {
title = streamCluster.clusterTitle
navigationIcon = ContextCompat.getDrawable(view.context, R.drawable.ic_arrow_back)
setNavigationOnClickListener { findNavController().navigateUp() }
}

View File

@@ -131,7 +131,7 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
if (app.packageName == event.packageName) {
checkAndSetupInstall()
transformIcon(false)
binding.layoutDetailsToolbar.toolbar.menu.apply {
binding.toolbar.menu.apply {
findItem(R.id.action_home_screen)?.isVisible =
ShortcutManagerUtil.canPinShortcut(requireContext(), app.packageName)
findItem(R.id.action_uninstall)?.isVisible = true
@@ -144,7 +144,7 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
if (app.packageName == event.packageName) {
checkAndSetupInstall()
transformIcon(false)
binding.layoutDetailsToolbar.toolbar.menu.apply {
binding.toolbar.menu.apply {
findItem(R.id.action_home_screen)?.isVisible = false
findItem(R.id.action_uninstall)?.isVisible = false
findItem(R.id.menu_app_settings)?.isVisible = false
@@ -360,12 +360,10 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
viewLifecycleOwner.lifecycleScope.launch {
viewModel.favourite.collect {
if (it) {
binding.layoutDetailsToolbar.toolbar.menu
?.findItem(R.id.action_favourite)
binding.toolbar.menu?.findItem(R.id.action_favourite)
?.setIcon(R.drawable.ic_favorite_checked)
} else {
binding.layoutDetailsToolbar.toolbar.menu
?.findItem(R.id.action_favourite)
binding.toolbar.menu?.findItem(R.id.action_favourite)
?.setIcon(R.drawable.ic_favorite_unchecked)
}
}
@@ -392,7 +390,7 @@ class AppDetailsFragment : BaseFragment<FragmentDetailsBinding>() {
}
private fun updateToolbar(app: App) {
binding.layoutDetailsToolbar.toolbar.apply {
binding.toolbar.apply {
elevation = 0f
navigationIcon = ContextCompat.getDrawable(requireContext(), R.drawable.ic_arrow_back)

View File

@@ -21,7 +21,6 @@ package com.aurora.store.view.ui.details
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.aurora.Constants
@@ -49,9 +48,8 @@ class DetailsExodusFragment : BaseFragment<FragmentGenericWithToolbarBinding>()
super.onViewCreated(view, savedInstanceState)
// Toolbar
binding.layoutToolbarNative.toolbar.apply {
binding.toolbar.apply {
title = args.displayName
navigationIcon = ContextCompat.getDrawable(view.context, R.drawable.ic_arrow_back)
setNavigationOnClickListener { findNavController().navigateUp() }
}

View File

@@ -21,12 +21,10 @@ package com.aurora.store.view.ui.details
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import androidx.navigation.fragment.navArgs
import com.aurora.gplayapi.data.models.SearchBundle
import com.aurora.store.R
import com.aurora.store.databinding.FragmentGenericWithToolbarBinding
import com.aurora.store.view.custom.recycler.EndlessRecyclerOnScrollListener
import com.aurora.store.view.epoxy.views.AppProgressViewModel_
@@ -49,9 +47,8 @@ class DevAppsFragment : BaseFragment<FragmentGenericWithToolbarBinding>() {
}
// Toolbar
binding.layoutToolbarNative.toolbar.apply {
binding.toolbar.apply {
title = args.developerName
navigationIcon = ContextCompat.getDrawable(view.context, R.drawable.ic_arrow_back)
setNavigationOnClickListener { findNavController().navigateUp() }
}

View File

@@ -22,7 +22,6 @@ package com.aurora.store.view.ui.downloads
import android.os.Bundle
import android.text.format.DateUtils
import android.view.View
import androidx.core.content.ContextCompat
import androidx.lifecycle.lifecycleScope
import androidx.navigation.fragment.findNavController
import com.aurora.Constants.GITLAB_URL
@@ -54,11 +53,7 @@ class DownloadFragment : BaseFragment<FragmentDownloadBinding>() {
super.onViewCreated(view, savedInstanceState)
// Toolbar
binding.layoutToolbarAction.toolbar.apply {
elevation = 0f
title = getString(R.string.title_download_manager)
navigationIcon = ContextCompat.getDrawable(view.context, R.drawable.ic_arrow_back)
inflateMenu(R.menu.menu_download_main)
binding.toolbar.apply {
setNavigationOnClickListener { findNavController().navigateUp() }
setOnMenuItemClickListener {
when (it.itemId) {

View File

@@ -85,9 +85,7 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
}
// Toolbar
binding.layoutToolbarAction.toolbar.apply {
elevation = 0f
inflateMenu(R.menu.menu_splash)
binding.toolbar.apply {
setOnMenuItemClickListener {
when (it.itemId) {
R.id.menu_blacklist_manager -> {
@@ -186,10 +184,10 @@ class SplashFragment : BaseFragment<FragmentSplashBinding>() {
private fun updateActionLayout(isVisible: Boolean) {
if (isVisible) {
binding.layoutAction.show()
binding.layoutToolbarAction.toolbar.visibility = View.VISIBLE
binding.toolbar.visibility = View.VISIBLE
} else {
binding.layoutAction.hide()
binding.layoutToolbarAction.toolbar.visibility = View.GONE
binding.toolbar.visibility = View.GONE
}
}

View File

@@ -25,7 +25,6 @@ import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.activity.result.contract.ActivityResultContracts
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
@@ -34,7 +33,7 @@ import androidx.viewpager2.adapter.FragmentStateAdapter
import com.aurora.extensions.toast
import com.aurora.store.R
import com.aurora.store.data.providers.NativeDeviceInfoProvider
import com.aurora.store.databinding.FragmentGenericWithPagerBinding
import com.aurora.store.databinding.FragmentSpoofBinding
import com.aurora.store.util.PathUtil
import com.aurora.store.view.ui.commons.BaseFragment
import com.google.android.material.tabs.TabLayout
@@ -42,7 +41,7 @@ import com.google.android.material.tabs.TabLayoutMediator
import dagger.hilt.android.AndroidEntryPoint
@AndroidEntryPoint
class SpoofFragment : BaseFragment<FragmentGenericWithPagerBinding>() {
class SpoofFragment : BaseFragment<FragmentSpoofBinding>() {
private val TAG = SpoofFragment::class.java.simpleName
// Android is weird, even if export device config with proper mime type, it will refuse to open
@@ -63,11 +62,7 @@ class SpoofFragment : BaseFragment<FragmentGenericWithPagerBinding>() {
super.onViewCreated(view, savedInstanceState)
// Toolbar
binding.layoutActionToolbar.toolbar.apply {
elevation = 0f
title = getString(R.string.title_spoof_manager)
navigationIcon = ContextCompat.getDrawable(view.context, R.drawable.ic_arrow_back)
inflateMenu(R.menu.menu_import_export)
binding.toolbar.apply {
setNavigationOnClickListener { findNavController().navigateUp() }
setOnMenuItemClickListener {
when (it.itemId) {

View File

@@ -28,9 +28,13 @@
android:weightSum="2"
tools:context=".view.ui.splash.SplashFragment">
<include
android:id="@+id/layout_toolbar_action"
layout="@layout/view_toolbar_native" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:menu="@menu/menu_splash" />
<LinearLayout
android:layout_width="match_parent"

View File

@@ -31,9 +31,14 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/layout_details_toolbar"
layout="@layout/view_toolbar_native" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:menu="@menu/menu_details"
app:navigationIcon="@drawable/ic_arrow_back" />
<androidx.core.widget.NestedScrollView
android:id="@+id/scrollView"

View File

@@ -25,9 +25,15 @@
android:orientation="vertical"
tools:context=".view.ui.downloads.DownloadFragment">
<include
android:id="@+id/layout_toolbar_action"
layout="@layout/view_toolbar_native" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:menu="@menu/menu_download_main"
app:navigationIcon="@drawable/ic_arrow_back"
app:title="@string/title_download_manager" />
<com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler"
@@ -38,4 +44,4 @@
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:stackFromEnd="false"
tools:listitem="@layout/view_download" />
</LinearLayout>
</LinearLayout>

View File

@@ -23,17 +23,21 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/layout_toolbar_native"
layout="@layout/view_toolbar_native" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:navigationIcon="@drawable/ic_arrow_back" />
<com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/layout_toolbar_native"
android:layout_below="@+id/toolbar"
android:clipToPadding="true"
android:paddingBottom="@dimen/height_bottom_adj"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:stackFromEnd="false" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -28,9 +28,13 @@
android:weightSum="2"
tools:context=".view.ui.splash.SplashFragment">
<include
android:id="@+id/layout_toolbar_action"
layout="@layout/view_toolbar_native" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:menu="@menu/menu_splash" />
<RelativeLayout
android:id="@+id/layout_top"

View File

@@ -22,15 +22,21 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/layout_action_toolbar"
layout="@layout/view_toolbar_native" />
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/actionBarSize"
android:theme="?attr/actionBarTheme"
app:menu="@menu/menu_import_export"
app:navigationIcon="@drawable/ic_arrow_back"
app:title="@string/title_spoof_manager" />
<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/layout_action_toolbar"
android:layout_below="@id/toolbar"
android:background="@android:color/transparent"
app:tabGravity="fill"
app:tabIndicator="@drawable/tab_indicator"
@@ -44,4 +50,4 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/tab_layout" />
</RelativeLayout>
</RelativeLayout>

View File

@@ -1,32 +0,0 @@
<!--
~ Aurora Store
~ Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
~
~ Aurora Store is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 2 of the License, or
~ (at your option) any later version.
~
~ Aurora Store is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
~
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
android:id="@+id/layout_toolbar_action"
layout="@layout/view_toolbar_native" />
<FrameLayout
android:id="@+id/settings"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

@@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Aurora Store
~ Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
~
~ Aurora Store is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 2 of the License, or
~ (at your option) any later version.
~
~ Aurora Store is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with Aurora Store. If not, see <http://www.gnu.org/licenses/>.
~
-->
<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="0dp"
app:elevation="0dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:windowBackground"
app:layout_scrollFlags="enterAlways|exitUntilCollapsed" />
</com.google.android.material.appbar.AppBarLayout>

View File

@@ -71,12 +71,12 @@
android:id="@+id/appsGamesFragment"
android:name="com.aurora.store.view.ui.all.AppsGamesFragment"
android:label="@string/title_apps_games"
tools:layout="@layout/fragment_generic_with_pager" />
tools:layout="@layout/fragment_generic_with_search" />
<fragment
android:id="@+id/spoofFragment"
android:name="com.aurora.store.view.ui.spoof.SpoofFragment"
android:label="@string/title_spoof_manager"
tools:layout="@layout/fragment_generic_with_pager" />
tools:layout="@layout/fragment_spoof" />
<fragment
android:id="@+id/favouriteFragment"
android:name="com.aurora.store.view.ui.commons.FavouriteFragment"