Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit 846be960 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

Merge remote-tracking branch 'origin/3908-add-pagination' into 3908-add-pagination

parents 09b4a156 09589182
Loading
Loading
Loading
Loading
+6 −9
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@

package foundation.e.apps.ui.compose.components

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
@@ -33,6 +33,7 @@ import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
@@ -42,21 +43,17 @@ import foundation.e.apps.ui.compose.theme.AppTheme
@Composable
fun SearchEmptyState(modifier: Modifier = Modifier) {
    Box(
        modifier = modifier
            .fillMaxSize(),
        modifier = modifier.fillMaxSize(),
        contentAlignment = Alignment.Center,
    ) {
        Column(
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.spacedBy(12.dp),
        ) {
            androidx.compose.foundation.Image(
            Image(
                painter = painterResource(id = R.drawable.ic_error_circular),
                contentDescription = null,
                contentScale = ContentScale.Fit,
                modifier = Modifier
                    .padding(bottom = 4.dp)
                    .size(96.dp),
                modifier = Modifier.size(64.dp),
            )
            Text(
                text = stringResource(id = R.string.no_apps_found),
@@ -64,7 +61,7 @@ fun SearchEmptyState(modifier: Modifier = Modifier) {
                    fontSize = 18.sp
                ),
                color = colorResource(id = R.color.light_grey),
                textAlign = androidx.compose.ui.text.style.TextAlign.Center,
                textAlign = TextAlign.Center,
            )
        }
    }
+4 −5
Original line number Diff line number Diff line
@@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Search
@@ -15,6 +14,7 @@ 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.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import foundation.e.apps.R
@@ -33,15 +33,14 @@ fun SearchInitialState(modifier: Modifier = Modifier) {
            Icon(
                imageVector = Icons.Outlined.Search,
                contentDescription = null,
                tint = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.45f),
                modifier = Modifier
                    .padding(bottom = 4.dp)
                    .size(72.dp),
                tint = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.5f),
                modifier = Modifier.size(64.dp),
            )
            Text(
                text = stringResource(id = R.string.search_hint),
                style = MaterialTheme.typography.bodyMedium,
                color = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.72f),
                textAlign = TextAlign.Center,
            )
        }
    }
+10 −20
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

package foundation.e.apps.ui.compose.components

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@@ -267,49 +268,38 @@ private fun PrimaryActionArea(
        // render the primary action button
    }

    val accentColor = MaterialTheme.colorScheme.tertiary

    val buttonContent: @Composable () -> Unit = {
        if (uiState.isInProgress) {
            val indicatorColor =
                if (uiState.isFilledStyle) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onPrimary
            CircularProgressIndicator(
                modifier = Modifier.size(16.dp),
                strokeWidth = 2.dp,
                color = indicatorColor,
                color = accentColor,
            )
        } else {
            val textColor =
                if (uiState.isFilledStyle) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onSurface
            Text(
                text = uiState.label,
                maxLines = 1,
                overflow = TextOverflow.Clip,
                color = textColor,
                color = accentColor,
            )
        }
    }

    Column(horizontalAlignment = Alignment.End) {
        val containerColor = if (uiState.isFilledStyle) {
            MaterialTheme.colorScheme.primary
        } else {
            MaterialTheme.colorScheme.secondaryContainer
        }
        val contentColor = if (uiState.isFilledStyle) {
            MaterialTheme.colorScheme.onPrimary
        } else {
            MaterialTheme.colorScheme.onSecondaryContainer
        }
        Button(
            onClick = onPrimaryClick,
            enabled = uiState.enabled,
            modifier = Modifier.height(40.dp),
            shape = RoundedCornerShape(4.dp),
            colors = ButtonDefaults.buttonColors(
                containerColor = containerColor,
                contentColor = contentColor,
                disabledContainerColor = containerColor.copy(alpha = 0.38f),
                disabledContentColor = contentColor.copy(alpha = 0.38f),
                containerColor = Color.Transparent,
                contentColor = accentColor,
                disabledContainerColor = Color.Transparent,
                disabledContentColor = accentColor.copy(alpha = 0.38f),
            ),
            border = BorderStroke(1.dp, if (uiState.enabled) accentColor else accentColor.copy(alpha = 0.38f)),
            contentPadding = ButtonDefaults.ContentPadding,
        ) {
            buttonContent()
+3 −3
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@ private fun SearchTabs(
            if (selectedIndex in tabPositions.indices) {
                TabRowDefaults.Indicator(
                    modifier = Modifier.tabIndicatorOffset(tabPositions[selectedIndex]),
                    color = MaterialTheme.colorScheme.primary,
                    color = MaterialTheme.colorScheme.tertiary,
                )
            }
        },
@@ -209,8 +209,8 @@ private fun SearchTabs(
            Tab(
                selected = index == selectedIndex,
                onClick = { onTabSelected(tab, index) },
                selectedContentColor = MaterialTheme.colorScheme.primary,
                unselectedContentColor = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.64f),
                selectedContentColor = MaterialTheme.colorScheme.tertiary,
                unselectedContentColor = MaterialTheme.colorScheme.onBackground.copy(alpha = 0.5f),
            ) {
                Text(
                    text = label,
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.MaterialTheme
@@ -44,6 +45,7 @@ fun SearchSuggestionsDropdown(

    Card(
        modifier = modifier.fillMaxWidth(),
        shape = RoundedCornerShape(0.dp),
        colors = CardDefaults.cardColors(
            containerColor = MaterialTheme.colorScheme.surface,
        ),
Loading