mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
App | Setting | New menu 3 (#2115)
This commit is contained in:
parent
c263305082
commit
182b99b6ae
24 changed files with 511 additions and 474 deletions
|
@ -153,6 +153,7 @@ dependencies {
|
|||
implementation project(':library-emojifier')
|
||||
implementation project(':library-syntax-highlighter')
|
||||
implementation project(':analytics')
|
||||
implementation project(':ui-settings')
|
||||
|
||||
def applicationDependencies = rootProject.ext.mainApplication
|
||||
def unitTestDependencies = rootProject.ext.unitTesting
|
||||
|
|
|
@ -6,8 +6,8 @@ import com.anytypeio.anytype.domain.auth.interactor.GetLibraryVersion
|
|||
import com.anytypeio.anytype.domain.auth.repo.AuthRepository
|
||||
import com.anytypeio.anytype.domain.block.repo.BlockRepository
|
||||
import com.anytypeio.anytype.domain.misc.UrlBuilder
|
||||
import com.anytypeio.anytype.presentation.settings.AboutAppViewModel
|
||||
import com.anytypeio.anytype.ui.settings.AboutAppFragment
|
||||
import com.anytypeio.anytype.ui_settings.about.AboutAppViewModel
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.Subcomponent
|
||||
|
|
|
@ -4,33 +4,22 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Typography
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.Font
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.fragment.app.viewModels
|
||||
import com.anytypeio.anytype.BuildConfig
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_ui.foundation.Dragger
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
|
||||
import com.anytypeio.anytype.di.common.componentManager
|
||||
import com.anytypeio.anytype.presentation.settings.AboutAppViewModel
|
||||
import com.anytypeio.anytype.ui_settings.about.AboutAppScreen
|
||||
import com.anytypeio.anytype.ui_settings.about.AboutAppViewModel
|
||||
import javax.inject.Inject
|
||||
|
||||
|
||||
|
@ -48,7 +37,14 @@ class AboutAppFragment : BaseBottomSheetComposeFragment() {
|
|||
): View {
|
||||
return ComposeView(requireContext()).apply {
|
||||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||
setContent { aboutAppScreen(vm) }
|
||||
setContent {
|
||||
MaterialTheme(typography = typography) {
|
||||
AboutAppScreen(
|
||||
vm = vm,
|
||||
version = BuildConfig.VERSION_NAME
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,145 +57,6 @@ class AboutAppFragment : BaseBottomSheetComposeFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun aboutAppScreen(
|
||||
vm: AboutAppViewModel
|
||||
) {
|
||||
|
||||
Column {
|
||||
Box(
|
||||
modifier = Modifier.padding(top = 6.dp).align(Alignment.CenterHorizontally)
|
||||
) {
|
||||
Dragger()
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.align(Alignment.CenterHorizontally).padding(
|
||||
top = 75.dp,
|
||||
bottom = 16.dp
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.about),
|
||||
fontFamily = fonts,
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 28.sp
|
||||
)
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp,
|
||||
bottom = 12.dp
|
||||
)
|
||||
) {
|
||||
Box(modifier = Modifier.weight(1.0f, true)) {
|
||||
Text(
|
||||
text = stringResource(R.string.app_version),
|
||||
fontFamily = fonts,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.weight(2.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Text(
|
||||
text = BuildConfig.VERSION_NAME,
|
||||
fontFamily = fonts,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp,
|
||||
bottom = 12.dp
|
||||
)
|
||||
) {
|
||||
Box(modifier = Modifier.weight(1.0f, true)) {
|
||||
Text(
|
||||
text = stringResource(R.string.build_number),
|
||||
fontFamily = fonts,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.weight(2.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Text(
|
||||
text = BuildConfig.VERSION_CODE.toString(),
|
||||
fontFamily = fonts,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp,
|
||||
bottom = 12.dp
|
||||
)
|
||||
) {
|
||||
Box(modifier = Modifier.weight(1.0f, true)) {
|
||||
Text(
|
||||
text = stringResource(R.string.library),
|
||||
fontFamily = fonts,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.weight(2.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Text(
|
||||
text = vm.libraryVersion.collectAsState().value,
|
||||
fontFamily = fonts,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp,
|
||||
bottom = 32.dp
|
||||
)
|
||||
) {
|
||||
Box(modifier = Modifier.weight(1.0f, true)) {
|
||||
Text(
|
||||
text = stringResource(R.string.user_id),
|
||||
fontFamily = fonts,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.weight(2.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Text(
|
||||
text = vm.userId.collectAsState().value,
|
||||
fontFamily = fonts,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val fonts = FontFamily(
|
||||
Font(R.font.inter_regular),
|
||||
Font(R.font.inter_bold, weight = FontWeight.Bold),
|
||||
|
|
|
@ -4,26 +4,11 @@ import android.os.Bundle
|
|||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.anytypeio.anytype.R
|
||||
import com.anytypeio.anytype.core_ui.foundation.Divider
|
||||
import com.anytypeio.anytype.core_ui.foundation.Dragger
|
||||
import com.anytypeio.anytype.core_ui.foundation.Toolbar
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
|
||||
import com.anytypeio.anytype.ui_settings.account.AccountAndDataScreen
|
||||
|
||||
class AccountAndDataFragment : BaseBottomSheetComposeFragment() {
|
||||
|
||||
|
@ -34,7 +19,11 @@ class AccountAndDataFragment : BaseBottomSheetComposeFragment() {
|
|||
): View {
|
||||
return ComposeView(requireContext()).apply {
|
||||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||
setContent { accountAndDataScreen() }
|
||||
setContent {
|
||||
MaterialTheme(typography = typography) {
|
||||
AccountAndDataScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,151 +36,3 @@ class AccountAndDataFragment : BaseBottomSheetComposeFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun accountAndDataScreen() {
|
||||
MaterialTheme(typography = typography) {
|
||||
Column {
|
||||
Box(Modifier.padding(vertical = 6.dp).align(Alignment.CenterHorizontally)) {
|
||||
Dragger()
|
||||
}
|
||||
Toolbar(stringResource(R.string.account_and_data))
|
||||
Section(stringResource(R.string.access))
|
||||
Keychain()
|
||||
Divider(paddingStart = 60.dp)
|
||||
Pincode()
|
||||
Divider(paddingStart = 60.dp)
|
||||
Section(stringResource(R.string.data))
|
||||
Action(stringResource(R.string.clear_file_cache))
|
||||
Divider()
|
||||
Section(stringResource(R.string.account))
|
||||
Action(
|
||||
name = stringResource(R.string.reset_account),
|
||||
color = colorResource(R.color.anytype_text_red)
|
||||
)
|
||||
Divider()
|
||||
Action(
|
||||
name = stringResource(R.string.delete_account),
|
||||
color = colorResource(R.color.anytype_text_red)
|
||||
)
|
||||
Divider()
|
||||
Box(Modifier.height(20.dp))
|
||||
Action(stringResource(R.string.log_out))
|
||||
Divider()
|
||||
Box(Modifier.height(54.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Section(name: String) {
|
||||
Box(
|
||||
modifier = Modifier.height(52.dp).fillMaxWidth(),
|
||||
contentAlignment = Alignment.BottomStart
|
||||
) {
|
||||
Text(
|
||||
text = name,
|
||||
fontSize = 13.sp,
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
bottom = 8.dp
|
||||
),
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Keychain() {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.height(52.dp)
|
||||
) {
|
||||
Image(
|
||||
painterResource(R.drawable.ic_key),
|
||||
contentDescription = "Key icon",
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp
|
||||
)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.keychain_phrase),
|
||||
modifier = Modifier.padding(
|
||||
start = 12.dp
|
||||
)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier.weight(1.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Arrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Pincode() {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.height(52.dp)
|
||||
) {
|
||||
Image(
|
||||
painterResource(R.drawable.ic_pin_code),
|
||||
contentDescription = "Pincode icon",
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp
|
||||
)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.pin_code),
|
||||
modifier = Modifier.padding(
|
||||
start = 12.dp
|
||||
)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier.weight(1.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Row {
|
||||
Text(
|
||||
text = stringResource(R.string.off),
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary),
|
||||
modifier = Modifier.padding(end = 10.dp)
|
||||
)
|
||||
Arrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Arrow() {
|
||||
Image(
|
||||
painterResource(R.drawable.ic_arrow_forward),
|
||||
contentDescription = "Arrow forward",
|
||||
modifier = Modifier.padding(
|
||||
end = 20.dp
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Action(
|
||||
name: String,
|
||||
color: Color = Color.Unspecified
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.height(52.dp).fillMaxWidth(),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Text(
|
||||
text = name,
|
||||
color = color,
|
||||
fontSize = 17.sp,
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.anytypeio.anytype.ui.settings
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import com.anytypeio.anytype.core_utils.ui.BaseBottomSheetComposeFragment
|
||||
import com.anytypeio.anytype.ui_settings.main.MainSettingScreen
|
||||
|
||||
class MainSettingFragment : BaseBottomSheetComposeFragment() {
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
return ComposeView(requireContext()).apply {
|
||||
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
|
||||
setContent {
|
||||
MaterialTheme(typography = typography) {
|
||||
MainSettingScreen()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun injectDependencies() {}
|
||||
override fun releaseDependencies() {}
|
||||
}
|
|
@ -263,16 +263,4 @@ Do the computation of an expensive paragraph of text on a background thread:
|
|||
<string name="download_from_node">All files will be deleted from your current device. They can be downloaded again from a backup node or another device.</string>
|
||||
|
||||
<string name="new_profile">new profile</string>
|
||||
<string name="about">About</string>
|
||||
<string name="app_version">App version</string>
|
||||
<string name="library">Library</string>
|
||||
<string name="user_id">User ID</string>
|
||||
<string name="build_number">Build Number</string>
|
||||
<string name="account_and_data"><![CDATA[Account & data]]></string>
|
||||
<string name="access">Access</string>
|
||||
<string name="data">Data</string>
|
||||
<string name="account">Account</string>
|
||||
<string name="delete_account">Delete account</string>
|
||||
<string name="reset_account">Reset account</string>
|
||||
<string name="clear_file_cache">Clear file cache</string>
|
||||
</resources>
|
||||
|
|
|
@ -13,43 +13,6 @@ android {
|
|||
testInstrumentationRunner config["test_runner"]
|
||||
}
|
||||
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions 'default'
|
||||
productFlavors {
|
||||
stable {
|
||||
dimension 'default'
|
||||
}
|
||||
experimental{
|
||||
dimension 'default'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
stable {
|
||||
java {
|
||||
srcDirs 'src/stable/java'
|
||||
}
|
||||
res {
|
||||
srcDirs 'src/stable/res'
|
||||
}
|
||||
}
|
||||
experimental {
|
||||
java {
|
||||
srcDirs 'src/experimental/java'
|
||||
}
|
||||
res {
|
||||
srcDirs 'src/experimental/res'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.anytypeio.anytype.core_ui.foundation
|
||||
|
||||
import androidx.annotation.DrawableRes
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
|
@ -9,6 +11,7 @@ import androidx.compose.runtime.Composable
|
|||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.anytypeio.anytype.core_ui.R
|
||||
|
@ -21,7 +24,8 @@ fun Toolbar(title: String) {
|
|||
) {
|
||||
Text(
|
||||
text = title,
|
||||
style = MaterialTheme.typography.h3
|
||||
style = MaterialTheme.typography.h3,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -50,4 +54,47 @@ fun Divider(
|
|||
.height(0.5.dp)
|
||||
.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Option(
|
||||
@DrawableRes image: Int,
|
||||
text: String
|
||||
) {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.height(52.dp)
|
||||
) {
|
||||
Image(
|
||||
painterResource(image),
|
||||
contentDescription = "Option icon",
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp
|
||||
)
|
||||
)
|
||||
Text(
|
||||
text = text,
|
||||
color = colorResource(R.color.text_primary),
|
||||
modifier = Modifier.padding(
|
||||
start = 12.dp
|
||||
)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier.weight(1.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Arrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Arrow() {
|
||||
Image(
|
||||
painterResource(R.drawable.ic_arrow_forward),
|
||||
contentDescription = "Arrow forward",
|
||||
modifier = Modifier.padding(
|
||||
end = 20.dp
|
||||
)
|
||||
)
|
||||
}
|
|
@ -13,48 +13,6 @@ android {
|
|||
testInstrumentationRunner config["test_runner"]
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions 'default'
|
||||
productFlavors {
|
||||
stable {
|
||||
dimension 'default'
|
||||
}
|
||||
experimental{
|
||||
dimension 'default'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
stable {
|
||||
java {
|
||||
srcDirs 'src/stable/java'
|
||||
}
|
||||
res {
|
||||
srcDirs 'src/stable/res'
|
||||
}
|
||||
}
|
||||
experimental {
|
||||
java {
|
||||
srcDirs 'src/experimental/java'
|
||||
}
|
||||
res {
|
||||
srcDirs 'src/experimental/res'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
testOptions {
|
||||
unitTests {
|
||||
includeAndroidResources = true
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
|
@ -15,42 +15,12 @@ android {
|
|||
|
||||
testOptions.unitTests.includeAndroidResources = true
|
||||
|
||||
flavorDimensions 'default'
|
||||
productFlavors {
|
||||
stable {
|
||||
dimension 'default'
|
||||
}
|
||||
experimental{
|
||||
dimension 'default'
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
stable {
|
||||
java {
|
||||
srcDirs 'src/stable/java'
|
||||
}
|
||||
res {
|
||||
srcDirs 'src/stable/res'
|
||||
}
|
||||
}
|
||||
experimental {
|
||||
java {
|
||||
srcDirs 'src/experimental/java'
|
||||
}
|
||||
res {
|
||||
srcDirs 'src/experimental/res'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lint {
|
||||
disable 'NullSafeMutableLiveData'
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation project(':domain')
|
||||
implementation project(':core-utils')
|
||||
implementation project(':library-emojifier')
|
||||
|
|
|
@ -14,13 +14,6 @@ android {
|
|||
testInstrumentationRunner config["test_runner"]
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
|
|
|
@ -15,3 +15,4 @@ include ':app',
|
|||
':analytics',
|
||||
':protocol',
|
||||
':core-models'
|
||||
include ':ui-settings'
|
||||
|
|
1
ui-settings/.gitignore
vendored
Normal file
1
ui-settings/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/build
|
49
ui-settings/build.gradle
Normal file
49
ui-settings/build.gradle
Normal file
|
@ -0,0 +1,49 @@
|
|||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
android {
|
||||
def config = rootProject.extensions.getByName("ext")
|
||||
|
||||
compileSdkVersion config["compile_sdk"]
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion config["min_sdk"]
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
compose true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion config["compose_version"]
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation project(':domain')
|
||||
implementation project(':core-ui')
|
||||
|
||||
def applicationDependencies = rootProject.ext.mainApplication
|
||||
def unitTestDependencies = rootProject.ext.unitTesting
|
||||
|
||||
implementation applicationDependencies.lifecycleViewModel
|
||||
|
||||
implementation applicationDependencies.compose
|
||||
implementation applicationDependencies.composeFoundation
|
||||
implementation applicationDependencies.composeMaterial
|
||||
implementation applicationDependencies.composeToolingPreview
|
||||
|
||||
debugImplementation applicationDependencies.composeTooling
|
||||
|
||||
testImplementation unitTestDependencies.junit
|
||||
testImplementation unitTestDependencies.kotlinTest
|
||||
}
|
1
ui-settings/src/main/AndroidManifest.xml
Normal file
1
ui-settings/src/main/AndroidManifest.xml
Normal file
|
@ -0,0 +1 @@
|
|||
<manifest package="com.anytypeio.anytype.ui_settings"/>
|
|
@ -0,0 +1,123 @@
|
|||
package com.anytypeio.anytype.ui_settings.about
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.anytypeio.anytype.core_ui.foundation.Dragger
|
||||
import com.anytypeio.anytype.ui_settings.R
|
||||
|
||||
@Composable
|
||||
fun AboutAppScreen(
|
||||
vm: AboutAppViewModel,
|
||||
version: String
|
||||
) {
|
||||
Column {
|
||||
Box(
|
||||
modifier = Modifier.padding(top = 6.dp).align(Alignment.CenterHorizontally)
|
||||
) {
|
||||
Dragger()
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.align(Alignment.CenterHorizontally).padding(
|
||||
top = 75.dp,
|
||||
bottom = 16.dp
|
||||
)
|
||||
) {
|
||||
Text(
|
||||
text = stringResource(R.string.about),
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 28.sp,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp,
|
||||
bottom = 12.dp
|
||||
)
|
||||
) {
|
||||
Box(modifier = Modifier.weight(1.0f, true)) {
|
||||
Text(
|
||||
text = stringResource(R.string.app_version),
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.weight(2.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Text(
|
||||
text = version,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp,
|
||||
bottom = 12.dp
|
||||
)
|
||||
) {
|
||||
Box(modifier = Modifier.weight(1.0f, true)) {
|
||||
Text(
|
||||
text = stringResource(R.string.library),
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.weight(2.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Text(
|
||||
text = vm.libraryVersion.collectAsState().value,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
Row(
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
end = 20.dp,
|
||||
top = 12.dp,
|
||||
bottom = 32.dp
|
||||
)
|
||||
) {
|
||||
Box(modifier = Modifier.weight(1.0f, true)) {
|
||||
Text(
|
||||
text = stringResource(R.string.user_id),
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
Box(
|
||||
modifier = Modifier.weight(2.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Text(
|
||||
text = vm.userId.collectAsState().value,
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package com.anytypeio.anytype.presentation.settings
|
||||
package com.anytypeio.anytype.ui_settings.about
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
|
@ -6,17 +6,16 @@ import androidx.lifecycle.viewModelScope
|
|||
import com.anytypeio.anytype.domain.auth.interactor.GetCurrentAccount
|
||||
import com.anytypeio.anytype.domain.auth.interactor.GetLibraryVersion
|
||||
import com.anytypeio.anytype.domain.base.BaseUseCase
|
||||
import com.anytypeio.anytype.presentation.common.BaseViewModel
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class AboutAppViewModel(
|
||||
private val getCurrentAccount: GetCurrentAccount,
|
||||
private val getLibraryVersion: GetLibraryVersion
|
||||
) : BaseViewModel() {
|
||||
) : ViewModel() {
|
||||
|
||||
val libraryVersion = MutableStateFlow("")
|
||||
val userId = MutableStateFlow<String>("")
|
||||
val userId = MutableStateFlow("")
|
||||
|
||||
init {
|
||||
viewModelScope.launch {
|
|
@ -0,0 +1,133 @@
|
|||
package com.anytypeio.anytype.ui_settings.account
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.colorResource
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.anytypeio.anytype.core_ui.foundation.*
|
||||
import com.anytypeio.anytype.ui_settings.R
|
||||
|
||||
@Composable
|
||||
fun AccountAndDataScreen() {
|
||||
Column {
|
||||
Box(Modifier.padding(vertical = 6.dp).align(Alignment.CenterHorizontally)) {
|
||||
Dragger()
|
||||
}
|
||||
Toolbar(stringResource(R.string.account_and_data))
|
||||
Section(stringResource(R.string.access))
|
||||
Option(
|
||||
image = R.drawable.ic_key,
|
||||
text = stringResource(R.string.keychain_phrase)
|
||||
)
|
||||
Divider(paddingStart = 60.dp)
|
||||
Pincode()
|
||||
Divider(paddingStart = 60.dp)
|
||||
Section(stringResource(R.string.data))
|
||||
Action(
|
||||
name = stringResource(R.string.clear_file_cache),
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
Divider()
|
||||
Section(stringResource(R.string.account))
|
||||
Action(
|
||||
name = stringResource(R.string.reset_account),
|
||||
color = colorResource(R.color.anytype_text_red)
|
||||
)
|
||||
Divider()
|
||||
Action(
|
||||
name = stringResource(R.string.delete_account),
|
||||
color = colorResource(R.color.anytype_text_red)
|
||||
)
|
||||
Divider()
|
||||
Box(Modifier.height(20.dp))
|
||||
Action(
|
||||
name = stringResource(R.string.log_out),
|
||||
color = colorResource(R.color.text_primary)
|
||||
)
|
||||
Divider()
|
||||
Box(Modifier.height(54.dp))
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Section(name: String) {
|
||||
Box(
|
||||
modifier = Modifier.height(52.dp).fillMaxWidth(),
|
||||
contentAlignment = Alignment.BottomStart
|
||||
) {
|
||||
Text(
|
||||
text = name,
|
||||
fontSize = 13.sp,
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp,
|
||||
bottom = 8.dp
|
||||
),
|
||||
color = colorResource(R.color.text_secondary)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Pincode() {
|
||||
Row(
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
modifier = Modifier.height(52.dp)
|
||||
) {
|
||||
Image(
|
||||
painterResource(R.drawable.ic_pin_code),
|
||||
contentDescription = "Pincode icon",
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp
|
||||
)
|
||||
)
|
||||
Text(
|
||||
text = stringResource(R.string.pin_code),
|
||||
color = colorResource(R.color.text_primary),
|
||||
modifier = Modifier.padding(
|
||||
start = 12.dp
|
||||
)
|
||||
)
|
||||
Box(
|
||||
modifier = Modifier.weight(1.0f, true),
|
||||
contentAlignment = Alignment.CenterEnd
|
||||
) {
|
||||
Row {
|
||||
Text(
|
||||
text = stringResource(R.string.off),
|
||||
fontSize = 17.sp,
|
||||
color = colorResource(R.color.text_secondary),
|
||||
modifier = Modifier.padding(end = 10.dp)
|
||||
)
|
||||
Arrow()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
fun Action(
|
||||
name: String,
|
||||
color: Color = Color.Unspecified
|
||||
) {
|
||||
Box(
|
||||
modifier = Modifier.height(52.dp).fillMaxWidth(),
|
||||
contentAlignment = Alignment.CenterStart
|
||||
) {
|
||||
Text(
|
||||
text = name,
|
||||
color = color,
|
||||
fontSize = 17.sp,
|
||||
modifier = Modifier.padding(
|
||||
start = 20.dp
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package com.anytypeio.anytype.ui_settings.main
|
||||
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.anytypeio.anytype.core_ui.foundation.Divider
|
||||
import com.anytypeio.anytype.core_ui.foundation.Dragger
|
||||
import com.anytypeio.anytype.core_ui.foundation.Option
|
||||
import com.anytypeio.anytype.ui_settings.R
|
||||
|
||||
@Composable
|
||||
fun MainSettingScreen() {
|
||||
Column {
|
||||
Box(
|
||||
modifier = Modifier.padding(vertical = 6.dp).align(Alignment.CenterHorizontally)
|
||||
) {
|
||||
Dragger()
|
||||
}
|
||||
Option(
|
||||
image = R.drawable.ic_key,
|
||||
text = stringResource(R.string.account_and_data)
|
||||
)
|
||||
Divider()
|
||||
Option(
|
||||
image = R.drawable.ic_key,
|
||||
text = stringResource(R.string.personalization)
|
||||
)
|
||||
Divider()
|
||||
Option(
|
||||
image = R.drawable.ic_key,
|
||||
text = stringResource(R.string.appearance)
|
||||
)
|
||||
Divider()
|
||||
Option(
|
||||
image = R.drawable.ic_key,
|
||||
text = stringResource(R.string.about)
|
||||
)
|
||||
Divider()
|
||||
Box(modifier = Modifier.height(16.dp))
|
||||
}
|
||||
}
|
18
ui-settings/src/main/res/drawable/ic_key.xml
Normal file
18
ui-settings/src/main/res/drawable/ic_key.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="28dp"
|
||||
android:height="29dp"
|
||||
android:viewportWidth="28"
|
||||
android:viewportHeight="29">
|
||||
<path
|
||||
android:pathData="M6,0.125L22,0.125A6,6 0,0 1,28 6.125L28,22.125A6,6 0,0 1,22 28.125L6,28.125A6,6 0,0 1,0 22.125L0,6.125A6,6 0,0 1,6 0.125z"
|
||||
android:fillColor="#2AA7EE"/>
|
||||
<path
|
||||
android:pathData="M17,11.125m-5,0a5,5 0,1 1,10 0a5,5 0,1 1,-10 0"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M13,12.625L15.5,15.125L13,17.625H11V19.625H9V21.625L8.5,22.125H6V19.625L13,12.625Z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M20,9.5962C20,10.4246 19.3284,11.0962 18.5,11.0962C17.6716,11.0962 17,10.4246 17,9.5962C17,8.7678 17.6716,8.0962 18.5,8.0962C19.3284,8.0962 20,8.7678 20,9.5962Z"
|
||||
android:fillColor="#2AA7EE"/>
|
||||
</vector>
|
17
ui-settings/src/main/res/drawable/ic_pin_code.xml
Normal file
17
ui-settings/src/main/res/drawable/ic_pin_code.xml
Normal file
|
@ -0,0 +1,17 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="28dp"
|
||||
android:height="29dp"
|
||||
android:viewportWidth="28"
|
||||
android:viewportHeight="29">
|
||||
<path
|
||||
android:pathData="M6,0.125L22,0.125A6,6 0,0 1,28 6.125L28,22.125A6,6 0,0 1,22 28.125L6,28.125A6,6 0,0 1,0 22.125L0,6.125A6,6 0,0 1,6 0.125z"
|
||||
android:fillColor="#5DD400"/>
|
||||
<path
|
||||
android:pathData="M8,12.125L20,12.125A1,1 0,0 1,21 13.125L21,21.125A1,1 0,0 1,20 22.125L8,22.125A1,1 0,0 1,7 21.125L7,13.125A1,1 0,0 1,8 12.125z"
|
||||
android:fillColor="#ffffff"/>
|
||||
<path
|
||||
android:pathData="M14,5.875L14,5.875A3.75,3.75 0,0 1,17.75 9.625L17.75,15.625A3.75,3.75 0,0 1,14 19.375L14,19.375A3.75,3.75 0,0 1,10.25 15.625L10.25,9.625A3.75,3.75 0,0 1,14 5.875z"
|
||||
android:strokeWidth="1.5"
|
||||
android:fillColor="#00000000"
|
||||
android:strokeColor="#ffffff"/>
|
||||
</vector>
|
19
ui-settings/src/main/res/values/strings.xml
Normal file
19
ui-settings/src/main/res/values/strings.xml
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="about">About</string>
|
||||
<string name="app_version">App version</string>
|
||||
<string name="library">Library</string>
|
||||
<string name="user_id">User ID</string>
|
||||
<string name="account_and_data"><![CDATA[Account & Data]]></string>
|
||||
<string name="personalization">Personalization</string>
|
||||
<string name="appearance">Appearance</string>
|
||||
<string name="keychain_phrase">Keychain phrase</string>
|
||||
<string name="clear_file_cache">Clear file cache</string>
|
||||
<string name="account">Account</string>
|
||||
<string name="reset_account">Reset account</string>
|
||||
<string name="delete_account">Delete account</string>
|
||||
<string name="data">Data</string>
|
||||
<string name="log_out">Logout</string>
|
||||
<string name="pin_code">Pin code</string>
|
||||
<string name="access">Access</string>
|
||||
</resources>
|
Loading…
Add table
Add a link
Reference in a new issue