Refine Settings, continue work on About page

This commit is contained in:
Patryk Michalik
2021-03-24 12:08:35 +01:00
parent 841e065748
commit 86a575c568
12 changed files with 126 additions and 65 deletions

View File

@@ -46,6 +46,7 @@
<uses-permission android:name="android.permission.READ_DEVICE_CONFIG" />
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- TODO(b/150802536): Enabled only for ENABLE_FIXED_ROTATION_TRANSFORM feature flag -->
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>

View File

@@ -268,6 +268,7 @@ dependencies {
implementation "androidx.compose.runtime:runtime-rxjava2:$compose_version"
implementation "androidx.compose.compiler:compiler:$compose_version"
implementation "androidx.navigation:navigation-compose:1.0.0-alpha09"
implementation "com.google.accompanist:accompanist-glide:0.6.2"
}
protobuf {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 KiB

View File

@@ -6,9 +6,9 @@
<string name="icon_pack">Icon Pack</string>
<string name="settings">Settings</string>
<string name="home_screen_label">Home Screen</string>
<string name="home_screen_description">New apps, grid, icons.</string>
<string name="home_screen_description">New Apps, Grid, Icons</string>
<string name="general_label">General</string>
<string name="general_description">Notification Dots, icon pack.</string>
<string name="general_description">Notification Dots, Icon Pack</string>
<string name="home_screen_rotation_label">Home Screen Rotation</string>
<string name="home_screen_rotaton_description">When device is rotated.</string>
<string name="auto_add_shortcuts_label">Add New Apps to Home Screen</string>
@@ -17,11 +17,11 @@
<string name="grid_label">Grid</string>
<string name="grid_description">Grid dimensions, icon size.</string>
<string name="dock_label">Dock</string>
<string name="dock_description">Icon count.</string>
<string name="dock_description">Icon Count</string>
<string name="app_drawer_label">App Drawer</string>
<string name="app_drawer_description">Column count, icons.</string>
<string name="app_drawer_description">Column Count, Icons</string>
<string name="folders_label">Folders</string>
<string name="folders_description">Row and column count.</string>
<string name="folders_description">Row and Column Count</string>
<string name="app_drawer_columns">App Drawer Columns</string>
<string name="dock_icons">Dock Icons</string>
<string name="max_folder_columns">Max. Folder Columns</string>
@@ -50,4 +50,6 @@
<string name="quickswitch_maintainer">QuickSwitch Maintainer</string>
<string name="all_apps_search_bar_hint">Search Apps</string>
<string name="settings_button_text">Home Settings</string>
<string name="developer">Developer</string>
<string name="support_representative">Support Representative</string>
</resources>

View File

@@ -1,6 +1,7 @@
package app.lawnchair.ui.preferences
import android.content.Intent
import androidx.annotation.StringRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.rememberScrollState
@@ -20,6 +21,53 @@ import app.lawnchair.util.preferences.getFormattedVersionName
import com.android.launcher3.R
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
class TeamMember(val name: String, @StringRes val descriptionRes: Int, val photoUrl: String, val socialUrl: String)
val teamMembers = listOf(
TeamMember(
name = "Antonio J. Roa Valverde",
descriptionRes = R.string.developer,
photoUrl = "https://avatars.githubusercontent.com/u/914983",
socialUrl = "https://twitter.com/6020peaks"
),
TeamMember(
name = "David Sn",
descriptionRes = R.string.devops_engineer,
photoUrl = "https://i.imgur.com/b65akTl.png",
socialUrl = "https://codebucket.de"
),
TeamMember(
name = "Manuel Lorenzo",
descriptionRes = R.string.developer,
photoUrl = "https://avatars.githubusercontent.com/u/183264",
socialUrl = "https://twitter.com/noloman"
),
TeamMember(
name = "paphonb",
descriptionRes = R.string.developer,
photoUrl = "https://avatars.githubusercontent.com/u/8080853",
socialUrl = "https://twitter.com/paphonb"
),
TeamMember(
name = "raphtlw",
descriptionRes = R.string.developer,
photoUrl = "https://avatars.githubusercontent.com/u/47694127",
socialUrl = "https://twitter.com/raphtlw"
),
TeamMember(
name = "Rhyse Simpson",
descriptionRes = R.string.quickswitch_maintainer,
photoUrl = "https://avatars.githubusercontent.com/u/7065700",
socialUrl = "https://twitter.com/skittles9823"
),
TeamMember(
name = "Rik Kode",
descriptionRes = R.string.support_representative,
photoUrl = "https://avatars.githubusercontent.com/u/29402532",
socialUrl = "https://twitter.com/RickKode"
)
)
@Composable
fun About() {
val context = LocalContext.current
@@ -88,7 +136,7 @@ fun About() {
ContributorCard(
name = "Kshitij Gupta",
description = stringResource(id = R.string.kshitij_description),
photoResId = R.drawable.kshitij_gupta,
photoUrl = "https://avatars.githubusercontent.com/u/18647641",
links = {
ContributorLink(iconResId = R.drawable.ic_twitter, url = "https://twitter.com/Agent_Fabulous")
ContributorLink(iconResId = R.drawable.ic_github, url = "https://github.com/AgentFabulous")
@@ -96,9 +144,9 @@ fun About() {
)
ContributorCard(
name = "Patryk Michalik",
description = stringResource(id = R.string.patryk_description),
includeTopPadding = true,
photoResId = R.drawable.patryk_michalik,
description = stringResource(id = R.string.patryk_description),
photoUrl = "https://raw.githubusercontent.com/patrykmichalik/brand/master/logo-on-indigo.png",
links = {
ContributorLink(iconResId = R.drawable.ic_website, url = "https://patrykmichalik.com")
ContributorLink(iconResId = R.drawable.ic_twitter, url = "https://twitter.com/patrykmichalik_")
@@ -106,18 +154,15 @@ fun About() {
}
)
PreferenceGroup(heading = stringResource(id = R.string.team_members), useTopPadding = true) {
ContributorRow(
name = "David Sn",
description = stringResource(id = R.string.devops_engineer),
photoRes = R.drawable.david_sn,
url = "https://codebucket.de"
)
ContributorRow(
name = "Rhyse Simpson",
description = stringResource(id = R.string.quickswitch_maintainer),
photoRes = R.drawable.rhyse_simpson,
url = "https://twitter.com/skittles9823"
)
teamMembers.forEachIndexed { index, it ->
ContributorRow(
name = it.name,
description = stringResource(it.descriptionRes),
url = it.socialUrl,
photoUrl = it.photoUrl,
showDivider = index != teamMembers.size - 1
)
}
}
PreferenceGroup(useTopPadding = true) {
ClickListenerPreference(label = stringResource(id = R.string.acknowledgements), showDivider = false, onClick = {

View File

@@ -1,7 +1,6 @@
package app.lawnchair.ui.preferences
import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
@@ -11,15 +10,15 @@ import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.google.accompanist.glide.GlideImage
@Composable
fun ContributorCard(
includeTopPadding: Boolean = false,
name: String,
description: String,
@DrawableRes photoResId: Int,
photoUrl: String,
links: @Composable () -> Unit
) {
Column(
@@ -34,13 +33,20 @@ fun ContributorCard(
.padding(start = 16.dp, top = 16.dp, end = 16.dp)
) {
Row(verticalAlignment = Alignment.CenterVertically) {
Image(
painter = painterResource(id = photoResId), contentDescription = null, modifier = Modifier
GlideImage(
data = photoUrl, contentDescription = null, fadeIn = true, modifier = Modifier
.clip(
CircleShape
)
.width(48.dp)
.height(48.dp)
.height(48.dp),
loading = {
Box(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colors.onBackground.copy(alpha = 0.08F))
)
}
)
Spacer(modifier = Modifier.requiredWidth(16.dp))
Text(name, style = MaterialTheme.typography.subtitle1, color = MaterialTheme.colors.onBackground)

View File

@@ -2,8 +2,7 @@ package app.lawnchair.ui.preferences
import android.content.Intent
import android.net.Uri
import androidx.annotation.DrawableRes
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
@@ -14,43 +13,50 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import com.google.accompanist.glide.GlideImage
@Composable
fun ContributorRow(name: String, description: String, @DrawableRes photoRes: Int, url: String) {
fun ContributorRow(name: String, description: String, photoUrl: String, url: String, showDivider: Boolean = true) {
val context = LocalContext.current
Row(
modifier = Modifier
.fillMaxWidth()
.height(64.dp)
.clickable {
val webpage = Uri.parse(url)
val intent = Intent(Intent.ACTION_VIEW, webpage)
if (intent.resolveActivity(context.packageManager) != null) {
context.startActivity(intent)
PreferenceTemplate(height = 72.dp, showDivider = showDivider) {
Row(
modifier = Modifier
.fillMaxSize()
.clickable {
val webpage = Uri.parse(url)
val intent = Intent(Intent.ACTION_VIEW, webpage)
if (intent.resolveActivity(context.packageManager) != null) {
context.startActivity(intent)
}
}
.padding(start = 16.dp, end = 16.dp),
verticalAlignment = Alignment.CenterVertically
) {
GlideImage(
data = photoUrl,
contentDescription = null,
fadeIn = true,
modifier = Modifier
.clip(CircleShape)
.width(32.dp)
.height(32.dp),
loading = {
Box(modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colors.onBackground.copy(alpha = 0.08F)))
}
)
Spacer(modifier = Modifier.requiredWidth(16.dp))
Column {
Text(text = name, style = MaterialTheme.typography.subtitle1, color = MaterialTheme.colors.onBackground)
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.medium,
LocalContentColor provides MaterialTheme.colors.onBackground
) {
Text(text = description, style = MaterialTheme.typography.body2)
}
}
.padding(start = 16.dp, end = 16.dp),
verticalAlignment = Alignment.CenterVertically
) {
Image(
painter = painterResource(id = photoRes), contentDescription = null, modifier = Modifier
.clip(
CircleShape
)
.width(32.dp)
.height(32.dp)
)
Spacer(modifier = Modifier.requiredWidth(24.dp))
Column {
Text(text = name, style = MaterialTheme.typography.subtitle1, color = MaterialTheme.colors.onBackground)
CompositionLocalProvider(
LocalContentAlpha provides ContentAlpha.medium,
LocalContentColor provides MaterialTheme.colors.onBackground
) {
Text(text = description, style = MaterialTheme.typography.body2)
}
}
}

View File

@@ -11,15 +11,15 @@ fun FolderPreferences(interactor: PreferenceInteractor) {
label = stringResource(id = R.string.max_folder_columns),
value = interactor.folderColumns.value,
onValueChange = { interactor.setFolderColumns(it) },
steps = 3,
valueRange = 3.0F..7.0F
steps = 2,
valueRange = 2.0F..5.0F
)
SliderPreference(
label = stringResource(id = R.string.max_folder_rows),
value = interactor.folderRows.value,
onValueChange = { interactor.setFolderRows(it) },
steps = 3,
valueRange = 3.0F..7.0F,
steps = 2,
valueRange = 2.0F..5.0F,
showDivider = false
)
}

View File

@@ -35,7 +35,7 @@ fun HomeScreenPreferences(interactor: PreferenceInteractor) {
value = interactor.workspaceRows.value,
onValueChange = { interactor.setWorkspaceRows(it) },
steps = 3,
valueRange = 4.0F..8.0F,
valueRange = 3.0F..7.0F,
showDivider = false
)
}