mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-05-19 14:10:38 -04:00
Use colorTertiaryContainer for warning containers
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package org.fdroid.fdroid.compose
|
||||
|
||||
import androidx.annotation.AttrRes
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
@@ -13,14 +15,18 @@ import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.DisposableEffect
|
||||
import androidx.compose.runtime.ReadOnlyComposable
|
||||
import androidx.compose.runtime.rememberUpdatedState
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||
import com.google.android.material.color.MaterialColors
|
||||
|
||||
object ComposeUtils {
|
||||
|
||||
@@ -111,3 +117,11 @@ object ComposeUtils {
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@ColorInt
|
||||
@ReadOnlyComposable
|
||||
fun colorAttribute(@AttrRes attrColor: Int): Color {
|
||||
val color = MaterialColors.getColor(LocalContext.current, attrColor, 0)
|
||||
return Color(color)
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ import androidx.recyclerview.widget.LinearSmoothScroller;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.transition.TransitionManager;
|
||||
|
||||
import com.google.android.material.color.MaterialColors;
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
|
||||
import com.google.android.material.progressindicator.LinearProgressIndicator;
|
||||
|
||||
@@ -583,7 +584,7 @@ public class AppDetailsRecyclerViewAdapter
|
||||
warningView.setVisibility(View.VISIBLE);
|
||||
} else if (SessionInstallManager.canBeUsed(context) && suggestedApk != null
|
||||
&& !SessionInstallManager.isTargetSdkSupported(suggestedApk.targetSdkVersion)) {
|
||||
int color = ContextCompat.getColor(context, R.color.warning);
|
||||
int color = MaterialColors.getColor(warningView, R.attr.warning);
|
||||
warningView.setBackgroundColor(color);
|
||||
warningView.setText(R.string.warning_target_sdk);
|
||||
warningView.setVisibility(View.VISIBLE);
|
||||
|
||||
@@ -45,6 +45,7 @@ import org.fdroid.fdroid.R
|
||||
import org.fdroid.fdroid.Utils
|
||||
import org.fdroid.fdroid.Utils.getGlideModel
|
||||
import org.fdroid.fdroid.compose.ComposeUtils.FDroidButton
|
||||
import org.fdroid.fdroid.compose.colorAttribute
|
||||
import org.fdroid.fdroid.ui.theme.FDroidContent
|
||||
import org.fdroid.index.v2.FileV2
|
||||
import org.fdroid.repo.FetchResult.IsExistingMirror
|
||||
@@ -180,7 +181,7 @@ fun RepoPreviewHeader(
|
||||
if (warningText != null) Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.background(colorResource(R.color.warning)),
|
||||
.background(colorAttribute(R.attr.warning)),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
Text(
|
||||
|
||||
@@ -189,7 +189,7 @@
|
||||
android:id="@+id/warning"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/warning"
|
||||
android:background="?attr/warning"
|
||||
android:padding="8dp"
|
||||
android:text="@string/warning_target_sdk"
|
||||
android:textAlignment="center"
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<attr name="categoryPreviewAppCardBackground" format="reference" />
|
||||
<attr name="mainTabSwapBackground" format="color" />
|
||||
<attr name="mainTabSwapSplashTint" format="color" />
|
||||
<attr name="warning" format="color" />
|
||||
<attr name="categoryName" format="color" />
|
||||
<attr name="installedApps" format="color" />
|
||||
<attr name="detailPanel" format="reference" />
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
<color tools:ignore="UnusedResources" name="fdroid_caption">#ff757575</color>
|
||||
|
||||
<color name="shadow">#cc222222</color>
|
||||
<color name="warning">#827717</color>
|
||||
|
||||
<color name="perms_costs_money">#fff4511e</color>
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
|
||||
<item name="mainTabSwapSplashTint">?attr/colorSurfaceDim</item>
|
||||
<item name="warning">?attr/colorTertiaryContainer</item>
|
||||
<item name="categoryName">#4a4a4a</item>
|
||||
<item name="installedApps">#424242</item>
|
||||
<item name="appListItem">#424242</item>
|
||||
|
||||
Reference in New Issue
Block a user