mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-05-19 22:08:23 -04:00
compose: Migrate onboarding logic to compose
* Still needs implementation for showing microG installation screen on huawei * No anonymous mode on huawei * Needs handling for showing permissions screen via settings Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -1,164 +0,0 @@
|
||||
package com.aurora.store.view.ui.onboarding
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import com.aurora.Constants.PACKAGE_NAME_GMS
|
||||
import com.aurora.extensions.browse
|
||||
import com.aurora.store.AuroraApp
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.event.Event
|
||||
import com.aurora.store.data.event.InstallerEvent
|
||||
import com.aurora.store.data.model.Dash
|
||||
import com.aurora.store.data.model.DownloadStatus
|
||||
import com.aurora.store.databinding.FragmentOnboardingMicrogBinding
|
||||
import com.aurora.store.util.PackageUtil
|
||||
import com.aurora.store.view.epoxy.views.EpoxyTextViewModel_
|
||||
import com.aurora.store.view.epoxy.views.preference.DashViewModel_
|
||||
import com.aurora.store.view.ui.commons.BaseFragment
|
||||
import com.aurora.store.viewmodel.onboarding.MicroGViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@AndroidEntryPoint
|
||||
class MicroGFragment : BaseFragment<FragmentOnboardingMicrogBinding>() {
|
||||
// Shared ViewModel
|
||||
val microGViewModel: MicroGViewModel by activityViewModels()
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
with(binding) {
|
||||
// RecyclerView
|
||||
epoxyRecycler.withModels {
|
||||
setFilterDuplicates(true)
|
||||
|
||||
add(
|
||||
EpoxyTextViewModel_()
|
||||
.id("microg_desc")
|
||||
.title(getString(R.string.onboarding_gms_missing))
|
||||
.size(14)
|
||||
.style(R.style.AuroraTextStyle)
|
||||
)
|
||||
|
||||
add(
|
||||
EpoxyTextViewModel_()
|
||||
.id("microg_gms")
|
||||
.title(getString(R.string.onboarding_gms_microg))
|
||||
.size(14)
|
||||
.style(R.style.AuroraTextStyle)
|
||||
)
|
||||
|
||||
|
||||
dashItems().forEach {
|
||||
add(
|
||||
DashViewModel_()
|
||||
.id(it.id)
|
||||
.dash(it)
|
||||
.click { _ ->
|
||||
requireContext().browse(it.url)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
checkboxAgreement.setOnCheckedChangeListener { _, value ->
|
||||
microGViewModel.markAgreement(value)
|
||||
btnMicroG.isEnabled = value
|
||||
}
|
||||
|
||||
btnMicroG.setOnClickListener { microGViewModel.downloadMicroG() }
|
||||
}
|
||||
|
||||
microGViewModel.download.filterNotNull().onEach {
|
||||
when (it.downloadStatus) {
|
||||
DownloadStatus.DOWNLOADING -> updateProgressBar(visible = true, it.progress)
|
||||
DownloadStatus.FAILED -> updateProgressBar(visible = false, 0)
|
||||
DownloadStatus.QUEUED -> updateProgressBar(visible = true, -1)
|
||||
DownloadStatus.COMPLETED -> updateProgressBar(visible = true, -1)
|
||||
else -> {}
|
||||
}
|
||||
}.launchIn(viewLifecycleOwner.lifecycleScope)
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
AuroraApp.events.installerEvent.collect { onEvent(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun onEvent(event: Event) {
|
||||
when (event) {
|
||||
is InstallerEvent.Installed -> {
|
||||
if (event.packageName == PACKAGE_NAME_GMS) {
|
||||
microGViewModel.downloadCompanion()
|
||||
}
|
||||
|
||||
if (PackageUtil.isMicroGBundleInstalled(requireContext())) {
|
||||
markInstallationComplete()
|
||||
}
|
||||
}
|
||||
|
||||
is InstallerEvent.Failed -> markInstallationFailed()
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateProgressBar(visible: Boolean, downloadProgress: Int) {
|
||||
with(binding.progressBar) {
|
||||
if (visible) show() else hide()
|
||||
isIndeterminate = downloadProgress == -1
|
||||
progress = downloadProgress
|
||||
}
|
||||
}
|
||||
|
||||
private fun markInstallationComplete() {
|
||||
with(binding) {
|
||||
with(btnMicroG) {
|
||||
isEnabled = false
|
||||
text = getString(R.string.title_installed)
|
||||
}
|
||||
checkboxAgreement.isEnabled = false
|
||||
progressBar.hide()
|
||||
}
|
||||
}
|
||||
|
||||
private fun markInstallationFailed() {
|
||||
with(binding) {
|
||||
with(btnMicroG) {
|
||||
isEnabled = false
|
||||
text = getString(R.string.action_install)
|
||||
}
|
||||
checkboxAgreement.isChecked = false
|
||||
progressBar.hide()
|
||||
}
|
||||
}
|
||||
|
||||
private fun dashItems(): List<Dash> {
|
||||
return listOf(
|
||||
Dash(
|
||||
id = 2,
|
||||
title = requireContext().getString(R.string.details_dev_website),
|
||||
subtitle = requireContext().getString(R.string.microg_website),
|
||||
icon = R.drawable.ic_network,
|
||||
url = "https://microG.org"
|
||||
),
|
||||
Dash(
|
||||
id = 4,
|
||||
title = requireContext().getString(R.string.privacy_policy_title),
|
||||
subtitle = requireContext().getString(R.string.microg_privacy_policy),
|
||||
icon = R.drawable.ic_privacy,
|
||||
url = "https://microg.org/privacy.html"
|
||||
),
|
||||
Dash(
|
||||
id = 5,
|
||||
title = requireContext().getString(R.string.menu_disclaimer),
|
||||
subtitle = requireContext().getString(R.string.microg_license_agreement),
|
||||
icon = R.drawable.ic_disclaimer,
|
||||
url = "https://raw.githubusercontent.com/microg/GmsCore/refs/heads/master/LICENSE"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,104 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.ui.onboarding
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.aurora.extensions.isHuawei
|
||||
import com.aurora.store.data.providers.BlacklistProvider
|
||||
import com.aurora.store.util.PackageUtil
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_AUTO_DELETE
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DISPENSER_URLS
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_AURORA_ONLY
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_FDROID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FOR_YOU
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_STYLE
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_CHECK_INTERVAL
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_EXTENDED
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_VENDING_VERSION
|
||||
import com.aurora.store.util.save
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
class OnboardingFragment : BaseFlavouredOnboardingFragment() {
|
||||
@Inject
|
||||
lateinit var blacklistProvider: BlacklistProvider
|
||||
|
||||
override fun loadDefaultPreferences() {
|
||||
/*Filters*/
|
||||
save(PREFERENCE_FILTER_AURORA_ONLY, false)
|
||||
save(PREFERENCE_FILTER_FDROID, true)
|
||||
|
||||
/*Network*/
|
||||
save(PREFERENCE_DISPENSER_URLS, emptySet())
|
||||
save(PREFERENCE_VENDING_VERSION, 0)
|
||||
|
||||
/*Customization*/
|
||||
save(PREFERENCE_THEME_STYLE, 0)
|
||||
save(PREFERENCE_DEFAULT_SELECTED_TAB, 0)
|
||||
save(PREFERENCE_FOR_YOU, true)
|
||||
|
||||
/*Installer*/
|
||||
save(PREFERENCE_AUTO_DELETE, true)
|
||||
save(PREFERENCE_INSTALLER_ID, 0)
|
||||
|
||||
/*Updates*/
|
||||
save(PREFERENCE_UPDATES_EXTENDED, false)
|
||||
save(PREFERENCE_UPDATES_CHECK_INTERVAL, 3)
|
||||
}
|
||||
|
||||
override fun onboardingPages(): List<Fragment> {
|
||||
var pages = mutableListOf(
|
||||
WelcomeFragment(),
|
||||
PermissionsFragment.newInstance()
|
||||
)
|
||||
|
||||
/**
|
||||
* MicroG Fragment Preconditions:
|
||||
* 1. It should be a Huawei device
|
||||
* 2. Supported App Gallery should be available, i.e. v15.1.x or above
|
||||
* 3. MicroG bundle should not be already installed
|
||||
*/
|
||||
if (
|
||||
isHuawei &&
|
||||
PackageUtil.hasSupportedAppGallery(requireContext()) &&
|
||||
!PackageUtil.isMicroGBundleInstalled(requireContext())
|
||||
) {
|
||||
pages.add(MicroGFragment())
|
||||
}
|
||||
|
||||
return pages
|
||||
}
|
||||
|
||||
override fun setupAutoUpdates() {
|
||||
super.setupAutoUpdates()
|
||||
|
||||
// Remove super & implement variant logic here
|
||||
}
|
||||
|
||||
override fun finishOnboarding() {
|
||||
blacklistProvider.blacklist("com.android.vending")
|
||||
blacklistProvider.blacklist("com.google.android.gms")
|
||||
|
||||
super.finishOnboarding()
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ 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.LocalContext
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
@@ -41,7 +43,12 @@ import com.aurora.store.compose.preview.PreviewTemplate
|
||||
* @param onClick Callback when the composable is clicked
|
||||
*/
|
||||
@Composable
|
||||
fun LinkListItem(modifier: Modifier = Modifier, link: Link, onClick: () -> Unit = {}) {
|
||||
fun LinkListItem(
|
||||
modifier: Modifier = Modifier,
|
||||
link: Link,
|
||||
onClick: () -> Unit = {},
|
||||
iconTint: Color? = null
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
@@ -58,7 +65,8 @@ fun LinkListItem(modifier: Modifier = Modifier, link: Link, onClick: () -> Unit
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.requiredSize(dimensionResource(R.dimen.icon_size_default))
|
||||
.clip(CircleShape)
|
||||
.clip(CircleShape),
|
||||
colorFilter = if (iconTint != null) ColorFilter.tint(color = iconTint) else null
|
||||
)
|
||||
VerticalDivider(
|
||||
modifier = Modifier
|
||||
|
||||
@@ -16,6 +16,7 @@ import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyItemScope
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -51,7 +52,8 @@ private const val TAG = "PermissionsScreen"
|
||||
@Composable
|
||||
fun PermissionList(
|
||||
modifier: Modifier = Modifier,
|
||||
permissions: Set<Permission>,
|
||||
permissions: List<Permission>,
|
||||
header: (@Composable (LazyItemScope.(Int) -> Unit))? = null,
|
||||
onPermissionCallback: (type: PermissionType) -> Unit = {}
|
||||
) {
|
||||
val context = LocalContext.current
|
||||
@@ -132,6 +134,8 @@ fun PermissionList(
|
||||
modifier = modifier.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_xxsmall))
|
||||
) {
|
||||
if (header != null) stickyHeader(content = header)
|
||||
|
||||
permissions.sortedBy { it.optional }
|
||||
.groupBy { permission -> permission.optional }
|
||||
.forEach { (key, value) ->
|
||||
@@ -166,7 +170,7 @@ private fun PermissionListPreview() {
|
||||
optional = Random.nextBoolean(),
|
||||
isGranted = Random.nextBoolean()
|
||||
)
|
||||
}.toSet()
|
||||
}
|
||||
PreviewTemplate {
|
||||
PermissionList(permissions = permissions)
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.aurora.store.compose.ui.details.AppDetailsScreen
|
||||
import com.aurora.store.compose.ui.dev.DevProfileScreen
|
||||
import com.aurora.store.compose.ui.downloads.DownloadsScreen
|
||||
import com.aurora.store.compose.ui.favourite.FavouriteScreen
|
||||
import com.aurora.store.compose.ui.onboarding.OnboardingScreen
|
||||
import com.aurora.store.compose.ui.search.SearchScreen
|
||||
|
||||
/**
|
||||
@@ -119,6 +120,10 @@ fun NavDisplay(startDestination: NavKey) {
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
entry<Screen.Onboarding> {
|
||||
OnboardingScreen()
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -50,4 +50,7 @@ sealed class Screen : NavKey, Parcelable {
|
||||
|
||||
@Serializable
|
||||
data object Favourite : Screen()
|
||||
|
||||
@Serializable
|
||||
data object Onboarding : Screen()
|
||||
}
|
||||
|
||||
@@ -43,8 +43,7 @@ fun PermissionRationaleScreen(
|
||||
onNavigateUp = onNavigateUp,
|
||||
permissions = permissions
|
||||
.filter { it.type in requiredPermissions }
|
||||
.map { permission -> permission.copy(optional = false) }
|
||||
.toSet(),
|
||||
.map { permission -> permission.copy(optional = false) },
|
||||
onPermissionCallback = { type ->
|
||||
viewModel.refreshPermissionsList()
|
||||
onPermissionCallback(type)
|
||||
@@ -54,7 +53,7 @@ fun PermissionRationaleScreen(
|
||||
|
||||
@Composable
|
||||
private fun ScreenContent(
|
||||
permissions: Set<Permission> = emptySet(),
|
||||
permissions: List<Permission> = emptyList(),
|
||||
onNavigateUp: () -> Unit = {},
|
||||
onPermissionCallback: (type: PermissionType) -> Unit = {},
|
||||
windowAdaptiveInfo: WindowAdaptiveInfo = currentWindowAdaptiveInfo()
|
||||
@@ -87,7 +86,7 @@ private fun PermissionsScreenPreview() {
|
||||
optional = Random.nextBoolean(),
|
||||
isGranted = Random.nextBoolean()
|
||||
)
|
||||
}.toSet()
|
||||
}
|
||||
PreviewTemplate {
|
||||
ScreenContent(permissions = permissions)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.aurora.store.compose.ui.onboarding
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.pager.HorizontalPager
|
||||
import androidx.compose.foundation.pager.rememberPagerState
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.compose.composable.PageIndicator
|
||||
import com.aurora.store.compose.preview.PreviewTemplate
|
||||
import com.aurora.store.compose.ui.onboarding.navigation.ExtraScreen
|
||||
import com.aurora.store.viewmodel.onboarding.OnboardingViewModel
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@Composable
|
||||
fun OnboardingScreen(viewModel: OnboardingViewModel = hiltViewModel()) {
|
||||
val pages = listOfNotNull(
|
||||
ExtraScreen.Welcome,
|
||||
ExtraScreen.Permissions
|
||||
)
|
||||
|
||||
ScreenContent(
|
||||
pages = pages,
|
||||
onFinishOnboarding = { viewModel.finishOnboarding() }
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ScreenContent(
|
||||
pages: List<ExtraScreen> = emptyList(),
|
||||
onFinishOnboarding: () -> Unit = {}
|
||||
) {
|
||||
val pagerState = rememberPagerState { pages.size }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
Scaffold(
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
title = {
|
||||
PageIndicator(totalPages = pages.size, currentPage = pagerState.currentPage)
|
||||
}
|
||||
)
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(paddingValues)
|
||||
.fillMaxSize(),
|
||||
verticalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
HorizontalPager(
|
||||
modifier = Modifier.weight(1F),
|
||||
state = pagerState,
|
||||
verticalAlignment = Alignment.Top
|
||||
) { page ->
|
||||
when (pages[page]) {
|
||||
ExtraScreen.Welcome -> WelcomeScreen()
|
||||
ExtraScreen.Permissions -> PermissionsScreen()
|
||||
}
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(dimensionResource(R.dimen.padding_medium)),
|
||||
horizontalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.padding_medium))
|
||||
) {
|
||||
TextButton(
|
||||
modifier = Modifier.weight(1F),
|
||||
enabled = pagerState.currentPage != 0,
|
||||
onClick = {
|
||||
coroutineScope.launch {
|
||||
pagerState.animateScrollToPage(pagerState.currentPage - 1)
|
||||
}
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.action_back),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
|
||||
Button(
|
||||
modifier = Modifier.weight(1F),
|
||||
onClick = {
|
||||
when {
|
||||
pagerState.currentPage < (pagerState.pageCount - 1) -> {
|
||||
coroutineScope.launch {
|
||||
pagerState.animateScrollToPage(pagerState.currentPage + 1)
|
||||
}
|
||||
}
|
||||
|
||||
else -> onFinishOnboarding()
|
||||
}
|
||||
}
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.action_next),
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview
|
||||
@Composable
|
||||
private fun OnboardingScreenPreview() {
|
||||
PreviewTemplate {
|
||||
ScreenContent(
|
||||
pages = listOf(ExtraScreen.Welcome, ExtraScreen.Permissions)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.aurora.store.compose.ui.onboarding
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.tooling.preview.datasource.LoremIpsum
|
||||
import androidx.hilt.lifecycle.viewmodel.compose.hiltViewModel
|
||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.compose.composable.PermissionList
|
||||
import com.aurora.store.compose.preview.PreviewTemplate
|
||||
import com.aurora.store.data.model.Permission
|
||||
import com.aurora.store.data.model.PermissionType
|
||||
import com.aurora.store.viewmodel.commons.PermissionRationaleViewModel
|
||||
import kotlin.random.Random
|
||||
|
||||
@Composable
|
||||
fun PermissionsScreen(viewModel: PermissionRationaleViewModel = hiltViewModel()) {
|
||||
val permissions by viewModel.permissions.collectAsStateWithLifecycle()
|
||||
|
||||
ScreenContent(
|
||||
permissions = permissions,
|
||||
onPermissionCallback = { viewModel.refreshPermissionsList() }
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ScreenContent(
|
||||
permissions: List<Permission> = emptyList(),
|
||||
onPermissionCallback: (type: PermissionType) -> Unit = {}
|
||||
) {
|
||||
PermissionList(
|
||||
modifier = Modifier.padding(horizontal = dimensionResource(R.dimen.padding_medium)),
|
||||
permissions = permissions,
|
||||
onPermissionCallback = onPermissionCallback,
|
||||
header = {
|
||||
Surface(modifier = Modifier.fillMaxWidth()) {
|
||||
Column(
|
||||
modifier = Modifier.padding(dimensionResource(R.dimen.padding_normal))
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.onboarding_title_permissions),
|
||||
style = MaterialTheme.typography.headlineLargeEmphasized,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.onboarding_permission_select),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
maxLines = 2,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun PermissionsScreenPreview() {
|
||||
val permissions = PermissionType.entries.map { type ->
|
||||
Permission(
|
||||
type = type,
|
||||
title = LoremIpsum(3).values.first(),
|
||||
subtitle = LoremIpsum(7).values.first(),
|
||||
optional = Random.nextBoolean(),
|
||||
isGranted = Random.nextBoolean()
|
||||
)
|
||||
}
|
||||
PreviewTemplate {
|
||||
ScreenContent(
|
||||
permissions = permissions
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.aurora.store.compose.ui.onboarding
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.dimensionResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import com.aurora.extensions.browse
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.compose.composable.LinkListItem
|
||||
import com.aurora.store.compose.preview.PreviewTemplate
|
||||
import com.aurora.store.compose.ui.about.AboutDialog
|
||||
import com.aurora.store.data.model.Link
|
||||
|
||||
@Composable
|
||||
fun WelcomeScreen() {
|
||||
var shouldShowAboutDialog by rememberSaveable { mutableStateOf(false) }
|
||||
|
||||
if (shouldShowAboutDialog) {
|
||||
AboutDialog(onDismiss = { shouldShowAboutDialog = false })
|
||||
}
|
||||
|
||||
ScreenContent(onAboutAurora = { shouldShowAboutDialog = true })
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun ScreenContent(onAboutAurora: () -> Unit = {}) {
|
||||
val context = LocalContext.current
|
||||
|
||||
val links = listOf(
|
||||
Link(
|
||||
id = 0,
|
||||
title = stringResource(R.string.title_about),
|
||||
subtitle = stringResource(R.string.about_aurora_store_subtitle),
|
||||
icon = R.drawable.ic_menu_about,
|
||||
url = "https://auroraoss.com/"
|
||||
),
|
||||
Link(
|
||||
id = 1,
|
||||
title = stringResource(R.string.faqs_title),
|
||||
subtitle = stringResource(R.string.faqs_subtitle),
|
||||
icon = R.drawable.ic_faq,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/-/wikis/Frequently%20Asked%20Questions"
|
||||
),
|
||||
Link(
|
||||
id = 2,
|
||||
title = stringResource(R.string.source_code_title),
|
||||
subtitle = stringResource(R.string.source_code_subtitle),
|
||||
icon = R.drawable.ic_code,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/"
|
||||
),
|
||||
Link(
|
||||
id = 3,
|
||||
title = stringResource(R.string.menu_license),
|
||||
subtitle = stringResource(R.string.license_subtitle),
|
||||
icon = R.drawable.ic_license,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/LICENSE"
|
||||
),
|
||||
Link(
|
||||
id = 4,
|
||||
title = stringResource(R.string.privacy_policy_title),
|
||||
subtitle = stringResource(R.string.privacy_policy_subtitle),
|
||||
icon = R.drawable.ic_privacy,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/POLICY.md"
|
||||
),
|
||||
Link(
|
||||
id = 5,
|
||||
title = stringResource(R.string.menu_disclaimer),
|
||||
subtitle = stringResource(R.string.disclaimer_subtitle),
|
||||
icon = R.drawable.ic_disclaimer,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/DISCLAIMER.md"
|
||||
)
|
||||
)
|
||||
|
||||
LazyColumn(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
contentPadding = PaddingValues(horizontal = dimensionResource(R.dimen.padding_medium)),
|
||||
verticalArrangement = Arrangement.spacedBy(dimensionResource(R.dimen.margin_xxsmall))
|
||||
) {
|
||||
stickyHeader {
|
||||
Surface(modifier = Modifier.fillMaxWidth()) {
|
||||
Column(
|
||||
modifier = Modifier.padding(dimensionResource(R.dimen.padding_normal))
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.onboarding_title_welcome),
|
||||
style = MaterialTheme.typography.headlineLargeEmphasized,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.onboarding_welcome_select),
|
||||
style = MaterialTheme.typography.titleLarge,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
items(items = links, key = { item -> item.id }) { link ->
|
||||
LinkListItem(
|
||||
link = link,
|
||||
onClick = {
|
||||
when (link.id) {
|
||||
0 -> onAboutAurora()
|
||||
else -> context.browse(link.url)
|
||||
}
|
||||
},
|
||||
iconTint = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
private fun WelcomeScreenPreview() {
|
||||
PreviewTemplate {
|
||||
ScreenContent()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2025 The Calyx Institute
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package com.aurora.store.compose.ui.onboarding.navigation
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.navigation3.runtime.NavKey
|
||||
import kotlinx.parcelize.Parcelize
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
/**
|
||||
* Extra destinations for onboarding
|
||||
*
|
||||
* All of these destinations are child destinations of onboarding screen are shown inside it.
|
||||
*/
|
||||
@Parcelize
|
||||
@Serializable
|
||||
sealed class ExtraScreen : NavKey, Parcelable {
|
||||
|
||||
@Serializable
|
||||
data object Welcome : ExtraScreen()
|
||||
|
||||
@Serializable
|
||||
data object Permissions : ExtraScreen()
|
||||
}
|
||||
@@ -1,41 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.data.model
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
|
||||
data class Dash(
|
||||
var id: Int,
|
||||
var title: String,
|
||||
var subtitle: String,
|
||||
@DrawableRes var icon: Int,
|
||||
var url: String
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return when (other) {
|
||||
is Dash -> other.id == id
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return id.hashCode()
|
||||
}
|
||||
}
|
||||
@@ -25,15 +25,4 @@ data class Permission(
|
||||
val subtitle: String,
|
||||
val optional: Boolean = false,
|
||||
val isGranted: Boolean = false
|
||||
) {
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return when (other) {
|
||||
is Permission -> other.type == type
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return type.hashCode()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
@@ -93,20 +93,14 @@ class PermissionProvider(private val fragment: Fragment) :
|
||||
context.getString(R.string.onboarding_permission_installer_legacy_desc)
|
||||
},
|
||||
optional = false,
|
||||
isGranted = PermissionProvider.isGranted(
|
||||
context,
|
||||
PermissionType.INSTALL_UNKNOWN_APPS
|
||||
)
|
||||
isGranted = isGranted(context, PermissionType.INSTALL_UNKNOWN_APPS)
|
||||
),
|
||||
Permission(
|
||||
type = PermissionType.DOZE_WHITELIST,
|
||||
title = context.getString(R.string.onboarding_permission_doze),
|
||||
subtitle = context.getString(R.string.onboarding_permission_doze_desc),
|
||||
optional = true,
|
||||
isGranted = PermissionProvider.isGranted(
|
||||
context,
|
||||
PermissionType.DOZE_WHITELIST
|
||||
)
|
||||
isGranted = isGranted(context, PermissionType.DOZE_WHITELIST)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -117,10 +111,7 @@ class PermissionProvider(private val fragment: Fragment) :
|
||||
title = context.getString(R.string.onboarding_permission_esm),
|
||||
subtitle = context.getString(R.string.onboarding_permission_esa_desc),
|
||||
optional = false,
|
||||
isGranted = PermissionProvider.isGranted(
|
||||
context,
|
||||
PermissionType.STORAGE_MANAGER
|
||||
)
|
||||
isGranted = isGranted(context, PermissionType.STORAGE_MANAGER)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
@@ -130,10 +121,7 @@ class PermissionProvider(private val fragment: Fragment) :
|
||||
title = context.getString(R.string.onboarding_permission_esa),
|
||||
subtitle = context.getString(R.string.onboarding_permission_esa_desc),
|
||||
optional = false,
|
||||
isGranted = PermissionProvider.isGranted(
|
||||
context,
|
||||
PermissionType.EXTERNAL_STORAGE
|
||||
)
|
||||
isGranted = isGranted(context, PermissionType.EXTERNAL_STORAGE)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -145,10 +133,7 @@ class PermissionProvider(private val fragment: Fragment) :
|
||||
title = context.getString(R.string.onboarding_permission_notifications),
|
||||
subtitle = context.getString(R.string.onboarding_permission_notifications_desc),
|
||||
optional = true,
|
||||
isGranted = PermissionProvider.isGranted(
|
||||
context,
|
||||
PermissionType.POST_NOTIFICATIONS
|
||||
)
|
||||
isGranted = isGranted(context, PermissionType.POST_NOTIFICATIONS)
|
||||
)
|
||||
)
|
||||
}
|
||||
@@ -160,10 +145,7 @@ class PermissionProvider(private val fragment: Fragment) :
|
||||
title = context.getString(R.string.app_links_title),
|
||||
subtitle = context.getString(R.string.app_links_desc),
|
||||
optional = true,
|
||||
isGranted = PermissionProvider.isGranted(
|
||||
context,
|
||||
PermissionType.APP_LINKS
|
||||
)
|
||||
isGranted = isGranted(context, PermissionType.APP_LINKS)
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,54 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.epoxy.views.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.airbnb.epoxy.CallbackProp
|
||||
import com.airbnb.epoxy.ModelProp
|
||||
import com.airbnb.epoxy.ModelView
|
||||
import com.aurora.store.data.model.Dash
|
||||
import com.aurora.store.databinding.ViewDashBinding
|
||||
import com.aurora.store.view.epoxy.views.BaseModel
|
||||
import com.aurora.store.view.epoxy.views.BaseView
|
||||
|
||||
@ModelView(
|
||||
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
|
||||
baseModelClass = BaseModel::class
|
||||
)
|
||||
class DashView @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : BaseView<ViewDashBinding>(context, attrs, defStyleAttr) {
|
||||
|
||||
@ModelProp
|
||||
fun dash(dash: Dash) {
|
||||
binding.line1.text = dash.title
|
||||
binding.line2.text = dash.subtitle
|
||||
binding.img.setImageDrawable(ContextCompat.getDrawable(context, dash.icon))
|
||||
}
|
||||
|
||||
@CallbackProp
|
||||
fun click(onClickListener: OnClickListener?) {
|
||||
binding.root.setOnClickListener(onClickListener)
|
||||
}
|
||||
}
|
||||
@@ -1,65 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.epoxy.views.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.airbnb.epoxy.CallbackProp
|
||||
import com.airbnb.epoxy.ModelProp
|
||||
import com.airbnb.epoxy.ModelView
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.model.Permission
|
||||
import com.aurora.store.databinding.ViewPermissionBinding
|
||||
import com.aurora.store.view.epoxy.views.BaseModel
|
||||
import com.aurora.store.view.epoxy.views.BaseView
|
||||
|
||||
@ModelView(
|
||||
autoLayout = ModelView.Size.MATCH_WIDTH_WRAP_HEIGHT,
|
||||
baseModelClass = BaseModel::class
|
||||
)
|
||||
class PermissionView @JvmOverloads constructor(
|
||||
context: Context?,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : BaseView<ViewPermissionBinding>(context, attrs, defStyleAttr) {
|
||||
|
||||
@ModelProp
|
||||
fun permission(installer: Permission) {
|
||||
binding.line1.text = installer.title
|
||||
binding.line2.text = installer.subtitle
|
||||
}
|
||||
|
||||
@ModelProp
|
||||
fun isGranted(granted: Boolean) {
|
||||
if (granted) {
|
||||
binding.btnAction.isEnabled = false
|
||||
binding.btnAction.text = ContextCompat.getString(context, R.string.action_granted)
|
||||
} else {
|
||||
binding.btnAction.isEnabled = true
|
||||
binding.btnAction.text = ContextCompat.getString(context, R.string.action_grant)
|
||||
}
|
||||
}
|
||||
|
||||
@CallbackProp
|
||||
fun click(onClickListener: OnClickListener?) {
|
||||
binding.btnAction.setOnClickListener(onClickListener)
|
||||
}
|
||||
}
|
||||
@@ -1,203 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.ui.details
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.aurora.extensions.browse
|
||||
import com.aurora.store.AuroraApp
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.event.Event
|
||||
import com.aurora.store.data.event.InstallerEvent
|
||||
import com.aurora.store.data.model.Dash
|
||||
import com.aurora.store.data.model.DownloadStatus
|
||||
import com.aurora.store.databinding.FragmentDetailsMicrogBinding
|
||||
import com.aurora.store.util.PackageUtil
|
||||
import com.aurora.store.view.epoxy.views.EpoxyTextViewModel_
|
||||
import com.aurora.store.view.epoxy.views.preference.DashViewModel_
|
||||
import com.aurora.store.view.ui.commons.BaseFragment
|
||||
import com.aurora.store.viewmodel.onboarding.MicroGViewModel
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import kotlinx.coroutines.flow.filterNotNull
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@AndroidEntryPoint
|
||||
class DetailsMicroGFragment : BaseFragment<FragmentDetailsMicrogBinding>() {
|
||||
|
||||
val microGViewModel: MicroGViewModel by viewModels()
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Toolbar
|
||||
binding.toolbar.apply {
|
||||
title = ""
|
||||
setNavigationOnClickListener { findNavController().navigateUp() }
|
||||
}
|
||||
|
||||
with(binding) {
|
||||
// RecyclerView
|
||||
epoxyRecycler.withModels {
|
||||
setFilterDuplicates(true)
|
||||
|
||||
add(
|
||||
EpoxyTextViewModel_()
|
||||
.id("microg_title")
|
||||
.title(getString(R.string.onboarding_title_gsf))
|
||||
.size(32)
|
||||
.style(R.style.AuroraTextStyle)
|
||||
)
|
||||
|
||||
add(
|
||||
EpoxyTextViewModel_()
|
||||
.id("microg_desc")
|
||||
.title(getString(R.string.onboarding_title_gsf_desc))
|
||||
.size(18)
|
||||
.style(R.style.AuroraTextStyle)
|
||||
)
|
||||
|
||||
add(
|
||||
EpoxyTextViewModel_()
|
||||
.id("microg_desc")
|
||||
.title(getString(R.string.onboarding_gms_missing))
|
||||
.size(14)
|
||||
.style(R.style.AuroraTextStyle)
|
||||
)
|
||||
|
||||
add(
|
||||
EpoxyTextViewModel_()
|
||||
.id("microg_gms")
|
||||
.title(getString(R.string.onboarding_gms_microg))
|
||||
.size(14)
|
||||
.style(R.style.AuroraTextStyle)
|
||||
)
|
||||
|
||||
|
||||
dashItems().forEach {
|
||||
add(
|
||||
DashViewModel_()
|
||||
.id(it.id)
|
||||
.dash(it)
|
||||
.click { _ ->
|
||||
requireContext().browse(it.url)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
checkboxAgreement.setOnCheckedChangeListener { _, value ->
|
||||
microGViewModel.markAgreement(value)
|
||||
btnMicroG.isEnabled = value
|
||||
}
|
||||
|
||||
btnMicroG.setOnClickListener { microGViewModel.downloadMicroG() }
|
||||
btnSkip.setOnClickListener { findNavController().navigateUp() }
|
||||
}
|
||||
|
||||
microGViewModel.download.filterNotNull().onEach {
|
||||
when (it.status) {
|
||||
DownloadStatus.DOWNLOADING -> updateProgressBar(visible = true, it.progress)
|
||||
DownloadStatus.FAILED -> updateProgressBar(visible = false, 0)
|
||||
DownloadStatus.QUEUED -> updateProgressBar(visible = true, -1)
|
||||
DownloadStatus.COMPLETED -> updateProgressBar(visible = true, -1)
|
||||
else -> {}
|
||||
}
|
||||
}.launchIn(viewLifecycleOwner.lifecycleScope)
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
AuroraApp.events.installerEvent.collect { onEvent(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun onEvent(event: Event) {
|
||||
when (event) {
|
||||
is InstallerEvent.Installed -> {
|
||||
if (PackageUtil.isMicroGBundleInstalled(requireContext())) {
|
||||
markInstallationComplete()
|
||||
}
|
||||
}
|
||||
|
||||
is InstallerEvent.Failed -> markInstallationFailed()
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateProgressBar(visible: Boolean, downloadProgress: Int) {
|
||||
with(binding.progressBar) {
|
||||
if (visible) show() else hide()
|
||||
isIndeterminate = downloadProgress == -1
|
||||
progress = downloadProgress
|
||||
}
|
||||
}
|
||||
|
||||
private fun markInstallationComplete() {
|
||||
with(binding) {
|
||||
with(btnMicroG) {
|
||||
isEnabled = true
|
||||
text = getString(R.string.action_finish)
|
||||
setOnClickListener { findNavController().navigateUp() }
|
||||
}
|
||||
checkboxAgreement.isEnabled = false
|
||||
progressBar.hide()
|
||||
}
|
||||
}
|
||||
|
||||
private fun markInstallationFailed() {
|
||||
with(binding) {
|
||||
with(btnMicroG) {
|
||||
isEnabled = false
|
||||
text = getString(R.string.action_install)
|
||||
}
|
||||
checkboxAgreement.isChecked = false
|
||||
progressBar.hide()
|
||||
}
|
||||
}
|
||||
|
||||
private fun dashItems(): List<Dash> {
|
||||
return listOf(
|
||||
Dash(
|
||||
id = 2,
|
||||
title = requireContext().getString(R.string.details_dev_website),
|
||||
subtitle = requireContext().getString(R.string.microg_website),
|
||||
icon = R.drawable.ic_network,
|
||||
url = "https://microG.org"
|
||||
),
|
||||
Dash(
|
||||
id = 4,
|
||||
title = requireContext().getString(R.string.privacy_policy_title),
|
||||
subtitle = requireContext().getString(R.string.microg_privacy_policy),
|
||||
icon = R.drawable.ic_privacy,
|
||||
url = "https://microg.org/privacy.html"
|
||||
),
|
||||
Dash(
|
||||
id = 5,
|
||||
title = requireContext().getString(R.string.menu_disclaimer),
|
||||
subtitle = requireContext().getString(R.string.microg_license_agreement),
|
||||
icon = R.drawable.ic_disclaimer,
|
||||
url = "https://raw.githubusercontent.com/microg/GmsCore/refs/heads/master/LICENSE"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
package com.aurora.store.view.ui.onboarding
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.fragment.app.FragmentManager
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
|
||||
import com.aurora.extensions.areNotificationsEnabled
|
||||
import com.aurora.extensions.isIgnoringBatteryOptimizations
|
||||
import com.aurora.store.AuroraApp
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.event.Event
|
||||
import com.aurora.store.data.event.InstallerEvent
|
||||
import com.aurora.store.data.model.UpdateMode
|
||||
import com.aurora.store.data.work.CacheWorker
|
||||
import com.aurora.store.databinding.FragmentOnboardingBinding
|
||||
import com.aurora.store.util.PackageUtil
|
||||
import com.aurora.store.util.Preferences
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INTRO
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_AUTO
|
||||
import com.aurora.store.util.save
|
||||
import com.aurora.store.view.ui.commons.BaseFragment
|
||||
import com.aurora.store.viewmodel.onboarding.MicroGViewModel
|
||||
import com.aurora.store.viewmodel.onboarding.OnboardingPage
|
||||
import com.aurora.store.viewmodel.onboarding.OnboardingViewModel
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.jakewharton.processphoenix.ProcessPhoenix
|
||||
import kotlinx.coroutines.flow.combine
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
abstract class BaseFlavouredOnboardingFragment : BaseFragment<FragmentOnboardingBinding>() {
|
||||
// Shared ViewModels
|
||||
val microGViewModel: MicroGViewModel by activityViewModels()
|
||||
val onboardingViewModel: OnboardingViewModel by activityViewModels()
|
||||
|
||||
var currentPage = 0
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentOnboardingBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Adjust layout margins for edgeToEdge display
|
||||
ViewCompat.setOnApplyWindowInsetsListener(binding.layoutBottom) { layout, windowInsets ->
|
||||
val insets = windowInsets.getInsets(WindowInsetsCompat.Type.navigationBars())
|
||||
layout.setPadding(0, 0, 0, insets.bottom)
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
val isDefaultPrefLoaded = Preferences.getBoolean(requireContext(), PREFERENCE_DEFAULT)
|
||||
|
||||
if (!isDefaultPrefLoaded) {
|
||||
save(PREFERENCE_DEFAULT, true)
|
||||
loadDefaultPreferences()
|
||||
|
||||
// No onboarding for TV, proceed with defaults
|
||||
if (PackageUtil.isTv(view.context)) finishOnboarding()
|
||||
}
|
||||
|
||||
val pages = onboardingPages()
|
||||
|
||||
with(binding) {
|
||||
// ViewPager2
|
||||
with(viewpager2) {
|
||||
adapter = PagerAdapter(
|
||||
childFragmentManager,
|
||||
viewLifecycleOwner.lifecycle,
|
||||
pages
|
||||
)
|
||||
isUserInputEnabled = false
|
||||
setCurrentItem(0, true)
|
||||
registerOnPageChangeCallback(object : OnPageChangeCallback() {
|
||||
override fun onPageSelected(position: Int) {
|
||||
onboardingViewModel.setCurrentPage(
|
||||
when (position) {
|
||||
0 -> OnboardingPage.WELCOME
|
||||
1 -> OnboardingPage.PERMISSIONS
|
||||
2 -> OnboardingPage.GSF
|
||||
else -> OnboardingPage.WELCOME
|
||||
}
|
||||
)
|
||||
currentPage = position
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
TabLayoutMediator(tabLayout, viewpager2, true) { tab, position ->
|
||||
tab.text = (position + 1).toString()
|
||||
}.attach()
|
||||
}
|
||||
|
||||
updateBackwardButton(false)
|
||||
updateForwardButton(true)
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
// Combine both relevant flows
|
||||
combine(
|
||||
microGViewModel.checked,
|
||||
onboardingViewModel.currentPage
|
||||
) { isChecked, page -> isChecked to page }.collect { (isChecked, page) ->
|
||||
when (page) {
|
||||
OnboardingPage.WELCOME -> {
|
||||
updateBackwardButton(enabled = false)
|
||||
updateForwardButton(enabled = true)
|
||||
}
|
||||
|
||||
OnboardingPage.PERMISSIONS -> {
|
||||
updateBackwardButton(enabled = true)
|
||||
val isLastPage = pages.size == 2
|
||||
|
||||
updateForwardButton(
|
||||
enabled = true,
|
||||
resId = if (isLastPage) R.string.action_finish else R.string.action_next,
|
||||
if (isLastPage) {
|
||||
{ finishOnboarding() }
|
||||
} else {
|
||||
null
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
OnboardingPage.GSF -> {
|
||||
updateBackwardButton(enabled = true)
|
||||
|
||||
if (isChecked) {
|
||||
val isInstalled = PackageUtil.isMicroGBundleInstalled(requireContext())
|
||||
updateForwardButton(
|
||||
enabled = isInstalled,
|
||||
resId = R.string.action_finish,
|
||||
action = if (isInstalled) {
|
||||
{ finishOnboarding() }
|
||||
} else {
|
||||
null
|
||||
}
|
||||
)
|
||||
} else {
|
||||
updateForwardButton(
|
||||
enabled = false,
|
||||
resId = R.string.action_finish,
|
||||
action = { finishOnboarding() }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
AuroraApp.events.installerEvent.collect { onEvent(it) }
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateBackwardButton(
|
||||
enabled: Boolean = true
|
||||
) {
|
||||
with(binding.btnBackward) {
|
||||
isEnabled = enabled
|
||||
text = getString(R.string.action_back)
|
||||
setOnClickListener({
|
||||
binding.viewpager2.setCurrentItem(binding.viewpager2.currentItem - 1, true)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateForwardButton(
|
||||
enabled: Boolean = true,
|
||||
@StringRes resId: Int = R.string.action_next,
|
||||
action: ((View) -> Unit)? = null
|
||||
) {
|
||||
with(binding.btnForward) {
|
||||
isEnabled = enabled
|
||||
text = getString(resId)
|
||||
setOnClickListener(action ?: {
|
||||
binding.viewpager2.setCurrentItem(binding.viewpager2.currentItem + 1, true)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun onEvent(event: Event) {
|
||||
when (event) {
|
||||
is InstallerEvent.Installed -> {
|
||||
if (PackageUtil.isMicroGBundleInstalled(requireContext())) {
|
||||
with(binding.btnForward) {
|
||||
isEnabled = true
|
||||
text = getString(R.string.action_finish)
|
||||
setOnClickListener {
|
||||
finishOnboarding()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
abstract fun loadDefaultPreferences()
|
||||
|
||||
abstract fun onboardingPages(): List<Fragment>
|
||||
|
||||
open fun finishOnboarding() {
|
||||
setupAutoUpdates()
|
||||
CacheWorker.scheduleAutomatedCacheCleanup(requireContext())
|
||||
Preferences.putBooleanNow(requireContext(), PREFERENCE_INTRO, true)
|
||||
|
||||
// Restart the app to ensure all permissions are granted
|
||||
ProcessPhoenix.triggerRebirth(context)
|
||||
}
|
||||
|
||||
open fun setupAutoUpdates() {
|
||||
val updateMode = when {
|
||||
requireContext().isIgnoringBatteryOptimizations() -> UpdateMode.CHECK_AND_INSTALL
|
||||
requireContext().areNotificationsEnabled() -> UpdateMode.CHECK_AND_NOTIFY
|
||||
else -> UpdateMode.DISABLED
|
||||
}
|
||||
|
||||
save(PREFERENCE_UPDATES_AUTO, updateMode.ordinal)
|
||||
|
||||
onboardingViewModel.updateHelper.scheduleAutomatedCheck()
|
||||
}
|
||||
|
||||
internal class PagerAdapter(
|
||||
fragmentManager: FragmentManager,
|
||||
lifecycle: Lifecycle,
|
||||
var items: List<Fragment>
|
||||
) : FragmentStateAdapter(fragmentManager, lifecycle) {
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
return items[position]
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return items.size
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
/*
|
||||
* Aurora Store
|
||||
* Copyright (C) 2021, Rahul Kumar Patel <whyorean@gmail.com>
|
||||
* Copyright (C) 2022, The Calyx Institute
|
||||
*
|
||||
* 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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.ui.onboarding
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.core.os.bundleOf
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import com.aurora.extensions.isOAndAbove
|
||||
import com.aurora.extensions.isRAndAbove
|
||||
import com.aurora.extensions.isSAndAbove
|
||||
import com.aurora.extensions.isTAndAbove
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.model.Permission
|
||||
import com.aurora.store.data.model.PermissionType
|
||||
import com.aurora.store.data.providers.PermissionProvider.Companion.isGranted
|
||||
import com.aurora.store.databinding.FragmentOnboardingPermissionsBinding
|
||||
import com.aurora.store.view.epoxy.views.TextDividerViewModel_
|
||||
import com.aurora.store.view.epoxy.views.preference.PermissionViewModel_
|
||||
import com.aurora.store.view.ui.commons.BaseFragment
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class PermissionsFragment : BaseFragment<FragmentOnboardingPermissionsBinding>() {
|
||||
|
||||
private val args: PermissionsFragmentArgs by navArgs()
|
||||
|
||||
companion object {
|
||||
fun newInstance(isOnboarding: Boolean = true): PermissionsFragment {
|
||||
return PermissionsFragment().apply {
|
||||
arguments = bundleOf("isOnboarding" to isOnboarding)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// Headers are only visible if we are onboarding
|
||||
binding.title.isVisible = args.isOnboarding
|
||||
binding.toolbar.apply {
|
||||
isVisible = !args.isOnboarding
|
||||
setNavigationOnClickListener { findNavController().navigateUp() }
|
||||
}
|
||||
|
||||
updateController()
|
||||
}
|
||||
|
||||
private fun permissionList(): List<Permission> {
|
||||
val permissions = mutableListOf(
|
||||
Permission(
|
||||
PermissionType.INSTALL_UNKNOWN_APPS,
|
||||
getString(R.string.onboarding_permission_installer),
|
||||
if (isOAndAbove) {
|
||||
getString(R.string.onboarding_permission_installer_desc)
|
||||
} else {
|
||||
getString(R.string.onboarding_permission_installer_legacy_desc)
|
||||
}
|
||||
),
|
||||
Permission(
|
||||
PermissionType.DOZE_WHITELIST,
|
||||
getString(R.string.onboarding_permission_doze),
|
||||
getString(R.string.onboarding_permission_doze_desc),
|
||||
true
|
||||
)
|
||||
)
|
||||
|
||||
if (isRAndAbove) {
|
||||
permissions.add(
|
||||
Permission(
|
||||
PermissionType.STORAGE_MANAGER,
|
||||
getString(R.string.onboarding_permission_esm),
|
||||
getString(R.string.onboarding_permission_esa_desc),
|
||||
false
|
||||
)
|
||||
)
|
||||
} else {
|
||||
permissions.add(
|
||||
Permission(
|
||||
PermissionType.EXTERNAL_STORAGE,
|
||||
getString(R.string.onboarding_permission_esa),
|
||||
getString(R.string.onboarding_permission_esa_desc),
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if (isTAndAbove) {
|
||||
permissions.add(
|
||||
Permission(
|
||||
PermissionType.POST_NOTIFICATIONS,
|
||||
getString(R.string.onboarding_permission_notifications),
|
||||
getString(R.string.onboarding_permission_notifications_desc),
|
||||
true
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
if (isSAndAbove) {
|
||||
permissions.add(
|
||||
Permission(
|
||||
PermissionType.APP_LINKS,
|
||||
getString(R.string.app_links_title),
|
||||
getString(R.string.app_links_desc),
|
||||
optional = true
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
return permissions
|
||||
}
|
||||
|
||||
private fun updateController() {
|
||||
binding.epoxyRecycler.withModels {
|
||||
setFilterDuplicates(true)
|
||||
|
||||
add(
|
||||
TextDividerViewModel_()
|
||||
.id("required_divider")
|
||||
.title(getString(R.string.item_required))
|
||||
)
|
||||
|
||||
permissionList()
|
||||
.filterNot { it.optional }
|
||||
.forEach { add(renderPermissionView(it)) }
|
||||
|
||||
val optionalPermissions = permissionList().filter { it.optional }
|
||||
if (optionalPermissions.isNotEmpty()) {
|
||||
add(
|
||||
TextDividerViewModel_()
|
||||
.id("optional_divider")
|
||||
.title(getString(R.string.item_optional))
|
||||
)
|
||||
|
||||
optionalPermissions.forEach { add(renderPermissionView(it)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun renderPermissionView(permission: Permission): PermissionViewModel_ {
|
||||
return PermissionViewModel_()
|
||||
.id(permission.type.name)
|
||||
.permission(permission)
|
||||
.isGranted(isGranted(requireContext(), permission.type))
|
||||
.click { _ ->
|
||||
permissionProvider.request(permission.type) {
|
||||
if (it) updateController()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,105 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.ui.onboarding
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.aurora.extensions.browse
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.data.model.Dash
|
||||
import com.aurora.store.databinding.FragmentOnboardingWelcomeBinding
|
||||
import com.aurora.store.view.epoxy.views.preference.DashViewModel_
|
||||
import com.aurora.store.view.ui.commons.BaseFragment
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class WelcomeFragment : BaseFragment<FragmentOnboardingWelcomeBinding>() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
// RecyclerView
|
||||
binding.epoxyRecycler.withModels {
|
||||
setFilterDuplicates(true)
|
||||
loadDashFromAssets().forEach {
|
||||
add(
|
||||
DashViewModel_()
|
||||
.id(it.id)
|
||||
.dash(it)
|
||||
.click { _ ->
|
||||
if (it.id == 0) {
|
||||
findNavController().navigate(R.id.aboutDialog)
|
||||
} else {
|
||||
requireContext().browse(it.url)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun loadDashFromAssets(): List<Dash> {
|
||||
return listOf(
|
||||
Dash(
|
||||
id = 0,
|
||||
title = requireContext().getString(R.string.title_about),
|
||||
subtitle = requireContext().getString(R.string.about_aurora_store_subtitle),
|
||||
icon = R.drawable.ic_menu_about,
|
||||
url = "https://auroraoss.com/"
|
||||
),
|
||||
Dash(
|
||||
id = 1,
|
||||
title = requireContext().getString(R.string.faqs_title),
|
||||
subtitle = requireContext().getString(R.string.faqs_subtitle),
|
||||
icon = R.drawable.ic_faq,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/-/wikis/Frequently%20Asked%20Questions"
|
||||
),
|
||||
Dash(
|
||||
id = 2,
|
||||
title = requireContext().getString(R.string.source_code_title),
|
||||
subtitle = requireContext().getString(R.string.source_code_subtitle),
|
||||
icon = R.drawable.ic_code,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/"
|
||||
),
|
||||
Dash(
|
||||
id = 3,
|
||||
title = requireContext().getString(R.string.menu_license),
|
||||
subtitle = requireContext().getString(R.string.license_subtitle),
|
||||
icon = R.drawable.ic_license,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/LICENSE"
|
||||
),
|
||||
Dash(
|
||||
id = 4,
|
||||
title = requireContext().getString(R.string.privacy_policy_title),
|
||||
subtitle = requireContext().getString(R.string.privacy_policy_subtitle),
|
||||
icon = R.drawable.ic_privacy,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/POLICY.md"
|
||||
),
|
||||
Dash(
|
||||
id = 5,
|
||||
title = requireContext().getString(R.string.menu_disclaimer),
|
||||
subtitle = requireContext().getString(R.string.disclaimer_subtitle),
|
||||
icon = R.drawable.ic_disclaimer,
|
||||
url = "https://gitlab.com/AuroraOSS/AuroraStore/-/blob/master/DISCLAIMER.md"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -35,9 +35,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
||||
setPreferencesFromResource(R.xml.preferences_settings, rootKey)
|
||||
|
||||
findPreference<Preference>("pref_perms")?.setOnPreferenceClickListener {
|
||||
findNavController().navigate(
|
||||
SettingsFragmentDirections.actionSettingsFragmentToPermissionsFragment(false)
|
||||
)
|
||||
TODO()
|
||||
true
|
||||
}
|
||||
findPreference<Preference>("pref_install")?.setOnPreferenceClickListener {
|
||||
|
||||
@@ -70,9 +70,8 @@ abstract class BaseFlavouredSplashFragment : BaseFragment<FragmentSplashBinding>
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
if (!Preferences.getBoolean(requireContext(), PREFERENCE_INTRO)) {
|
||||
findNavController().navigate(
|
||||
SplashFragmentDirections.actionSplashFragmentToOnboardingFragment()
|
||||
)
|
||||
requireContext().navigate(Screen.Onboarding)
|
||||
activity?.finish()
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -24,10 +24,11 @@ class PermissionRationaleViewModel @Inject constructor(
|
||||
|
||||
fun refreshPermissionsList() {
|
||||
_permissions.value = _permissions.value.map { permission ->
|
||||
permission.copy(isGranted = PermissionProvider.isGranted(
|
||||
context,
|
||||
permission.type
|
||||
)
|
||||
permission.copy(
|
||||
isGranted = PermissionProvider.isGranted(
|
||||
context,
|
||||
permission.type
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.aurora.store.viewmodel.onboarding
|
||||
|
||||
enum class OnboardingPage {
|
||||
WELCOME,
|
||||
PERMISSIONS,
|
||||
GSF,
|
||||
}
|
||||
@@ -5,24 +5,85 @@
|
||||
|
||||
package com.aurora.store.viewmodel.onboarding
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.aurora.Constants
|
||||
import com.aurora.extensions.areNotificationsEnabled
|
||||
import com.aurora.extensions.isIgnoringBatteryOptimizations
|
||||
import com.aurora.store.data.helper.UpdateHelper
|
||||
import com.aurora.store.data.model.UpdateMode
|
||||
import com.aurora.store.data.work.CacheWorker
|
||||
import com.aurora.store.util.Preferences
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_AUTO_DELETE
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DISPENSER_URLS
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_AURORA_ONLY
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_FDROID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FOR_YOU
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INTRO
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_STYLE
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_AUTO
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_CHECK_INTERVAL
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_EXTENDED
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_VENDING_VERSION
|
||||
import com.aurora.store.util.save
|
||||
import com.jakewharton.processphoenix.ProcessPhoenix
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import javax.inject.Inject
|
||||
|
||||
@HiltViewModel
|
||||
class OnboardingViewModel @Inject constructor(val updateHelper: UpdateHelper) : ViewModel() {
|
||||
class OnboardingViewModel @Inject constructor(
|
||||
val updateHelper: UpdateHelper,
|
||||
@ApplicationContext private val context: Context
|
||||
) : ViewModel() {
|
||||
|
||||
private val _page = MutableStateFlow<OnboardingPage>(OnboardingPage.WELCOME)
|
||||
val currentPage: StateFlow<OnboardingPage> = _page
|
||||
private val TAG = OnboardingViewModel::class.java.simpleName
|
||||
|
||||
fun setCurrentPage(page: OnboardingPage) {
|
||||
viewModelScope.launch {
|
||||
_page.emit(page)
|
||||
fun finishOnboarding() {
|
||||
Log.i(TAG, "Finishing onboarding with defaults")
|
||||
context.saveDefaultPreferences()
|
||||
setupAutoUpdates()
|
||||
CacheWorker.scheduleAutomatedCacheCleanup(context)
|
||||
Preferences.putBooleanNow(context, PREFERENCE_INTRO, true)
|
||||
|
||||
// Restart the app to ensure all permissions are granted
|
||||
ProcessPhoenix.triggerRebirth(context)
|
||||
}
|
||||
|
||||
private fun setupAutoUpdates() {
|
||||
val updateMode = when {
|
||||
context.isIgnoringBatteryOptimizations() -> UpdateMode.CHECK_AND_INSTALL
|
||||
context.areNotificationsEnabled() -> UpdateMode.CHECK_AND_NOTIFY
|
||||
else -> UpdateMode.DISABLED
|
||||
}
|
||||
|
||||
context.save(PREFERENCE_UPDATES_AUTO, updateMode.ordinal)
|
||||
context.save(PREFERENCE_UPDATES_CHECK_INTERVAL, 3)
|
||||
updateHelper.scheduleAutomatedCheck()
|
||||
}
|
||||
|
||||
private fun Context.saveDefaultPreferences() {
|
||||
/*Filters*/
|
||||
save(PREFERENCE_FILTER_AURORA_ONLY, false)
|
||||
save(PREFERENCE_FILTER_FDROID, true)
|
||||
|
||||
/*Network*/
|
||||
save(PREFERENCE_DISPENSER_URLS, setOf(Constants.URL_DISPENSER))
|
||||
save(PREFERENCE_VENDING_VERSION, 0)
|
||||
|
||||
/*Customization*/
|
||||
save(PREFERENCE_THEME_STYLE, 0)
|
||||
save(PREFERENCE_DEFAULT_SELECTED_TAB, 0)
|
||||
save(PREFERENCE_FOR_YOU, true)
|
||||
|
||||
/*Installer*/
|
||||
save(PREFERENCE_AUTO_DELETE, true)
|
||||
save(PREFERENCE_INSTALLER_ID, 0)
|
||||
|
||||
/*Updates*/
|
||||
save(PREFERENCE_UPDATES_EXTENDED, false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +1,11 @@
|
||||
<?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/>.
|
||||
~
|
||||
~ SPDX-FileCopyrightText: Material Design Authors / Google LLC
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
|
||||
@@ -1,27 +1,12 @@
|
||||
<?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/>.
|
||||
~
|
||||
~ SPDX-FileCopyrightText: Material Design Authors / Google LLC
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:autoMirrored="true"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
|
||||
@@ -1,26 +1,11 @@
|
||||
<?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/>.
|
||||
~
|
||||
~ SPDX-FileCopyrightText: Material Design Authors / Google LLC
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
|
||||
@@ -1,26 +1,11 @@
|
||||
<?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/>.
|
||||
~
|
||||
~ SPDX-FileCopyrightText: Material Design Authors / Google LLC
|
||||
~ SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
|
||||
@@ -1,109 +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:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/top_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/bottom_layout"
|
||||
android:layout_alignParentTop="true"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:text="@string/onboarding_title_gsf"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="42sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/onboarding_title_gsf_desc"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/epoxy_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:scrollbars="none"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/view_dash" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:divider="@drawable/divider"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/padding_large"
|
||||
android:paddingEnd="@dimen/padding_large"
|
||||
android:showDividers="middle">
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/checkbox_agreement"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/padding_large"
|
||||
android:paddingEnd="@dimen/padding_xxsmall"
|
||||
android:text="@string/onboarding_gms_agreement" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_microG"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:enabled="false"
|
||||
android:maxWidth="@dimen/width_button"
|
||||
android:text="@string/action_install_microG" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"
|
||||
android:visibility="invisible" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -1,81 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<LinearLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:visibility="gone"
|
||||
app:navigationIcon="@drawable/ic_arrow_back"
|
||||
app:title="@string/onboarding_title_permissions" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:text="@string/onboarding_title_permissions"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="42sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/onboarding_permission_select"
|
||||
android:textAlignment="textStart" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/epoxy_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:scrollbars="none"
|
||||
tools:listitem="@layout/view_permission" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,63 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:text="@string/onboarding_title_welcome"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="42sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/onboarding_welcome_select"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/epoxy_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:scrollbars="none"
|
||||
tools:listitem="@layout/view_dash" />
|
||||
</LinearLayout>
|
||||
@@ -1,110 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<LinearLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="@dimen/height_navbar">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
app:navigationIcon="@drawable/ic_arrow_back" />
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/epoxy_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/bottom_layout"
|
||||
android:clipToPadding="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:scrollbars="none"
|
||||
app:itemSpacing="@dimen/margin_small"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/view_dash" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?attr/colorSurface"
|
||||
android:divider="@drawable/divider"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/checkbox_agreement"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/padding_large"
|
||||
android:paddingEnd="@dimen/padding_xxsmall"
|
||||
android:text="@string/onboarding_gms_agreement" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_microG"
|
||||
style="@style/Widget.Material3.Button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_xsmall"
|
||||
android:enabled="false"
|
||||
android:text="@string/action_install_microG"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_skip"
|
||||
app:layout_constraintTop_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_skip"
|
||||
style="@style/Widget.Material3.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/margin_xsmall"
|
||||
android:text="@string/action_ignore"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_microG"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
</LinearLayout>
|
||||
@@ -1,84 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout 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/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".view.ui.onboarding.OnboardingFragment">
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tab_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:background="@android:color/transparent"
|
||||
app:tabBackground="@drawable/tab_selector_onboarding"
|
||||
app:tabGravity="center"
|
||||
app:tabIndicatorHeight="0dp"
|
||||
app:tabTextAppearance="@style/TextAppearance.Aurora.Tab"
|
||||
app:tabSelectedTextColor="@android:color/white"
|
||||
app:tabTextColor="@android:color/transparent" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/viewpager2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_above="@id/layout_bottom"
|
||||
android:layout_below="@id/tab_layout" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/layout_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_forward"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_margin="@dimen/margin_xsmall"
|
||||
android:text="@string/action_next"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/btn_backward"
|
||||
app:layout_constraintTop_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_backward"
|
||||
style="@style/Widget.Material3.Button.TextButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_margin="@dimen/margin_xsmall"
|
||||
android:text="@string/action_back"
|
||||
android:textAllCaps="false"
|
||||
app:layout_constraintEnd_toStartOf="@id/btn_forward"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
</RelativeLayout>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
@@ -1,106 +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:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/top_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentTop="true"
|
||||
android:divider="@drawable/divider"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:paddingStart="@dimen/padding_normal"
|
||||
android:paddingEnd="@dimen/padding_normal"
|
||||
android:text="@string/onboarding_title_gsf"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="32sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/padding_normal"
|
||||
android:paddingEnd="@dimen/padding_normal"
|
||||
android:text="@string/onboarding_title_gsf_desc"
|
||||
android:textAlignment="textStart" />
|
||||
</LinearLayout>
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/epoxy_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_above="@id/bottom_layout"
|
||||
android:layout_below="@+id/top_layout"
|
||||
android:clipToPadding="false"
|
||||
android:nestedScrollingEnabled="false"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:scrollbars="none"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/view_dash" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/bottom_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:background="?attr/colorSurface"
|
||||
android:divider="@drawable/divider"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/padding_large"
|
||||
android:paddingEnd="@dimen/padding_large"
|
||||
android:showDividers="middle">
|
||||
|
||||
<com.google.android.material.checkbox.MaterialCheckBox
|
||||
android:id="@+id/checkbox_agreement"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/padding_large"
|
||||
android:paddingEnd="@dimen/padding_xxsmall"
|
||||
android:text="@string/onboarding_gms_agreement" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_microG"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:enabled="false"
|
||||
android:text="@string/action_install_microG" />
|
||||
|
||||
<com.google.android.material.progressindicator.LinearProgressIndicator
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="24dp"
|
||||
android:visibility="invisible" />
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
@@ -1,72 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<LinearLayout 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:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@drawable/divider"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?attr/actionBarSize"
|
||||
android:visibility="gone"
|
||||
app:navigationIcon="@drawable/ic_arrow_back"
|
||||
app:title="@string/onboarding_title_permissions" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:paddingStart="@dimen/padding_normal"
|
||||
android:paddingEnd="@dimen/padding_normal"
|
||||
android:text="@string/onboarding_title_permissions"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="32sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/subtitle"
|
||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/padding_normal"
|
||||
android:paddingEnd="@dimen/padding_normal"
|
||||
android:text="@string/onboarding_permission_select"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/epoxy_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:scrollbars="none"
|
||||
tools:listitem="@layout/view_permission" />
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,59 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:divider="@drawable/divider"
|
||||
android:orientation="vertical"
|
||||
android:showDividers="middle">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:includeFontPadding="true"
|
||||
android:paddingStart="@dimen/padding_normal"
|
||||
android:paddingEnd="@dimen/padding_normal"
|
||||
android:text="@string/onboarding_title_welcome"
|
||||
android:textAlignment="textStart"
|
||||
android:textColor="?colorAccent"
|
||||
android:textSize="32sp" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/AuroraTextStyle.Subtitle.Alt"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="@dimen/padding_normal"
|
||||
android:paddingEnd="@dimen/padding_normal"
|
||||
android:text="@string/onboarding_welcome_select"
|
||||
android:textAlignment="textStart" />
|
||||
|
||||
<com.airbnb.epoxy.EpoxyRecyclerView
|
||||
android:id="@+id/epoxy_recycler"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:padding="@dimen/padding_medium"
|
||||
android:scrollbars="none"
|
||||
tools:listitem="@layout/view_dash" />
|
||||
</LinearLayout>
|
||||
@@ -1,64 +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/>.
|
||||
~
|
||||
-->
|
||||
|
||||
<LinearLayout 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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:orientation="horizontal"
|
||||
android:padding="@dimen/padding_small">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/img"
|
||||
android:layout_width="@dimen/icon_size_default"
|
||||
android:layout_height="@dimen/icon_size_default"
|
||||
android:layout_gravity="center_vertical"
|
||||
app:tint="?colorAccent"
|
||||
tools:src="@drawable/ic_menu_about" />
|
||||
|
||||
<View
|
||||
android:layout_width="@dimen/margin_xxsmall"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginStart="@dimen/margin_xlarge"
|
||||
android:layout_marginEnd="@dimen/margin_xlarge"
|
||||
android:background="@drawable/divider_line"
|
||||
android:backgroundTint="?colorControlHighlight" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/line1"
|
||||
style="@style/AuroraTextStyle.Subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/line2"
|
||||
style="@style/AuroraTextStyle.Line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:text="Subtitle" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
@@ -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:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="@dimen/padding_small">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/line1"
|
||||
style="@style/AuroraTextStyle.Subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toStartOf="@id/btn_action"
|
||||
tools:text="Permission Title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/line2"
|
||||
style="@style/AuroraTextStyle.Line2"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/line1"
|
||||
android:layout_toStartOf="@id/btn_action"
|
||||
android:maxLines="3"
|
||||
tools:text="Permission Description" />
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/btn_action"
|
||||
style="@style/Widget.Material3.Button.TextButton.Dialog.Flush"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:text="@string/action_grant"
|
||||
app:iconPadding="@dimen/padding_small" />
|
||||
</RelativeLayout>
|
||||
@@ -70,11 +70,7 @@
|
||||
android:id="@+id/settingsFragment"
|
||||
android:name="com.aurora.store.view.ui.preferences.SettingsFragment"
|
||||
android:label="@string/title_settings"
|
||||
tools:layout="@layout/fragment_setting">
|
||||
<action
|
||||
android:id="@+id/action_settingsFragment_to_permissionsFragment"
|
||||
app:destination="@id/permissionsFragment" />
|
||||
</fragment>
|
||||
tools:layout="@layout/fragment_setting" />
|
||||
<fragment
|
||||
android:id="@+id/installationPreference"
|
||||
android:name="com.aurora.store.view.ui.preferences.installation.InstallationPreference"
|
||||
@@ -182,12 +178,6 @@
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@id/mobile_navigation"
|
||||
app:popUpToInclusive="true" />
|
||||
<action
|
||||
android:id="@+id/action_splashFragment_to_onboardingFragment"
|
||||
app:destination="@id/onboardingFragment"
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@id/mobile_navigation"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/googleFragment"
|
||||
@@ -199,17 +189,6 @@
|
||||
app:popUpTo="@id/splashFragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/onboardingFragment"
|
||||
android:name="com.aurora.store.view.ui.onboarding.OnboardingFragment"
|
||||
tools:layout="@layout/fragment_onboarding">
|
||||
<action
|
||||
android:id="@+id/action_onboardingFragment_to_splashFragment"
|
||||
app:destination="@id/splashFragment"
|
||||
app:launchSingleTop="true"
|
||||
app:popUpTo="@id/mobile_navigation"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/installerFragment"
|
||||
android:name="com.aurora.store.view.ui.preferences.installation.InstallerFragment"
|
||||
@@ -224,21 +203,6 @@
|
||||
android:id="@+id/action_dispenserFragment_to_removeDispenserDialog"
|
||||
app:destination="@id/removeDispenserDialog" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/permissionsFragment"
|
||||
android:name="com.aurora.store.view.ui.onboarding.PermissionsFragment"
|
||||
android:label="PermissionsFragment"
|
||||
tools:layout="@layout/fragment_onboarding_permissions">
|
||||
<argument
|
||||
android:name="isOnboarding"
|
||||
android:defaultValue="true"
|
||||
app:argType="boolean" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/detailsMicroGFragment"
|
||||
android:name="com.aurora.store.view.ui.details.DetailsMicroGFragment"
|
||||
android:label="MicroGFragment"
|
||||
tools:layout="@layout/fragment_details_microg" />
|
||||
<dialog
|
||||
android:id="@+id/appMenuSheet"
|
||||
android:name="com.aurora.store.view.ui.sheets.AppMenuSheet"
|
||||
|
||||
@@ -1,82 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.ui.onboarding
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.aurora.Constants
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_AUTO_DELETE
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DISPENSER_URLS
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_AURORA_ONLY
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_FDROID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FOR_YOU
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_STYLE
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_CHECK_INTERVAL
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_EXTENDED
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_VENDING_VERSION
|
||||
import com.aurora.store.util.save
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class OnboardingFragment : BaseFlavouredOnboardingFragment() {
|
||||
|
||||
override fun loadDefaultPreferences() {
|
||||
/*Filters*/
|
||||
save(PREFERENCE_FILTER_AURORA_ONLY, false)
|
||||
save(PREFERENCE_FILTER_FDROID, true)
|
||||
|
||||
/*Network*/
|
||||
save(PREFERENCE_DISPENSER_URLS, setOf(Constants.URL_DISPENSER))
|
||||
save(PREFERENCE_VENDING_VERSION, 0)
|
||||
|
||||
/*Customization*/
|
||||
save(PREFERENCE_THEME_STYLE, 0)
|
||||
save(PREFERENCE_DEFAULT_SELECTED_TAB, 0)
|
||||
save(PREFERENCE_FOR_YOU, true)
|
||||
|
||||
/*Installer*/
|
||||
save(PREFERENCE_AUTO_DELETE, true)
|
||||
save(PREFERENCE_INSTALLER_ID, 0)
|
||||
|
||||
/*Updates*/
|
||||
save(PREFERENCE_UPDATES_EXTENDED, false)
|
||||
save(PREFERENCE_UPDATES_CHECK_INTERVAL, 3)
|
||||
}
|
||||
|
||||
override fun onboardingPages(): List<Fragment> {
|
||||
return listOf(
|
||||
WelcomeFragment(),
|
||||
PermissionsFragment.newInstance()
|
||||
)
|
||||
}
|
||||
|
||||
override fun setupAutoUpdates() {
|
||||
super.setupAutoUpdates()
|
||||
|
||||
// Remove super & implement variant logic here
|
||||
}
|
||||
|
||||
override fun finishOnboarding() {
|
||||
super.finishOnboarding()
|
||||
|
||||
// Remove super & implement variant logic here
|
||||
}
|
||||
}
|
||||
@@ -1,82 +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/>.
|
||||
*
|
||||
*/
|
||||
|
||||
package com.aurora.store.view.ui.onboarding
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.aurora.Constants
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_AUTO_DELETE
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_DISPENSER_URLS
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_AURORA_ONLY
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FILTER_FDROID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_FOR_YOU
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_STYLE
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_CHECK_INTERVAL
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_UPDATES_EXTENDED
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_VENDING_VERSION
|
||||
import com.aurora.store.util.save
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
|
||||
@AndroidEntryPoint
|
||||
class OnboardingFragment : BaseFlavouredOnboardingFragment() {
|
||||
|
||||
override fun loadDefaultPreferences() {
|
||||
/*Filters*/
|
||||
save(PREFERENCE_FILTER_AURORA_ONLY, false)
|
||||
save(PREFERENCE_FILTER_FDROID, true)
|
||||
|
||||
/*Network*/
|
||||
save(PREFERENCE_DISPENSER_URLS, setOf(Constants.URL_DISPENSER))
|
||||
save(PREFERENCE_VENDING_VERSION, 0)
|
||||
|
||||
/*Customization*/
|
||||
save(PREFERENCE_THEME_STYLE, 0)
|
||||
save(PREFERENCE_DEFAULT_SELECTED_TAB, 0)
|
||||
save(PREFERENCE_FOR_YOU, true)
|
||||
|
||||
/*Installer*/
|
||||
save(PREFERENCE_AUTO_DELETE, true)
|
||||
save(PREFERENCE_INSTALLER_ID, 0)
|
||||
|
||||
/*Updates*/
|
||||
save(PREFERENCE_UPDATES_EXTENDED, false)
|
||||
save(PREFERENCE_UPDATES_CHECK_INTERVAL, 3)
|
||||
}
|
||||
|
||||
override fun onboardingPages(): List<Fragment> {
|
||||
return listOf(
|
||||
WelcomeFragment(),
|
||||
PermissionsFragment.newInstance()
|
||||
)
|
||||
}
|
||||
|
||||
override fun setupAutoUpdates() {
|
||||
super.setupAutoUpdates()
|
||||
|
||||
// Remove super & implement variant logic here
|
||||
}
|
||||
|
||||
override fun finishOnboarding() {
|
||||
super.finishOnboarding()
|
||||
|
||||
// Remove super & implement variant logic here
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user