MainActivity: Move to actual toolbar
Drop downloads icon as its already present in drawer Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -41,6 +41,7 @@ import androidx.core.view.GravityCompat
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.NavDestination
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
import com.aurora.Constants
|
||||
import com.aurora.extensions.*
|
||||
@@ -131,7 +132,14 @@ class MainActivity : AppCompatActivity(), NetworkProvider.NetworkListener {
|
||||
|
||||
authData = AuthProvider.with(this).getAuthData()
|
||||
|
||||
attachToolbar()
|
||||
// Toolbar
|
||||
B.toolbar.apply {
|
||||
elevation = 0f
|
||||
setNavigationOnClickListener {
|
||||
B.drawerLayout.openDrawer(GravityCompat.START, true)
|
||||
}
|
||||
}
|
||||
|
||||
attachNavigation()
|
||||
attachDrawer()
|
||||
attachSearch()
|
||||
@@ -178,7 +186,7 @@ class MainActivity : AppCompatActivity(), NetworkProvider.NetworkListener {
|
||||
R.id.updatesFragment -> {
|
||||
B.searchFab.visibility = View.VISIBLE
|
||||
B.navView.visibility = View.VISIBLE
|
||||
B.viewToolbar.root.visibility = View.VISIBLE
|
||||
B.toolbar.visibility = View.VISIBLE
|
||||
window.navigationBarColor = SurfaceColors.SURFACE_2.getColor(this)
|
||||
}
|
||||
R.id.appDetailsFragment -> {
|
||||
@@ -196,17 +204,7 @@ class MainActivity : AppCompatActivity(), NetworkProvider.NetworkListener {
|
||||
private fun hideTopLevelOnlyViews() {
|
||||
B.searchFab.visibility = View.GONE
|
||||
B.navView.visibility = View.GONE
|
||||
B.viewToolbar.root.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun attachToolbar() {
|
||||
B.viewToolbar.imgActionPrimary.setOnClickListener {
|
||||
B.drawerLayout.openDrawer(GravityCompat.START, true)
|
||||
}
|
||||
|
||||
B.viewToolbar.imgActionSecondary.setOnClickListener {
|
||||
navController.navigate(R.id.downloadFragment)
|
||||
}
|
||||
B.toolbar.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun attachSearch() {
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?android:attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FFF"
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M21,18v2L3,20v-2h18zM17.404,3.904L22,8.5l-4.596,4.596 -1.414,-1.414L19.172,8.5 15.99,5.318l1.414,-1.414zM12,11v2L3,13v-2h9zM12,4v2L3,6L3,4h9z" />
|
||||
</vector>
|
||||
|
||||
@@ -33,9 +33,12 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<include
|
||||
android:id="@+id/view_toolbar"
|
||||
layout="@layout/view_toolbar_main" />
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:navigationIcon="@drawable/ic_menu_unfold"
|
||||
app:title="@string/app_name" />
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/nav_host_fragment"
|
||||
@@ -43,7 +46,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/nav_view"
|
||||
android:layout_below="@+id/view_toolbar"
|
||||
android:layout_below="@+id/toolbar"
|
||||
app:defaultNavHost="true"
|
||||
app:navGraph="@navigation/mobile_navigation" />
|
||||
|
||||
@@ -82,4 +85,4 @@
|
||||
app:itemIconTint="?android:attr/colorAccent"
|
||||
app:itemTextAppearance="@style/TextAppearance.Aurora.Line1"
|
||||
app:menu="@menu/menu_drawer" />
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
|
||||
@@ -1,66 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:paddingStart="@dimen/padding_normal"
|
||||
android:paddingEnd="@dimen/padding_normal">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/img_action_primary"
|
||||
android:layout_width="@dimen/icon_size_default"
|
||||
android:layout_height="@dimen/icon_size_default"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginEnd="@dimen/margin_small"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="@dimen/padding_xxsmall"
|
||||
android:contentDescription="@string/menu"
|
||||
app:srcCompat="@drawable/ic_menu_unfold"
|
||||
app:tint="?colorControlNormal" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/txt_title"
|
||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@id/img_action_secondary"
|
||||
android:layout_toEndOf="@id/img_action_primary"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="@dimen/padding_normal"
|
||||
android:paddingEnd="@dimen/padding_normal"
|
||||
android:singleLine="true"
|
||||
android:text="@string/app_name" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/img_action_secondary"
|
||||
android:layout_width="@dimen/icon_size_default"
|
||||
android:layout_height="@dimen/icon_size_default"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="@dimen/margin_small"
|
||||
android:background="?selectableItemBackgroundBorderless"
|
||||
android:padding="@dimen/padding_xxsmall"
|
||||
android:contentDescription="@string/title_download_manager"
|
||||
app:srcCompat="@drawable/ic_download"
|
||||
app:tint="?colorControlNormal" />
|
||||
</RelativeLayout>
|
||||
Reference in New Issue
Block a user