MainActivity: Move navigation drawer items into dialogfragment
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -157,6 +157,7 @@ dependencies {
|
||||
|
||||
//Coil
|
||||
implementation(libs.coil.kt)
|
||||
implementation(libs.coil.compose)
|
||||
|
||||
//Shimmer
|
||||
implementation(libs.facebook.shimmer)
|
||||
|
||||
@@ -25,6 +25,11 @@ object Constants {
|
||||
|
||||
const val APP_ID = "com.aurora.store"
|
||||
|
||||
const val URL_TOS = "https://play.google.com/about/play-terms/"
|
||||
const val URL_LICENSE = "https://gitlab.com/AuroraOSS/AuroraStore/blob/master/LICENSE"
|
||||
const val URL_DISCLAIMER = "https://gitlab.com/AuroraOSS/AuroraStore/blob/master/DISCLAIMER.md"
|
||||
const val URL_POLICY = "https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/POLICY.md"
|
||||
|
||||
const val EXODUS_SUBMIT_PAGE = "https://reports.exodus-privacy.eu.org/analysis/submit/#"
|
||||
const val EXODUS_REPORT_URL = "https://reports.exodus-privacy.eu.org/reports/"
|
||||
const val SHARE_URL = "https://play.google.com/store/apps/details?id="
|
||||
|
||||
@@ -20,32 +20,17 @@
|
||||
|
||||
package com.aurora.store
|
||||
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.provider.Settings
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.activity.addCallback
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_LOCKED_CLOSED
|
||||
import androidx.drawerlayout.widget.DrawerLayout.LOCK_MODE_UNLOCKED
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.FloatingWindow
|
||||
import androidx.navigation.NavController
|
||||
import androidx.navigation.fragment.NavHostFragment
|
||||
import androidx.navigation.ui.AppBarConfiguration
|
||||
import androidx.navigation.ui.navigateUp
|
||||
import androidx.navigation.ui.setupActionBarWithNavController
|
||||
import androidx.navigation.ui.setupWithNavController
|
||||
import coil.load
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import com.aurora.Constants
|
||||
import com.aurora.extensions.accentColor
|
||||
import com.aurora.extensions.applyThemeAccent
|
||||
@@ -56,7 +41,6 @@ import com.aurora.store.util.Log
|
||||
import com.aurora.store.util.Preferences
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
|
||||
import com.aurora.store.view.ui.sheets.NetworkDialogSheet
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@@ -65,7 +49,6 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var B: ActivityMainBinding
|
||||
private lateinit var navController: NavController
|
||||
private lateinit var appConfig: AppBarConfiguration
|
||||
|
||||
// TopLevelFragments
|
||||
private val topLevelFrags = listOf(
|
||||
@@ -111,11 +94,11 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
// Toolbar
|
||||
setSupportActionBar(B.toolbar)
|
||||
|
||||
attachNavigation()
|
||||
attachDrawer()
|
||||
B.navView.apply {
|
||||
val alphaColor = ColorUtils.setAlphaComponent(this@MainActivity.accentColor(), 100)
|
||||
setupWithNavController(navController)
|
||||
itemActiveIndicatorColor = ColorStateList.valueOf(alphaColor)
|
||||
}
|
||||
|
||||
// Handle quick exit from back actions
|
||||
val defaultTab = when (Preferences.getInteger(this, PREFERENCE_DEFAULT_SELECTED_TAB)) {
|
||||
@@ -124,7 +107,6 @@ class MainActivity : AppCompatActivity() {
|
||||
else -> R.id.appsContainerFragment
|
||||
}
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
if (!B.drawerLayout.isOpen) {
|
||||
if (navController.currentDestination?.id in topLevelFrags) {
|
||||
if (navController.currentDestination?.id == defaultTab) {
|
||||
finish()
|
||||
@@ -137,9 +119,6 @@ class MainActivity : AppCompatActivity() {
|
||||
} else {
|
||||
navController.navigateUp()
|
||||
}
|
||||
} else {
|
||||
B.drawerLayout.close()
|
||||
}
|
||||
}
|
||||
|
||||
// Handle intents
|
||||
@@ -152,83 +131,12 @@ class MainActivity : AppCompatActivity() {
|
||||
navController.addOnDestinationChangedListener { _, navDestination, _ ->
|
||||
if (navDestination !is FloatingWindow) {
|
||||
when (navDestination.id) {
|
||||
in topLevelFrags -> {
|
||||
B.navView.visibility = View.VISIBLE
|
||||
B.toolbar.visibility = View.VISIBLE
|
||||
B.drawerLayout.setDrawerLockMode(LOCK_MODE_UNLOCKED)
|
||||
}
|
||||
|
||||
else -> {
|
||||
hideTopLevelOnlyViews()
|
||||
in topLevelFrags -> B.navView.visibility = View.VISIBLE
|
||||
else -> B.navView.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
menuInflater.inflate(R.menu.menu_main, menu)
|
||||
return true
|
||||
}
|
||||
|
||||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
when (item.itemId) {
|
||||
R.id.menu_download_manager -> {
|
||||
navController.navigate(R.id.downloadFragment)
|
||||
return true
|
||||
}
|
||||
}
|
||||
return super.onOptionsItemSelected(item)
|
||||
}
|
||||
|
||||
private fun hideTopLevelOnlyViews() {
|
||||
B.navView.visibility = View.GONE
|
||||
B.toolbar.visibility = View.GONE
|
||||
B.drawerLayout.setDrawerLockMode(LOCK_MODE_LOCKED_CLOSED)
|
||||
}
|
||||
|
||||
private fun attachNavigation() {
|
||||
val bottomNavigationView: BottomNavigationView = B.navView
|
||||
bottomNavigationView.setupWithNavController(navController)
|
||||
|
||||
bottomNavigationView.apply {
|
||||
val alphaColor = ColorUtils.setAlphaComponent(this@MainActivity.accentColor(), 100)
|
||||
itemActiveIndicatorColor = ColorStateList.valueOf(alphaColor)
|
||||
}
|
||||
}
|
||||
|
||||
private fun attachDrawer() {
|
||||
val headerView: View = B.navigation.getHeaderView(0)
|
||||
|
||||
headerView.let {
|
||||
it.findViewById<ImageView>(R.id.img)?.load(R.mipmap.ic_launcher) {
|
||||
transformations(RoundedCornersTransformation(8F))
|
||||
}
|
||||
it.findViewById<TextView>(R.id.txt_name)?.text = getString(R.string.app_name)
|
||||
it.findViewById<TextView>(R.id.txt_email)?.text = getString(
|
||||
R.string.version,
|
||||
BuildConfig.VERSION_NAME,
|
||||
BuildConfig.VERSION_CODE
|
||||
)
|
||||
}
|
||||
|
||||
appConfig = AppBarConfiguration.Builder(topLevelFrags.toSet())
|
||||
.setOpenableLayout(B.root)
|
||||
.build()
|
||||
setupActionBarWithNavController(navController, appConfig)
|
||||
B.navigation.setupWithNavController(navController)
|
||||
}
|
||||
|
||||
override fun onSupportNavigateUp(): Boolean {
|
||||
return navController.navigateUp(appConfig)
|
||||
}
|
||||
|
||||
private fun checkExternalStorageManagerPermission() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
if (!Environment.isExternalStorageManager())
|
||||
startActivity(Intent(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION))
|
||||
}
|
||||
}
|
||||
|
||||
private fun isIntroDone(): Boolean {
|
||||
return Preferences.getBoolean(this@MainActivity, Preferences.PREFERENCE_INTRO)
|
||||
|
||||
@@ -26,6 +26,9 @@ import androidx.fragment.app.activityViewModels
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import coil.load
|
||||
import coil.transform.RoundedCornersTransformation
|
||||
import com.aurora.Constants.URL_DISCLAIMER
|
||||
import com.aurora.Constants.URL_LICENSE
|
||||
import com.aurora.Constants.URL_TOS
|
||||
import com.aurora.extensions.browse
|
||||
import com.aurora.gplayapi.data.models.AuthData
|
||||
import com.aurora.store.R
|
||||
@@ -48,11 +51,6 @@ class AccountFragment : Fragment(R.layout.fragment_account) {
|
||||
private lateinit var authData: AuthData
|
||||
private lateinit var accountProvider: AccountProvider
|
||||
|
||||
private val URL_TOS = "https://play.google.com/about/play-terms/"
|
||||
private val URL_LICENSE = "https://gitlab.com/AuroraOSS/AuroraStore/blob/master/LICENSE"
|
||||
private val URL_DISCLAIMER =
|
||||
"https://gitlab.com/AuroraOSS/AuroraStore/blob/master/DISCLAIMER.md"
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
_binding = FragmentAccountBinding.bind(view)
|
||||
|
||||
@@ -26,6 +26,7 @@ import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.aurora.store.MobileNavigationDirections
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.providers.AuthProvider
|
||||
import com.aurora.store.databinding.FragmentAppsGamesBinding
|
||||
@@ -48,6 +49,24 @@ class AppsContainerFragment : Fragment(R.layout.fragment_apps_games) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
_binding = FragmentAppsGamesBinding.bind(view)
|
||||
|
||||
// Toolbar
|
||||
binding.toolbar.apply {
|
||||
title = getString(R.string.title_apps)
|
||||
setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_download_manager -> {
|
||||
findNavController().navigate(R.id.downloadFragment)
|
||||
}
|
||||
R.id.menu_more -> {
|
||||
findNavController().navigate(
|
||||
MobileNavigationDirections.actionGlobalMoreDialogFragment()
|
||||
)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
// ViewPager
|
||||
val isForYouEnabled = Preferences.getBoolean(
|
||||
requireContext(),
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
package com.aurora.store.view.ui.commons
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.ColorFilter
|
||||
import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.util.fastForEach
|
||||
import androidx.core.graphics.ColorUtils
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import coil.compose.SubcomposeAsyncImage
|
||||
import coil.request.ImageRequest
|
||||
import com.aurora.Constants
|
||||
import com.aurora.Constants.URL_TOS
|
||||
import com.aurora.extensions.accentColor
|
||||
import com.aurora.extensions.browse
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.providers.AuthProvider
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
|
||||
class MoreDialogFragment : DialogFragment() {
|
||||
|
||||
private data class Option(
|
||||
@StringRes val title: Int,
|
||||
@DrawableRes val icon: Int,
|
||||
@IdRes val destinationID: Int
|
||||
)
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
return MaterialAlertDialogBuilder(requireContext())
|
||||
.setView(customDialogView(requireContext()))
|
||||
.create()
|
||||
}
|
||||
|
||||
private fun customDialogView(context: Context): ComposeView {
|
||||
return ComposeView(context).apply {
|
||||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||
setContent {
|
||||
val bColor = ColorUtils.setAlphaComponent(LocalContext.current.accentColor(), 20)
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(color = Color(bColor))
|
||||
.verticalScroll(rememberScrollState())
|
||||
.padding(13.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(5.dp, Alignment.CenterVertically)
|
||||
) {
|
||||
AppBar()
|
||||
AccountHeader()
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.clip(
|
||||
RoundedCornerShape(
|
||||
topStart = 5.dp,
|
||||
topEnd = 5.dp,
|
||||
bottomStart = 20.dp,
|
||||
bottomEnd = 20.dp
|
||||
)
|
||||
)
|
||||
.background(color = Color.White)
|
||||
) {
|
||||
getOptions().fastForEach { option -> OptionItem(option = option) }
|
||||
}
|
||||
getExtraOptions().fastForEach { option -> OptionItem(option = option) }
|
||||
Footer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun AppBar() {
|
||||
Box(contentAlignment = Alignment.CenterStart) {
|
||||
IconButton(onClick = { findNavController().navigateUp() }) {
|
||||
Icon(
|
||||
painter = painterResource(id = R.drawable.ic_cancel),
|
||||
contentDescription = stringResource(id = R.string.action_cancel),
|
||||
tint = Color.Black
|
||||
)
|
||||
}
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = stringResource(id = R.string.app_name),
|
||||
style = MaterialTheme.typography.titleMedium,
|
||||
textAlign = TextAlign.Center
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Footer() {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(5.dp, Alignment.CenterHorizontally)
|
||||
) {
|
||||
TextButton(onClick = { requireContext().browse(Constants.URL_POLICY) }) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.privacy_policy_title),
|
||||
color = Color.Black
|
||||
)
|
||||
}
|
||||
Text(text = "•")
|
||||
TextButton(onClick = { requireContext().browse(URL_TOS) }) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.menu_terms),
|
||||
color = Color.Black
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun AccountHeader() {
|
||||
val authData = AuthProvider.with(LocalContext.current).getAuthData()
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(
|
||||
RoundedCornerShape(
|
||||
topStart = 20.dp,
|
||||
topEnd = 20.dp,
|
||||
bottomStart = 5.dp,
|
||||
bottomEnd = 5.dp
|
||||
)
|
||||
)
|
||||
.background(color = Color.White)
|
||||
.padding(20.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(15.dp),
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth(),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(15.dp, Alignment.Start)
|
||||
) {
|
||||
SubcomposeAsyncImage(
|
||||
model = ImageRequest.Builder(LocalContext.current)
|
||||
.data(if (authData.isAnonymous) R.mipmap.ic_launcher else authData.userProfile?.artwork?.url)
|
||||
.placeholder(R.drawable.ic_account)
|
||||
.crossfade(true)
|
||||
.build(),
|
||||
contentDescription = stringResource(id = R.string.title_account_manager),
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.requiredSize(48.dp)
|
||||
.clip(CircleShape)
|
||||
)
|
||||
Column(
|
||||
verticalArrangement = Arrangement.Top,
|
||||
horizontalAlignment = Alignment.Start
|
||||
) {
|
||||
Text(
|
||||
text = if (authData.isAnonymous) "anonymous" else authData.userProfile!!.name,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
fontSize = 16.sp
|
||||
)
|
||||
Text(
|
||||
text = if (authData.isAnonymous) "anonymous@gmail.com" else authData.userProfile!!.email,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp
|
||||
)
|
||||
}
|
||||
}
|
||||
OutlinedButton(
|
||||
onClick = { findNavController().navigate(R.id.accountFragment) },
|
||||
shape = RoundedCornerShape(12.dp)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.manage_account),
|
||||
color = Color.Black
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun OptionItem(option: Option) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable { findNavController().navigate(option.destinationID) }
|
||||
.padding(15.dp),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.spacedBy(8.dp, Alignment.Start)
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = option.icon),
|
||||
contentDescription = stringResource(id = option.title),
|
||||
colorFilter = ColorFilter.tint(color = Color.Black),
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 10.dp)
|
||||
.requiredSize(25.dp)
|
||||
)
|
||||
Text(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
text = stringResource(id = option.title),
|
||||
color = Color.Black,
|
||||
fontSize = 16.sp,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun getOptions(): List<Option> {
|
||||
return listOf(
|
||||
Option(
|
||||
title = R.string.title_apps_games,
|
||||
icon = R.drawable.ic_apps,
|
||||
destinationID = R.id.appsGamesFragment
|
||||
),
|
||||
Option(
|
||||
title = R.string.title_apps_sale,
|
||||
icon = R.drawable.ic_sale,
|
||||
destinationID = R.id.appSalesFragment
|
||||
),
|
||||
Option(
|
||||
title = R.string.title_blacklist_manager,
|
||||
icon = R.drawable.ic_blacklist,
|
||||
destinationID = R.id.blacklistFragment
|
||||
),
|
||||
Option(
|
||||
title = R.string.title_spoof_manager,
|
||||
icon = R.drawable.ic_spoof,
|
||||
destinationID = R.id.spoofFragment
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
private fun getExtraOptions(): List<Option> {
|
||||
return listOf(
|
||||
Option(
|
||||
title = R.string.title_settings,
|
||||
icon = R.drawable.ic_menu_settings,
|
||||
destinationID = R.id.settingsFragment
|
||||
),
|
||||
Option(
|
||||
title = R.string.title_about,
|
||||
icon = R.drawable.ic_menu_about,
|
||||
destinationID = R.id.aboutFragment
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import androidx.fragment.app.FragmentManager
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.aurora.store.MobileNavigationDirections
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.providers.AuthProvider
|
||||
import com.aurora.store.databinding.FragmentAppsGamesBinding
|
||||
@@ -48,6 +49,24 @@ class GamesContainerFragment : Fragment(R.layout.fragment_apps_games) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
_binding = FragmentAppsGamesBinding.bind(view)
|
||||
|
||||
// Toolbar
|
||||
binding.toolbar.apply {
|
||||
title = getString(R.string.title_games)
|
||||
setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_download_manager -> {
|
||||
findNavController().navigate(R.id.downloadFragment)
|
||||
}
|
||||
R.id.menu_more -> {
|
||||
findNavController().navigate(
|
||||
MobileNavigationDirections.actionGlobalMoreDialogFragment()
|
||||
)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
}
|
||||
|
||||
// ViewPager
|
||||
val isForYouEnabled = Preferences.getBoolean(
|
||||
requireContext(),
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.aurora.extensions.browse
|
||||
import com.aurora.extensions.isRAndAbove
|
||||
import com.aurora.extensions.toast
|
||||
import com.aurora.gplayapi.data.models.App
|
||||
import com.aurora.store.MobileNavigationDirections
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.event.BusEvent
|
||||
import com.aurora.store.data.room.download.Download
|
||||
@@ -87,6 +88,21 @@ class UpdatesFragment : BaseFragment(R.layout.fragment_updates) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
_binding = FragmentUpdatesBinding.bind(view)
|
||||
|
||||
// Toolbar
|
||||
binding.toolbar.setOnMenuItemClickListener {
|
||||
when (it.itemId) {
|
||||
R.id.menu_download_manager -> {
|
||||
findNavController().navigate(R.id.downloadFragment)
|
||||
}
|
||||
R.id.menu_more -> {
|
||||
findNavController().navigate(
|
||||
MobileNavigationDirections.actionGlobalMoreDialogFragment()
|
||||
)
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
viewModel.observe()
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
viewModel.updates.combine(viewModel.downloadsList) { uList, dList ->
|
||||
|
||||
11
app/src/main/res/drawable/ic_account.xml
Normal file
11
app/src/main/res/drawable/ic_account.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M234,684Q285,645 348,622.5Q411,600 480,600Q549,600 612,622.5Q675,645 726,684Q761,643 780.5,591Q800,539 800,480Q800,347 706.5,253.5Q613,160 480,160Q347,160 253.5,253.5Q160,347 160,480Q160,539 179.5,591Q199,643 234,684ZM480,520Q421,520 380.5,479.5Q340,439 340,380Q340,321 380.5,280.5Q421,240 480,240Q539,240 579.5,280.5Q620,321 620,380Q620,439 579.5,479.5Q539,520 480,520ZM480,880Q397,880 324,848.5Q251,817 197,763Q143,709 111.5,636Q80,563 80,480Q80,397 111.5,324Q143,251 197,197Q251,143 324,111.5Q397,80 480,80Q563,80 636,111.5Q709,143 763,197Q817,251 848.5,324Q880,397 880,480Q880,563 848.5,636Q817,709 763,763Q709,817 636,848.5Q563,880 480,880ZM480,800Q533,800 580,784.5Q627,769 666,740Q627,711 580,695.5Q533,680 480,680Q427,680 380,695.5Q333,711 294,740Q333,769 380,784.5Q427,800 480,800ZM480,440Q506,440 523,423Q540,406 540,380Q540,354 523,337Q506,320 480,320Q454,320 437,337Q420,354 420,380Q420,406 437,423Q454,440 480,440ZM480,380Q480,380 480,380Q480,380 480,380Q480,380 480,380Q480,380 480,380Q480,380 480,380Q480,380 480,380Q480,380 480,380Q480,380 480,380ZM480,740Q480,740 480,740Q480,740 480,740Q480,740 480,740Q480,740 480,740Q480,740 480,740Q480,740 480,740Q480,740 480,740Q480,740 480,740Z"/>
|
||||
</vector>
|
||||
@@ -20,9 +20,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M17,13a4,4 0,1 1,0 8c-2.142,0 -4,-1.79 -4,-4h-2a4,4 0,1 1,-0.535 -2h3.07A3.998,3.998 0,0 1,17 13zM2,12v-2h2V7a4,4 0,0 1,4 -4h8a4,4 0,0 1,4 4v3h2v2H2z" />
|
||||
</vector>
|
||||
|
||||
11
app/src/main/res/drawable/ic_settings_account.xml
Normal file
11
app/src/main/res/drawable/ic_settings_account.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M580,920Q555,920 537.5,902.5Q520,885 520,860L520,580Q520,555 537.5,537.5Q555,520 580,520L860,520Q885,520 902.5,537.5Q920,555 920,580L920,860Q920,885 902.5,902.5Q885,920 860,920L580,920ZM580,860L860,860L860,828Q835,797 799,778.5Q763,760 720,760Q677,760 641,778.5Q605,797 580,828L580,860ZM720,720Q745,720 762.5,702.5Q780,685 780,660Q780,635 762.5,617.5Q745,600 720,600Q695,600 677.5,617.5Q660,635 660,660Q660,685 677.5,702.5Q695,720 720,720ZM480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480Q480,480 480,480L480,480L480,480L480,480Q480,480 480,480Q480,480 480,480L480,480ZM482,340Q424,340 383,381Q342,422 342,480Q342,528 369,564Q396,600 440,614L440,524Q432,516 427,503.5Q422,491 422,480Q422,455 439.5,437.5Q457,420 482,420Q496,420 507,425.5Q518,431 526,440L616,440Q603,396 566.5,368Q530,340 482,340ZM370,880L354,752Q341,747 329.5,740Q318,733 307,725L188,775L78,585L181,507Q180,500 180,493.5Q180,487 180,480Q180,473 180,466.5Q180,460 181,453L78,375L188,185L307,235Q318,227 330,220Q342,213 354,208L370,80L590,80L606,208Q619,213 630.5,220Q642,227 653,235L772,185L882,375L797,440Q797,440 797,440Q797,440 797,440L696,440Q695,435 694,429.5Q693,424 691,419L777,354L738,286L639,328Q617,305 590.5,289.5Q564,274 533,266L520,160L441,160L427,266Q396,274 369.5,289.5Q343,305 321,327L222,286L183,354L269,418Q264,433 262,448Q260,463 260,480Q260,496 262,511Q264,526 269,541L183,606L222,674L321,632Q345,657 375,674Q405,691 440,696L440,880L370,880Z"/>
|
||||
</vector>
|
||||
@@ -1,4 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Aurora Store
|
||||
~ Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
|
||||
~
|
||||
@@ -17,57 +18,30 @@
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/drawer_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<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:menu="@menu/menu_main"
|
||||
app:title="@string/app_name" />
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/nav_host_fragment"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/nav_view"
|
||||
android:layout_below="@+id/toolbar"
|
||||
android:layout_height="0dp"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_constraintBottom_toTopOf="@+id/nav_view"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/mobile_navigation" />
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/nav_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
app:labelVisibilityMode="labeled"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:menu="@menu/menu_bottom_nav" />
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
<com.google.android.material.navigation.NavigationView
|
||||
android:id="@+id/navigation"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
android:background="?android:attr/windowBackground"
|
||||
android:overScrollMode="never"
|
||||
app:headerLayout="@layout/layout_nav_header"
|
||||
app:itemIconTint="?android:attr/colorAccent"
|
||||
app:itemTextAppearance="@style/TextAppearance.Aurora.Line1"
|
||||
app:menu="@menu/menu_drawer" />
|
||||
</androidx.drawerlayout.widget.DrawerLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@@ -23,10 +23,19 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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_main" />
|
||||
|
||||
<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/toolbar"
|
||||
android:background="@android:color/transparent"
|
||||
android:paddingStart="@dimen/margin_large"
|
||||
android:paddingEnd="@dimen/margin_large"
|
||||
|
||||
@@ -24,10 +24,20 @@
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<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_main"
|
||||
app:title="@string/title_updates" />
|
||||
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/swipe_refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@id/toolbar">
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/recycler"
|
||||
|
||||
@@ -1,54 +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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/nav_header_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/padding_large"
|
||||
android:paddingTop="@dimen/padding_small"
|
||||
android:paddingEnd="@dimen/padding_small"
|
||||
android:paddingBottom="@dimen/padding_small">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/img"
|
||||
android:layout_width="@dimen/icon_size_large"
|
||||
android:layout_height="@dimen/icon_size_large"
|
||||
app:srcCompat="@drawable/bg_placeholder" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/txt_name"
|
||||
style="@style/AuroraTextStyle.Subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/img"
|
||||
android:layout_marginTop="@dimen/margin_small"
|
||||
tools:text="Aurora Store" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/txt_email"
|
||||
style="@style/AuroraTextStyle.Line1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/txt_name"
|
||||
android:layout_marginTop="@dimen/margin_xxsmall"
|
||||
tools:text="4.0.1" />
|
||||
</RelativeLayout>
|
||||
@@ -1,67 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<group android:id="@+id/group1">
|
||||
<item
|
||||
android:id="@id/appsGamesFragment"
|
||||
android:icon="@drawable/ic_apps"
|
||||
android:title="@string/title_apps_games" />
|
||||
|
||||
<item
|
||||
android:id="@id/appSalesFragment"
|
||||
android:icon="@drawable/ic_sale"
|
||||
android:title="@string/title_apps_sale" />
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/group2">
|
||||
<item
|
||||
android:id="@id/blacklistFragment"
|
||||
android:icon="@drawable/ic_blacklist"
|
||||
android:title="@string/title_blacklist_manager" />
|
||||
<item
|
||||
android:id="@id/spoofFragment"
|
||||
android:icon="@drawable/ic_spoof"
|
||||
android:title="@string/title_spoof_manager" />
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/group3">
|
||||
<item
|
||||
android:id="@id/downloadFragment"
|
||||
android:icon="@drawable/ic_download_manager"
|
||||
android:title="@string/title_download_manager" />
|
||||
|
||||
<item
|
||||
android:id="@id/accountFragment"
|
||||
android:icon="@drawable/ic_account_manager"
|
||||
android:title="@string/title_account_manager" />
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/group4">
|
||||
<item
|
||||
android:id="@id/settingsFragment"
|
||||
android:icon="@drawable/ic_menu_settings"
|
||||
android:title="@string/title_settings" />
|
||||
|
||||
<item
|
||||
android:id="@id/aboutFragment"
|
||||
android:icon="@drawable/ic_menu_about"
|
||||
android:title="@string/title_about" />
|
||||
</group>
|
||||
</menu>
|
||||
@@ -24,5 +24,11 @@
|
||||
android:id="@+id/menu_download_manager"
|
||||
android:icon="@drawable/ic_download_manager"
|
||||
android:title="@string/title_download_manager"
|
||||
app:showAsAction="always" />
|
||||
app:showAsAction="ifRoom" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_more"
|
||||
android:icon="@drawable/ic_settings_account"
|
||||
android:title="@string/title_more"
|
||||
app:showAsAction="ifRoom" />
|
||||
</menu>
|
||||
|
||||
@@ -50,6 +50,9 @@
|
||||
<action
|
||||
android:id="@+id/action_global_dozeWarningSheet"
|
||||
app:destination="@id/dozeWarningSheet" />
|
||||
<action
|
||||
android:id="@+id/action_global_moreDialogFragment"
|
||||
app:destination="@id/moreDialogFragment" />
|
||||
<fragment
|
||||
android:id="@+id/appsContainerFragment"
|
||||
android:name="com.aurora.store.view.ui.apps.AppsContainerFragment"
|
||||
@@ -477,4 +480,8 @@
|
||||
app:argType="boolean"
|
||||
android:defaultValue="false" />
|
||||
</dialog>
|
||||
<dialog
|
||||
android:id="@+id/moreDialogFragment"
|
||||
android:name="com.aurora.store.view.ui.commons.MoreDialogFragment"
|
||||
android:label="MoreDialogFragment" />
|
||||
</navigation>
|
||||
|
||||
@@ -431,4 +431,8 @@
|
||||
|
||||
<!-- AboutFragment -->
|
||||
<string name="version" translatable="false">v<xliff:g id="version_name">%1$s</xliff:g> (<xliff:g id="version_code">%2$d</xliff:g>)</string>
|
||||
|
||||
<!-- MoreDialogFragment -->
|
||||
<string name="title_more">More</string>
|
||||
<string name="manage_account">Manage your account</string>
|
||||
</resources>
|
||||
|
||||
@@ -63,6 +63,7 @@ androidx-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit
|
||||
androidx-viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "viewpager2Version" }
|
||||
androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workVersion" }
|
||||
coil-kt = { module = "io.coil-kt:coil", version.ref = "coilVersion" }
|
||||
coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coilVersion" }
|
||||
facebook-shimmer = { module = "com.facebook.shimmer:shimmer", version.ref = "shimmerVersion" }
|
||||
gitlab-auroraoss-gplayapi = { module = "com.gitlab.AuroraOSS:gplayapi", version.ref = "gplayapiVersion" }
|
||||
github-topjohnwu-libsu = { module = "com.github.topjohnwu.libsu:core", version.ref = "core" }
|
||||
|
||||
Reference in New Issue
Block a user