Material 3 theme [WIP]
This commit is contained in:
parent
d7f549795a
commit
0e1ca1c1f9
@ -50,7 +50,7 @@
|
|||||||
android:parentActivityName=".ui.legacy.activity.LauncherActivity"
|
android:parentActivityName=".ui.legacy.activity.LauncherActivity"
|
||||||
android:screenOrientation="portrait"
|
android:screenOrientation="portrait"
|
||||||
android:taskAffinity="de.mm20.launcher2.settings"
|
android:taskAffinity="de.mm20.launcher2.settings"
|
||||||
android:theme="@style/SettingsTheme">
|
android:theme="@style/SettingsTheme.DefaultColors">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
|||||||
@ -11,12 +11,18 @@ import de.mm20.launcher2.fragment.PreferencesCalendarFragment
|
|||||||
import de.mm20.launcher2.fragment.PreferencesMainFragment
|
import de.mm20.launcher2.fragment.PreferencesMainFragment
|
||||||
import de.mm20.launcher2.fragment.PreferencesServicesFragment
|
import de.mm20.launcher2.fragment.PreferencesServicesFragment
|
||||||
import de.mm20.launcher2.fragment.PreferencesWeatherFragment
|
import de.mm20.launcher2.fragment.PreferencesWeatherFragment
|
||||||
|
import de.mm20.launcher2.preferences.ColorSchemes
|
||||||
|
import de.mm20.launcher2.preferences.LauncherPreferences
|
||||||
import de.mm20.launcher2.ui.legacy.activity.LauncherActivity
|
import de.mm20.launcher2.ui.legacy.activity.LauncherActivity
|
||||||
|
|
||||||
class SettingsActivity : AppCompatActivity() {
|
class SettingsActivity : AppCompatActivity() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
when(LauncherPreferences.instance.colorScheme) {
|
||||||
|
ColorSchemes.BLACK -> setTheme(R.style.SettingsTheme_BlackWhiteColors)
|
||||||
|
else -> setTheme(R.style.SettingsTheme_DefaultColors)
|
||||||
|
}
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
val fragment = getStartFragment()
|
val fragment = getStartFragment()
|
||||||
setupActionBar()
|
setupActionBar()
|
||||||
@ -32,7 +38,6 @@ class SettingsActivity : AppCompatActivity() {
|
|||||||
.replace(android.R.id.content, fragment)
|
.replace(android.R.id.content, fragment)
|
||||||
.commit()
|
.commit()
|
||||||
}
|
}
|
||||||
findViewById<View>(android.R.id.content)?.setBackgroundColor(getColor(R.color.settings_window_background))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
|
|||||||
@ -1,21 +1,26 @@
|
|||||||
package de.mm20.launcher2.fragment
|
package de.mm20.launcher2.fragment
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Intent
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.content.FileProvider
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceCategory
|
import androidx.preference.PreferenceCategory
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import com.afollestad.materialdialogs.MaterialDialog
|
import com.afollestad.materialdialogs.MaterialDialog
|
||||||
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import de.mm20.launcher2.R
|
import de.mm20.launcher2.R
|
||||||
import de.mm20.launcher2.crashreporter.CrashReporter
|
import de.mm20.launcher2.crashreporter.CrashReporter
|
||||||
import de.mm20.launcher2.debug.DebugInformationDumper
|
import de.mm20.launcher2.debug.DebugInformationDumper
|
||||||
|
import de.mm20.launcher2.ktx.tryStartActivity
|
||||||
import de.mm20.launcher2.licenses.AppLicense
|
import de.mm20.launcher2.licenses.AppLicense
|
||||||
import de.mm20.launcher2.licenses.OpenSourceLicenses
|
import de.mm20.launcher2.licenses.OpenSourceLicenses
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
|
||||||
class PreferencesAboutFragment : PreferenceFragmentCompat() {
|
class PreferencesAboutFragment : PreferenceFragmentCompat() {
|
||||||
@ -96,14 +101,27 @@ class PreferencesAboutFragment : PreferenceFragmentCompat() {
|
|||||||
findPreference<Preference>("export_debug")?.setOnPreferenceClickListener {
|
findPreference<Preference>("export_debug")?.setOnPreferenceClickListener {
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
val path = DebugInformationDumper().dump(requireContext())
|
val path = DebugInformationDumper().dump(requireContext())
|
||||||
Toast.makeText(
|
Snackbar.make(
|
||||||
activity,
|
requireView(),
|
||||||
getString(
|
getString(
|
||||||
R.string.debug_export_information_file,
|
R.string.debug_export_information_file,
|
||||||
path
|
path
|
||||||
),
|
),
|
||||||
Toast.LENGTH_SHORT
|
Snackbar.LENGTH_LONG
|
||||||
).show()
|
)
|
||||||
|
.setAction(R.string.menu_share) {
|
||||||
|
val context = requireContext()
|
||||||
|
context.tryStartActivity(Intent(Intent.ACTION_SEND).apply {
|
||||||
|
type = "text/plain"
|
||||||
|
putExtra(
|
||||||
|
Intent.EXTRA_STREAM, FileProvider.getUriForFile(
|
||||||
|
context,
|
||||||
|
context.applicationContext.packageName + ".fileprovider",
|
||||||
|
File(path)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
}.show()
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
package de.mm20.launcher2.fragment
|
package de.mm20.launcher2.fragment
|
||||||
|
|
||||||
import android.Manifest
|
|
||||||
import android.app.WallpaperManager
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.drawable.ColorDrawable
|
import android.graphics.drawable.ColorDrawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@ -11,7 +9,6 @@ import android.widget.LinearLayout
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
import androidx.core.app.ActivityCompat
|
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.preference.ListPreference
|
import androidx.preference.ListPreference
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
@ -23,7 +20,6 @@ import de.mm20.launcher2.R
|
|||||||
import de.mm20.launcher2.icons.IconPackManager
|
import de.mm20.launcher2.icons.IconPackManager
|
||||||
import de.mm20.launcher2.icons.IconRepository
|
import de.mm20.launcher2.icons.IconRepository
|
||||||
import de.mm20.launcher2.icons.LauncherIcon
|
import de.mm20.launcher2.icons.LauncherIcon
|
||||||
import de.mm20.launcher2.ktx.checkPermission
|
|
||||||
import de.mm20.launcher2.preferences.IconShape
|
import de.mm20.launcher2.preferences.IconShape
|
||||||
import de.mm20.launcher2.preferences.LauncherPreferences
|
import de.mm20.launcher2.preferences.LauncherPreferences
|
||||||
import de.mm20.launcher2.preferences.Themes
|
import de.mm20.launcher2.preferences.Themes
|
||||||
@ -48,6 +44,11 @@ class PreferencesAppearanceFragment : PreferenceFragmentCompat() {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findPreference<Preference>("card_background")?.setOnPreferenceChangeListener { _, newValue ->
|
||||||
|
requireActivity().recreate()
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
findPreference<Preference>("wallpaper")?.setOnPreferenceClickListener {
|
findPreference<Preference>("wallpaper")?.setOnPreferenceClickListener {
|
||||||
requireContext().startActivity(Intent.createChooser(Intent(Intent.ACTION_SET_WALLPAPER), null))
|
requireContext().startActivity(Intent.createChooser(Intent(Intent.ACTION_SET_WALLPAPER), null))
|
||||||
true
|
true
|
||||||
@ -79,18 +80,18 @@ class PreferencesAppearanceFragment : PreferenceFragmentCompat() {
|
|||||||
}
|
}
|
||||||
setOnPreferenceChangeListener { _, newValue ->
|
setOnPreferenceChangeListener { _, newValue ->
|
||||||
val index = (newValue as String).toInt()
|
val index = (newValue as String).toInt()
|
||||||
iconRepository.clearCache()
|
|
||||||
if (index == -1) iconPackManager.selectIconPack("")
|
if (index == -1) iconPackManager.selectIconPack("")
|
||||||
else {
|
else {
|
||||||
iconPackManager.selectIconPack(packs[index].packageName)
|
iconPackManager.selectIconPack(packs[index].packageName)
|
||||||
}
|
}
|
||||||
|
iconRepository.recreate()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
findPreference<Preference>("legacy_icon_bg")?.setOnPreferenceChangeListener { _, _ ->
|
findPreference<Preference>("legacy_icon_bg")?.setOnPreferenceChangeListener { _, _ ->
|
||||||
iconRepository.clearCache()
|
iconRepository.recreate()
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,23 +6,15 @@ import android.app.WallpaperManager
|
|||||||
import android.graphics.*
|
import android.graphics.*
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewOutlineProvider
|
|
||||||
import androidx.core.content.res.ResourcesCompat
|
import androidx.core.content.res.ResourcesCompat
|
||||||
import androidx.core.view.doOnNextLayout
|
import androidx.core.view.doOnNextLayout
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.lifecycleScope
|
|
||||||
import androidx.preference.Preference
|
import androidx.preference.Preference
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import de.mm20.launcher2.R
|
import de.mm20.launcher2.R
|
||||||
import de.mm20.launcher2.ktx.dp
|
import de.mm20.launcher2.ktx.dp
|
||||||
import de.mm20.launcher2.ktx.translate
|
|
||||||
import de.mm20.launcher2.preferences.CardBackground
|
|
||||||
import de.mm20.launcher2.preferences.LauncherPreferences
|
import de.mm20.launcher2.preferences.LauncherPreferences
|
||||||
import kotlinx.android.synthetic.main.fragment_card_settings.*
|
import kotlinx.android.synthetic.main.fragment_card_settings.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
import kotlinx.coroutines.withContext
|
|
||||||
import java.io.File
|
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
class PreferencesCardFragment : Fragment(R.layout.fragment_card_settings) {
|
class PreferencesCardFragment : Fragment(R.layout.fragment_card_settings) {
|
||||||
@ -68,18 +60,6 @@ class PreferencesCardFragment : Fragment(R.layout.fragment_card_settings) {
|
|||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
findPreference<Preference>("card_background")?.let {
|
|
||||||
it.setOnPreferenceChangeListener { preference, newValue ->
|
|
||||||
val background = CardBackground.byValue(newValue as String)
|
|
||||||
var color = when (background) {
|
|
||||||
CardBackground.BLACK -> context.getColor(R.color.cardview_background_black)
|
|
||||||
else -> context.getColor(R.color.cardview_background)
|
|
||||||
}
|
|
||||||
color = color and ((previewCard.backgroundOpacity shl 24) or 0xFFFFFF)
|
|
||||||
previewCard.setCardBackgroundColor(color)
|
|
||||||
true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
childFragmentManager.beginTransaction()
|
childFragmentManager.beginTransaction()
|
||||||
@ -89,8 +69,6 @@ class PreferencesCardFragment : Fragment(R.layout.fragment_card_settings) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private var blurBitmap: Bitmap? = null
|
|
||||||
|
|
||||||
private var animator: Animator? = null
|
private var animator: Animator? = null
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
super.onStart()
|
super.onStart()
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
android:id="@+id/frameLayout"
|
android:id="@+id/frameLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="232dp"
|
android:layout_height="232dp"
|
||||||
|
android:background="?colorPrimaryContainer"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent">
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|||||||
@ -8,6 +8,15 @@
|
|||||||
app:key="theme"
|
app:key="theme"
|
||||||
app:summary="%s"
|
app:summary="%s"
|
||||||
app:title="@string/preference_theme" />
|
app:title="@string/preference_theme" />
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
app:key="card_background"
|
||||||
|
android:defaultValue="0"
|
||||||
|
app:summary="%s"
|
||||||
|
app:title="@string/preference_screen_colors"
|
||||||
|
app:entries="@array/preference_card_background_entries"
|
||||||
|
app:entryValues="@array/preference_card_background_values"
|
||||||
|
/>
|
||||||
<Preference
|
<Preference
|
||||||
app:key="cards"
|
app:key="cards"
|
||||||
app:summary="@string/preference_cards_summary"
|
app:summary="@string/preference_cards_summary"
|
||||||
|
|||||||
@ -24,13 +24,4 @@
|
|||||||
app:min="0"
|
app:min="0"
|
||||||
app:updatesContinuously="true" />
|
app:updatesContinuously="true" />
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
app:key="card_background"
|
|
||||||
android:defaultValue="0"
|
|
||||||
app:summary="%s"
|
|
||||||
app:title="@string/preference_card_background"
|
|
||||||
app:entries="@array/preference_card_background_entries"
|
|
||||||
app:entryValues="@array/preference_card_background_values"
|
|
||||||
/>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
@ -15,10 +15,8 @@ import androidx.lifecycle.MutableLiveData
|
|||||||
import de.mm20.launcher2.badges.Badge
|
import de.mm20.launcher2.badges.Badge
|
||||||
import de.mm20.launcher2.badges.BadgeProvider
|
import de.mm20.launcher2.badges.BadgeProvider
|
||||||
import de.mm20.launcher2.hiddenitems.HiddenItemsRepository
|
import de.mm20.launcher2.hiddenitems.HiddenItemsRepository
|
||||||
import de.mm20.launcher2.icons.IconRepository
|
|
||||||
import de.mm20.launcher2.preferences.LauncherPreferences
|
import de.mm20.launcher2.preferences.LauncherPreferences
|
||||||
import de.mm20.launcher2.search.BaseSearchableRepository
|
import de.mm20.launcher2.search.BaseSearchableRepository
|
||||||
import de.mm20.launcher2.search.SearchRepository
|
|
||||||
import de.mm20.launcher2.search.data.AppInstallation
|
import de.mm20.launcher2.search.data.AppInstallation
|
||||||
import de.mm20.launcher2.search.data.Application
|
import de.mm20.launcher2.search.data.Application
|
||||||
import de.mm20.launcher2.search.data.LauncherApp
|
import de.mm20.launcher2.search.data.LauncherApp
|
||||||
@ -27,7 +25,6 @@ import kotlinx.coroutines.withContext
|
|||||||
|
|
||||||
class AppRepository(
|
class AppRepository(
|
||||||
val context: Context,
|
val context: Context,
|
||||||
val iconRepository: IconRepository,
|
|
||||||
hiddenItemsRepository: HiddenItemsRepository,
|
hiddenItemsRepository: HiddenItemsRepository,
|
||||||
badgeProvider: BadgeProvider
|
badgeProvider: BadgeProvider
|
||||||
) : BaseSearchableRepository() {
|
) : BaseSearchableRepository() {
|
||||||
@ -148,10 +145,7 @@ class AppRepository(
|
|||||||
override fun onBadgingChanged(sessionId: Int) {
|
override fun onBadgingChanged(sessionId: Int) {
|
||||||
val inst = installations.value ?: mutableListOf()
|
val inst = installations.value ?: mutableListOf()
|
||||||
inst.removeAll {
|
inst.removeAll {
|
||||||
if (it.session.sessionId == sessionId) {
|
it.session.sessionId == sessionId
|
||||||
iconRepository.removeIconFromCache(it)
|
|
||||||
true
|
|
||||||
} else false
|
|
||||||
}
|
}
|
||||||
onCreated(sessionId)
|
onCreated(sessionId)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,6 @@ import org.koin.androidx.viewmodel.dsl.viewModel
|
|||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
val applicationsModule = module {
|
val applicationsModule = module {
|
||||||
single { AppRepository(androidContext(), get(), get(), get()) }
|
single { AppRepository(androidContext(), get(), get()) }
|
||||||
viewModel { AppViewModel(get()) }
|
viewModel { AppViewModel(get()) }
|
||||||
}
|
}
|
||||||
@ -7,53 +7,59 @@ import android.content.pm.LauncherActivityInfo
|
|||||||
import android.content.pm.LauncherApps
|
import android.content.pm.LauncherApps
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.pm.ShortcutInfo
|
import android.content.pm.ShortcutInfo
|
||||||
|
import android.graphics.drawable.AdaptiveIconDrawable
|
||||||
import android.os.*
|
import android.os.*
|
||||||
import androidx.core.content.getSystemService
|
import androidx.core.content.getSystemService
|
||||||
import de.mm20.launcher2.icons.IconPackManager
|
|
||||||
import de.mm20.launcher2.icons.LauncherIcon
|
import de.mm20.launcher2.icons.LauncherIcon
|
||||||
import de.mm20.launcher2.ktx.getSerialNumber
|
import de.mm20.launcher2.ktx.getSerialNumber
|
||||||
|
import de.mm20.launcher2.preferences.LauncherPreferences
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.json.JSONObject
|
|
||||||
import org.koin.core.component.KoinComponent
|
import org.koin.core.component.KoinComponent
|
||||||
import org.koin.core.component.inject
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An [Application] based on an [android.content.pm.LauncherActivityInfo]
|
* An [Application] based on an [android.content.pm.LauncherActivityInfo]
|
||||||
*/
|
*/
|
||||||
class LauncherApp(
|
class LauncherApp(
|
||||||
context: Context,
|
context: Context,
|
||||||
private val launcherActivityInfo: LauncherActivityInfo
|
public val launcherActivityInfo: LauncherActivityInfo
|
||||||
) : Application(
|
) : Application(
|
||||||
label = launcherActivityInfo.label.toString(),
|
label = launcherActivityInfo.label.toString(),
|
||||||
`package` = launcherActivityInfo.applicationInfo.packageName,
|
`package` = launcherActivityInfo.applicationInfo.packageName,
|
||||||
activity = launcherActivityInfo.name,
|
activity = launcherActivityInfo.name,
|
||||||
flags = launcherActivityInfo.applicationInfo.flags,
|
flags = launcherActivityInfo.applicationInfo.flags,
|
||||||
version = getPackageVersionName(context, launcherActivityInfo.applicationInfo.packageName),
|
version = getPackageVersionName(context, launcherActivityInfo.applicationInfo.packageName),
|
||||||
shortcuts = run {
|
shortcuts = run {
|
||||||
val appShortcuts = mutableListOf<AppShortcut>()
|
val appShortcuts = mutableListOf<AppShortcut>()
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
|
||||||
val launcherApps = context.getSystemService<LauncherApps>()!!
|
val launcherApps = context.getSystemService<LauncherApps>()!!
|
||||||
if (!launcherApps.hasShortcutHostPermission()) return@run appShortcuts
|
if (!launcherApps.hasShortcutHostPermission()) return@run appShortcuts
|
||||||
val query = LauncherApps.ShortcutQuery()
|
val query = LauncherApps.ShortcutQuery()
|
||||||
.setPackage(launcherActivityInfo.applicationInfo.packageName)
|
.setPackage(launcherActivityInfo.applicationInfo.packageName)
|
||||||
.setQueryFlags(LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC or LauncherApps.ShortcutQuery.FLAG_MATCH_MANIFEST)
|
.setQueryFlags(LauncherApps.ShortcutQuery.FLAG_MATCH_DYNAMIC or LauncherApps.ShortcutQuery.FLAG_MATCH_MANIFEST)
|
||||||
val shortcuts = try {
|
val shortcuts = try {
|
||||||
launcherApps.getShortcuts(query, launcherActivityInfo.user)
|
launcherApps.getShortcuts(query, launcherActivityInfo.user)
|
||||||
} catch (e: IllegalStateException) {
|
} catch (e: IllegalStateException) {
|
||||||
emptyList<ShortcutInfo>()
|
emptyList<ShortcutInfo>()
|
||||||
}
|
|
||||||
appShortcuts.addAll(shortcuts?.map { AppShortcut(context, it, launcherActivityInfo.label.toString()) }
|
|
||||||
?: emptyList())
|
|
||||||
}
|
}
|
||||||
appShortcuts
|
appShortcuts.addAll(shortcuts?.map {
|
||||||
|
AppShortcut(
|
||||||
|
context,
|
||||||
|
it,
|
||||||
|
launcherActivityInfo.label.toString()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
?: emptyList())
|
||||||
}
|
}
|
||||||
|
appShortcuts
|
||||||
|
}
|
||||||
), KoinComponent {
|
), KoinComponent {
|
||||||
|
|
||||||
internal val userSerialNumber: Long = launcherActivityInfo.user.getSerialNumber(context)
|
internal val userSerialNumber: Long = launcherActivityInfo.user.getSerialNumber(context)
|
||||||
private val isMainProfile = launcherActivityInfo.user == Process.myUserHandle()
|
private val isMainProfile = launcherActivityInfo.user == Process.myUserHandle()
|
||||||
|
|
||||||
override val badgeKey: String = if (isMainProfile) "app://${`package`}" else "profile://$userSerialNumber"
|
override val badgeKey: String =
|
||||||
|
if (isMainProfile) "app://${`package`}" else "profile://$userSerialNumber"
|
||||||
|
|
||||||
override val key: String
|
override val key: String
|
||||||
get() = if (isMainProfile) "app://$`package`:$activity" else "app://$`package`:$activity:${userSerialNumber}"
|
get() = if (isMainProfile) "app://$`package`:$activity" else "app://$`package`:$activity:${userSerialNumber}"
|
||||||
@ -63,9 +69,31 @@ class LauncherApp(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun loadIconAsync(context: Context, size: Int): LauncherIcon? {
|
override suspend fun loadIconAsync(context: Context, size: Int): LauncherIcon? {
|
||||||
val iconPackManager: IconPackManager by inject()
|
try {
|
||||||
return withContext(Dispatchers.IO) {
|
val icon =
|
||||||
iconPackManager.getIcon(context, launcherActivityInfo, size)
|
withContext(Dispatchers.IO) {
|
||||||
|
launcherActivityInfo.getIcon(context.resources.displayMetrics.densityDpi)
|
||||||
|
|
||||||
|
} ?: return null
|
||||||
|
when {
|
||||||
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && icon is AdaptiveIconDrawable -> {
|
||||||
|
return LauncherIcon(
|
||||||
|
foreground = icon.foreground ?: return null,
|
||||||
|
background = icon.background,
|
||||||
|
foregroundScale = 1.5f,
|
||||||
|
backgroundScale = 1.5f
|
||||||
|
)
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
return LauncherIcon(
|
||||||
|
foreground = icon,
|
||||||
|
foregroundScale = 0.7f,
|
||||||
|
autoGenerateBackgroundMode = LauncherPreferences.instance.legacyIconBg.toInt()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: PackageManager.NameNotFoundException) {
|
||||||
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,10 +107,10 @@ class LauncherApp(
|
|||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
launcherApps.startMainActivity(
|
launcherApps.startMainActivity(
|
||||||
ComponentName(`package`, activity),
|
ComponentName(`package`, activity),
|
||||||
launcherActivityInfo.user,
|
launcherActivityInfo.user,
|
||||||
null,
|
null,
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
} catch (e: SecurityException) {
|
} catch (e: SecurityException) {
|
||||||
return false
|
return false
|
||||||
|
|||||||
31
base/src/main/res/values-night-v31/color-schemes.xml
Normal file
31
base/src/main/res/values-night-v31/color-schemes.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<resources>
|
||||||
|
<style name="DefaultColors" parent="Theme.Material3.DayNight">
|
||||||
|
<item name="colorPrimary">@android:color/system_accent1_200</item>
|
||||||
|
<item name="colorOnPrimary">@android:color/system_accent1_800</item>
|
||||||
|
<item name="colorPrimaryContainer">@android:color/system_accent1_700</item>
|
||||||
|
<item name="colorOnPrimaryContainer">@android:color/system_accent1_100</item>
|
||||||
|
<item name="colorPrimaryInverse">@android:color/system_accent1_600</item>
|
||||||
|
<item name="colorSecondary">@android:color/system_accent2_200</item>
|
||||||
|
<item name="colorOnSecondary">@android:color/system_accent2_800</item>
|
||||||
|
<item name="colorSecondaryContainer">@android:color/system_accent2_700</item>
|
||||||
|
<item name="colorOnSecondaryContainer">@android:color/system_accent2_100</item>
|
||||||
|
<item name="colorTertiary">@android:color/system_accent3_200</item>
|
||||||
|
<item name="colorOnTertiary">@android:color/system_accent3_800</item>
|
||||||
|
<item name="colorTertiaryContainer">@android:color/system_accent3_700</item>
|
||||||
|
<item name="colorOnTertiaryContainer">@android:color/system_accent3_100</item>
|
||||||
|
<item name="colorError">#fff2b8b5</item>
|
||||||
|
<item name="colorOnError">#ff601410</item>
|
||||||
|
<item name="colorErrorContainer">#ff8c1d18</item>
|
||||||
|
<item name="colorOnErrorContainer">#fff2b8b5</item>
|
||||||
|
<item name="colorOutline">@android:color/system_neutral2_400</item>
|
||||||
|
<item name="android:colorBackground">@android:color/system_neutral1_900</item>
|
||||||
|
<item name="colorOnBackground">@android:color/system_neutral1_100</item>
|
||||||
|
<item name="colorSurface">@android:color/system_neutral1_900</item>
|
||||||
|
<item name="colorOnSurface">@android:color/system_neutral1_200</item>
|
||||||
|
<item name="colorSurfaceVariant">@android:color/system_neutral2_700</item>
|
||||||
|
<item name="colorOnSurfaceVariant">@android:color/system_neutral2_200</item>
|
||||||
|
<item name="colorSurfaceInverse">@android:color/system_neutral1_100</item>
|
||||||
|
<item name="colorOnSurfaceInverse">@android:color/system_neutral1_800</item>
|
||||||
|
<item name="elevationOverlayEnabled">true</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
61
base/src/main/res/values-night/color-schemes.xml
Normal file
61
base/src/main/res/values-night/color-schemes.xml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<resources>
|
||||||
|
<style name="DefaultColors" parent="Theme.Material3.DayNight">
|
||||||
|
<item name="colorPrimary">#72D1FF</item>
|
||||||
|
<item name="colorOnPrimary">#003549</item>
|
||||||
|
<item name="colorPrimaryContainer">#004D68</item>
|
||||||
|
<item name="colorOnPrimaryContainer">#BFE8FF</item>
|
||||||
|
<item name="colorPrimaryInverse">#006689</item>
|
||||||
|
<item name="colorSecondary">#A2D824</item>
|
||||||
|
<item name="colorOnSecondary">#243600</item>
|
||||||
|
<item name="colorSecondaryContainer">#354E00</item>
|
||||||
|
<item name="colorOnSecondaryContainer">#BDF542</item>
|
||||||
|
<item name="colorTertiary">#FEBB2B</item>
|
||||||
|
<item name="colorOnTertiary">#422C00</item>
|
||||||
|
<item name="colorTertiaryContainer">#5F4100</item>
|
||||||
|
<item name="colorOnTertiaryContainer">#FFDEA4</item>
|
||||||
|
<item name="colorError">#FFB4A9</item>
|
||||||
|
<item name="colorOnError">#680003</item>
|
||||||
|
<item name="colorErrorContainer">#930006</item>
|
||||||
|
<item name="colorOnErrorContainer">#FFDAD4</item>
|
||||||
|
<item name="colorOutline">#8B9298</item>
|
||||||
|
<item name="android:colorBackground">#191C1E</item>
|
||||||
|
<item name="colorOnBackground">#E1E2E4</item>
|
||||||
|
<item name="colorSurface">#191C1E</item>
|
||||||
|
<item name="colorOnSurface">#E1E2E4</item>
|
||||||
|
<item name="colorSurfaceVariant">#41484D</item>
|
||||||
|
<item name="colorOnSurfaceVariant">#C0C7CD</item>
|
||||||
|
<item name="colorSurfaceInverse">#E1E2E4</item>
|
||||||
|
<item name="colorOnSurfaceInverse">#191C1E</item>
|
||||||
|
<item name="elevationOverlayEnabled">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="BlackWhiteColors" parent="Theme.Material3.DayNight">
|
||||||
|
<item name="colorPrimary">@android:color/white</item>
|
||||||
|
<item name="colorOnPrimary">@android:color/black</item>
|
||||||
|
<item name="colorPrimaryContainer">@android:color/black</item>
|
||||||
|
<item name="colorOnPrimaryContainer">@android:color/white</item>
|
||||||
|
<item name="colorPrimaryInverse">@android:color/black</item>
|
||||||
|
<item name="colorSecondary">@android:color/white</item>
|
||||||
|
<item name="colorOnSecondary">@android:color/black</item>
|
||||||
|
<item name="colorSecondaryContainer">@android:color/black</item>
|
||||||
|
<item name="colorOnSecondaryContainer">@android:color/white</item>
|
||||||
|
<item name="colorTertiary">@android:color/white</item>
|
||||||
|
<item name="colorOnTertiary">@android:color/black</item>
|
||||||
|
<item name="colorTertiaryContainer">@android:color/black</item>
|
||||||
|
<item name="colorOnTertiaryContainer">@android:color/white</item>
|
||||||
|
<item name="colorError">@android:color/black</item>
|
||||||
|
<item name="colorOnError">@android:color/white</item>
|
||||||
|
<item name="colorErrorContainer">@android:color/black</item>
|
||||||
|
<item name="colorOnErrorContainer">@android:color/white</item>
|
||||||
|
<item name="colorOutline">@android:color/white</item>
|
||||||
|
<item name="android:colorBackground">@android:color/black</item>
|
||||||
|
<item name="colorOnBackground">@android:color/white</item>
|
||||||
|
<item name="colorSurface">@android:color/black</item>
|
||||||
|
<item name="colorOnSurface">@android:color/white</item>
|
||||||
|
<item name="colorSurfaceVariant">@android:color/black</item>
|
||||||
|
<item name="colorOnSurfaceVariant">@android:color/white</item>
|
||||||
|
<item name="colorSurfaceInverse">@android:color/white</item>
|
||||||
|
<item name="colorOnSurfaceInverse">@android:color/black</item>
|
||||||
|
<item name="elevationOverlayEnabled">false</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources xmlns:tools="http://schemas.android.com/tools">
|
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
<color name="android_green">#00DE7A</color>
|
||||||
<color name="red">#E57373</color>
|
<color name="red">#E57373</color>
|
||||||
<color name="pink">#F06292</color>
|
<color name="pink">#F06292</color>
|
||||||
<color name="purple">#BA68C8</color>
|
<color name="purple">#BA68C8</color>
|
||||||
|
|||||||
@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
<style name="BaseLauncherTheme.Settings">
|
<style name="BaseLauncherTheme.Settings">
|
||||||
<item name="android:windowLightStatusBar">false</item>
|
<item name="android:windowLightStatusBar">false</item>
|
||||||
|
<item name="actionBarTheme">@style/ActionBarSettings</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="ActionBarSettings">
|
||||||
|
<item name="titleTextColor">@android:color/white</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="LauncherTheme.IconStyle">
|
<style name="LauncherTheme.IconStyle">
|
||||||
|
|||||||
13
base/src/main/res/values-night/themes.xml
Normal file
13
base/src/main/res/values-night/themes.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<style name="SettingsTheme.DefaultColors" parent="DefaultColors">
|
||||||
|
<item name="android:statusBarColor">?colorSurface</item>
|
||||||
|
<item name="android:windowLightStatusBar">false</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="SettingsTheme.BlackWhiteColors" parent="BlackWhiteColors">
|
||||||
|
<item name="android:statusBarColor">?colorSurface</item>
|
||||||
|
<item name="android:windowLightStatusBar">false</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
31
base/src/main/res/values-v31/color-schemes.xml
Normal file
31
base/src/main/res/values-v31/color-schemes.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<resources>
|
||||||
|
<style name="DefaultColors" parent="Theme.Material3.DayNight">
|
||||||
|
<item name="colorPrimary">@android:color/system_accent1_600</item>
|
||||||
|
<item name="colorOnPrimary">@android:color/system_accent1_0</item>
|
||||||
|
<item name="colorPrimaryContainer">@android:color/system_accent1_100</item>
|
||||||
|
<item name="colorOnPrimaryContainer">@android:color/system_accent1_900</item>
|
||||||
|
<item name="colorPrimaryInverse">@android:color/system_accent1_200</item>
|
||||||
|
<item name="colorSecondary">@android:color/system_accent2_600</item>
|
||||||
|
<item name="colorOnSecondary">@android:color/system_accent2_0</item>
|
||||||
|
<item name="colorSecondaryContainer">@android:color/system_accent2_100</item>
|
||||||
|
<item name="colorOnSecondaryContainer">@android:color/system_accent2_900</item>
|
||||||
|
<item name="colorTertiary">@android:color/system_accent3_600</item>
|
||||||
|
<item name="colorOnTertiary">@android:color/system_accent3_0</item>
|
||||||
|
<item name="colorTertiaryContainer">@android:color/system_accent3_100</item>
|
||||||
|
<item name="colorOnTertiaryContainer">@android:color/system_accent3_900</item>
|
||||||
|
<item name="colorError">#ffb3261e</item>
|
||||||
|
<item name="colorOnError">@android:color/white</item>
|
||||||
|
<item name="colorErrorContainer">#fff9dedc</item>
|
||||||
|
<item name="colorOnErrorContainer">#ff410e0b</item>
|
||||||
|
<item name="colorOutline">@android:color/system_neutral2_500</item>
|
||||||
|
<item name="android:colorBackground">@android:color/system_neutral1_10</item>
|
||||||
|
<item name="colorOnBackground">@android:color/system_neutral1_900</item>
|
||||||
|
<item name="colorSurface">@android:color/system_neutral1_10</item>
|
||||||
|
<item name="colorOnSurface">@android:color/system_neutral1_900</item>
|
||||||
|
<item name="colorSurfaceVariant">@android:color/system_neutral2_100</item>
|
||||||
|
<item name="colorOnSurfaceVariant">@android:color/system_neutral2_700</item>
|
||||||
|
<item name="colorSurfaceInverse">@android:color/system_neutral2_800</item>
|
||||||
|
<item name="colorOnSurfaceInverse">@android:color/system_neutral2_50</item>
|
||||||
|
<item name="elevationOverlayEnabled">false</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
61
base/src/main/res/values/color-schemes.xml
Normal file
61
base/src/main/res/values/color-schemes.xml
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<resources>
|
||||||
|
<style name="DefaultColors" parent="Theme.Material3.DayNight">
|
||||||
|
<item name="colorPrimary">#006689</item>
|
||||||
|
<item name="colorOnPrimary">@android:color/white</item>
|
||||||
|
<item name="colorPrimaryContainer">#BFE8FF</item>
|
||||||
|
<item name="colorOnPrimaryContainer">#001E2C</item>
|
||||||
|
<item name="colorPrimaryInverse">#72D1FF</item>
|
||||||
|
<item name="colorSecondary">#496800</item>
|
||||||
|
<item name="colorOnSecondary">@android:color/white</item>
|
||||||
|
<item name="colorSecondaryContainer">#BDF542</item>
|
||||||
|
<item name="colorOnSecondaryContainer">#131F00</item>
|
||||||
|
<item name="colorTertiary">#7D5700</item>
|
||||||
|
<item name="colorOnTertiary">@android:color/white</item>
|
||||||
|
<item name="colorTertiaryContainer">#FFDEA4</item>
|
||||||
|
<item name="colorOnTertiaryContainer">#281900</item>
|
||||||
|
<item name="colorError">#BA1B1B</item>
|
||||||
|
<item name="colorOnError">@android:color/white</item>
|
||||||
|
<item name="colorErrorContainer">#FFDAD4</item>
|
||||||
|
<item name="colorOnErrorContainer">#410001</item>
|
||||||
|
<item name="colorOutline">#71787D</item>
|
||||||
|
<item name="android:colorBackground">#FBFCFE</item>
|
||||||
|
<item name="colorOnBackground">#191C1E</item>
|
||||||
|
<item name="colorSurface">#FBFCFE</item>
|
||||||
|
<item name="colorOnSurface">#191C1E</item>
|
||||||
|
<item name="colorSurfaceVariant">#DCE3E9</item>
|
||||||
|
<item name="colorOnSurfaceVariant">#41484D</item>
|
||||||
|
<item name="colorSurfaceInverse">#2E3133</item>
|
||||||
|
<item name="colorOnSurfaceInverse">#F0F1F3</item>
|
||||||
|
<item name="elevationOverlayEnabled">false</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="BlackWhiteColors" parent="Theme.Material3.DayNight">
|
||||||
|
<item name="colorPrimary">@android:color/black</item>
|
||||||
|
<item name="colorOnPrimary">@android:color/white</item>
|
||||||
|
<item name="colorPrimaryContainer">@android:color/white</item>
|
||||||
|
<item name="colorOnPrimaryContainer">@android:color/black</item>
|
||||||
|
<item name="colorPrimaryInverse">@android:color/white</item>
|
||||||
|
<item name="colorSecondary">@android:color/black</item>
|
||||||
|
<item name="colorOnSecondary">@android:color/white</item>
|
||||||
|
<item name="colorSecondaryContainer">@android:color/white</item>
|
||||||
|
<item name="colorOnSecondaryContainer">@android:color/black</item>
|
||||||
|
<item name="colorTertiary">@android:color/black</item>
|
||||||
|
<item name="colorOnTertiary">@android:color/white</item>
|
||||||
|
<item name="colorTertiaryContainer">@android:color/white</item>
|
||||||
|
<item name="colorOnTertiaryContainer">@android:color/black</item>
|
||||||
|
<item name="colorError">@android:color/white</item>
|
||||||
|
<item name="colorOnError">@android:color/black</item>
|
||||||
|
<item name="colorErrorContainer">@android:color/white</item>
|
||||||
|
<item name="colorOnErrorContainer">@android:color/black</item>
|
||||||
|
<item name="colorOutline">@android:color/black</item>
|
||||||
|
<item name="android:colorBackground">@android:color/white</item>
|
||||||
|
<item name="colorOnBackground">@android:color/black</item>
|
||||||
|
<item name="colorSurface">@android:color/white</item>
|
||||||
|
<item name="colorOnSurface">@android:color/black</item>
|
||||||
|
<item name="colorSurfaceVariant">@android:color/white</item>
|
||||||
|
<item name="colorOnSurfaceVariant">@android:color/black</item>
|
||||||
|
<item name="colorSurfaceInverse">@android:color/black</item>
|
||||||
|
<item name="colorOnSurfaceInverse">@android:color/white</item>
|
||||||
|
<item name="elevationOverlayEnabled">false</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@ -2,6 +2,7 @@
|
|||||||
<resources>
|
<resources>
|
||||||
<color name="badge_text">#8A000000</color>
|
<color name="badge_text">#8A000000</color>
|
||||||
|
|
||||||
|
<color name="android_green">#00A55B</color>
|
||||||
<color name="red">#E53935</color>
|
<color name="red">#E53935</color>
|
||||||
<color name="pink">#D81B60</color>
|
<color name="pink">#D81B60</color>
|
||||||
<color name="purple">#9C27B0</color>
|
<color name="purple">#9C27B0</color>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="BaseLauncherTheme" parent="Theme.MaterialComponents.DayNight">
|
<style name="BaseLauncherTheme" parent="Theme.Material3.DayNight">
|
||||||
<item name="android:colorPrimary">@color/blue</item>
|
<item name="android:colorPrimary">@color/blue</item>
|
||||||
<item name="android:colorAccent">@color/blue</item>
|
<item name="android:colorAccent">@color/blue</item>
|
||||||
<item name="colorPrimary">@color/blue</item>
|
<item name="colorPrimary">@color/blue</item>
|
||||||
@ -46,28 +46,28 @@
|
|||||||
<item name="android:windowShowWallpaper">true</item>
|
<item name="android:windowShowWallpaper">true</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AlertDialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
|
<style name="AlertDialogTheme" parent="ThemeOverlay.Material3.Dialog.Alert">
|
||||||
<item name="buttonBarButtonStyle">@style/AlertDialogButtonStyle</item>
|
<item name="buttonBarButtonStyle">@style/AlertDialogButtonStyle</item>
|
||||||
<item name="dialogCornerRadius">8dp</item>
|
<item name="dialogCornerRadius">8dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="AlertDialogButtonStyle" parent="Widget.MaterialComponents.Button.UnelevatedButton">
|
<style name="AlertDialogButtonStyle" parent="Widget.Material3.Button.UnelevatedButton">
|
||||||
<item name="android:textColor">?colorAccent</item>
|
<item name="android:textColor">?colorAccent</item>
|
||||||
<item name="android:letterSpacing">0</item>
|
<item name="android:letterSpacing">0</item>
|
||||||
<item name="android:background">?selectableItemBackground</item>
|
<item name="android:background">?selectableItemBackground</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="CardViewStyle" parent="Widget.MaterialComponents.CardView">
|
<style name="CardViewStyle" parent="Widget.Material3.CardView.Elevated">
|
||||||
<item name="cardCornerRadius">8dp</item>
|
<item name="cardCornerRadius">8dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="InnerCardViewStyle" parent="Widget.MaterialComponents.CardView">
|
<style name="InnerCardViewStyle" parent="Widget.Material3.CardView.Outlined">
|
||||||
<item name="cardElevation">0dp</item>
|
<item name="cardElevation">0dp</item>
|
||||||
<item name="strokeWidth">1dp</item>
|
<item name="strokeWidth">1dp</item>
|
||||||
<item name="strokeColor">@color/color_divider</item>
|
<item name="strokeColor">@color/color_divider</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="ElevatedInnerCardViewStyle" parent="Widget.MaterialComponents.CardView">
|
<style name="ElevatedInnerCardViewStyle" parent="Widget.Material3.CardView.Elevated">
|
||||||
<item name="cardElevation">4dp</item>
|
<item name="cardElevation">4dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|||||||
42
base/src/main/res/values/themes.xml
Normal file
42
base/src/main/res/values/themes.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<style name="SettingsTheme.DefaultColors" parent="DefaultColors">
|
||||||
|
<item name="android:statusBarColor">?colorSurface</item>
|
||||||
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="SettingsTheme.BlackWhiteColors" parent="BlackWhiteColors">
|
||||||
|
<item name="android:statusBarColor">?colorSurface</item>
|
||||||
|
<item name="android:windowLightStatusBar">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="LauncherTheme.DefaultColors" parent="DefaultColors">
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:windowShowWallpaper">true</item>
|
||||||
|
<item name="android:colorPrimaryDark">#0000</item>
|
||||||
|
<item name="android:statusBarColor">#00000000</item>
|
||||||
|
<item name="android:navigationBarColor">#00000000</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
|
<item name="android:windowTranslucentStatus">false</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">false</item>
|
||||||
|
<item name="android:enforceStatusBarContrast">false</item>
|
||||||
|
<item name="android:enforceNavigationBarContrast">false</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="LauncherTheme.BlackWhiteColors" parent="BlackWhiteColors">
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:windowShowWallpaper">true</item>
|
||||||
|
<item name="android:colorPrimaryDark">#0000</item>
|
||||||
|
<item name="android:statusBarColor">#00000000</item>
|
||||||
|
<item name="android:navigationBarColor">#00000000</item>
|
||||||
|
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
|
||||||
|
<item name="android:windowTranslucentStatus">false</item>
|
||||||
|
<item name="android:windowTranslucentNavigation">false</item>
|
||||||
|
<item name="android:enforceStatusBarContrast">false</item>
|
||||||
|
<item name="android:enforceNavigationBarContrast">false</item>
|
||||||
|
<item name="windowActionBar">false</item>
|
||||||
|
<item name="windowNoTitle">true</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
||||||
@ -10,19 +10,15 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/appbar"
|
android:id="@+id/appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.DayNight.ActionBar">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<androidx.appcompat.widget.Toolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="?attr/actionBarSize" />
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.DayNight" />
|
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
@ -42,8 +38,8 @@
|
|||||||
android:id="@+id/appInfo"
|
android:id="@+id/appInfo"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dp"
|
|
||||||
android:layout_marginTop="10dp"
|
android:layout_marginTop="10dp"
|
||||||
android:textColor="?android:textColorPrimary"/>
|
android:padding="10dp"
|
||||||
|
android:textColor="?android:textColorPrimary" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|||||||
@ -7,24 +7,20 @@
|
|||||||
tools:context="com.balsikandar.crashreporter.ui.CrashReporterActivity">
|
tools:context="com.balsikandar.crashreporter.ui.CrashReporterActivity">
|
||||||
|
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
android:id="@+id/appbar"
|
android:id="@+id/appbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:theme="@style/ThemeOverlay.AppCompat.DayNight.ActionBar">
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.Toolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
android:id="@+id/toolbar"
|
android:id="@+id/toolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="?attr/actionBarSize"
|
android:layout_height="wrap_content"/>
|
||||||
android:background="?attr/colorPrimary"
|
|
||||||
app:popupTheme="@style/ThemeOverlay.AppCompat.DayNight" />
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
<com.google.android.material.tabs.TabLayout
|
||||||
android:id="@+id/tabs"
|
android:id="@+id/tabs"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="?attr/actionBarSize" />
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<style name="CrashReporter.Theme" parent="Theme.AppCompat.DayNight.NoActionBar">
|
<style name="CrashReporter.Theme" parent="SettingsTheme.DefaultColors">
|
||||||
<item name="colorAccent">@color/blue</item>
|
<item name="windowActionBar">false</item>
|
||||||
<item name="colorPrimary">@color/settings_color_primary</item>
|
<item name="windowNoTitle">true</item>
|
||||||
<item name="colorPrimaryDark">@color/settings_color_primary_dark</item>
|
|
||||||
</style>
|
</style>
|
||||||
</resources>
|
</resources>
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package de.mm20.launcher2.database
|
package de.mm20.launcher2.database
|
||||||
|
|
||||||
|
import android.content.ComponentName
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.room.*
|
import androidx.room.*
|
||||||
import de.mm20.launcher2.database.entities.IconEntity
|
import de.mm20.launcher2.database.entities.IconEntity
|
||||||
@ -11,10 +12,10 @@ interface IconDao {
|
|||||||
fun insertAll(icons: List<IconEntity>)
|
fun insertAll(icons: List<IconEntity>)
|
||||||
|
|
||||||
@Query("SELECT drawable FROM Icons WHERE componentName = :componentName AND iconPack = :iconPack")
|
@Query("SELECT drawable FROM Icons WHERE componentName = :componentName AND iconPack = :iconPack")
|
||||||
fun getIconName(componentName: String, iconPack: String): String?
|
suspend fun getIconName(componentName: String, iconPack: String): String?
|
||||||
|
|
||||||
@Query("SELECT * FROM Icons WHERE componentName = :componentName AND iconPack = :iconPack")
|
@Query("SELECT * FROM Icons WHERE componentName = :componentName AND iconPack = :iconPack")
|
||||||
fun getIcon(componentName: String, iconPack: String): IconEntity?
|
suspend fun getIcon(componentName: String, iconPack: String): IconEntity?
|
||||||
|
|
||||||
@Query("DELETE FROM Icons WHERE iconPack = :iconPack")
|
@Query("DELETE FROM Icons WHERE iconPack = :iconPack")
|
||||||
fun deleteIcons(iconPack: String)
|
fun deleteIcons(iconPack: String)
|
||||||
@ -27,11 +28,17 @@ interface IconDao {
|
|||||||
installIconPack(iconPack)
|
installIconPack(iconPack)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
fun installGrayscaleIconMap(packageName: String, icons: List<IconEntity>) {
|
||||||
|
deleteIcons(packageName)
|
||||||
|
insertAll(icons)
|
||||||
|
}
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
fun installIconPack(iconPack: IconPackEntity)
|
fun installIconPack(iconPack: IconPackEntity)
|
||||||
|
|
||||||
@Query("SELECT * FROM IconPack")
|
@Query("SELECT * FROM IconPack")
|
||||||
fun getInstalledIconPacks(): List<IconPackEntity>
|
suspend fun getInstalledIconPacks(): List<IconPackEntity>
|
||||||
|
|
||||||
@Query("SELECT * FROM IconPack")
|
@Query("SELECT * FROM IconPack")
|
||||||
fun getInstalledIconPacksLiveData(): LiveData<List<IconPackEntity>>
|
fun getInstalledIconPacksLiveData(): LiveData<List<IconPackEntity>>
|
||||||
@ -40,10 +47,10 @@ interface IconDao {
|
|||||||
fun deleteIconPack(iconPack: IconPackEntity)
|
fun deleteIconPack(iconPack: IconPackEntity)
|
||||||
|
|
||||||
@Query("SELECT * FROM IconPack WHERE packageName = :packageName AND version = :version")
|
@Query("SELECT * FROM IconPack WHERE packageName = :packageName AND version = :version")
|
||||||
fun getPacks(packageName: String, version: String): List<IconPackEntity>
|
suspend fun getPacks(packageName: String, version: String): List<IconPackEntity>
|
||||||
|
|
||||||
@Transaction
|
@Transaction
|
||||||
fun isInstalled(iconPack: IconPackEntity): Boolean {
|
suspend fun isInstalled(iconPack: IconPackEntity): Boolean {
|
||||||
return getPacks(iconPack.packageName, iconPack.version).isNotEmpty()
|
return getPacks(iconPack.packageName, iconPack.version).isNotEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,14 +67,17 @@ interface IconDao {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Query("SELECT drawable FROM Icons WHERE iconPack = :pack AND type = 'iconback'")
|
@Query("SELECT drawable FROM Icons WHERE iconPack = :pack AND type = 'iconback'")
|
||||||
fun getIconBacks(pack: String): List<String>
|
suspend fun getIconBacks(pack: String): List<String>
|
||||||
|
|
||||||
@Query("SELECT drawable FROM Icons WHERE iconPack = :pack AND type = 'iconupon'")
|
@Query("SELECT drawable FROM Icons WHERE iconPack = :pack AND type = 'iconupon'")
|
||||||
fun getIconUpons(pack: String): List<String>
|
suspend fun getIconUpons(pack: String): List<String>
|
||||||
|
|
||||||
@Query("SELECT drawable FROM Icons WHERE iconPack = :pack AND type = 'iconmask'")
|
@Query("SELECT drawable FROM Icons WHERE iconPack = :pack AND type = 'iconmask'")
|
||||||
fun getIconMasks(pack: String): List<String>
|
suspend fun getIconMasks(pack: String): List<String>
|
||||||
|
|
||||||
@Query("SELECT scale FROM IconPack WHERE packageName = :pack")
|
@Query("SELECT scale FROM IconPack WHERE packageName = :pack")
|
||||||
fun getScale(pack: String): Float?
|
suspend fun getScale(pack: String): Float?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM Icons WHERE type = 'greyscale_icon' AND componentName = :componentName")
|
||||||
|
suspend fun getGreyscaleIcon(componentName: String): IconEntity?
|
||||||
}
|
}
|
||||||
@ -381,7 +381,7 @@
|
|||||||
<string name="disclaimer_currency_converter">Wechselkurse so wie sie einmal täglich von der Europäischen Zentralbank herausgegeben werden. Alle Angaben sind ohne Gewähr. Es wird keine Haftung für die hier dargestellten Informationen übernommen.</string>
|
<string name="disclaimer_currency_converter">Wechselkurse so wie sie einmal täglich von der Europäischen Zentralbank herausgegeben werden. Alle Angaben sind ohne Gewähr. Es wird keine Haftung für die hier dargestellten Informationen übernommen.</string>
|
||||||
<string name="unit_converter_show_all">Alle anzeigen</string>
|
<string name="unit_converter_show_all">Alle anzeigen</string>
|
||||||
<string name="preference_card_background">Hintergrund</string>
|
<string name="preference_card_background">Hintergrund</string>
|
||||||
<string name="preference_card_background_default">Standard (weiß/dunkelgrau)</string>
|
<string name="preference_card_background_default">Standard</string>
|
||||||
<string name="preference_card_background_black">Weiß/schwarz</string>
|
<string name="preference_card_background_black">Weiß/schwarz</string>
|
||||||
<string name="preference_card_background_colored">Farbig (aus Hintergrundbild)</string>
|
<string name="preference_card_background_colored">Farbig (aus Hintergrundbild)</string>
|
||||||
<string name="preference_screen_colors">Farbschema</string>
|
<string name="preference_screen_colors">Farbschema</string>
|
||||||
|
|||||||
@ -379,7 +379,7 @@
|
|||||||
<string name="disclaimer_currency_converter">"Exchange rates as published once per day by the European Central Bank. All information is provided \"as is\" without any kind of guarantee. No liability is assumed for these information."</string>
|
<string name="disclaimer_currency_converter">"Exchange rates as published once per day by the European Central Bank. All information is provided \"as is\" without any kind of guarantee. No liability is assumed for these information."</string>
|
||||||
<string name="unit_converter_show_all">Show all</string>
|
<string name="unit_converter_show_all">Show all</string>
|
||||||
<string name="preference_card_background">Background</string>
|
<string name="preference_card_background">Background</string>
|
||||||
<string name="preference_card_background_default">Default (white/dark gray)</string>
|
<string name="preference_card_background_default">Default</string>
|
||||||
<string name="preference_card_background_black">White/black</string>
|
<string name="preference_card_background_black">White/black</string>
|
||||||
<string name="preference_card_background_colored">Colored (from wallpaper)</string>
|
<string name="preference_card_background_colored">Colored (from wallpaper)</string>
|
||||||
|
|
||||||
|
|||||||
@ -88,7 +88,7 @@ class LauncherPreferences(val context: Application, version: Int = 3) {
|
|||||||
var iconShape by EnumPreference("icon_shape", default = IconShape.PLATFORM_DEFAULT)
|
var iconShape by EnumPreference("icon_shape", default = IconShape.PLATFORM_DEFAULT)
|
||||||
var firstRunVersion by IntPreference("first_run_version", default = 0)
|
var firstRunVersion by IntPreference("first_run_version", default = 0)
|
||||||
|
|
||||||
var cardBackground by EnumPreference("card_background", default = CardBackground.DEFAULT)
|
var colorScheme by EnumPreference("card_background", default = ColorSchemes.DEFAULT)
|
||||||
var cardOpacity by IntPreference("card_opacity", default = 0xFF)
|
var cardOpacity by IntPreference("card_opacity", default = 0xFF)
|
||||||
var cardStrokeWidth by IntPreference("card_stroke_width", default = 0)
|
var cardStrokeWidth by IntPreference("card_stroke_width", default = 0)
|
||||||
var cardRadius by IntPreference("card_radius", default = 8)
|
var cardRadius by IntPreference("card_radius", default = 8)
|
||||||
@ -169,11 +169,11 @@ enum class WeatherProviders(override val value: String) : PreferenceEnum {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class CardBackground(override val value: String) : PreferenceEnum {
|
enum class ColorSchemes(override val value: String) : PreferenceEnum {
|
||||||
DEFAULT("0"),
|
DEFAULT("0"),
|
||||||
BLACK("2");
|
BLACK("2");
|
||||||
companion object {
|
companion object {
|
||||||
fun byValue(value: String): CardBackground {
|
fun byValue(value: String): ColorSchemes {
|
||||||
return values().first { it.value == value }
|
return values().first { it.value == value }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -57,6 +57,7 @@ dependencies {
|
|||||||
implementation(libs.androidx.compose.ui)
|
implementation(libs.androidx.compose.ui)
|
||||||
implementation(libs.androidx.compose.uitooling)
|
implementation(libs.androidx.compose.uitooling)
|
||||||
implementation(libs.androidx.compose.material)
|
implementation(libs.androidx.compose.material)
|
||||||
|
implementation(libs.androidx.compose.material3)
|
||||||
implementation(libs.androidx.compose.materialicons)
|
implementation(libs.androidx.compose.materialicons)
|
||||||
implementation(libs.androidx.compose.animation)
|
implementation(libs.androidx.compose.animation)
|
||||||
implementation(libs.androidx.compose.animationgraphics)
|
implementation(libs.androidx.compose.animationgraphics)
|
||||||
|
|||||||
@ -1,34 +1,28 @@
|
|||||||
package de.mm20.launcher2.ui
|
package de.mm20.launcher2.ui
|
||||||
|
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.material.darkColors
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.lightColors
|
||||||
|
import androidx.compose.material3.Typography
|
||||||
|
import androidx.compose.material3.lightColorScheme
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.Font
|
import androidx.compose.ui.text.font.Font
|
||||||
import androidx.compose.ui.text.font.FontFamily
|
import androidx.compose.ui.text.font.FontFamily
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import de.mm20.launcher2.preferences.Settings
|
|
||||||
import de.mm20.launcher2.preferences.Settings.AppearanceSettings.Theme
|
import de.mm20.launcher2.preferences.Settings.AppearanceSettings.Theme
|
||||||
import de.mm20.launcher2.preferences.dataStore
|
import de.mm20.launcher2.preferences.dataStore
|
||||||
import de.mm20.launcher2.ui.locals.LocalColorScheme
|
import de.mm20.launcher2.ui.locals.LocalColorScheme
|
||||||
|
import de.mm20.launcher2.ui.theme.colors.toDarkColorScheme
|
||||||
|
import de.mm20.launcher2.ui.theme.colors.toLightColorScheme
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
|
|
||||||
val lightPalette = lightColors(
|
|
||||||
primary = Color(0, 114, 255)
|
|
||||||
)
|
|
||||||
|
|
||||||
val darkPalette = darkColors(
|
|
||||||
primary = Color(0, 114, 255)
|
|
||||||
)
|
|
||||||
|
|
||||||
val Inter = FontFamily(
|
val Inter = FontFamily(
|
||||||
Font(R.font.inter_thin, FontWeight.Thin),
|
Font(R.font.inter_thin, FontWeight.Thin),
|
||||||
Font(R.font.inter_extralight, FontWeight.ExtraLight),
|
Font(R.font.inter_extralight, FontWeight.ExtraLight),
|
||||||
@ -43,193 +37,80 @@ val Inter = FontFamily(
|
|||||||
|
|
||||||
|
|
||||||
val typography = Typography(
|
val typography = Typography(
|
||||||
h1 = TextStyle(
|
displayLarge = TextStyle(
|
||||||
fontSize = 96.sp,
|
|
||||||
fontWeight = FontWeight.Light,
|
|
||||||
fontFamily = Inter
|
|
||||||
),
|
|
||||||
h2 = TextStyle(
|
|
||||||
fontSize = 60.sp,
|
|
||||||
fontWeight = FontWeight.Light,
|
|
||||||
fontFamily = Inter
|
|
||||||
),
|
|
||||||
h3 = TextStyle(
|
|
||||||
fontSize = 48.sp,
|
|
||||||
fontWeight = FontWeight.Normal,
|
|
||||||
fontFamily = Inter
|
|
||||||
),
|
|
||||||
h4 = TextStyle(
|
|
||||||
fontSize = 34.sp,
|
|
||||||
fontWeight = FontWeight.Normal,
|
|
||||||
fontFamily = Inter
|
|
||||||
),
|
|
||||||
h5 = TextStyle(
|
|
||||||
fontSize = 24.sp,
|
|
||||||
fontWeight = FontWeight.Medium,
|
|
||||||
fontFamily = Inter
|
|
||||||
),
|
|
||||||
h6 = TextStyle(
|
|
||||||
fontSize = 20.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
fontFamily = Inter
|
|
||||||
),
|
|
||||||
caption = TextStyle(
|
|
||||||
fontFamily = Inter,
|
fontFamily = Inter,
|
||||||
fontSize = 13.sp
|
fontSize = 57.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
),
|
),
|
||||||
subtitle1 = TextStyle(
|
displayMedium = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 45.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
displaySmall = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 36.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
headlineLarge = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 32.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
headlineMedium = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 28.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
headlineSmall = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 24.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
titleLarge = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 22.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
titleMedium = TextStyle(
|
||||||
fontFamily = Inter,
|
fontFamily = Inter,
|
||||||
fontSize = 16.sp,
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.Bold,
|
fontWeight = FontWeight.Medium,
|
||||||
),
|
),
|
||||||
subtitle2 = TextStyle(
|
titleSmall = TextStyle(
|
||||||
fontFamily = Inter,
|
fontFamily = Inter,
|
||||||
fontWeight = FontWeight.SemiBold,
|
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
),
|
),
|
||||||
body1 = TextStyle(
|
bodyLarge = TextStyle(
|
||||||
fontSize = 13.sp
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
bodyMedium = TextStyle(
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
bodySmall = TextStyle(
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
labelLarge = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
),
|
||||||
|
labelMedium = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontFamily = Inter,
|
||||||
|
fontSize = 11.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
),
|
),
|
||||||
body2 = TextStyle(
|
|
||||||
fontSize = 12.sp
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
val shapes = Shapes(
|
|
||||||
medium = RoundedCornerShape(8.dp)
|
|
||||||
)
|
|
||||||
|
|
||||||
val Colors.red: Color
|
|
||||||
get() = if (isLight) Color(0xFFE53935) else Color(0xFFE57373)
|
|
||||||
|
|
||||||
val Colors.pink: Color
|
|
||||||
get() = if (isLight) Color(0xFFD81B60) else Color(0xFFF06292)
|
|
||||||
|
|
||||||
val Colors.purple: Color
|
|
||||||
get() = if (isLight) Color(0xFF8E24AA) else Color(0xFFBA68C8)
|
|
||||||
|
|
||||||
val Colors.deepPurple: Color
|
|
||||||
get() = if (isLight) Color(0xFF5E35B1) else Color(0xFF9575CD)
|
|
||||||
|
|
||||||
val Colors.indigo: Color
|
|
||||||
get() = if (isLight) Color(0xFF3949AB) else Color(0xFF7986CB)
|
|
||||||
|
|
||||||
val Colors.blue: Color
|
|
||||||
get() = if (isLight) Color(0xFF039BE5) else Color(0xFF4FC3F7)
|
|
||||||
|
|
||||||
val Colors.lightBlue: Color
|
|
||||||
get() = if (isLight) Color(0xFF1E88E5) else Color(0xFF64B5F6)
|
|
||||||
|
|
||||||
val Colors.cyan: Color
|
|
||||||
get() = if (isLight) Color(0xFF00ACC1) else Color(0xFF4DD0E1)
|
|
||||||
|
|
||||||
val Colors.teal: Color
|
|
||||||
get() = if (isLight) Color(0xFF00897B) else Color(0xFF4DB6AC)
|
|
||||||
|
|
||||||
val Colors.green: Color
|
|
||||||
get() = if (isLight) Color(0xFF388E3C) else Color(0xFF81C784)
|
|
||||||
|
|
||||||
val Colors.lightGreen: Color
|
|
||||||
get() = if (isLight) Color(0xFF7CB342) else Color(0xFFAED581)
|
|
||||||
|
|
||||||
|
|
||||||
val Colors.lime: Color
|
|
||||||
get() = if (isLight) Color(0xFFC0CA33) else Color(0xFFDCE775)
|
|
||||||
|
|
||||||
val Colors.yellow: Color
|
|
||||||
get() = if (isLight) Color(0xFFFDD835) else Color(0xFFFFF176)
|
|
||||||
|
|
||||||
val Colors.amber: Color
|
|
||||||
get() = if (isLight) Color(0xFFFFB300) else Color(0xFFFFD54F)
|
|
||||||
|
|
||||||
val Colors.orange: Color
|
|
||||||
get() = if (isLight) Color(0xFFFB8C00) else Color(0xFFFFB74D)
|
|
||||||
|
|
||||||
val Colors.deepOrange: Color
|
|
||||||
get() = if (isLight) Color(0xFFF4511E) else Color(0xFFFF8A65)
|
|
||||||
|
|
||||||
val Colors.brown: Color
|
|
||||||
get() = if (isLight) Color(0xFF6D4C41) else Color(0xFFA1887F)
|
|
||||||
|
|
||||||
val Colors.gray: Color
|
|
||||||
get() = if (isLight) Color(0xFF757575) else Color(0xFFE0E0E0)
|
|
||||||
|
|
||||||
val Colors.blueGray: Color
|
|
||||||
get() = if (isLight) Color(0xFF546E7A) else Color(0xFF90A4AE)
|
|
||||||
|
|
||||||
|
|
||||||
val Colors.androidGreen: Color
|
|
||||||
get() = if (isLight) Color(0xFF00A55B) else Color(0xFF00DE7A)
|
|
||||||
|
|
||||||
val Colors.weatherSkyClear: Color
|
|
||||||
get() = Color(0xff4482ac)
|
|
||||||
|
|
||||||
val Colors.weatherSkyClearNight: Color
|
|
||||||
get() = deepPurple
|
|
||||||
|
|
||||||
val Colors.weatherSkyCloudy: Color
|
|
||||||
get() = gray
|
|
||||||
|
|
||||||
val Colors.weatherSkyCloudyNight: Color
|
|
||||||
get() = gray
|
|
||||||
|
|
||||||
val Colors.weatherSkyThunder: Color
|
|
||||||
get() = gray
|
|
||||||
|
|
||||||
val Colors.weatherSkyThunderNight: Color
|
|
||||||
get() = gray
|
|
||||||
|
|
||||||
val Colors.weatherCloudLight1: Color
|
|
||||||
get() = Color(0xFFECEFF1)
|
|
||||||
|
|
||||||
val Colors.weatherCloudLight2: Color
|
|
||||||
get() = if (isLight) Color(0xFF90A4AE) else Color(0xFFCFD8DC)
|
|
||||||
|
|
||||||
val Colors.weatherCloudMedium1: Color
|
|
||||||
get() = if (isLight) Color(0xFF546E7A) else Color(0xFF78909C)
|
|
||||||
|
|
||||||
val Colors.weatherCloudMedium2: Color
|
|
||||||
get() = if (isLight) Color(0xFF455a64) else Color(0xFF607D8B)
|
|
||||||
|
|
||||||
val Colors.weatherCloudDark1: Color
|
|
||||||
get() = if (isLight) Color(0xFF37474F) else Color(0xFF546E7A)
|
|
||||||
|
|
||||||
val Colors.weatherCloudDark2: Color
|
|
||||||
get() = if (isLight) Color(0xFF263238) else Color(0xFF455A64)
|
|
||||||
|
|
||||||
val Colors.weatherSun: Color
|
|
||||||
get() = amber
|
|
||||||
|
|
||||||
val Colors.weatherMoon: Color
|
|
||||||
get() = if (isLight) Color(0xFF9E9E9E) else Color(0xFFE0E0E0)
|
|
||||||
|
|
||||||
val Colors.weatherBolt: Color
|
|
||||||
get() = amber
|
|
||||||
|
|
||||||
val Colors.weatherHot: Color
|
|
||||||
get() = red
|
|
||||||
|
|
||||||
val Colors.weatherCold: Color
|
|
||||||
get() = lightBlue
|
|
||||||
|
|
||||||
val Colors.weatherWind: Color
|
|
||||||
get() = if (isLight) Color(0xFF90A4AE) else Color(0xFFCFD8DC)
|
|
||||||
|
|
||||||
val Colors.weatherWindDark: Color
|
|
||||||
get() = if (isLight) Color(0xFF546E7A) else Color(0xFF78909C)
|
|
||||||
|
|
||||||
val Colors.weatherRain: Color
|
|
||||||
get() = blue
|
|
||||||
|
|
||||||
val Colors.weatherHail: Color
|
|
||||||
get() = if (isLight) Color(0xFFBBDEFB) else Color(0xFFE3F2FD)
|
|
||||||
|
|
||||||
val Colors.weatherSnow: Color
|
|
||||||
get() = if (isLight) Color(0xFFE0E0E0) else Color(0xFFF5F5F5)
|
|
||||||
|
|
||||||
val Colors.weatherFog: Color
|
|
||||||
get() = weatherCloudLight2
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun LauncherTheme(content: @Composable () -> Unit) {
|
fun LauncherTheme(content: @Composable () -> Unit) {
|
||||||
|
|
||||||
@ -244,33 +125,20 @@ fun LauncherTheme(content: @Composable () -> Unit) {
|
|||||||
val colorScheme = LocalColorScheme.current
|
val colorScheme = LocalColorScheme.current
|
||||||
|
|
||||||
val colors = if (darkTheme) {
|
val colors = if (darkTheme) {
|
||||||
darkColors(
|
colorScheme.toDarkColorScheme()
|
||||||
onSurface = colorScheme.neutral2.shade10,
|
|
||||||
surface = colorScheme.neutral2.shade800,
|
|
||||||
onBackground = colorScheme.neutral2.shade10,
|
|
||||||
background = colorScheme.neutral2.shade900,
|
|
||||||
primary = colorScheme.accent1.shade300,
|
|
||||||
primaryVariant = colorScheme.accent1.shade400,
|
|
||||||
secondary = colorScheme.accent2.shade300,
|
|
||||||
secondaryVariant = colorScheme.accent3.shade300,
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
lightColors(
|
colorScheme.toLightColorScheme()
|
||||||
surface = colorScheme.neutral1.shade0,
|
}
|
||||||
onSurface = colorScheme.neutral2.shade1000,
|
|
||||||
onBackground = colorScheme.neutral2.shade1000,
|
androidx.compose.material.MaterialTheme(
|
||||||
background = colorScheme.neutral1.shade50,
|
colors = if (darkTheme) darkColors() else lightColors()
|
||||||
primary = colorScheme.accent1.shade600,
|
) {
|
||||||
primaryVariant = colorScheme.accent1.shade700,
|
MaterialTheme(
|
||||||
secondary = colorScheme.accent2.shade600,
|
colorScheme = colors,
|
||||||
secondaryVariant = colorScheme.accent3.shade600,
|
typography = typography,
|
||||||
|
content = content
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
MaterialTheme(
|
|
||||||
colors = colors,
|
|
||||||
typography = typography,
|
|
||||||
shapes = shapes,
|
|
||||||
content = content
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
@ -15,11 +15,11 @@ fun ColorSchemeTest() {
|
|||||||
|
|
||||||
Card {
|
Card {
|
||||||
Column {
|
Column {
|
||||||
SwatchRow(swatch = colorScheme.neutral1)
|
SwatchRow(swatch = colorScheme.neutral)
|
||||||
SwatchRow(swatch = colorScheme.neutral2)
|
SwatchRow(swatch = colorScheme.neutralVariant)
|
||||||
SwatchRow(swatch = colorScheme.accent1)
|
SwatchRow(swatch = colorScheme.primary)
|
||||||
SwatchRow(swatch = colorScheme.accent2)
|
SwatchRow(swatch = colorScheme.secondary)
|
||||||
SwatchRow(swatch = colorScheme.accent3)
|
SwatchRow(swatch = colorScheme.tertiary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -31,42 +31,42 @@ fun SwatchRow(swatch: ColorSwatch) {
|
|||||||
) {
|
) {
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.height(24.dp).weight(1f)
|
.height(24.dp).weight(1f)
|
||||||
.background(swatch.shade0))
|
.background(swatch.shade100))
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.height(24.dp).weight(1f)
|
.height(24.dp).weight(1f)
|
||||||
.background(swatch.shade10))
|
.background(swatch.shade99))
|
||||||
|
Box(modifier = Modifier
|
||||||
|
.height(24.dp).weight(1f)
|
||||||
|
.background(swatch.shade95))
|
||||||
|
Box(modifier = Modifier
|
||||||
|
.height(24.dp).weight(1f)
|
||||||
|
.background(swatch.shade90))
|
||||||
|
Box(modifier = Modifier
|
||||||
|
.height(24.dp).weight(1f)
|
||||||
|
.background(swatch.shade80))
|
||||||
|
Box(modifier = Modifier
|
||||||
|
.height(24.dp).weight(1f)
|
||||||
|
.background(swatch.shade70))
|
||||||
|
Box(modifier = Modifier
|
||||||
|
.height(24.dp).weight(1f)
|
||||||
|
.background(swatch.shade60))
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.height(24.dp).weight(1f)
|
.height(24.dp).weight(1f)
|
||||||
.background(swatch.shade50))
|
.background(swatch.shade50))
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.height(24.dp).weight(1f)
|
.height(24.dp).weight(1f)
|
||||||
.background(swatch.shade100))
|
.background(swatch.shade40))
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.height(24.dp).weight(1f)
|
.height(24.dp).weight(1f)
|
||||||
.background(swatch.shade200))
|
.background(swatch.shade30))
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.height(24.dp).weight(1f)
|
.height(24.dp).weight(1f)
|
||||||
.background(swatch.shade300))
|
.background(swatch.shade20))
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.height(24.dp).weight(1f)
|
.height(24.dp).weight(1f)
|
||||||
.background(swatch.shade400))
|
.background(swatch.shade10))
|
||||||
Box(modifier = Modifier
|
Box(modifier = Modifier
|
||||||
.height(24.dp).weight(1f)
|
.height(24.dp).weight(1f)
|
||||||
.background(swatch.shade500))
|
.background(swatch.shade0))
|
||||||
Box(modifier = Modifier
|
|
||||||
.height(24.dp).weight(1f)
|
|
||||||
.background(swatch.shade600))
|
|
||||||
Box(modifier = Modifier
|
|
||||||
.height(24.dp).weight(1f)
|
|
||||||
.background(swatch.shade700))
|
|
||||||
Box(modifier = Modifier
|
|
||||||
.height(24.dp).weight(1f)
|
|
||||||
.background(swatch.shade800))
|
|
||||||
Box(modifier = Modifier
|
|
||||||
.height(24.dp).weight(1f)
|
|
||||||
.background(swatch.shade900))
|
|
||||||
Box(modifier = Modifier
|
|
||||||
.height(24.dp).weight(1f)
|
|
||||||
.background(swatch.shade1000))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4,7 +4,10 @@ import androidx.compose.foundation.BorderStroke
|
|||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.Card
|
||||||
|
import androidx.compose.material.ContentAlpha
|
||||||
|
import androidx.compose.material.LocalContentAlpha
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -27,7 +30,7 @@ fun InformationText(
|
|||||||
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
|
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
|
||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text,
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
modifier = (if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier).padding(12.dp)
|
modifier = (if (onClick != null) Modifier.clickable(onClick = onClick) else Modifier).padding(12.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,57 +1,73 @@
|
|||||||
package de.mm20.launcher2.ui
|
package de.mm20.launcher2.ui
|
||||||
|
|
||||||
import androidx.compose.foundation.isSystemInDarkTheme
|
import androidx.compose.foundation.isSystemInDarkTheme
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.material.Typography
|
|
||||||
import androidx.compose.material.darkColors
|
|
||||||
import androidx.compose.material.lightColors
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
|
|
||||||
val legacyTypography = Typography(
|
val legacyTypography = Typography(
|
||||||
h1 = TextStyle(
|
displayLarge = TextStyle(
|
||||||
fontSize = 96.sp,
|
fontSize = 57.sp,
|
||||||
fontWeight = FontWeight.Light,
|
|
||||||
),
|
|
||||||
h2 = TextStyle(
|
|
||||||
fontSize = 60.sp,
|
|
||||||
fontWeight = FontWeight.Light,
|
|
||||||
),
|
|
||||||
h3 = TextStyle(
|
|
||||||
fontSize = 48.sp,
|
|
||||||
fontWeight = FontWeight.Normal,
|
fontWeight = FontWeight.Normal,
|
||||||
),
|
),
|
||||||
h4 = TextStyle(
|
displayMedium = TextStyle(
|
||||||
fontSize = 34.sp,
|
fontSize = 45.sp,
|
||||||
fontWeight = FontWeight.Normal,
|
fontWeight = FontWeight.Normal,
|
||||||
),
|
),
|
||||||
h5 = TextStyle(
|
displaySmall = TextStyle(
|
||||||
|
fontSize = 36.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
headlineLarge = TextStyle(
|
||||||
|
fontSize = 32.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
headlineMedium = TextStyle(
|
||||||
|
fontSize = 28.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
headlineSmall = TextStyle(
|
||||||
fontSize = 24.sp,
|
fontSize = 24.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
titleLarge = TextStyle(
|
||||||
|
fontSize = 22.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
titleMedium = TextStyle(
|
||||||
|
fontSize = 16.sp,
|
||||||
fontWeight = FontWeight.Medium,
|
fontWeight = FontWeight.Medium,
|
||||||
),
|
),
|
||||||
h6 = TextStyle(
|
titleSmall = TextStyle(
|
||||||
fontSize = 20.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
),
|
|
||||||
caption = TextStyle(
|
|
||||||
fontSize = 13.sp
|
|
||||||
),
|
|
||||||
subtitle1 = TextStyle(
|
|
||||||
fontSize = 16.sp,
|
|
||||||
fontWeight = FontWeight.Bold,
|
|
||||||
),
|
|
||||||
subtitle2 = TextStyle(
|
|
||||||
fontWeight = FontWeight.SemiBold,
|
|
||||||
fontSize = 14.sp,
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
),
|
),
|
||||||
body1 = TextStyle(
|
bodyLarge = TextStyle(
|
||||||
fontSize = 14.sp
|
fontSize = 16.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
bodyMedium = TextStyle(
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
bodySmall = TextStyle(
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontWeight = FontWeight.Normal,
|
||||||
|
),
|
||||||
|
labelLarge = TextStyle(
|
||||||
|
fontSize = 14.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
),
|
||||||
|
labelMedium = TextStyle(
|
||||||
|
fontSize = 12.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
|
),
|
||||||
|
labelSmall = TextStyle(
|
||||||
|
fontSize = 11.sp,
|
||||||
|
fontWeight = FontWeight.Medium,
|
||||||
),
|
),
|
||||||
body2 = TextStyle(
|
|
||||||
fontSize = 13.sp
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@ -59,6 +75,6 @@ fun LegacyLauncherTheme(content: @Composable () -> Unit) {
|
|||||||
MaterialTheme(
|
MaterialTheme(
|
||||||
typography = legacyTypography,
|
typography = legacyTypography,
|
||||||
content = content,
|
content = content,
|
||||||
colors = if (isSystemInDarkTheme()) darkColors() else lightColors()
|
colorScheme = if (isSystemInDarkTheme()) darkColorScheme() else lightColorScheme()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -8,9 +8,9 @@ import androidx.compose.foundation.interaction.collectIsPressedAsState
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.requiredSize
|
import androidx.compose.foundation.layout.requiredSize
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -85,7 +85,7 @@ fun ShapedLauncherIcon(
|
|||||||
|
|
||||||
Surface(
|
Surface(
|
||||||
shape = iconShape,
|
shape = iconShape,
|
||||||
elevation = animateDpAsState(if (isPressed) 4.dp else 1.dp).value,
|
shadowElevation = animateDpAsState(if (isPressed) 4.dp else 1.dp).value,
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.requiredSize(size)
|
.requiredSize(size)
|
||||||
) {
|
) {
|
||||||
@ -94,7 +94,7 @@ fun ShapedLauncherIcon(
|
|||||||
.requiredSize(size)
|
.requiredSize(size)
|
||||||
.background(
|
.background(
|
||||||
color = if (icon == null) {
|
color = if (icon == null) {
|
||||||
placeholder.color.copy(alpha = 0.4f).compositeOver(MaterialTheme.colors.surface)
|
placeholder.color.copy(alpha = 0.4f).compositeOver(MaterialTheme.colorScheme.surface)
|
||||||
} else {
|
} else {
|
||||||
Color.Gray
|
Color.Gray
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,24 +59,24 @@ class ComposeActivity : AppCompatActivity() {
|
|||||||
.collectAsState(initial = Settings.AppearanceSettings.ColorScheme.Default)
|
.collectAsState(initial = Settings.AppearanceSettings.ColorScheme.Default)
|
||||||
|
|
||||||
val colorScheme = when (colorSchemePreference) {
|
val colorScheme = when (colorSchemePreference) {
|
||||||
Settings.AppearanceSettings.ColorScheme.MM20 -> MM20ColorScheme()
|
Settings.AppearanceSettings.ColorScheme.MM20 -> MM20ColorPalette()
|
||||||
Settings.AppearanceSettings.ColorScheme.Wallpaper -> {
|
Settings.AppearanceSettings.ColorScheme.Wallpaper -> {
|
||||||
if (isAtLeastApiLevel(Build.VERSION_CODES.O_MR1)) {
|
if (isAtLeastApiLevel(Build.VERSION_CODES.O_MR1)) {
|
||||||
val wallpaperColors by wallpaperColorsAsState()
|
val wallpaperColors by wallpaperColorsAsState()
|
||||||
WallpaperColorScheme(wallpaperColors)
|
WallpaperColorPalette(wallpaperColors)
|
||||||
} else DefaultColorScheme()
|
} else DefaultColorPalette()
|
||||||
}
|
}
|
||||||
Settings.AppearanceSettings.ColorScheme.MaterialYou -> {
|
Settings.AppearanceSettings.ColorScheme.MaterialYou -> {
|
||||||
if (isAtLeastApiLevel(Build.VERSION_CODES.S)) {
|
if (isAtLeastApiLevel(Build.VERSION_CODES.S)) {
|
||||||
SystemColorScheme(context)
|
SystemColorPalette(context)
|
||||||
} else DefaultColorScheme()
|
} else DefaultColorPalette()
|
||||||
}
|
}
|
||||||
Settings.AppearanceSettings.ColorScheme.BlackAndWhite -> BlackWhiteColorScheme()
|
Settings.AppearanceSettings.ColorScheme.BlackAndWhite -> BlackWhiteColorPalette()
|
||||||
Settings.AppearanceSettings.ColorScheme.Custom -> {
|
Settings.AppearanceSettings.ColorScheme.Custom -> {
|
||||||
val customColors by customColorsAsState()
|
val customColors by customColorsAsState()
|
||||||
CustomColorScheme(customColors)
|
CustomColorPalette(customColors)
|
||||||
}
|
}
|
||||||
else -> DefaultColorScheme()
|
else -> DefaultColorPalette()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
package de.mm20.launcher2.ui.compat
|
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.ui.graphics.painter.ColorPainter
|
|
||||||
import androidx.compose.ui.graphics.painter.Painter
|
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import de.mm20.launcher2.ui.R
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun animatedVectorResource(@DrawableRes id: Int): AnimatedVectorResourceStub {
|
|
||||||
return AnimatedVectorResourceStub(id)
|
|
||||||
}
|
|
||||||
|
|
||||||
class AnimatedVectorResourceStub(
|
|
||||||
val res: Int
|
|
||||||
) {
|
|
||||||
@Composable
|
|
||||||
fun painterFor(atEnd: Boolean): Painter {
|
|
||||||
return ColorPainter(MaterialTheme.colors.onSurface)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -4,7 +4,7 @@ import androidx.compose.foundation.border
|
|||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.RowScope
|
import androidx.compose.foundation.layout.RowScope
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@ -15,7 +15,7 @@ fun Chip(
|
|||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.border(1.dp, MaterialTheme.colors.onSurface.copy(alpha = 0.1f), shape = MaterialTheme.shapes.large)
|
.border(1.dp, MaterialTheme.colorScheme.onSurface.copy(alpha = 0.1f))
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp),
|
.padding(horizontal = 16.dp, vertical = 8.dp),
|
||||||
|
|
||||||
content = content
|
content = content
|
||||||
|
|||||||
@ -5,10 +5,10 @@ import androidx.compose.foundation.Canvas
|
|||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -37,7 +37,7 @@ fun DigitalClock(time: Long) {
|
|||||||
Text(
|
Text(
|
||||||
modifier = Modifier.padding(4.dp),
|
modifier = Modifier.padding(4.dp),
|
||||||
text = format.format(time),
|
text = format.format(time),
|
||||||
style = MaterialTheme.typography.h1.copy(
|
style = MaterialTheme.typography.displayLarge.copy(
|
||||||
fontSize = 100.sp,
|
fontSize = 100.sp,
|
||||||
fontWeight = FontWeight.Black,
|
fontWeight = FontWeight.Black,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
@ -86,12 +86,12 @@ fun AnalogClock(time: Long) {
|
|||||||
date.timeInMillis = time
|
date.timeInMillis = time
|
||||||
val minute = date[Calendar.MINUTE]
|
val minute = date[Calendar.MINUTE]
|
||||||
val hour = date[Calendar.HOUR]
|
val hour = date[Calendar.HOUR]
|
||||||
val dark = !MaterialTheme.colors.isLight
|
val dark = true//!MaterialTheme.colors.isLight
|
||||||
val cs = LocalColorScheme.current
|
val cs = LocalColorScheme.current
|
||||||
val bgColor = if (dark) cs.accent1.shade800 else cs.accent1.shade200
|
val bgColor = if (dark) cs.primary.shade20 else cs.primary.shade80
|
||||||
val hourColor = if (dark) cs.accent1.shade300 else cs.accent1.shade600
|
val hourColor = if (dark) cs.primary.shade70 else cs.primary.shade40
|
||||||
val minuteColor = if (dark) cs.accent1.shade200 else cs.accent1.shade700
|
val minuteColor = if (dark) cs.primary.shade80 else cs.primary.shade30
|
||||||
val textColor = if (dark) cs.accent1.shade500 else cs.accent1.shade400
|
val textColor = if (dark) cs.primary.shade50 else cs.primary.shade60
|
||||||
|
|
||||||
val hourAngle = 30f * hour + 0.5f * minute
|
val hourAngle = 30f * hour + 0.5f * minute
|
||||||
val minuteAngle = 6f * minute
|
val minuteAngle = 6f * minute
|
||||||
@ -102,7 +102,7 @@ fun AnalogClock(time: Long) {
|
|||||||
.size(156.dp),
|
.size(156.dp),
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
color = bgColor,
|
color = bgColor,
|
||||||
elevation = 8.dp
|
shadowElevation = 8.dp
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.fillMaxSize()
|
modifier = Modifier.fillMaxSize()
|
||||||
@ -110,7 +110,7 @@ fun AnalogClock(time: Long) {
|
|||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "12",
|
text = "12",
|
||||||
style = MaterialTheme.typography.subtitle1.copy(
|
style = MaterialTheme.typography.headlineMedium.copy(
|
||||||
fontSize = 32.sp,
|
fontSize = 32.sp,
|
||||||
lineHeight = 32.sp,
|
lineHeight = 32.sp,
|
||||||
),
|
),
|
||||||
@ -121,7 +121,7 @@ fun AnalogClock(time: Long) {
|
|||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = "3",
|
text = "3",
|
||||||
style = MaterialTheme.typography.subtitle1.copy(
|
style = MaterialTheme.typography.headlineMedium.copy(
|
||||||
fontSize = 32.sp
|
fontSize = 32.sp
|
||||||
),
|
),
|
||||||
color = textColor,
|
color = textColor,
|
||||||
@ -131,7 +131,7 @@ fun AnalogClock(time: Long) {
|
|||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = "6",
|
text = "6",
|
||||||
style = MaterialTheme.typography.subtitle1.copy(
|
style = MaterialTheme.typography.headlineMedium.copy(
|
||||||
fontSize = 32.sp
|
fontSize = 32.sp
|
||||||
),
|
),
|
||||||
color = textColor,
|
color = textColor,
|
||||||
@ -141,7 +141,7 @@ fun AnalogClock(time: Long) {
|
|||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = "9",
|
text = "9",
|
||||||
style = MaterialTheme.typography.subtitle1.copy(
|
style = MaterialTheme.typography.headlineMedium.copy(
|
||||||
fontSize = 32.sp
|
fontSize = 32.sp
|
||||||
),
|
),
|
||||||
color = textColor,
|
color = textColor,
|
||||||
|
|||||||
@ -2,10 +2,10 @@ package de.mm20.launcher2.ui.component
|
|||||||
|
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.OutlinedTextField
|
import androidx.compose.material.OutlinedTextField
|
||||||
import androidx.compose.material.Slider
|
import androidx.compose.material.Slider
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -82,7 +82,7 @@ fun ColorPicker(
|
|||||||
Text(
|
Text(
|
||||||
"Hex: ",
|
"Hex: ",
|
||||||
modifier = Modifier.weight(2f),
|
modifier = Modifier.weight(2f),
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = hex,
|
value = hex,
|
||||||
@ -114,7 +114,7 @@ private fun SliderRow(
|
|||||||
Text(
|
Text(
|
||||||
label,
|
label,
|
||||||
modifier = Modifier.weight(1f),
|
modifier = Modifier.weight(1f),
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.weight(7f)
|
modifier = Modifier.weight(7f)
|
||||||
|
|||||||
@ -13,6 +13,8 @@ import androidx.compose.material.icons.rounded.Star
|
|||||||
import androidx.compose.material.icons.rounded.StarBorder
|
import androidx.compose.material.icons.rounded.StarBorder
|
||||||
import androidx.compose.material.icons.rounded.Visibility
|
import androidx.compose.material.icons.rounded.Visibility
|
||||||
import androidx.compose.material.icons.rounded.VisibilityOff
|
import androidx.compose.material.icons.rounded.VisibilityOff
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.livedata.observeAsState
|
import androidx.compose.runtime.livedata.observeAsState
|
||||||
@ -24,7 +26,6 @@ import androidx.compose.ui.res.colorResource
|
|||||||
import androidx.compose.ui.unit.IntOffset
|
import androidx.compose.ui.unit.IntOffset
|
||||||
import androidx.compose.ui.unit.LayoutDirection
|
import androidx.compose.ui.unit.LayoutDirection
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
|
||||||
import de.mm20.launcher2.favorites.FavoritesViewModel
|
import de.mm20.launcher2.favorites.FavoritesViewModel
|
||||||
import de.mm20.launcher2.search.data.Searchable
|
import de.mm20.launcher2.search.data.Searchable
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
@ -45,7 +46,7 @@ fun DefaultSwipeActions(
|
|||||||
val isPinned by viewModel.isPinned(item).observeAsState()
|
val isPinned by viewModel.isPinned(item).observeAsState()
|
||||||
val isHidden by viewModel.isHidden(item).observeAsState()
|
val isHidden by viewModel.isHidden(item).observeAsState()
|
||||||
|
|
||||||
val state = rememberSwipeableState(
|
val state = androidx.compose.material.rememberSwipeableState(
|
||||||
SwipeAction.Default,
|
SwipeAction.Default,
|
||||||
confirmStateChange = {
|
confirmStateChange = {
|
||||||
if (it == SwipeAction.Favorites) {
|
if (it == SwipeAction.Favorites) {
|
||||||
@ -96,7 +97,7 @@ fun DefaultSwipeActions(
|
|||||||
modifier = Modifier.matchParentSize()
|
modifier = Modifier.matchParentSize()
|
||||||
) {
|
) {
|
||||||
Card(
|
Card(
|
||||||
backgroundColor = MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.divider),
|
backgroundColor = MaterialTheme.colorScheme.onSurface.copy(alpha = ContentAlpha.divider),
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
elevation = 0.dp
|
elevation = 0.dp
|
||||||
) {
|
) {
|
||||||
@ -132,7 +133,7 @@ fun DefaultSwipeActions(
|
|||||||
Icons.Rounded.VisibilityOff
|
Icons.Rounded.VisibilityOff
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tint = animateColorAsState(if (isDismissing) MaterialTheme.colors.onPrimary else MaterialTheme.colors.onSurface).value,
|
tint = animateColorAsState(if (isDismissing) MaterialTheme.colorScheme.onPrimary else MaterialTheme.colorScheme.onSurface).value,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(horizontal = 16.dp)
|
.padding(horizontal = 16.dp)
|
||||||
.scale(animateFloatAsState(if (isDismissing) 1.2f else 1f).value),
|
.scale(animateFloatAsState(if (isDismissing) 1.2f else 1f).value),
|
||||||
|
|||||||
@ -4,7 +4,7 @@ package de.mm20.launcher2.ui.component
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.requiredSize
|
import androidx.compose.foundation.layout.requiredSize
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material.LocalContentAlpha
|
import androidx.compose.material3.LocalContentAlpha
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.alpha
|
import androidx.compose.ui.draw.alpha
|
||||||
|
|||||||
@ -8,8 +8,14 @@ import androidx.compose.foundation.layout.*
|
|||||||
import androidx.compose.foundation.text.BasicText
|
import androidx.compose.foundation.text.BasicText
|
||||||
import androidx.compose.foundation.text.BasicTextField
|
import androidx.compose.foundation.text.BasicTextField
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.*
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.Search
|
import androidx.compose.material.icons.rounded.Search
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.LocalContentColor
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -142,7 +148,7 @@ fun SearchBar(
|
|||||||
}) {
|
}) {
|
||||||
Text(
|
Text(
|
||||||
stringResource(id = R.string.wallpaper),
|
stringResource(id = R.string.wallpaper),
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
DropdownMenuItem(onClick = {
|
DropdownMenuItem(onClick = {
|
||||||
@ -151,7 +157,7 @@ fun SearchBar(
|
|||||||
}) {
|
}) {
|
||||||
Text(
|
Text(
|
||||||
stringResource(id = R.string.title_activity_settings),
|
stringResource(id = R.string.title_activity_settings),
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,8 +7,8 @@ import androidx.compose.foundation.lazy.LazyColumn
|
|||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.foundation.lazy.LazyListState
|
import androidx.compose.foundation.lazy.LazyListState
|
||||||
import androidx.compose.material.Divider
|
import androidx.compose.material.Divider
|
||||||
import androidx.compose.material.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -26,7 +26,7 @@ fun SearchColumn(
|
|||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.background(MaterialTheme.colors.background)
|
.background(MaterialTheme.colorScheme.background)
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.statusBarsPadding()
|
.statusBarsPadding()
|
||||||
.navigationBarsWithImePadding()
|
.navigationBarsWithImePadding()
|
||||||
@ -39,7 +39,7 @@ fun SearchColumn(
|
|||||||
val wikipedia = wikipediaResult()
|
val wikipedia = wikipediaResult()
|
||||||
|
|
||||||
|
|
||||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colors.onSurface) {
|
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
contentPadding = PaddingValues(8.dp),
|
contentPadding = PaddingValues(8.dp),
|
||||||
state = listState
|
state = listState
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import androidx.compose.material.LocalTextStyle
|
import androidx.compose.material3.LocalTextStyle
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|||||||
@ -2,7 +2,9 @@ package de.mm20.launcher2.ui.component
|
|||||||
|
|
||||||
import androidx.compose.animation.animateContentSize
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.DropdownMenu
|
||||||
|
import androidx.compose.material.DropdownMenuItem
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.*
|
import androidx.compose.material.icons.rounded.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
@ -103,7 +105,7 @@ fun ColumnScope.OverflowMenuItems(items: List<ToolbarAction>, onDismiss: () -> U
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
action.label, modifier = Modifier.weight(1f),
|
action.label, modifier = Modifier.weight(1f),
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
Icon(imageVector = Icons.Rounded.ArrowRight, contentDescription = null)
|
Icon(imageVector = Icons.Rounded.ArrowRight, contentDescription = null)
|
||||||
}
|
}
|
||||||
@ -114,7 +116,7 @@ fun ColumnScope.OverflowMenuItems(items: List<ToolbarAction>, onDismiss: () -> U
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
action.label,
|
action.label,
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +127,7 @@ fun ColumnScope.OverflowMenuItems(items: List<ToolbarAction>, onDismiss: () -> U
|
|||||||
}) {
|
}) {
|
||||||
Text(
|
Text(
|
||||||
action.label,
|
action.label,
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import androidx.compose.foundation.ScrollState
|
|||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||||
@ -48,7 +48,7 @@ fun WidgetColumn(
|
|||||||
widgets = viewModel.getWidgets()
|
widgets = viewModel.getWidgets()
|
||||||
}
|
}
|
||||||
|
|
||||||
val isLightTheme = MaterialTheme.colors.isLight
|
val isLightTheme = androidx.compose.material.MaterialTheme.colors.isLight
|
||||||
|
|
||||||
val windowHeight = LocalWindowSize.current.height
|
val windowHeight = LocalWindowSize.current.height
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ fun WidgetColumn(
|
|||||||
.background(
|
.background(
|
||||||
Brush.verticalGradient(
|
Brush.verticalGradient(
|
||||||
background to Color.Transparent,
|
background to Color.Transparent,
|
||||||
background to MaterialTheme.colors.background
|
background to MaterialTheme.colorScheme.background
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -94,7 +94,7 @@ fun WidgetColumn(
|
|||||||
icon = {
|
icon = {
|
||||||
Icon(painter = icon.painterFor(atEnd = editMode), contentDescription = null)
|
Icon(painter = icon.painterFor(atEnd = editMode), contentDescription = null)
|
||||||
},
|
},
|
||||||
backgroundColor = MaterialTheme.colors.surface,
|
containerColor = MaterialTheme.colorScheme.tertiaryContainer,
|
||||||
onClick = {
|
onClick = {
|
||||||
editMode = !editMode
|
editMode = !editMode
|
||||||
})
|
})
|
||||||
|
|||||||
@ -5,7 +5,8 @@ import androidx.compose.foundation.layout.*
|
|||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.Card
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
@ -53,7 +54,7 @@ fun ColorPreference(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
style = MaterialTheme.typography.h6,
|
style = MaterialTheme.typography.headlineMedium,
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
start = 24.dp, end = 24.dp, top = 16.dp, bottom = 8.dp
|
start = 24.dp, end = 24.dp, top = 16.dp, bottom = 8.dp
|
||||||
)
|
)
|
||||||
@ -86,7 +87,6 @@ fun ColorPreference(
|
|||||||
fun ColorPreview(color: Color) {
|
fun ColorPreview(color: Color) {
|
||||||
Surface(
|
Surface(
|
||||||
modifier = Modifier.size(32.dp),
|
modifier = Modifier.size(32.dp),
|
||||||
elevation = 0.dp,
|
|
||||||
shape = RoundedCornerShape(16.dp),
|
shape = RoundedCornerShape(16.dp),
|
||||||
color = color
|
color = color
|
||||||
) {}
|
) {}
|
||||||
|
|||||||
@ -4,7 +4,9 @@ import androidx.compose.foundation.clickable
|
|||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.Card
|
||||||
|
import androidx.compose.material.RadioButton
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -45,7 +47,7 @@ fun <T> ListPreference(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
style = MaterialTheme.typography.h6,
|
style = MaterialTheme.typography.headlineMedium,
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
start = 24.dp, end = 24.dp, top = 16.dp, bottom = 8.dp
|
start = 24.dp, end = 24.dp, top = 16.dp, bottom = 8.dp
|
||||||
)
|
)
|
||||||
|
|||||||
@ -2,7 +2,9 @@ package de.mm20.launcher2.ui.component.preferences
|
|||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.ContentAlpha
|
||||||
|
import androidx.compose.material.LocalContentAlpha
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
@ -39,18 +41,18 @@ fun Preference(
|
|||||||
modifier = Modifier.padding(start = 4.dp),
|
modifier = Modifier.padding(start = 4.dp),
|
||||||
imageVector = icon,
|
imageVector = icon,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.primary,
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
) {
|
) {
|
||||||
Text(text = title, style = MaterialTheme.typography.subtitle2)
|
Text(text = title, style = MaterialTheme.typography.titleMedium)
|
||||||
if (summary != null) {
|
if (summary != null) {
|
||||||
Text(
|
Text(
|
||||||
text = summary,
|
text = summary,
|
||||||
style = MaterialTheme.typography.body1,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
modifier = Modifier.padding(top = 1.dp)
|
modifier = Modifier.padding(top = 1.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
package de.mm20.launcher2.ui.component.preferences
|
package de.mm20.launcher2.ui.component.preferences
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@ -15,7 +15,8 @@ fun PreferenceCategory(
|
|||||||
content: @Composable ColumnScope.() -> Unit
|
content: @Composable ColumnScope.() -> Unit
|
||||||
) {
|
) {
|
||||||
Surface(
|
Surface(
|
||||||
elevation = 2.dp,
|
shadowElevation = 2.dp,
|
||||||
|
tonalElevation = 2.dp,
|
||||||
modifier = Modifier.padding(bottom = 4.dp).fillMaxWidth()
|
modifier = Modifier.padding(bottom = 4.dp).fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Column {
|
Column {
|
||||||
@ -27,8 +28,8 @@ fun PreferenceCategory(
|
|||||||
Text(
|
Text(
|
||||||
modifier = Modifier.padding(start = 56.dp),
|
modifier = Modifier.padding(start = 56.dp),
|
||||||
text = title,
|
text = title,
|
||||||
style = MaterialTheme.typography.subtitle2,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
color = MaterialTheme.colors.primary
|
color = MaterialTheme.colorScheme.primary
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,9 +5,9 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.material.*
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.ArrowBack
|
import androidx.compose.material.icons.rounded.ArrowBack
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
@ -15,24 +15,23 @@ import com.google.accompanist.insets.systemBarsPadding
|
|||||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||||
import de.mm20.launcher2.ui.locals.LocalNavController
|
import de.mm20.launcher2.ui.locals.LocalNavController
|
||||||
|
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun PreferenceScreen(
|
fun PreferenceScreen(
|
||||||
title: String,
|
title: String,
|
||||||
scaffoldState: ScaffoldState = rememberScaffoldState(),
|
|
||||||
content: LazyListScope.() -> Unit
|
content: LazyListScope.() -> Unit
|
||||||
) {
|
) {
|
||||||
val navController = LocalNavController.current
|
val navController = LocalNavController.current
|
||||||
val systemUiController = rememberSystemUiController()
|
val systemUiController = rememberSystemUiController()
|
||||||
systemUiController.setStatusBarColor(MaterialTheme.colors.surface)
|
systemUiController.setStatusBarColor(MaterialTheme.colorScheme.surface)
|
||||||
systemUiController.setNavigationBarColor(Color.Black)
|
systemUiController.setNavigationBarColor(Color.Black)
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.systemBarsPadding()
|
modifier = Modifier.systemBarsPadding()
|
||||||
) {
|
) {
|
||||||
Scaffold(
|
Scaffold(
|
||||||
scaffoldState = scaffoldState,
|
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
SmallTopAppBar(
|
||||||
backgroundColor = MaterialTheme.colors.surface,
|
|
||||||
title = {
|
title = {
|
||||||
Text(title)
|
Text(title)
|
||||||
},
|
},
|
||||||
@ -42,14 +41,14 @@ fun PreferenceScreen(
|
|||||||
}) {
|
}) {
|
||||||
Icon(imageVector = Icons.Rounded.ArrowBack, contentDescription = "Back")
|
Icon(imageVector = Icons.Rounded.ArrowBack, contentDescription = "Back")
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}) {
|
}) {
|
||||||
LazyColumn(
|
LazyColumn(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.padding(it),
|
.padding(it),
|
||||||
content = content
|
content = content,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package de.mm20.launcher2.ui.component.preferences
|
package de.mm20.launcher2.ui.component.preferences
|
||||||
|
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Switch
|
import androidx.compose.material.Switch
|
||||||
import androidx.compose.material.SwitchDefaults
|
import androidx.compose.material.SwitchDefaults
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -25,7 +25,7 @@ fun SwitchPreference(
|
|||||||
},
|
},
|
||||||
controls = {
|
controls = {
|
||||||
Switch(checked = value, onCheckedChange = onValueChanged, colors = SwitchDefaults.colors(
|
Switch(checked = value, onCheckedChange = onValueChanged, colors = SwitchDefaults.colors(
|
||||||
uncheckedThumbColor = MaterialTheme.colors.onSurface
|
uncheckedThumbColor = MaterialTheme.colorScheme.onSurface
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -1,11 +1,12 @@
|
|||||||
package de.mm20.launcher2.ui.icons
|
package de.mm20.launcher2.ui.icons
|
||||||
|
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.*
|
import androidx.compose.material.icons.rounded.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.vector.ImageVector
|
import androidx.compose.ui.graphics.vector.ImageVector
|
||||||
|
import androidx.compose.ui.res.colorResource
|
||||||
import de.mm20.launcher2.search.data.Application
|
import de.mm20.launcher2.search.data.Application
|
||||||
import de.mm20.launcher2.search.data.File
|
import de.mm20.launcher2.search.data.File
|
||||||
import de.mm20.launcher2.search.data.Searchable
|
import de.mm20.launcher2.search.data.Searchable
|
||||||
@ -31,7 +32,7 @@ fun Searchable.getPlaceholderIcon(): PlaceholderIcon {
|
|||||||
@Composable
|
@Composable
|
||||||
fun Application.getPlaceholderIcon(): PlaceholderIcon {
|
fun Application.getPlaceholderIcon(): PlaceholderIcon {
|
||||||
return PlaceholderIcon(
|
return PlaceholderIcon(
|
||||||
MaterialTheme.colors.androidGreen,
|
colorResource(id = R.color.android_green),
|
||||||
Icons.Rounded.Android
|
Icons.Rounded.Android
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -40,19 +41,19 @@ fun Application.getPlaceholderIcon(): PlaceholderIcon {
|
|||||||
fun File.getPlaceholderIcon(): PlaceholderIcon {
|
fun File.getPlaceholderIcon(): PlaceholderIcon {
|
||||||
return when {
|
return when {
|
||||||
isDirectory -> PlaceholderIcon(
|
isDirectory -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.lightBlue,
|
colorResource(id = R.color.lightblue),
|
||||||
Icons.Rounded.Folder
|
Icons.Rounded.Folder
|
||||||
)
|
)
|
||||||
mimeType.startsWith("image/") -> PlaceholderIcon(
|
mimeType.startsWith("image/") -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.teal,
|
colorResource(id = R.color.teal),
|
||||||
Icons.Rounded.Image
|
Icons.Rounded.Image
|
||||||
)
|
)
|
||||||
mimeType.startsWith("audio/") -> PlaceholderIcon(
|
mimeType.startsWith("audio/") -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.orange,
|
colorResource(id = R.color.orange),
|
||||||
Icons.Rounded.Audiotrack
|
Icons.Rounded.Audiotrack
|
||||||
)
|
)
|
||||||
mimeType.startsWith("video/") -> PlaceholderIcon(
|
mimeType.startsWith("video/") -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.purple,
|
colorResource(id = R.color.purple),
|
||||||
Icons.Rounded.Movie
|
Icons.Rounded.Movie
|
||||||
)
|
)
|
||||||
/*
|
/*
|
||||||
@ -66,7 +67,7 @@ fun File.getPlaceholderIcon(): PlaceholderIcon {
|
|||||||
}*/
|
}*/
|
||||||
else -> when (mimeType) {
|
else -> when (mimeType) {
|
||||||
"application/pdf" -> PlaceholderIcon(
|
"application/pdf" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.red,
|
colorResource(id = R.color.red),
|
||||||
Icons.Rounded.Pdf
|
Icons.Rounded.Pdf
|
||||||
)
|
)
|
||||||
"application/zip",
|
"application/zip",
|
||||||
@ -78,7 +79,7 @@ fun File.getPlaceholderIcon(): PlaceholderIcon {
|
|||||||
"application/x-zip-compressed",
|
"application/x-zip-compressed",
|
||||||
"application/x-gzip",
|
"application/x-gzip",
|
||||||
"application/x-bzip2" -> PlaceholderIcon(
|
"application/x-bzip2" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.brown,
|
colorResource(id = R.color.brown),
|
||||||
Icons.Rounded.Archive
|
Icons.Rounded.Archive
|
||||||
)
|
)
|
||||||
"application/vnd.oasis.opendocument.text",
|
"application/vnd.oasis.opendocument.text",
|
||||||
@ -88,7 +89,7 @@ fun File.getPlaceholderIcon(): PlaceholderIcon {
|
|||||||
"application/x-iwork-pages-sffpages",
|
"application/x-iwork-pages-sffpages",
|
||||||
"application/vnd.apple.pages",
|
"application/vnd.apple.pages",
|
||||||
"application/vnd.google-apps.document" -> PlaceholderIcon(
|
"application/vnd.google-apps.document" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.blue,
|
colorResource(id = R.color.blue),
|
||||||
Icons.Rounded.Notes
|
Icons.Rounded.Notes
|
||||||
)
|
)
|
||||||
"application/vnd.oasis.opendocument.spreadsheet",
|
"application/vnd.oasis.opendocument.spreadsheet",
|
||||||
@ -97,7 +98,7 @@ fun File.getPlaceholderIcon(): PlaceholderIcon {
|
|||||||
"application/x-iwork-numbers-sffnumbers",
|
"application/x-iwork-numbers-sffnumbers",
|
||||||
"application/vnd.apple.numbers",
|
"application/vnd.apple.numbers",
|
||||||
"application/vnd.google-apps.spreadsheet" -> PlaceholderIcon(
|
"application/vnd.google-apps.spreadsheet" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.lightGreen,
|
colorResource(id = R.color.lightgreen),
|
||||||
Icons.Rounded.BorderAll
|
Icons.Rounded.BorderAll
|
||||||
)
|
)
|
||||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
||||||
@ -105,11 +106,11 @@ fun File.getPlaceholderIcon(): PlaceholderIcon {
|
|||||||
"application/x-iwork-keynote-sffkey",
|
"application/x-iwork-keynote-sffkey",
|
||||||
"application/vnd.apple.keynote",
|
"application/vnd.apple.keynote",
|
||||||
"application/vnd.google-apps.presentation" -> PlaceholderIcon(
|
"application/vnd.google-apps.presentation" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.amber,
|
colorResource(id = R.color.amber),
|
||||||
Icons.Rounded.Slideshow
|
Icons.Rounded.Slideshow
|
||||||
)
|
)
|
||||||
"application/vnd.android.package-archive" -> PlaceholderIcon(
|
"application/vnd.android.package-archive" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.androidGreen,
|
colorResource(id = R.color.android_green),
|
||||||
Icons.Rounded.Android
|
Icons.Rounded.Android
|
||||||
)
|
)
|
||||||
"text/x-asm",
|
"text/x-asm",
|
||||||
@ -120,24 +121,24 @@ fun File.getPlaceholderIcon(): PlaceholderIcon {
|
|||||||
"text/x-script.perl",
|
"text/x-script.perl",
|
||||||
"text/javascript",
|
"text/javascript",
|
||||||
"application/json" -> PlaceholderIcon(
|
"application/json" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.pink,
|
colorResource(id = R.color.pink),
|
||||||
Icons.Rounded.Code
|
Icons.Rounded.Code
|
||||||
)
|
)
|
||||||
"text/xml",
|
"text/xml",
|
||||||
"text/html" -> PlaceholderIcon(
|
"text/html" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.deepOrange,
|
colorResource(id = R.color.deeporange),
|
||||||
Icons.Rounded.Code
|
Icons.Rounded.Code
|
||||||
)
|
)
|
||||||
"application/vnd.google-apps.form" -> PlaceholderIcon(
|
"application/vnd.google-apps.form" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.deepPurple,
|
colorResource(id = R.color.deeppurple),
|
||||||
Icons.Rounded.ViewList
|
Icons.Rounded.ViewList
|
||||||
)
|
)
|
||||||
"application/epub+zip" -> PlaceholderIcon(
|
"application/epub+zip" -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.blue,
|
colorResource(id = R.color.blue),
|
||||||
Icons.Rounded.Book
|
Icons.Rounded.Book
|
||||||
)
|
)
|
||||||
else -> PlaceholderIcon(
|
else -> PlaceholderIcon(
|
||||||
MaterialTheme.colors.blueGray,
|
colorResource(id = R.color.bluegrey),
|
||||||
Icons.Rounded.InsertDriveFile
|
Icons.Rounded.InsertDriveFile
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -272,7 +272,10 @@ class ApplicationDetailRepresentation : Representation, KoinComponent {
|
|||||||
|
|
||||||
val viewModel : FavoritesViewModel by (context as AppCompatActivity).viewModel()
|
val viewModel : FavoritesViewModel by (context as AppCompatActivity).viewModel()
|
||||||
|
|
||||||
|
var count = 0
|
||||||
for (si in shortcuts) {
|
for (si in shortcuts) {
|
||||||
|
if (count > 4) break
|
||||||
|
count++
|
||||||
val view = Chip(context)
|
val view = Chip(context)
|
||||||
view.text = si.label
|
view.text = si.label
|
||||||
|
|
||||||
@ -282,6 +285,8 @@ class ApplicationDetailRepresentation : Representation, KoinComponent {
|
|||||||
context.resources.displayMetrics.densityDpi
|
context.resources.displayMetrics.densityDpi
|
||||||
)
|
)
|
||||||
|
|
||||||
|
view.chipIconTint = null
|
||||||
|
|
||||||
view.chipStrokeWidth = 1 * context.dp
|
view.chipStrokeWidth = 1 * context.dp
|
||||||
view.chipStrokeColor =
|
view.chipStrokeColor =
|
||||||
ContextCompat.getColorStateList(context, R.color.chip_stroke)
|
ContextCompat.getColorStateList(context, R.color.chip_stroke)
|
||||||
|
|||||||
@ -5,7 +5,6 @@ import android.content.res.ColorStateList
|
|||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import com.google.android.material.card.MaterialCardView
|
import com.google.android.material.card.MaterialCardView
|
||||||
import de.mm20.launcher2.ktx.dp
|
import de.mm20.launcher2.ktx.dp
|
||||||
import de.mm20.launcher2.preferences.CardBackground
|
|
||||||
import de.mm20.launcher2.preferences.LauncherPreferences
|
import de.mm20.launcher2.preferences.LauncherPreferences
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
@ -41,12 +40,12 @@ open class LauncherCardView @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val cardColor = when (LauncherPreferences.instance.cardBackground) {
|
/*val cardColor = when (LauncherPreferences.instance.cardBackground) {
|
||||||
CardBackground.DEFAULT-> context.getColor(R.color.cardview_background)
|
CardBackground.DEFAULT-> context.getColor(R.color.cardview_background)
|
||||||
CardBackground.BLACK -> context.getColor(R.color.cardview_background_black)
|
CardBackground.BLACK -> context.getColor(R.color.cardview_background_black)
|
||||||
}
|
}
|
||||||
setCardBackgroundColor(cardColor)
|
setCardBackgroundColor(cardColor)*/
|
||||||
strokeColor = cardColor
|
strokeColor = cardBackgroundColor.defaultColor
|
||||||
strokeWidth = (LauncherPreferences.instance.cardStrokeWidth * dp).roundToInt()
|
strokeWidth = (LauncherPreferences.instance.cardStrokeWidth * dp).roundToInt()
|
||||||
radius = LauncherPreferences.instance.cardRadius * dp
|
radius = LauncherPreferences.instance.cardRadius * dp
|
||||||
|
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import android.view.View
|
|||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.material.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.platform.ComposeView
|
import androidx.compose.ui.platform.ComposeView
|
||||||
import androidx.core.app.NotificationManagerCompat
|
import androidx.core.app.NotificationManagerCompat
|
||||||
@ -59,7 +59,7 @@ class MusicWidget : LauncherWidget {
|
|||||||
composeView.setContent {
|
composeView.setContent {
|
||||||
LegacyLauncherTheme {
|
LegacyLauncherTheme {
|
||||||
// TODO: Temporary solution until parent widget card is rewritten in Compose
|
// TODO: Temporary solution until parent widget card is rewritten in Compose
|
||||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colors.onSurface) {
|
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) {
|
||||||
Column {
|
Column {
|
||||||
MusicWidget()
|
MusicWidget()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import android.util.AttributeSet
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.material.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.platform.ComposeView
|
import androidx.compose.ui.platform.ComposeView
|
||||||
import de.mm20.launcher2.ui.LegacyLauncherTheme
|
import de.mm20.launcher2.ui.LegacyLauncherTheme
|
||||||
@ -44,7 +44,7 @@ class WeatherWidget : LauncherWidget {
|
|||||||
composeView.setContent {
|
composeView.setContent {
|
||||||
LegacyLauncherTheme {
|
LegacyLauncherTheme {
|
||||||
// TODO: Temporary solution until parent widget card is rewritten in Compose
|
// TODO: Temporary solution until parent widget card is rewritten in Compose
|
||||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colors.onSurface) {
|
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) {
|
||||||
Column {
|
Column {
|
||||||
WeatherWidget()
|
WeatherWidget()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import androidx.compose.runtime.compositionLocalOf
|
|||||||
import androidx.compose.ui.geometry.Size
|
import androidx.compose.ui.geometry.Size
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
import de.mm20.launcher2.ui.theme.WallpaperColors
|
import de.mm20.launcher2.ui.theme.WallpaperColors
|
||||||
import de.mm20.launcher2.ui.theme.colors.ColorScheme
|
import de.mm20.launcher2.ui.theme.colors.ColorPalette
|
||||||
import de.mm20.launcher2.ui.theme.colors.DefaultColorScheme
|
import de.mm20.launcher2.ui.theme.colors.DefaultColorPalette
|
||||||
|
|
||||||
val LocalWindowSize = compositionLocalOf { Size(0f, 0f) }
|
val LocalWindowSize = compositionLocalOf { Size(0f, 0f) }
|
||||||
|
|
||||||
@ -14,6 +14,6 @@ val LocalAppWidgetHost = compositionLocalOf<AppWidgetHost?>(defaultFactory = { n
|
|||||||
|
|
||||||
val LocalWallpaperColors = compositionLocalOf<WallpaperColors?> { null }
|
val LocalWallpaperColors = compositionLocalOf<WallpaperColors?> { null }
|
||||||
|
|
||||||
val LocalColorScheme = compositionLocalOf<ColorScheme> { DefaultColorScheme() }
|
val LocalColorScheme = compositionLocalOf<ColorPalette> { DefaultColorPalette() }
|
||||||
|
|
||||||
val LocalNavController = compositionLocalOf<NavController?> { null }
|
val LocalNavController = compositionLocalOf<NavController?> { null }
|
||||||
@ -7,8 +7,7 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.material.ExperimentalMaterialApi
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
@ -31,7 +30,6 @@ import kotlinx.coroutines.flow.combine
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
||||||
@OptIn(
|
@OptIn(
|
||||||
ExperimentalMaterialApi::class,
|
|
||||||
ExperimentalAnimationApi::class,
|
ExperimentalAnimationApi::class,
|
||||||
ExperimentalPagerApi::class,
|
ExperimentalPagerApi::class,
|
||||||
InternalCoroutinesApi::class
|
InternalCoroutinesApi::class
|
||||||
@ -45,7 +43,7 @@ fun LauncherMainScreen() {
|
|||||||
val searchColumnState = rememberLazyListState()
|
val searchColumnState = rememberLazyListState()
|
||||||
val widgetColumnState = rememberScrollState()
|
val widgetColumnState = rememberScrollState()
|
||||||
|
|
||||||
val isLightTheme = MaterialTheme.colors.isLight
|
val isLightTheme = androidx.compose.material.MaterialTheme.colors.isLight
|
||||||
|
|
||||||
val windowHeight = LocalWindowSize.current.height
|
val windowHeight = LocalWindowSize.current.height
|
||||||
|
|
||||||
|
|||||||
@ -2,11 +2,9 @@ package de.mm20.launcher2.ui.screens.settings
|
|||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.compose.material.SnackbarDuration
|
|
||||||
import androidx.compose.material.SnackbarResult
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.Info
|
import androidx.compose.material.icons.rounded.Info
|
||||||
import androidx.compose.material.rememberScaffoldState
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
@ -27,15 +25,14 @@ import de.mm20.launcher2.ui.locals.LocalNavController
|
|||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsAboutScreen() {
|
fun SettingsAboutScreen() {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val navController = LocalNavController.current
|
val navController = LocalNavController.current
|
||||||
val scaffoldState = rememberScaffoldState()
|
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
PreferenceScreen(
|
PreferenceScreen(
|
||||||
title = stringResource(id = R.string.preference_screen_about),
|
title = stringResource(id = R.string.preference_screen_about),
|
||||||
scaffoldState = scaffoldState
|
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
PreferenceCategory {
|
PreferenceCategory {
|
||||||
@ -109,7 +106,7 @@ fun SettingsAboutScreen() {
|
|||||||
onClick = {
|
onClick = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
val path = DebugInformationDumper().dump(context)
|
val path = DebugInformationDumper().dump(context)
|
||||||
val result = scaffoldState.snackbarHostState.showSnackbar(
|
/*val result = scaffoldState.snackbarHostState.showSnackbar(
|
||||||
context.getString(R.string.debug_export_information_file, path),
|
context.getString(R.string.debug_export_information_file, path),
|
||||||
actionLabel = context.getString(R.string.menu_share),
|
actionLabel = context.getString(R.string.menu_share),
|
||||||
duration = SnackbarDuration.Long
|
duration = SnackbarDuration.Long
|
||||||
@ -125,7 +122,7 @@ fun SettingsAboutScreen() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@ -134,7 +131,7 @@ fun SettingsAboutScreen() {
|
|||||||
onClick = {
|
onClick = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
val path = DebugInformationDumper().exportDatabases(context)
|
val path = DebugInformationDumper().exportDatabases(context)
|
||||||
val result = scaffoldState.snackbarHostState.showSnackbar(
|
/*val result = scaffoldState.snackbarHostState.showSnackbar(
|
||||||
context.getString(R.string.debug_export_information_file, path),
|
context.getString(R.string.debug_export_information_file, path),
|
||||||
actionLabel = context.getString(R.string.menu_share),
|
actionLabel = context.getString(R.string.menu_share),
|
||||||
duration = SnackbarDuration.Long
|
duration = SnackbarDuration.Long
|
||||||
@ -150,7 +147,7 @@ fun SettingsAboutScreen() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,7 +3,7 @@ package de.mm20.launcher2.ui.screens.settings
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.RadioButtonChecked
|
import androidx.compose.material.icons.rounded.RadioButtonChecked
|
||||||
import androidx.compose.material.icons.rounded.RadioButtonUnchecked
|
import androidx.compose.material.icons.rounded.RadioButtonUnchecked
|
||||||
@ -43,17 +43,17 @@ fun SettingsColorsScreen() {
|
|||||||
val schemes = mutableListOf(
|
val schemes = mutableListOf(
|
||||||
ColorSchemeItem(
|
ColorSchemeItem(
|
||||||
ColorSchemeOption.Default,
|
ColorSchemeOption.Default,
|
||||||
DefaultColorScheme(),
|
DefaultColorPalette(),
|
||||||
stringResource(id = R.string.preference_colors_default)
|
stringResource(id = R.string.preference_colors_default)
|
||||||
),
|
),
|
||||||
ColorSchemeItem(
|
ColorSchemeItem(
|
||||||
ColorSchemeOption.MM20,
|
ColorSchemeOption.MM20,
|
||||||
MM20ColorScheme(),
|
MM20ColorPalette(),
|
||||||
stringResource(id = R.string.preference_colors_mm20)
|
stringResource(id = R.string.preference_colors_mm20)
|
||||||
),
|
),
|
||||||
ColorSchemeItem(
|
ColorSchemeItem(
|
||||||
ColorSchemeOption.BlackAndWhite,
|
ColorSchemeOption.BlackAndWhite,
|
||||||
BlackWhiteColorScheme(),
|
BlackWhiteColorPalette(),
|
||||||
stringResource(id = R.string.preference_colors_bw)
|
stringResource(id = R.string.preference_colors_bw)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -61,7 +61,7 @@ fun SettingsColorsScreen() {
|
|||||||
schemes.add(
|
schemes.add(
|
||||||
ColorSchemeItem(
|
ColorSchemeItem(
|
||||||
ColorSchemeOption.MaterialYou,
|
ColorSchemeOption.MaterialYou,
|
||||||
SystemColorScheme(context),
|
SystemColorPalette(context),
|
||||||
stringResource(id = R.string.preference_colors_mdyou)
|
stringResource(id = R.string.preference_colors_mdyou)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -71,7 +71,7 @@ fun SettingsColorsScreen() {
|
|||||||
schemes.add(
|
schemes.add(
|
||||||
ColorSchemeItem(
|
ColorSchemeItem(
|
||||||
ColorSchemeOption.Wallpaper,
|
ColorSchemeOption.Wallpaper,
|
||||||
WallpaperColorScheme(wallpaperColors),
|
WallpaperColorPalette(wallpaperColors),
|
||||||
stringResource(id = R.string.preference_colors_wallpaper)
|
stringResource(id = R.string.preference_colors_wallpaper)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -79,7 +79,7 @@ fun SettingsColorsScreen() {
|
|||||||
schemes.add(
|
schemes.add(
|
||||||
ColorSchemeItem(
|
ColorSchemeItem(
|
||||||
ColorSchemeOption.Custom,
|
ColorSchemeOption.Custom,
|
||||||
CustomColorScheme(customColors),
|
CustomColorPalette(customColors),
|
||||||
stringResource(id = R.string.preference_colors_custom)
|
stringResource(id = R.string.preference_colors_custom)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -89,7 +89,7 @@ fun SettingsColorsScreen() {
|
|||||||
title = scheme.label,
|
title = scheme.label,
|
||||||
icon = if (colorScheme == scheme.value) Icons.Rounded.RadioButtonChecked else Icons.Rounded.RadioButtonUnchecked,
|
icon = if (colorScheme == scheme.value) Icons.Rounded.RadioButtonChecked else Icons.Rounded.RadioButtonUnchecked,
|
||||||
controls = {
|
controls = {
|
||||||
ColorSchemePreview(scheme.colorScheme)
|
ColorSchemePreview(scheme.colorPalette)
|
||||||
},
|
},
|
||||||
onClick = {
|
onClick = {
|
||||||
scope.launch {
|
scope.launch {
|
||||||
@ -196,13 +196,13 @@ fun SettingsColorsScreen() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ColorSchemePreview(colorScheme: ColorScheme) {
|
private fun ColorSchemePreview(colorPalette: ColorPalette) {
|
||||||
val isDark = !MaterialTheme.colors.isLight
|
val isDark = !androidx.compose.material.MaterialTheme.colors.isLight
|
||||||
val neutral1 = if (isDark) colorScheme.neutral1.shade800 else colorScheme.neutral1.shade100
|
val neutral1 = if (isDark) colorPalette.neutral.shade20 else colorPalette.neutral.shade90
|
||||||
val neutral2 = if (isDark) colorScheme.neutral2.shade800 else colorScheme.neutral2.shade100
|
val neutral2 = if (isDark) colorPalette.neutralVariant.shade20 else colorPalette.neutralVariant.shade90
|
||||||
val accent1 = if (isDark) colorScheme.accent1.shade300 else colorScheme.accent1.shade500
|
val accent1 = if (isDark) colorPalette.primary.shade70 else colorPalette.primary.shade50
|
||||||
val accent2 = if (isDark) colorScheme.accent2.shade300 else colorScheme.accent2.shade500
|
val accent2 = if (isDark) colorPalette.secondary.shade70 else colorPalette.secondary.shade50
|
||||||
val accent3 = if (isDark) colorScheme.accent3.shade300 else colorScheme.accent3.shade500
|
val accent3 = if (isDark) colorPalette.tertiary.shade70 else colorPalette.tertiary.shade50
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier.height(48.dp),
|
modifier = Modifier.height(48.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
@ -250,6 +250,6 @@ private fun ColorSchemePreview(colorScheme: ColorScheme) {
|
|||||||
|
|
||||||
private data class ColorSchemeItem(
|
private data class ColorSchemeItem(
|
||||||
val value: ColorSchemeOption,
|
val value: ColorSchemeOption,
|
||||||
val colorScheme: ColorScheme,
|
val colorPalette: ColorPalette,
|
||||||
val label: String,
|
val label: String,
|
||||||
)
|
)
|
||||||
@ -7,10 +7,10 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.OpenInBrowser
|
import androidx.compose.material.icons.rounded.OpenInBrowser
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -40,11 +40,11 @@ fun SettingsLicenseScreen(libraryName: String? = null) {
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier.padding(16.dp)
|
modifier = Modifier.padding(16.dp)
|
||||||
) {
|
) {
|
||||||
Text(text = library.name, style = MaterialTheme.typography.subtitle1)
|
Text(text = library.name, style = MaterialTheme.typography.titleMedium)
|
||||||
library.description?.let { Text(text = it) }
|
library.description?.let { Text(text = it) }
|
||||||
}
|
}
|
||||||
CompositionLocalProvider(
|
CompositionLocalProvider(
|
||||||
LocalContentColor provides MaterialTheme.colors.primary
|
LocalContentColor provides MaterialTheme.colorScheme.primary
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -61,7 +61,7 @@ fun SettingsLicenseScreen(libraryName: String? = null) {
|
|||||||
Text(
|
Text(
|
||||||
modifier = Modifier.padding(start = 8.dp),
|
modifier = Modifier.padding(start = 8.dp),
|
||||||
text = stringResource(id = R.string.open_webpage),
|
text = stringResource(id = R.string.open_webpage),
|
||||||
style = MaterialTheme.typography.button
|
style = MaterialTheme.typography.labelMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +74,7 @@ fun SettingsLicenseScreen(libraryName: String? = null) {
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = library.licenseName),
|
text = stringResource(id = library.licenseName),
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
library.copyrightNote?.let {
|
library.copyrightNote?.let {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@ -5,8 +5,8 @@ import androidx.compose.animation.core.Spring
|
|||||||
import androidx.compose.animation.core.animateDpAsState
|
import androidx.compose.animation.core.animateDpAsState
|
||||||
import androidx.compose.animation.core.spring
|
import androidx.compose.animation.core.spring
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.ArrowBack
|
import androidx.compose.material.icons.rounded.ArrowBack
|
||||||
import androidx.compose.material.icons.rounded.Delete
|
import androidx.compose.material.icons.rounded.Delete
|
||||||
@ -62,21 +62,21 @@ fun ApplicationItem(
|
|||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = app.label,
|
text = app.label,
|
||||||
style = MaterialTheme.typography.subtitle1,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
app.version?.let {
|
app.version?.let {
|
||||||
Text(
|
Text(
|
||||||
text = it,
|
text = it,
|
||||||
style = MaterialTheme.typography.body1,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
text = app.`package`,
|
text = app.`package`,
|
||||||
style = MaterialTheme.typography.body1,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import androidx.compose.animation.AnimatedVisibility
|
|||||||
import androidx.compose.animation.ExperimentalAnimationApi
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|||||||
@ -4,7 +4,10 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.Card
|
||||||
|
import androidx.compose.material.ContentAlpha
|
||||||
|
import androidx.compose.material.LocalContentAlpha
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
@ -39,7 +42,7 @@ fun calculatorItem(): LazyListScope.() -> Unit {
|
|||||||
}
|
}
|
||||||
Text(
|
Text(
|
||||||
text = "= ${it.formattedString}",
|
text = "= ${it.formattedString}",
|
||||||
style = MaterialTheme.typography.subtitle1,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
modifier = Modifier.align(Alignment.End),
|
modifier = Modifier.align(Alignment.End),
|
||||||
)
|
)
|
||||||
if (it.term.matches(Regex("(0x|0b)?[0-9]+"))) {
|
if (it.term.matches(Regex("(0x|0b)?[0-9]+"))) {
|
||||||
|
|||||||
@ -9,8 +9,8 @@ import androidx.compose.animation.core.spring
|
|||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.ArrowBack
|
import androidx.compose.material.icons.rounded.ArrowBack
|
||||||
import androidx.compose.material.icons.rounded.Delete
|
import androidx.compose.material.icons.rounded.Delete
|
||||||
@ -74,7 +74,7 @@ fun FileItem(
|
|||||||
Column {
|
Column {
|
||||||
Text(
|
Text(
|
||||||
text = file.label,
|
text = file.label,
|
||||||
style = MaterialTheme.typography.subtitle2,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
)
|
)
|
||||||
|
|||||||
@ -3,8 +3,8 @@ package de.mm20.launcher2.ui.search
|
|||||||
import androidx.compose.foundation.layout.ColumnScope
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -22,7 +22,7 @@ fun ColumnScope.GridItemLabel(
|
|||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis,
|
overflow = TextOverflow.Ellipsis,
|
||||||
textAlign = TextAlign.Center,
|
textAlign = TextAlign.Center,
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import androidx.compose.animation.ExperimentalAnimationApi
|
|||||||
import androidx.compose.animation.animateContentSize
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.animation.core.animateDpAsState
|
import androidx.compose.animation.core.animateDpAsState
|
||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.foundation.lazy.LazyListState
|
import androidx.compose.foundation.lazy.LazyListState
|
||||||
@ -94,11 +95,11 @@ fun LazyListScope.NotSoLazySearchableGrid(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalAnimationApi::class)
|
@OptIn(ExperimentalAnimationApi::class, ExperimentalFoundationApi::class)
|
||||||
fun LazyListScope.SearchableGrid(
|
fun LazyListScope.SearchableGrid(
|
||||||
items: List<Searchable>,
|
items: List<Searchable>,
|
||||||
columns: Int = 5,
|
columns: Int = 5,
|
||||||
listState: LazyListState
|
listState: LazyListState,
|
||||||
) {
|
) {
|
||||||
val rows = (items.size + columns - 1) / columns
|
val rows = (items.size + columns - 1) / columns
|
||||||
|
|
||||||
@ -109,6 +110,7 @@ fun LazyListScope.SearchableGrid(
|
|||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.requiredHeight(100.dp)
|
.requiredHeight(100.dp)
|
||||||
|
.animateItemPlacement()
|
||||||
.zIndex(
|
.zIndex(
|
||||||
animateFloatAsState(
|
animateFloatAsState(
|
||||||
if (focusedItem != -1 && rowIndex == focusedItem / columns) 100f else 0f
|
if (focusedItem != -1 && rowIndex == focusedItem / columns) 100f else 0f
|
||||||
@ -125,7 +127,8 @@ fun LazyListScope.SearchableGrid(
|
|||||||
hasFocus = itemIndex == focusedItem,
|
hasFocus = itemIndex == focusedItem,
|
||||||
requestFocus = {
|
requestFocus = {
|
||||||
focusedItem = if (it) itemIndex else -1
|
focusedItem = if (it) itemIndex else -1
|
||||||
})
|
}
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
Spacer(Modifier.weight(1f, fill = true))
|
Spacer(Modifier.weight(1f, fill = true))
|
||||||
}
|
}
|
||||||
@ -144,7 +147,8 @@ fun RowScope.GridItem(
|
|||||||
column: Int,
|
column: Int,
|
||||||
totalColumns: Int,
|
totalColumns: Int,
|
||||||
hasFocus: Boolean,
|
hasFocus: Boolean,
|
||||||
requestFocus: (Boolean) -> Unit
|
requestFocus: (Boolean) -> Unit,
|
||||||
|
modifier: Modifier = Modifier,
|
||||||
) {
|
) {
|
||||||
val insets = LocalWindowInsets.current.systemBars
|
val insets = LocalWindowInsets.current.systemBars
|
||||||
|
|
||||||
@ -178,7 +182,7 @@ fun RowScope.GridItem(
|
|||||||
val windowSize = LocalWindowSize.current
|
val windowSize = LocalWindowSize.current
|
||||||
|
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = modifier
|
||||||
.weight(1f, fill = true)
|
.weight(1f, fill = true)
|
||||||
.fillMaxHeight()
|
.fillMaxHeight()
|
||||||
.zIndex(z)
|
.zIndex(z)
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import androidx.compose.animation.core.updateTransition
|
|||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.Card
|
import androidx.compose.material.Card
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@ -73,7 +73,7 @@ fun SearchableItem(
|
|||||||
|
|
||||||
|
|
||||||
Card(
|
Card(
|
||||||
backgroundColor = MaterialTheme.colors.surface.copy(alpha = cardAlpha),
|
backgroundColor = MaterialTheme.colorScheme.surface.copy(alpha = cardAlpha),
|
||||||
elevation = cardElevation
|
elevation = cardElevation
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
package de.mm20.launcher2.ui.search
|
package de.mm20.launcher2.ui.search
|
||||||
|
|
||||||
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
|
import androidx.compose.foundation.lazy.LazyItemScope
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Modifier
|
||||||
import de.mm20.launcher2.search.data.Searchable
|
import de.mm20.launcher2.search.data.Searchable
|
||||||
import de.mm20.launcher2.ui.component.SectionDivider
|
import de.mm20.launcher2.ui.component.SectionDivider
|
||||||
|
|
||||||
@ -17,7 +20,8 @@ fun LazyListScope.SearchableList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun ListItem(item: Searchable) {
|
fun LazyItemScope.ListItem(item: Searchable) {
|
||||||
SearchableItem(item = item)
|
SearchableItem(item = item, modifier = Modifier.animateItemPlacement())
|
||||||
}
|
}
|
||||||
@ -5,8 +5,8 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.ContentAlpha
|
import androidx.compose.material.ContentAlpha
|
||||||
import androidx.compose.material.LocalContentAlpha
|
import androidx.compose.material.LocalContentAlpha
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.ArrowBack
|
import androidx.compose.material.icons.rounded.ArrowBack
|
||||||
import androidx.compose.material.icons.rounded.Share
|
import androidx.compose.material.icons.rounded.Share
|
||||||
@ -36,7 +36,7 @@ fun WikipediaItem(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = wikipedia.label,
|
text = wikipedia.label,
|
||||||
style = MaterialTheme.typography.subtitle1,
|
style = MaterialTheme.typography.titleLarge,
|
||||||
)
|
)
|
||||||
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
|
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@ -10,7 +10,8 @@ import androidx.compose.animation.core.animateFloatAsState
|
|||||||
import androidx.compose.foundation.BorderStroke
|
import androidx.compose.foundation.BorderStroke
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.Card
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.ArrowBack
|
import androidx.compose.material.icons.rounded.ArrowBack
|
||||||
import androidx.compose.material.icons.rounded.Star
|
import androidx.compose.material.icons.rounded.Star
|
||||||
@ -35,7 +36,7 @@ import de.mm20.launcher2.ui.search.Representation
|
|||||||
import de.mm20.launcher2.ui.toPixels
|
import de.mm20.launcher2.ui.toPixels
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterialApi::class, ExperimentalAnimationApi::class)
|
@OptIn(ExperimentalAnimationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
fun CalendarEventItem(
|
fun CalendarEventItem(
|
||||||
event: CalendarEvent,
|
event: CalendarEvent,
|
||||||
@ -56,7 +57,7 @@ fun CalendarEventItem(
|
|||||||
elevation = animateDpAsState(if (representation == Representation.Full) 4.dp else 0.dp).value,
|
elevation = animateDpAsState(if (representation == Representation.Full) 4.dp else 0.dp).value,
|
||||||
border = BorderStroke(
|
border = BorderStroke(
|
||||||
width = animateDpAsState(if (representation == Representation.List) 1.dp else 0.dp).value,
|
width = animateDpAsState(if (representation == Representation.List) 1.dp else 0.dp).value,
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = animateFloatAsState(if (representation == Representation.List) 0.18f else 0f).value)
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = animateFloatAsState(if (representation == Representation.List) 0.18f else 0f).value)
|
||||||
),
|
),
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
) {
|
) {
|
||||||
@ -80,14 +81,14 @@ fun CalendarEventItem(
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = event.label,
|
text = event.label,
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
representation == Representation.List
|
representation == Representation.List
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = formatEventTime(event = event),
|
text = formatEventTime(event = event),
|
||||||
style = MaterialTheme.typography.body1
|
style = MaterialTheme.typography.bodyMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,8 +2,8 @@ package de.mm20.launcher2.ui.theme.colors
|
|||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
class BlackWhiteColorScheme: ColorScheme() {
|
class BlackWhiteColorPalette: ColorPalette() {
|
||||||
override val neutral1: ColorSwatch
|
override val neutral: ColorSwatch
|
||||||
get() = ColorSwatch(
|
get() = ColorSwatch(
|
||||||
Color.White,
|
Color.White,
|
||||||
Color.White,
|
Color.White,
|
||||||
@ -19,12 +19,12 @@ class BlackWhiteColorScheme: ColorScheme() {
|
|||||||
Color.Black,
|
Color.Black,
|
||||||
Color.Black,
|
Color.Black,
|
||||||
)
|
)
|
||||||
override val neutral2: ColorSwatch
|
override val neutralVariant: ColorSwatch
|
||||||
get() = neutral1
|
get() = neutral
|
||||||
override val accent1: ColorSwatch
|
override val primary: ColorSwatch
|
||||||
get() = neutral1
|
get() = neutral
|
||||||
override val accent2: ColorSwatch
|
override val secondary: ColorSwatch
|
||||||
get() = neutral1
|
get() = neutral
|
||||||
override val accent3: ColorSwatch
|
override val tertiary: ColorSwatch
|
||||||
get() = neutral1
|
get() = neutral
|
||||||
}
|
}
|
||||||
@ -0,0 +1,66 @@
|
|||||||
|
package de.mm20.launcher2.ui.theme.colors
|
||||||
|
|
||||||
|
import androidx.compose.material3.ColorScheme
|
||||||
|
import androidx.compose.material3.darkColorScheme
|
||||||
|
import androidx.compose.material3.lightColorScheme
|
||||||
|
|
||||||
|
abstract class ColorPalette {
|
||||||
|
abstract val neutral: ColorSwatch
|
||||||
|
abstract val neutralVariant: ColorSwatch
|
||||||
|
|
||||||
|
abstract val primary: ColorSwatch
|
||||||
|
abstract val secondary: ColorSwatch
|
||||||
|
abstract val tertiary: ColorSwatch
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ColorPalette.toDarkColorScheme() : ColorScheme {
|
||||||
|
return darkColorScheme(
|
||||||
|
primary = primary.shade80,
|
||||||
|
onPrimary = primary.shade20,
|
||||||
|
primaryContainer = primary.shade30,
|
||||||
|
onPrimaryContainer = primary.shade90,
|
||||||
|
secondary = secondary.shade80,
|
||||||
|
onSecondary = secondary.shade20,
|
||||||
|
secondaryContainer = secondary.shade30,
|
||||||
|
onSecondaryContainer = secondary.shade90,
|
||||||
|
tertiary = tertiary.shade80,
|
||||||
|
onTertiary = tertiary.shade20,
|
||||||
|
tertiaryContainer = tertiary.shade30,
|
||||||
|
onTertiaryContainer = tertiary.shade90,
|
||||||
|
background = neutral.shade10,
|
||||||
|
onBackground = neutral.shade90,
|
||||||
|
surface = neutral.shade10,
|
||||||
|
onSurface = neutral.shade80,
|
||||||
|
surfaceVariant = neutralVariant.shade30,
|
||||||
|
onSurfaceVariant = neutralVariant.shade80,
|
||||||
|
outline = neutralVariant.shade60,
|
||||||
|
inverseOnSurface = neutralVariant.shade20,
|
||||||
|
inverseSurface = neutralVariant.shade90,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun ColorPalette.toLightColorScheme() : ColorScheme {
|
||||||
|
return lightColorScheme(
|
||||||
|
primary = primary.shade40,
|
||||||
|
onPrimary = primary.shade100,
|
||||||
|
primaryContainer = primary.shade90,
|
||||||
|
onPrimaryContainer = primary.shade10,
|
||||||
|
secondary = secondary.shade40,
|
||||||
|
onSecondary = secondary.shade100,
|
||||||
|
secondaryContainer = secondary.shade90,
|
||||||
|
onSecondaryContainer = secondary.shade10,
|
||||||
|
tertiary = tertiary.shade40,
|
||||||
|
onTertiary = tertiary.shade100,
|
||||||
|
tertiaryContainer = tertiary.shade90,
|
||||||
|
onTertiaryContainer = tertiary.shade10,
|
||||||
|
background = neutral.shade99,
|
||||||
|
onBackground = neutral.shade10,
|
||||||
|
surface = neutral.shade99,
|
||||||
|
onSurface = neutral.shade10,
|
||||||
|
surfaceVariant = neutralVariant.shade90,
|
||||||
|
onSurfaceVariant = neutralVariant.shade30,
|
||||||
|
outline = neutralVariant.shade50,
|
||||||
|
inverseOnSurface = neutralVariant.shade95,
|
||||||
|
inverseSurface = neutralVariant.shade20,
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1,12 +0,0 @@
|
|||||||
package de.mm20.launcher2.ui.theme.colors
|
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
|
|
||||||
abstract class ColorScheme {
|
|
||||||
abstract val neutral1: ColorSwatch
|
|
||||||
abstract val neutral2: ColorSwatch
|
|
||||||
|
|
||||||
abstract val accent1: ColorSwatch
|
|
||||||
abstract val accent2: ColorSwatch
|
|
||||||
abstract val accent3: ColorSwatch
|
|
||||||
}
|
|
||||||
@ -1,7 +1,6 @@
|
|||||||
package de.mm20.launcher2.ui.theme.colors
|
package de.mm20.launcher2.ui.theme.colors
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.compositeOver
|
|
||||||
import androidx.compose.ui.graphics.toArgb
|
import androidx.compose.ui.graphics.toArgb
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
import androidx.core.graphics.blue
|
import androidx.core.graphics.blue
|
||||||
@ -9,19 +8,19 @@ import androidx.core.graphics.green
|
|||||||
import androidx.core.graphics.red
|
import androidx.core.graphics.red
|
||||||
|
|
||||||
data class ColorSwatch(
|
data class ColorSwatch(
|
||||||
val shade0: Color,
|
|
||||||
val shade10: Color,
|
|
||||||
val shade50: Color,
|
|
||||||
val shade100: Color,
|
val shade100: Color,
|
||||||
val shade200: Color,
|
val shade99: Color,
|
||||||
val shade300: Color,
|
val shade95: Color,
|
||||||
val shade400: Color,
|
val shade90: Color,
|
||||||
val shade500: Color,
|
val shade80: Color,
|
||||||
val shade600: Color,
|
val shade70: Color,
|
||||||
val shade700: Color,
|
val shade60: Color,
|
||||||
val shade800: Color,
|
val shade50: Color,
|
||||||
val shade900: Color,
|
val shade40: Color,
|
||||||
val shade1000: Color,
|
val shade30: Color,
|
||||||
|
val shade20: Color,
|
||||||
|
val shade10: Color,
|
||||||
|
val shade0: Color,
|
||||||
)
|
)
|
||||||
|
|
||||||
fun colorSwatch(color: Color): ColorSwatch {
|
fun colorSwatch(color: Color): ColorSwatch {
|
||||||
@ -30,18 +29,18 @@ fun colorSwatch(color: Color): ColorSwatch {
|
|||||||
ColorUtils.RGBToHSL(rgb.red, rgb.green, rgb.blue, hsl)
|
ColorUtils.RGBToHSL(rgb.red, rgb.green, rgb.blue, hsl)
|
||||||
|
|
||||||
return ColorSwatch(
|
return ColorSwatch(
|
||||||
shade0 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 1f })),
|
shade100 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 1f })),
|
||||||
shade10 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.99f })),
|
shade99 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.99f })),
|
||||||
shade50 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.95f })),
|
shade95 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.95f })),
|
||||||
shade100 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.9f })),
|
shade90 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.9f })),
|
||||||
shade200 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.8f })),
|
shade80 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.8f })),
|
||||||
shade300 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.7f })),
|
shade70 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.7f })),
|
||||||
shade400 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.6f })),
|
shade60 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.6f })),
|
||||||
shade500 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.49f })),
|
shade50 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.49f })),
|
||||||
shade600 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.4f })),
|
shade40 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.4f })),
|
||||||
shade700 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.3f })),
|
shade30 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.3f })),
|
||||||
shade800 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.2f })),
|
shade20 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.2f })),
|
||||||
shade900 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.1f })),
|
shade10 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0.1f })),
|
||||||
shade1000 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0f })),
|
shade0 = Color(ColorUtils.HSLToColor(hsl.also { it[2] = 0f })),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -9,16 +9,16 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import de.mm20.launcher2.preferences.dataStore
|
import de.mm20.launcher2.preferences.dataStore
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
|
|
||||||
class CustomColorScheme(val colors: CustomColors) : ColorScheme() {
|
class CustomColorPalette(val colors: CustomColors) : ColorPalette() {
|
||||||
override val neutral1: ColorSwatch
|
override val neutral: ColorSwatch
|
||||||
get() = colorSwatch(colors.neutral1)
|
get() = colorSwatch(colors.neutral1)
|
||||||
override val neutral2: ColorSwatch
|
override val neutralVariant: ColorSwatch
|
||||||
get() = colorSwatch(colors.neutral2)
|
get() = colorSwatch(colors.neutral2)
|
||||||
override val accent1: ColorSwatch
|
override val primary: ColorSwatch
|
||||||
get() = colorSwatch(colors.accent1)
|
get() = colorSwatch(colors.accent1)
|
||||||
override val accent2: ColorSwatch
|
override val secondary: ColorSwatch
|
||||||
get() = colorSwatch(colors.accent2)
|
get() = colorSwatch(colors.accent2)
|
||||||
override val accent3: ColorSwatch
|
override val tertiary: ColorSwatch
|
||||||
get() = colorSwatch(colors.accent3)
|
get() = colorSwatch(colors.accent3)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package de.mm20.launcher2.ui.theme.colors
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
|
||||||
|
class DefaultColorPalette: ColorPalette() {
|
||||||
|
|
||||||
|
override val neutral = colorSwatch(Color.Black)
|
||||||
|
|
||||||
|
override val neutralVariant = neutral
|
||||||
|
|
||||||
|
override val primary = colorSwatch(Color(0xFF39A0ED))
|
||||||
|
|
||||||
|
override val secondary = colorSwatch(Color(0xFF4C6085))
|
||||||
|
|
||||||
|
override val tertiary = colorSwatch(Color(0xFFF59CA9))
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package de.mm20.launcher2.ui.theme.colors
|
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
|
|
||||||
|
|
||||||
class DefaultColorScheme: ColorScheme() {
|
|
||||||
|
|
||||||
override val neutral1 = colorSwatch(Color.Black)
|
|
||||||
|
|
||||||
override val neutral2 = neutral1
|
|
||||||
|
|
||||||
override val accent1 = colorSwatch(Color(0xFF39A0ED))
|
|
||||||
|
|
||||||
override val accent2 = colorSwatch(Color(0xFF4C6085))
|
|
||||||
|
|
||||||
override val accent3 = colorSwatch(Color(0xFFF59CA9))
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
package de.mm20.launcher2.ui.theme.colors
|
||||||
|
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
class MM20ColorPalette: ColorPalette() {
|
||||||
|
override val neutral = colorSwatch(Color(0xff233139))
|
||||||
|
override val neutralVariant = colorSwatch(Color(0xff233139))
|
||||||
|
override val primary = colorSwatch(Color(0xfface330))
|
||||||
|
override val secondary = colorSwatch(Color(0xff496777))
|
||||||
|
override val tertiary = colorSwatch(Color(0xfface330))
|
||||||
|
}
|
||||||
@ -1,11 +0,0 @@
|
|||||||
package de.mm20.launcher2.ui.theme.colors
|
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
|
|
||||||
class MM20ColorScheme: ColorScheme() {
|
|
||||||
override val neutral1 = colorSwatch(Color(0xff233139))
|
|
||||||
override val neutral2 = colorSwatch(Color(0xff233139))
|
|
||||||
override val accent1 = colorSwatch(Color(0xfface330))
|
|
||||||
override val accent2 = colorSwatch(Color(0xff496777))
|
|
||||||
override val accent3 = colorSwatch(Color(0xfface330))
|
|
||||||
}
|
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
package de.mm20.launcher2.ui.theme.colors
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.os.Build
|
||||||
|
import androidx.annotation.RequiresApi
|
||||||
|
import androidx.compose.ui.graphics.Color
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.S)
|
||||||
|
class SystemColorPalette(context: Context) : ColorPalette() {
|
||||||
|
override val neutral = ColorSwatch(
|
||||||
|
shade100 = Color(context.getColor(android.R.color.system_neutral1_0)),
|
||||||
|
shade99 = Color(context.getColor(android.R.color.system_neutral1_10)),
|
||||||
|
shade95 = Color(context.getColor(android.R.color.system_neutral1_50)),
|
||||||
|
shade90 = Color(context.getColor(android.R.color.system_neutral1_100)),
|
||||||
|
shade80 = Color(context.getColor(android.R.color.system_neutral1_200)),
|
||||||
|
shade70 = Color(context.getColor(android.R.color.system_neutral1_300)),
|
||||||
|
shade60 = Color(context.getColor(android.R.color.system_neutral1_400)),
|
||||||
|
shade50 = Color(context.getColor(android.R.color.system_neutral1_500)),
|
||||||
|
shade40 = Color(context.getColor(android.R.color.system_neutral1_600)),
|
||||||
|
shade30 = Color(context.getColor(android.R.color.system_neutral1_700)),
|
||||||
|
shade20 = Color(context.getColor(android.R.color.system_neutral1_800)),
|
||||||
|
shade10 = Color(context.getColor(android.R.color.system_neutral1_900)),
|
||||||
|
shade0 = Color(context.getColor(android.R.color.system_neutral1_1000)),
|
||||||
|
)
|
||||||
|
|
||||||
|
override val neutralVariant = ColorSwatch(
|
||||||
|
shade100 = Color(context.getColor(android.R.color.system_neutral2_0)),
|
||||||
|
shade99 = Color(context.getColor(android.R.color.system_neutral2_10)),
|
||||||
|
shade95 = Color(context.getColor(android.R.color.system_neutral2_50)),
|
||||||
|
shade90 = Color(context.getColor(android.R.color.system_neutral2_100)),
|
||||||
|
shade80 = Color(context.getColor(android.R.color.system_neutral2_200)),
|
||||||
|
shade70 = Color(context.getColor(android.R.color.system_neutral2_300)),
|
||||||
|
shade60 = Color(context.getColor(android.R.color.system_neutral2_400)),
|
||||||
|
shade50 = Color(context.getColor(android.R.color.system_neutral2_500)),
|
||||||
|
shade40 = Color(context.getColor(android.R.color.system_neutral2_600)),
|
||||||
|
shade30 = Color(context.getColor(android.R.color.system_neutral2_700)),
|
||||||
|
shade20 = Color(context.getColor(android.R.color.system_neutral2_800)),
|
||||||
|
shade10 = Color(context.getColor(android.R.color.system_neutral2_900)),
|
||||||
|
shade0 = Color(context.getColor(android.R.color.system_neutral2_1000)),
|
||||||
|
)
|
||||||
|
|
||||||
|
override val primary = ColorSwatch(
|
||||||
|
shade100 = Color(context.getColor(android.R.color.system_accent1_0)),
|
||||||
|
shade99 = Color(context.getColor(android.R.color.system_accent1_10)),
|
||||||
|
shade95 = Color(context.getColor(android.R.color.system_accent1_50)),
|
||||||
|
shade90 = Color(context.getColor(android.R.color.system_accent1_100)),
|
||||||
|
shade80 = Color(context.getColor(android.R.color.system_accent1_200)),
|
||||||
|
shade70 = Color(context.getColor(android.R.color.system_accent1_300)),
|
||||||
|
shade60 = Color(context.getColor(android.R.color.system_accent1_400)),
|
||||||
|
shade50 = Color(context.getColor(android.R.color.system_accent1_500)),
|
||||||
|
shade40 = Color(context.getColor(android.R.color.system_accent1_600)),
|
||||||
|
shade30 = Color(context.getColor(android.R.color.system_accent1_700)),
|
||||||
|
shade20 = Color(context.getColor(android.R.color.system_accent1_800)),
|
||||||
|
shade10 = Color(context.getColor(android.R.color.system_accent1_900)),
|
||||||
|
shade0 = Color(context.getColor(android.R.color.system_accent1_1000)),
|
||||||
|
)
|
||||||
|
|
||||||
|
override val secondary = ColorSwatch(
|
||||||
|
shade100 = Color(context.getColor(android.R.color.system_accent2_0)),
|
||||||
|
shade99 = Color(context.getColor(android.R.color.system_accent2_10)),
|
||||||
|
shade95 = Color(context.getColor(android.R.color.system_accent2_50)),
|
||||||
|
shade90 = Color(context.getColor(android.R.color.system_accent2_100)),
|
||||||
|
shade80 = Color(context.getColor(android.R.color.system_accent2_200)),
|
||||||
|
shade70 = Color(context.getColor(android.R.color.system_accent2_300)),
|
||||||
|
shade60 = Color(context.getColor(android.R.color.system_accent2_400)),
|
||||||
|
shade50 = Color(context.getColor(android.R.color.system_accent2_500)),
|
||||||
|
shade40 = Color(context.getColor(android.R.color.system_accent2_600)),
|
||||||
|
shade30 = Color(context.getColor(android.R.color.system_accent2_700)),
|
||||||
|
shade20 = Color(context.getColor(android.R.color.system_accent2_800)),
|
||||||
|
shade10 = Color(context.getColor(android.R.color.system_accent2_900)),
|
||||||
|
shade0 = Color(context.getColor(android.R.color.system_accent2_1000)),
|
||||||
|
)
|
||||||
|
|
||||||
|
override val tertiary = ColorSwatch(
|
||||||
|
shade100 = Color(context.getColor(android.R.color.system_accent3_0)),
|
||||||
|
shade99 = Color(context.getColor(android.R.color.system_accent3_10)),
|
||||||
|
shade95 = Color(context.getColor(android.R.color.system_accent3_50)),
|
||||||
|
shade90 = Color(context.getColor(android.R.color.system_accent3_100)),
|
||||||
|
shade80 = Color(context.getColor(android.R.color.system_accent3_200)),
|
||||||
|
shade70 = Color(context.getColor(android.R.color.system_accent3_300)),
|
||||||
|
shade60 = Color(context.getColor(android.R.color.system_accent3_400)),
|
||||||
|
shade50 = Color(context.getColor(android.R.color.system_accent3_500)),
|
||||||
|
shade40 = Color(context.getColor(android.R.color.system_accent3_600)),
|
||||||
|
shade30 = Color(context.getColor(android.R.color.system_accent3_700)),
|
||||||
|
shade20 = Color(context.getColor(android.R.color.system_accent3_800)),
|
||||||
|
shade10 = Color(context.getColor(android.R.color.system_accent3_900)),
|
||||||
|
shade0 = Color(context.getColor(android.R.color.system_accent3_1000)),
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1,89 +0,0 @@
|
|||||||
package de.mm20.launcher2.ui.theme.colors
|
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import android.os.Build
|
|
||||||
import androidx.annotation.RequiresApi
|
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
|
|
||||||
@RequiresApi(api = Build.VERSION_CODES.S)
|
|
||||||
class SystemColorScheme(context: Context) : ColorScheme() {
|
|
||||||
override val neutral1 = ColorSwatch(
|
|
||||||
shade0 = Color(context.getColor(android.R.color.system_neutral1_0)),
|
|
||||||
shade10 = Color(context.getColor(android.R.color.system_neutral1_10)),
|
|
||||||
shade50 = Color(context.getColor(android.R.color.system_neutral1_50)),
|
|
||||||
shade100 = Color(context.getColor(android.R.color.system_neutral1_100)),
|
|
||||||
shade200 = Color(context.getColor(android.R.color.system_neutral1_200)),
|
|
||||||
shade300 = Color(context.getColor(android.R.color.system_neutral1_300)),
|
|
||||||
shade400 = Color(context.getColor(android.R.color.system_neutral1_400)),
|
|
||||||
shade500 = Color(context.getColor(android.R.color.system_neutral1_500)),
|
|
||||||
shade600 = Color(context.getColor(android.R.color.system_neutral1_600)),
|
|
||||||
shade700 = Color(context.getColor(android.R.color.system_neutral1_700)),
|
|
||||||
shade800 = Color(context.getColor(android.R.color.system_neutral1_800)),
|
|
||||||
shade900 = Color(context.getColor(android.R.color.system_neutral1_900)),
|
|
||||||
shade1000 = Color(context.getColor(android.R.color.system_neutral1_1000)),
|
|
||||||
)
|
|
||||||
|
|
||||||
override val neutral2 = ColorSwatch(
|
|
||||||
shade0 = Color(context.getColor(android.R.color.system_neutral2_0)),
|
|
||||||
shade10 = Color(context.getColor(android.R.color.system_neutral2_10)),
|
|
||||||
shade50 = Color(context.getColor(android.R.color.system_neutral2_50)),
|
|
||||||
shade100 = Color(context.getColor(android.R.color.system_neutral2_100)),
|
|
||||||
shade200 = Color(context.getColor(android.R.color.system_neutral2_200)),
|
|
||||||
shade300 = Color(context.getColor(android.R.color.system_neutral2_300)),
|
|
||||||
shade400 = Color(context.getColor(android.R.color.system_neutral2_400)),
|
|
||||||
shade500 = Color(context.getColor(android.R.color.system_neutral2_500)),
|
|
||||||
shade600 = Color(context.getColor(android.R.color.system_neutral2_600)),
|
|
||||||
shade700 = Color(context.getColor(android.R.color.system_neutral2_700)),
|
|
||||||
shade800 = Color(context.getColor(android.R.color.system_neutral2_800)),
|
|
||||||
shade900 = Color(context.getColor(android.R.color.system_neutral2_900)),
|
|
||||||
shade1000 = Color(context.getColor(android.R.color.system_neutral2_1000)),
|
|
||||||
)
|
|
||||||
|
|
||||||
override val accent1 = ColorSwatch(
|
|
||||||
shade0 = Color(context.getColor(android.R.color.system_accent1_0)),
|
|
||||||
shade10 = Color(context.getColor(android.R.color.system_accent1_10)),
|
|
||||||
shade50 = Color(context.getColor(android.R.color.system_accent1_50)),
|
|
||||||
shade100 = Color(context.getColor(android.R.color.system_accent1_100)),
|
|
||||||
shade200 = Color(context.getColor(android.R.color.system_accent1_200)),
|
|
||||||
shade300 = Color(context.getColor(android.R.color.system_accent1_300)),
|
|
||||||
shade400 = Color(context.getColor(android.R.color.system_accent1_400)),
|
|
||||||
shade500 = Color(context.getColor(android.R.color.system_accent1_500)),
|
|
||||||
shade600 = Color(context.getColor(android.R.color.system_accent1_600)),
|
|
||||||
shade700 = Color(context.getColor(android.R.color.system_accent1_700)),
|
|
||||||
shade800 = Color(context.getColor(android.R.color.system_accent1_800)),
|
|
||||||
shade900 = Color(context.getColor(android.R.color.system_accent1_900)),
|
|
||||||
shade1000 = Color(context.getColor(android.R.color.system_accent1_1000)),
|
|
||||||
)
|
|
||||||
|
|
||||||
override val accent2 = ColorSwatch(
|
|
||||||
shade0 = Color(context.getColor(android.R.color.system_accent2_0)),
|
|
||||||
shade10 = Color(context.getColor(android.R.color.system_accent2_10)),
|
|
||||||
shade50 = Color(context.getColor(android.R.color.system_accent2_50)),
|
|
||||||
shade100 = Color(context.getColor(android.R.color.system_accent2_100)),
|
|
||||||
shade200 = Color(context.getColor(android.R.color.system_accent2_200)),
|
|
||||||
shade300 = Color(context.getColor(android.R.color.system_accent2_300)),
|
|
||||||
shade400 = Color(context.getColor(android.R.color.system_accent2_400)),
|
|
||||||
shade500 = Color(context.getColor(android.R.color.system_accent2_500)),
|
|
||||||
shade600 = Color(context.getColor(android.R.color.system_accent2_600)),
|
|
||||||
shade700 = Color(context.getColor(android.R.color.system_accent2_700)),
|
|
||||||
shade800 = Color(context.getColor(android.R.color.system_accent2_800)),
|
|
||||||
shade900 = Color(context.getColor(android.R.color.system_accent2_900)),
|
|
||||||
shade1000 = Color(context.getColor(android.R.color.system_accent2_1000)),
|
|
||||||
)
|
|
||||||
|
|
||||||
override val accent3 = ColorSwatch(
|
|
||||||
shade0 = Color(context.getColor(android.R.color.system_accent3_0)),
|
|
||||||
shade10 = Color(context.getColor(android.R.color.system_accent3_10)),
|
|
||||||
shade50 = Color(context.getColor(android.R.color.system_accent3_50)),
|
|
||||||
shade100 = Color(context.getColor(android.R.color.system_accent3_100)),
|
|
||||||
shade200 = Color(context.getColor(android.R.color.system_accent3_200)),
|
|
||||||
shade300 = Color(context.getColor(android.R.color.system_accent3_300)),
|
|
||||||
shade400 = Color(context.getColor(android.R.color.system_accent3_400)),
|
|
||||||
shade500 = Color(context.getColor(android.R.color.system_accent3_500)),
|
|
||||||
shade600 = Color(context.getColor(android.R.color.system_accent3_600)),
|
|
||||||
shade700 = Color(context.getColor(android.R.color.system_accent3_700)),
|
|
||||||
shade800 = Color(context.getColor(android.R.color.system_accent3_800)),
|
|
||||||
shade900 = Color(context.getColor(android.R.color.system_accent3_900)),
|
|
||||||
shade1000 = Color(context.getColor(android.R.color.system_accent3_1000)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
@ -5,14 +5,14 @@ import androidx.compose.ui.graphics.toArgb
|
|||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
import de.mm20.launcher2.ui.theme.WallpaperColors
|
import de.mm20.launcher2.ui.theme.WallpaperColors
|
||||||
|
|
||||||
class WallpaperColorScheme(
|
class WallpaperColorPalette(
|
||||||
wallpaperColors: WallpaperColors
|
wallpaperColors: WallpaperColors
|
||||||
) : ColorScheme() {
|
) : ColorPalette() {
|
||||||
override val neutral1: ColorSwatch
|
override val neutral: ColorSwatch
|
||||||
override val neutral2: ColorSwatch
|
override val neutralVariant: ColorSwatch
|
||||||
override val accent1: ColorSwatch
|
override val primary: ColorSwatch
|
||||||
override val accent2: ColorSwatch
|
override val secondary: ColorSwatch
|
||||||
override val accent3: ColorSwatch
|
override val tertiary: ColorSwatch
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val primary = wallpaperColors.primary
|
val primary = wallpaperColors.primary
|
||||||
@ -35,11 +35,11 @@ class WallpaperColorScheme(
|
|||||||
?: primary
|
?: primary
|
||||||
|
|
||||||
|
|
||||||
neutral1 = colorSwatch(neutral)
|
this.neutral = colorSwatch(neutral)
|
||||||
neutral2 = neutral1
|
neutralVariant = this.neutral
|
||||||
accent1 = colorSwatch(acc1)
|
this.primary = colorSwatch(acc1)
|
||||||
accent2 = colorSwatch(acc2)
|
this.secondary = colorSwatch(acc2)
|
||||||
accent3 = neutral1
|
this.tertiary = this.neutral
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isBrown(color: Color): Boolean {
|
private fun isBrown(color: Color): Boolean {
|
||||||
@ -7,7 +7,9 @@ import androidx.compose.animation.core.*
|
|||||||
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
import androidx.compose.animation.graphics.ExperimentalAnimationGraphicsApi
|
||||||
import androidx.compose.animation.graphics.res.animatedVectorResource
|
import androidx.compose.animation.graphics.res.animatedVectorResource
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.DropdownMenu
|
||||||
|
import androidx.compose.material.DropdownMenuItem
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.AcUnit
|
import androidx.compose.material.icons.rounded.AcUnit
|
||||||
import androidx.compose.material.icons.rounded.Air
|
import androidx.compose.material.icons.rounded.Air
|
||||||
@ -20,6 +22,7 @@ import androidx.compose.ui.draw.clipToBounds
|
|||||||
import androidx.compose.ui.draw.rotate
|
import androidx.compose.ui.draw.rotate
|
||||||
import androidx.compose.ui.draw.scale
|
import androidx.compose.ui.draw.scale
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
|
import androidx.compose.ui.res.colorResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import de.mm20.launcher2.ui.*
|
import de.mm20.launcher2.ui.*
|
||||||
@ -65,7 +68,7 @@ private fun SunMoon(icon: WeatherIcon, night: Boolean) {
|
|||||||
val transition = updateTransition(targetState = icon, "AnimatedWeatherIcon")
|
val transition = updateTransition(targetState = icon, "AnimatedWeatherIcon")
|
||||||
|
|
||||||
val color by animateColorAsState(
|
val color by animateColorAsState(
|
||||||
if (night) MaterialTheme.colors.weatherMoon else MaterialTheme.colors.weatherSun
|
if (night)colorResource(id = R.color.weather_moon) else colorResource(id = R.color.weather_sun)
|
||||||
)
|
)
|
||||||
val scale by transition.animateFloat(label = "sunScale") {
|
val scale by transition.animateFloat(label = "sunScale") {
|
||||||
when (it) {
|
when (it) {
|
||||||
@ -129,7 +132,7 @@ private fun LightningBolt(icon: WeatherIcon) {
|
|||||||
.size(32.dp)
|
.size(32.dp)
|
||||||
.offset(offset.x.dp, offset.y.dp)
|
.offset(offset.x.dp, offset.y.dp)
|
||||||
.scale(scale),
|
.scale(scale),
|
||||||
tint = MaterialTheme.colors.weatherBolt
|
tint = colorResource(id = R.color.weather_lightning_bolt)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +162,7 @@ private fun LightningBolt2(icon: WeatherIcon) {
|
|||||||
.size(32.dp)
|
.size(32.dp)
|
||||||
.offset(offset.x.dp, offset.y.dp)
|
.offset(offset.x.dp, offset.y.dp)
|
||||||
.scale(scale),
|
.scale(scale),
|
||||||
tint = MaterialTheme.colors.weatherBolt
|
tint = colorResource(id = R.color.weather_lightning_bolt)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,19 +219,19 @@ private fun Cloud1(icon: WeatherIcon) {
|
|||||||
WeatherIcon.ThunderstormWithRain,
|
WeatherIcon.ThunderstormWithRain,
|
||||||
WeatherIcon.HeavyThunderstorm,
|
WeatherIcon.HeavyThunderstorm,
|
||||||
WeatherIcon.HeavyThunderstormWithRain,
|
WeatherIcon.HeavyThunderstormWithRain,
|
||||||
WeatherIcon.Storm -> MaterialTheme.colors.weatherCloudDark2
|
WeatherIcon.Storm -> colorResource(id = R.color.weather_cloud_dark_2)
|
||||||
WeatherIcon.Showers,
|
WeatherIcon.Showers,
|
||||||
WeatherIcon.Sleet,
|
WeatherIcon.Sleet,
|
||||||
WeatherIcon.Hail,
|
WeatherIcon.Hail,
|
||||||
WeatherIcon.Cloudy,
|
WeatherIcon.Cloudy,
|
||||||
WeatherIcon.Wind,
|
WeatherIcon.Wind,
|
||||||
WeatherIcon.Fog -> MaterialTheme.colors.weatherCloudDark1
|
WeatherIcon.Fog -> colorResource(id = R.color.weather_cloud_dark_1)
|
||||||
WeatherIcon.Drizzle,
|
WeatherIcon.Drizzle,
|
||||||
WeatherIcon.Snow -> MaterialTheme.colors.weatherCloudMedium2
|
WeatherIcon.Snow -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
WeatherIcon.MostlyCloudy -> MaterialTheme.colors.weatherCloudLight2
|
WeatherIcon.MostlyCloudy -> colorResource(id = R.color.weather_cloud_light_2)
|
||||||
WeatherIcon.PartlyCloudy,
|
WeatherIcon.PartlyCloudy,
|
||||||
WeatherIcon.BrokenClouds -> MaterialTheme.colors.weatherCloudLight1
|
WeatherIcon.BrokenClouds -> colorResource(id = R.color.weather_cloud_light_1)
|
||||||
else -> MaterialTheme.colors.weatherCloudMedium2
|
else -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,12 +292,12 @@ private fun Cloud2(icon: WeatherIcon) {
|
|||||||
}
|
}
|
||||||
val color by transition.animateColor(label = "color") {
|
val color by transition.animateColor(label = "color") {
|
||||||
when (it) {
|
when (it) {
|
||||||
WeatherIcon.BrokenClouds -> MaterialTheme.colors.weatherCloudLight2
|
WeatherIcon.BrokenClouds -> colorResource(id = R.color.weather_cloud_light_2)
|
||||||
WeatherIcon.Thunderstorm,
|
WeatherIcon.Thunderstorm,
|
||||||
WeatherIcon.ThunderstormWithRain,
|
WeatherIcon.ThunderstormWithRain,
|
||||||
WeatherIcon.HeavyThunderstorm,
|
WeatherIcon.HeavyThunderstorm,
|
||||||
WeatherIcon.HeavyThunderstormWithRain,
|
WeatherIcon.HeavyThunderstormWithRain,
|
||||||
WeatherIcon.Storm -> MaterialTheme.colors.weatherCloudMedium2
|
WeatherIcon.Storm -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
WeatherIcon.Showers,
|
WeatherIcon.Showers,
|
||||||
WeatherIcon.Drizzle,
|
WeatherIcon.Drizzle,
|
||||||
WeatherIcon.Sleet,
|
WeatherIcon.Sleet,
|
||||||
@ -302,9 +305,9 @@ private fun Cloud2(icon: WeatherIcon) {
|
|||||||
WeatherIcon.Hail,
|
WeatherIcon.Hail,
|
||||||
WeatherIcon.Cloudy,
|
WeatherIcon.Cloudy,
|
||||||
WeatherIcon.Wind,
|
WeatherIcon.Wind,
|
||||||
WeatherIcon.Fog -> MaterialTheme.colors.weatherCloudMedium1
|
WeatherIcon.Fog -> colorResource(id = R.color.weather_cloud_medium_1)
|
||||||
WeatherIcon.MostlyCloudy -> MaterialTheme.colors.weatherCloudMedium1
|
WeatherIcon.MostlyCloudy -> colorResource(id = R.color.weather_cloud_medium_1)
|
||||||
else -> MaterialTheme.colors.weatherCloudMedium2
|
else -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -363,15 +366,15 @@ private fun Cloud3(icon: WeatherIcon) {
|
|||||||
WeatherIcon.ThunderstormWithRain,
|
WeatherIcon.ThunderstormWithRain,
|
||||||
WeatherIcon.HeavyThunderstorm,
|
WeatherIcon.HeavyThunderstorm,
|
||||||
WeatherIcon.HeavyThunderstormWithRain,
|
WeatherIcon.HeavyThunderstormWithRain,
|
||||||
WeatherIcon.Storm -> MaterialTheme.colors.weatherCloudDark1
|
WeatherIcon.Storm -> colorResource(id = R.color.weather_cloud_dark_1)
|
||||||
WeatherIcon.Showers,
|
WeatherIcon.Showers,
|
||||||
WeatherIcon.Sleet,
|
WeatherIcon.Sleet,
|
||||||
WeatherIcon.Hail,
|
WeatherIcon.Hail,
|
||||||
WeatherIcon.Cloudy,
|
WeatherIcon.Cloudy,
|
||||||
WeatherIcon.Wind -> MaterialTheme.colors.weatherCloudMedium2
|
WeatherIcon.Wind -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
WeatherIcon.Drizzle,
|
WeatherIcon.Drizzle,
|
||||||
WeatherIcon.Snow -> MaterialTheme.colors.weatherCloudLight2
|
WeatherIcon.Snow -> colorResource(id = R.color.weather_cloud_light_2)
|
||||||
else -> MaterialTheme.colors.weatherCloudMedium2
|
else -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +404,7 @@ private fun Hot(icon: WeatherIcon) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.scale(scale)
|
.scale(scale)
|
||||||
.size(32.dp),
|
.size(32.dp),
|
||||||
tint = MaterialTheme.colors.weatherHot
|
tint = colorResource(id = R.color.weather_hot)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -420,7 +423,7 @@ private fun Cold(icon: WeatherIcon) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.scale(scale)
|
.scale(scale)
|
||||||
.size(32.dp),
|
.size(32.dp),
|
||||||
tint = MaterialTheme.colors.weatherCold
|
tint = colorResource(id = R.color.weather_cold)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +443,7 @@ private fun Wind1(icon: WeatherIcon) {
|
|||||||
.scale(scale)
|
.scale(scale)
|
||||||
.offset(12.dp, 11.dp)
|
.offset(12.dp, 11.dp)
|
||||||
.size(32.dp),
|
.size(32.dp),
|
||||||
tint = MaterialTheme.colors.weatherWind
|
tint = colorResource(id = R.color.weather_wind)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,7 +463,7 @@ private fun Wind2(icon: WeatherIcon) {
|
|||||||
.scale(scale)
|
.scale(scale)
|
||||||
.offset(8.dp, -1.dp)
|
.offset(8.dp, -1.dp)
|
||||||
.size(32.dp),
|
.size(32.dp),
|
||||||
tint = MaterialTheme.colors.weatherWindDark
|
tint = colorResource(id = R.color.weather_wind_dark)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,7 +531,7 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
.offset(y = 8.dp + 11.dp * animProgress),
|
.offset(y = 8.dp + 11.dp * animProgress),
|
||||||
imageVector = Icons.Rounded.WeatherLightRainAnimatable,
|
imageVector = Icons.Rounded.WeatherLightRainAnimatable,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherRain
|
tint = colorResource(id = R.color.weather_rain)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
WeatherIcon.Hail -> {
|
WeatherIcon.Hail -> {
|
||||||
@ -544,7 +547,7 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
.offset(y = 8.dp + 11.dp * animProgress),
|
.offset(y = 8.dp + 11.dp * animProgress),
|
||||||
imageVector = Icons.Rounded.WeatherHailAnimatable,
|
imageVector = Icons.Rounded.WeatherHailAnimatable,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherHail
|
tint = colorResource(id = R.color.weather_hail)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
WeatherIcon.Snow -> {
|
WeatherIcon.Snow -> {
|
||||||
@ -563,7 +566,7 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
),
|
),
|
||||||
imageVector = Icons.Rounded.WeatherHailAnimatable,
|
imageVector = Icons.Rounded.WeatherHailAnimatable,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherSnow
|
tint = colorResource(id = R.color.weather_snow)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
WeatherIcon.Showers,
|
WeatherIcon.Showers,
|
||||||
@ -581,7 +584,7 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
.offset(y = 8.dp + 11.dp * animProgress),
|
.offset(y = 8.dp + 11.dp * animProgress),
|
||||||
imageVector = Icons.Rounded.WeatherRainAnimatable,
|
imageVector = Icons.Rounded.WeatherRainAnimatable,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherRain
|
tint = colorResource(id = R.color.weather_rain)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
WeatherIcon.Sleet -> {
|
WeatherIcon.Sleet -> {
|
||||||
@ -597,7 +600,7 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
.offset(y = 8.dp + 11.dp * animProgress),
|
.offset(y = 8.dp + 11.dp * animProgress),
|
||||||
imageVector = Icons.Rounded.WeatherSleetRainAnimatable,
|
imageVector = Icons.Rounded.WeatherSleetRainAnimatable,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherRain
|
tint = colorResource(id = R.color.weather_rain)
|
||||||
)
|
)
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -605,7 +608,7 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
.offset(y = 8.dp + 11.dp * animProgress),
|
.offset(y = 8.dp + 11.dp * animProgress),
|
||||||
imageVector = Icons.Rounded.WeatherSleetSnowAnimatable,
|
imageVector = Icons.Rounded.WeatherSleetSnowAnimatable,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherSnow
|
tint = colorResource(id = R.color.weather_snow)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -624,7 +627,7 @@ private fun Fog(icon: WeatherIcon) {
|
|||||||
.offset(x = 6.dp, y = 7.dp),
|
.offset(x = 6.dp, y = 7.dp),
|
||||||
imageVector = Icons.Rounded.WeatherFog,
|
imageVector = Icons.Rounded.WeatherFog,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherFog
|
tint = colorResource(id = R.color.weather_fog)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,7 @@ package de.mm20.launcher2.ui.weather
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.offset
|
import androidx.compose.foundation.layout.offset
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.*
|
import androidx.compose.material.icons.rounded.*
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@ -12,6 +11,7 @@ import androidx.compose.ui.Alignment
|
|||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.scale
|
import androidx.compose.ui.draw.scale
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.res.colorResource
|
||||||
import androidx.compose.ui.unit.DpOffset
|
import androidx.compose.ui.unit.DpOffset
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import de.mm20.launcher2.ui.*
|
import de.mm20.launcher2.ui.*
|
||||||
@ -51,7 +51,7 @@ private fun SunMoon(icon: WeatherIcon, night: Boolean) {
|
|||||||
else -> return
|
else -> return
|
||||||
}
|
}
|
||||||
|
|
||||||
val color = if (night) MaterialTheme.colors.weatherMoon else MaterialTheme.colors.weatherSun
|
val color = if (night) colorResource(id = R.color.weather_moon) else colorResource(id = R.color.weather_sun)
|
||||||
|
|
||||||
val scale = when (icon) {
|
val scale = when (icon) {
|
||||||
WeatherIcon.Clear,
|
WeatherIcon.Clear,
|
||||||
@ -139,18 +139,18 @@ private fun Cloud1(icon: WeatherIcon) {
|
|||||||
WeatherIcon.Thunderstorm,
|
WeatherIcon.Thunderstorm,
|
||||||
WeatherIcon.ThunderstormWithRain,
|
WeatherIcon.ThunderstormWithRain,
|
||||||
WeatherIcon.HeavyThunderstorm,
|
WeatherIcon.HeavyThunderstorm,
|
||||||
WeatherIcon.HeavyThunderstormWithRain -> MaterialTheme.colors.weatherCloudDark2
|
WeatherIcon.HeavyThunderstormWithRain -> colorResource(id = R.color.weather_cloud_dark_2)
|
||||||
WeatherIcon.Showers,
|
WeatherIcon.Showers,
|
||||||
WeatherIcon.Sleet,
|
WeatherIcon.Sleet,
|
||||||
WeatherIcon.Hail,
|
WeatherIcon.Hail,
|
||||||
WeatherIcon.Cloudy,
|
WeatherIcon.Cloudy,
|
||||||
WeatherIcon.Fog -> MaterialTheme.colors.weatherCloudDark1
|
WeatherIcon.Fog -> colorResource(id = R.color.weather_cloud_dark_1)
|
||||||
WeatherIcon.Drizzle,
|
WeatherIcon.Drizzle,
|
||||||
WeatherIcon.Snow -> MaterialTheme.colors.weatherCloudMedium2
|
WeatherIcon.Snow -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
WeatherIcon.MostlyCloudy -> MaterialTheme.colors.weatherCloudLight2
|
WeatherIcon.MostlyCloudy -> colorResource(id = R.color.weather_cloud_light_2)
|
||||||
WeatherIcon.PartlyCloudy,
|
WeatherIcon.PartlyCloudy,
|
||||||
WeatherIcon.BrokenClouds -> MaterialTheme.colors.weatherCloudLight1
|
WeatherIcon.BrokenClouds -> colorResource(id = R.color.weather_cloud_light_1)
|
||||||
else -> MaterialTheme.colors.weatherCloudMedium2
|
else -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
Icon(
|
Icon(
|
||||||
@ -218,20 +218,20 @@ private fun Cloud2(icon: WeatherIcon) {
|
|||||||
else -> DpOffset.Zero
|
else -> DpOffset.Zero
|
||||||
}
|
}
|
||||||
val color = when (icon) {
|
val color = when (icon) {
|
||||||
WeatherIcon.BrokenClouds -> MaterialTheme.colors.weatherCloudLight2
|
WeatherIcon.BrokenClouds -> colorResource(id = R.color.weather_cloud_light_2)
|
||||||
WeatherIcon.Thunderstorm,
|
WeatherIcon.Thunderstorm,
|
||||||
WeatherIcon.ThunderstormWithRain,
|
WeatherIcon.ThunderstormWithRain,
|
||||||
WeatherIcon.HeavyThunderstorm,
|
WeatherIcon.HeavyThunderstorm,
|
||||||
WeatherIcon.HeavyThunderstormWithRain -> MaterialTheme.colors.weatherCloudMedium2
|
WeatherIcon.HeavyThunderstormWithRain -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
WeatherIcon.Showers,
|
WeatherIcon.Showers,
|
||||||
WeatherIcon.Drizzle,
|
WeatherIcon.Drizzle,
|
||||||
WeatherIcon.Sleet,
|
WeatherIcon.Sleet,
|
||||||
WeatherIcon.Snow,
|
WeatherIcon.Snow,
|
||||||
WeatherIcon.Hail,
|
WeatherIcon.Hail,
|
||||||
WeatherIcon.Cloudy,
|
WeatherIcon.Cloudy,
|
||||||
WeatherIcon.Fog -> MaterialTheme.colors.weatherCloudMedium1
|
WeatherIcon.Fog -> colorResource(id = R.color.weather_cloud_medium_1)
|
||||||
WeatherIcon.MostlyCloudy -> MaterialTheme.colors.weatherCloudMedium1
|
WeatherIcon.MostlyCloudy -> colorResource(id = R.color.weather_cloud_medium_1)
|
||||||
else -> MaterialTheme.colors.weatherCloudMedium2
|
else -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
Icon(
|
Icon(
|
||||||
@ -280,14 +280,14 @@ private fun Cloud3(icon: WeatherIcon) {
|
|||||||
WeatherIcon.Thunderstorm,
|
WeatherIcon.Thunderstorm,
|
||||||
WeatherIcon.ThunderstormWithRain,
|
WeatherIcon.ThunderstormWithRain,
|
||||||
WeatherIcon.HeavyThunderstorm,
|
WeatherIcon.HeavyThunderstorm,
|
||||||
WeatherIcon.HeavyThunderstormWithRain -> MaterialTheme.colors.weatherCloudDark1
|
WeatherIcon.HeavyThunderstormWithRain -> colorResource(id = R.color.weather_cloud_dark_1)
|
||||||
WeatherIcon.Showers,
|
WeatherIcon.Showers,
|
||||||
WeatherIcon.Sleet,
|
WeatherIcon.Sleet,
|
||||||
WeatherIcon.Hail,
|
WeatherIcon.Hail,
|
||||||
WeatherIcon.Cloudy -> MaterialTheme.colors.weatherCloudMedium2
|
WeatherIcon.Cloudy -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
WeatherIcon.Drizzle,
|
WeatherIcon.Drizzle,
|
||||||
WeatherIcon.Snow -> MaterialTheme.colors.weatherCloudLight2
|
WeatherIcon.Snow -> colorResource(id = R.color.weather_cloud_light_2)
|
||||||
else -> MaterialTheme.colors.weatherCloudMedium2
|
else -> colorResource(id = R.color.weather_cloud_medium_2)
|
||||||
}
|
}
|
||||||
|
|
||||||
Icon(
|
Icon(
|
||||||
@ -309,7 +309,7 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
.size(32.dp),
|
.size(32.dp),
|
||||||
imageVector = Icons.Rounded.WeatherSleetSnow,
|
imageVector = Icons.Rounded.WeatherSleetSnow,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherSnow
|
tint = colorResource(id = R.color.weather_snow)
|
||||||
)
|
)
|
||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@ -317,7 +317,7 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
.size(32.dp),
|
.size(32.dp),
|
||||||
imageVector = Icons.Rounded.WeatherSleetRain,
|
imageVector = Icons.Rounded.WeatherSleetRain,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherRain
|
tint = colorResource(id = R.color.weather_rain)
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -344,9 +344,9 @@ private fun Precipitation(icon: WeatherIcon) {
|
|||||||
WeatherIcon.Drizzle,
|
WeatherIcon.Drizzle,
|
||||||
WeatherIcon.Showers,
|
WeatherIcon.Showers,
|
||||||
WeatherIcon.ThunderstormWithRain,
|
WeatherIcon.ThunderstormWithRain,
|
||||||
WeatherIcon.HeavyThunderstormWithRain -> MaterialTheme.colors.weatherRain
|
WeatherIcon.HeavyThunderstormWithRain -> colorResource(id = R.color.weather_rain)
|
||||||
WeatherIcon.Hail -> MaterialTheme.colors.weatherHail
|
WeatherIcon.Hail -> colorResource(id = R.color.weather_hail)
|
||||||
WeatherIcon.Snow -> MaterialTheme.colors.weatherSnow
|
WeatherIcon.Snow -> colorResource(id = R.color.weather_snow)
|
||||||
else -> Color.Unspecified
|
else -> Color.Unspecified
|
||||||
}
|
}
|
||||||
Icon(
|
Icon(
|
||||||
@ -367,7 +367,7 @@ private fun HotCold(icon: WeatherIcon) {
|
|||||||
.size(32.dp),
|
.size(32.dp),
|
||||||
imageVector = Icons.Rounded.Thermostat,
|
imageVector = Icons.Rounded.Thermostat,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherHot
|
tint = colorResource(id = R.color.weather_hot)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (icon == WeatherIcon.Cold) {
|
if (icon == WeatherIcon.Cold) {
|
||||||
@ -376,7 +376,7 @@ private fun HotCold(icon: WeatherIcon) {
|
|||||||
.size(32.dp),
|
.size(32.dp),
|
||||||
imageVector = Icons.Rounded.AcUnit,
|
imageVector = Icons.Rounded.AcUnit,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherCold
|
tint = colorResource(id = R.color.weather_cold)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -390,7 +390,7 @@ private fun Wind(icon: WeatherIcon) {
|
|||||||
.size(24.dp),
|
.size(24.dp),
|
||||||
imageVector = Icons.Rounded.Air,
|
imageVector = Icons.Rounded.Air,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherWindDark
|
tint = colorResource(id = R.color.weather_wind_dark)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (icon == WeatherIcon.Wind || icon == WeatherIcon.Storm) {
|
if (icon == WeatherIcon.Wind || icon == WeatherIcon.Storm) {
|
||||||
@ -399,7 +399,7 @@ private fun Wind(icon: WeatherIcon) {
|
|||||||
.size(if(icon == WeatherIcon.Wind) 32.dp else 24.dp),
|
.size(if(icon == WeatherIcon.Wind) 32.dp else 24.dp),
|
||||||
imageVector = Icons.Rounded.Air,
|
imageVector = Icons.Rounded.Air,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherWind
|
tint = colorResource(id = R.color.weather_wind)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,7 +417,7 @@ private fun Fog(icon: WeatherIcon) {
|
|||||||
.offset(x = 3.dp, y = 4.dp),
|
.offset(x = 3.dp, y = 4.dp),
|
||||||
imageVector = Icons.Rounded.WeatherFog,
|
imageVector = Icons.Rounded.WeatherFog,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherFog
|
tint = colorResource(id = R.color.weather_fog)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ private fun LightningBolts(icon: WeatherIcon) {
|
|||||||
.offset(x = if (isHeavy) 4.dp else 1.dp, y = 6.dp),
|
.offset(x = if (isHeavy) 4.dp else 1.dp, y = 6.dp),
|
||||||
imageVector = Icons.Rounded.Bolt,
|
imageVector = Icons.Rounded.Bolt,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherBolt
|
tint = colorResource(id = R.color.weather_lightning_bolt)
|
||||||
)
|
)
|
||||||
|
|
||||||
if (icon == WeatherIcon.HeavyThunderstorm || icon == WeatherIcon.HeavyThunderstormWithRain) {
|
if (icon == WeatherIcon.HeavyThunderstorm || icon == WeatherIcon.HeavyThunderstormWithRain) {
|
||||||
@ -450,7 +450,7 @@ private fun LightningBolts(icon: WeatherIcon) {
|
|||||||
.offset(x = -3.dp, y = 6.dp),
|
.offset(x = -3.dp, y = 6.dp),
|
||||||
imageVector = Icons.Rounded.Bolt,
|
imageVector = Icons.Rounded.Bolt,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = MaterialTheme.colors.weatherBolt
|
tint = colorResource(id = R.color.weather_lightning_bolt)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,7 +7,9 @@ import android.widget.FrameLayout
|
|||||||
import androidx.compose.animation.animateContentSize
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.DropdownMenu
|
||||||
|
import androidx.compose.material.DropdownMenuItem
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.*
|
import androidx.compose.material.icons.rounded.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
@ -123,7 +125,7 @@ fun CalendarWidget() {
|
|||||||
if (pinnedEvents.isNotEmpty()) {
|
if (pinnedEvents.isNotEmpty()) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(id = R.string.calendar_widget_pinned_events),
|
text = stringResource(id = R.string.calendar_widget_pinned_events),
|
||||||
style = MaterialTheme.typography.subtitle1
|
style = MaterialTheme.typography.titleLarge
|
||||||
)
|
)
|
||||||
DeprecatedSearchableList(
|
DeprecatedSearchableList(
|
||||||
items = pinnedEvents,
|
items = pinnedEvents,
|
||||||
@ -179,7 +181,7 @@ fun DaySelector(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.wrapContentWidth(),
|
.wrapContentWidth(),
|
||||||
text = formatDay(LocalContext.current, selectedDay),
|
text = formatDay(LocalContext.current, selectedDay),
|
||||||
style = MaterialTheme.typography.subtitle1
|
style = MaterialTheme.typography.titleLarge
|
||||||
)
|
)
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Rounded.ArrowDropDown,
|
imageVector = Icons.Rounded.ArrowDropDown,
|
||||||
@ -199,7 +201,7 @@ fun DaySelector(
|
|||||||
}) {
|
}) {
|
||||||
Text(
|
Text(
|
||||||
text = formatDay(LocalContext.current, day),
|
text = formatDay(LocalContext.current, day),
|
||||||
style = MaterialTheme.typography.subtitle2
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -245,7 +247,7 @@ object CalendarWidgetShim {
|
|||||||
composeView.id = FrameLayout.generateViewId()
|
composeView.id = FrameLayout.generateViewId()
|
||||||
composeView.setContent {
|
composeView.setContent {
|
||||||
LauncherTheme {
|
LauncherTheme {
|
||||||
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colors.onSurface) {
|
CompositionLocalProvider(LocalContentColor provides MaterialTheme.colorScheme.onSurface) {
|
||||||
Column {
|
Column {
|
||||||
CalendarWidget()
|
CalendarWidget()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,8 @@ import android.content.Intent
|
|||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import androidx.compose.animation.animateColorAsState
|
import androidx.compose.animation.animateColorAsState
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.LocalContentColor
|
import androidx.compose.material3.LocalContentColor
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -39,7 +39,7 @@ fun ClockWidget(
|
|||||||
contentAlignment = Alignment.BottomCenter
|
contentAlignment = Alignment.BottomCenter
|
||||||
) {
|
) {
|
||||||
val contentColor by animateColorAsState(
|
val contentColor by animateColorAsState(
|
||||||
if (transparentBackground) Color.White else MaterialTheme.colors.onSurface
|
if (transparentBackground) Color.White else MaterialTheme.colorScheme.onSurface
|
||||||
)
|
)
|
||||||
|
|
||||||
CompositionLocalProvider(LocalContentColor provides contentColor) {
|
CompositionLocalProvider(LocalContentColor provides contentColor) {
|
||||||
|
|||||||
@ -7,10 +7,10 @@ import androidx.compose.foundation.Image
|
|||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.combinedClickable
|
import androidx.compose.foundation.combinedClickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.material.IconButton
|
import androidx.compose.material3.IconButton
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.MusicNote
|
import androidx.compose.material.icons.rounded.MusicNote
|
||||||
import androidx.compose.material.icons.rounded.SkipNext
|
import androidx.compose.material.icons.rounded.SkipNext
|
||||||
@ -65,20 +65,20 @@ fun MusicWidget() {
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = title ?: "---",
|
text = title ?: "---",
|
||||||
style = MaterialTheme.typography.subtitle1,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = artist ?: "---",
|
text = artist ?: "---",
|
||||||
modifier = Modifier.padding(vertical = 2.dp),
|
modifier = Modifier.padding(vertical = 2.dp),
|
||||||
style = MaterialTheme.typography.body1,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = album ?: "---",
|
text = album ?: "---",
|
||||||
style = MaterialTheme.typography.body1,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
overflow = TextOverflow.Ellipsis
|
overflow = TextOverflow.Ellipsis
|
||||||
)
|
)
|
||||||
@ -131,7 +131,7 @@ fun MusicWidget() {
|
|||||||
.conditional(
|
.conditional(
|
||||||
albumArt == null,
|
albumArt == null,
|
||||||
Modifier.background(
|
Modifier.background(
|
||||||
LocalColorScheme.current.accent1.shade200
|
LocalColorScheme.current.primary.shade80
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
@ -149,7 +149,7 @@ fun MusicWidget() {
|
|||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Rounded.MusicNote,
|
imageVector = Icons.Rounded.MusicNote,
|
||||||
contentDescription = null,
|
contentDescription = null,
|
||||||
tint = LocalColorScheme.current.accent1.shade600,
|
tint = LocalColorScheme.current.primary.shade40,
|
||||||
modifier = Modifier.size(56.dp)
|
modifier = Modifier.size(56.dp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import android.appwidget.AppWidgetManager
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
@ -26,7 +26,7 @@ fun PlatformWidget(widget: Widget) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val height = widget.height.dp.toPixels().toInt()
|
val height = widget.height.dp.toPixels().toInt()
|
||||||
val isLightTheme = MaterialTheme.colors.isLight
|
val isLightTheme = androidx.compose.material.MaterialTheme.colors.isLight
|
||||||
|
|
||||||
AndroidView(
|
AndroidView(
|
||||||
factory = {
|
factory = {
|
||||||
|
|||||||
@ -4,28 +4,25 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import android.view.View
|
|
||||||
import android.widget.FrameLayout
|
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.ExperimentalAnimationApi
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
import androidx.compose.foundation.Image
|
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.ContentAlpha
|
||||||
|
import androidx.compose.material.DropdownMenu
|
||||||
|
import androidx.compose.material.DropdownMenuItem
|
||||||
|
import androidx.compose.material.LocalContentAlpha
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.ArrowDropDown
|
|
||||||
import androidx.compose.material.icons.rounded.ArrowDropDown
|
import androidx.compose.material.icons.rounded.ArrowDropDown
|
||||||
|
import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.runtime.livedata.observeAsState
|
import androidx.compose.runtime.livedata.observeAsState
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.ComposeView
|
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.colorResource
|
import androidx.compose.ui.res.colorResource
|
||||||
import androidx.compose.ui.res.painterResource
|
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.res.vectorResource
|
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.DpOffset
|
import androidx.compose.ui.unit.DpOffset
|
||||||
@ -34,10 +31,7 @@ import androidx.compose.ui.unit.sp
|
|||||||
import androidx.lifecycle.viewmodel.compose.viewModel
|
import androidx.lifecycle.viewmodel.compose.viewModel
|
||||||
import de.mm20.launcher2.ktx.tryStartActivity
|
import de.mm20.launcher2.ktx.tryStartActivity
|
||||||
import de.mm20.launcher2.preferences.LauncherPreferences
|
import de.mm20.launcher2.preferences.LauncherPreferences
|
||||||
import de.mm20.launcher2.ui.LauncherTheme
|
|
||||||
import de.mm20.launcher2.ui.LegacyLauncherTheme
|
|
||||||
import de.mm20.launcher2.ui.R
|
import de.mm20.launcher2.ui.R
|
||||||
import de.mm20.launcher2.ui.legacyTypography
|
|
||||||
import de.mm20.launcher2.ui.weather.AnimatedWeatherIcon
|
import de.mm20.launcher2.ui.weather.AnimatedWeatherIcon
|
||||||
import de.mm20.launcher2.ui.weather.WeatherIcon
|
import de.mm20.launcher2.ui.weather.WeatherIcon
|
||||||
import de.mm20.launcher2.weather.DailyForecast
|
import de.mm20.launcher2.weather.DailyForecast
|
||||||
@ -81,7 +75,7 @@ fun WeatherWidget() {
|
|||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = selectedForecast.location,
|
text = selectedForecast.location,
|
||||||
style = MaterialTheme.typography.subtitle1
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = convertTemperature(
|
text = convertTemperature(
|
||||||
@ -96,7 +90,7 @@ fun WeatherWidget() {
|
|||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = selectedForecast.condition,
|
text = selectedForecast.condition,
|
||||||
style = MaterialTheme.typography.body1
|
style = MaterialTheme.typography.bodySmall
|
||||||
)
|
)
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
@ -107,7 +101,7 @@ fun WeatherWidget() {
|
|||||||
.padding(vertical = 12.dp)
|
.padding(vertical = 12.dp)
|
||||||
) {
|
) {
|
||||||
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
|
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.medium) {
|
||||||
Text(text = stringResource(id = if (detailsExpanded) R.string.weather_widget_hide_details else R.string.weather_widget_show_details))
|
Text(text = stringResource(id = if (detailsExpanded) R.string.weather_widget_hide_details else R.string.weather_widget_show_details), style = MaterialTheme.typography.bodySmall)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,7 +140,7 @@ fun WeatherWidget() {
|
|||||||
Spacer(modifier = Modifier.weight(1f))
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
Surface(
|
Surface(
|
||||||
shape = RoundedCornerShape(topStartPercent = 50, bottomStartPercent = 50),
|
shape = RoundedCornerShape(topStartPercent = 50, bottomStartPercent = 50),
|
||||||
color = MaterialTheme.colors.onSurface.copy(alpha = 0.12f),
|
color = MaterialTheme.colorScheme.onSurface.copy(alpha = 0.12f),
|
||||||
modifier = Modifier.align(Alignment.End)
|
modifier = Modifier.align(Alignment.End)
|
||||||
|
|
||||||
) {
|
) {
|
||||||
@ -207,11 +201,11 @@ fun WeatherDetailRow(title: String, value: String) {
|
|||||||
Text(
|
Text(
|
||||||
text = title,
|
text = title,
|
||||||
modifier = Modifier.padding(end = 8.dp),
|
modifier = Modifier.padding(end = 8.dp),
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = value,
|
text = value,
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,7 +235,7 @@ fun WeatherDaySelector(
|
|||||||
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
|
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
|
||||||
Text(
|
Text(
|
||||||
text = dateFormat.format(selectedDay.timestamp),
|
text = dateFormat.format(selectedDay.timestamp),
|
||||||
style = MaterialTheme.typography.subtitle2,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.CenterVertically)
|
.align(Alignment.CenterVertically)
|
||||||
.padding(start = 16.dp, end = 8.dp)
|
.padding(start = 16.dp, end = 8.dp)
|
||||||
@ -253,7 +247,7 @@ fun WeatherDaySelector(
|
|||||||
selectedDay.minTemp
|
selectedDay.minTemp
|
||||||
)
|
)
|
||||||
}° / ${convertTemperature(imperialUnits, selectedDay.maxTemp)}°",
|
}° / ${convertTemperature(imperialUnits, selectedDay.maxTemp)}°",
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
modifier = Modifier.align(Alignment.CenterVertically)
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
)
|
)
|
||||||
Icon(
|
Icon(
|
||||||
@ -281,7 +275,7 @@ fun WeatherDaySelector(
|
|||||||
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
|
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
|
||||||
Text(
|
Text(
|
||||||
text = dateFormat.format(d.timestamp),
|
text = dateFormat.format(d.timestamp),
|
||||||
style = MaterialTheme.typography.subtitle2,
|
style = MaterialTheme.typography.labelSmall,
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.CenterVertically)
|
.align(Alignment.CenterVertically)
|
||||||
@ -296,7 +290,7 @@ fun WeatherDaySelector(
|
|||||||
)
|
)
|
||||||
}° / ${convertTemperature(imperialUnits, d.maxTemp)}°",
|
}° / ${convertTemperature(imperialUnits, d.maxTemp)}°",
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
modifier = Modifier.align(Alignment.CenterVertically)
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -332,7 +326,7 @@ fun WeatherTimeSelector(
|
|||||||
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
|
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
|
||||||
Text(
|
Text(
|
||||||
text = dateFormat.format(selectedForecast.timestamp),
|
text = dateFormat.format(selectedForecast.timestamp),
|
||||||
style = MaterialTheme.typography.subtitle2,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
modifier = Modifier.align(Alignment.CenterVertically)
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -358,7 +352,7 @@ fun WeatherTimeSelector(
|
|||||||
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
|
CompositionLocalProvider(LocalContentAlpha provides ContentAlpha.high) {
|
||||||
Text(
|
Text(
|
||||||
text = dateFormat.format(fc.timestamp),
|
text = dateFormat.format(fc.timestamp),
|
||||||
style = MaterialTheme.typography.subtitle2,
|
style = MaterialTheme.typography.titleSmall,
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.CenterVertically)
|
.align(Alignment.CenterVertically)
|
||||||
@ -370,7 +364,7 @@ fun WeatherTimeSelector(
|
|||||||
Text(
|
Text(
|
||||||
text = "${convertTemperature(imperialUnits, fc.temperature)}°",
|
text = "${convertTemperature(imperialUnits, fc.temperature)}°",
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
style = MaterialTheme.typography.body2,
|
style = MaterialTheme.typography.bodySmall,
|
||||||
modifier = Modifier.align(Alignment.CenterVertically)
|
modifier = Modifier.align(Alignment.CenterVertically)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
package de.mm20.launcher2.ui.widget.parts
|
package de.mm20.launcher2.ui.widget.parts
|
||||||
|
|
||||||
import android.text.format.DateUtils
|
import android.text.format.DateUtils
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import de.mm20.launcher2.ui.component.TextClock
|
import de.mm20.launcher2.ui.component.TextClock
|
||||||
|
|
||||||
@ -9,6 +9,6 @@ import de.mm20.launcher2.ui.component.TextClock
|
|||||||
fun DatePart() {
|
fun DatePart() {
|
||||||
TextClock(
|
TextClock(
|
||||||
formatFlags = DateUtils.FORMAT_SHOW_WEEKDAY or DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_YEAR,
|
formatFlags = DateUtils.FORMAT_SHOW_WEEKDAY or DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_YEAR,
|
||||||
style = MaterialTheme.typography.subtitle1
|
style = MaterialTheme.typography.titleMedium
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -126,6 +126,7 @@
|
|||||||
android:animateLayoutChanges="true"
|
android:animateLayoutChanges="true"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
|
android:paddingTop="8dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<de.mm20.launcher2.view.ElevationImageView
|
<de.mm20.launcher2.view.ElevationImageView
|
||||||
@ -163,10 +164,7 @@
|
|||||||
android:layout_marginTop="8dp"
|
android:layout_marginTop="8dp"
|
||||||
android:layout_marginBottom="16dp"
|
android:layout_marginBottom="16dp"
|
||||||
android:text="@string/menu_edit_widgets"
|
android:text="@string/menu_edit_widgets"
|
||||||
android:textColor="@color/text_color_primary"
|
app:icon="@drawable/ic_edit" />
|
||||||
app:backgroundTint="?colorSurface"
|
|
||||||
app:icon="@drawable/ic_edit"
|
|
||||||
app:iconTint="@color/text_color_primary" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@ -185,10 +183,10 @@
|
|||||||
android:id="@+id/editWidgetToolbar"
|
android:id="@+id/editWidgetToolbar"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?colorSurface"
|
|
||||||
android:elevation="4dp"
|
android:elevation="4dp"
|
||||||
android:translationY="-56dp"
|
android:translationY="-56dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
style="@style/Widget.Material3.Toolbar.Surface"
|
||||||
app:title="@string/menu_edit_widgets" />
|
app:title="@string/menu_edit_widgets" />
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|||||||
20
ui/src/main/res/values-night/weather_colors.xml
Normal file
20
ui/src/main/res/values-night/weather_colors.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="weather_sun">@color/amber</color>
|
||||||
|
<color name="weather_moon">#E0E0E0</color>
|
||||||
|
<color name="weather_cloud_light_1">#ECEFF1</color>
|
||||||
|
<color name="weather_cloud_light_2">#CFD8DC</color>
|
||||||
|
<color name="weather_cloud_medium_1">#78909C</color>
|
||||||
|
<color name="weather_cloud_medium_2">#607D8B</color>
|
||||||
|
<color name="weather_cloud_dark_1">#546E7A</color>
|
||||||
|
<color name="weather_cloud_dark_2">#455A64</color>
|
||||||
|
<color name="weather_snow">#F5F5F5</color>
|
||||||
|
<color name="weather_rain">@color/blue</color>
|
||||||
|
<color name="weather_hail">#E3F2FD</color>
|
||||||
|
<color name="weather_hot">@color/red</color>
|
||||||
|
<color name="weather_cold">@color/lightblue</color>
|
||||||
|
<color name="weather_wind">#CFD8DC</color>
|
||||||
|
<color name="weather_wind_dark">#78909C</color>
|
||||||
|
<color name="weather_fog">@color/weather_cloud_light_2</color>
|
||||||
|
<color name="weather_lightning_bolt">@color/amber</color>
|
||||||
|
</resources>
|
||||||
20
ui/src/main/res/values/weather_colors.xml
Normal file
20
ui/src/main/res/values/weather_colors.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="weather_sun">@color/amber</color>
|
||||||
|
<color name="weather_moon">#9E9E9E</color>
|
||||||
|
<color name="weather_cloud_light_1">#ECEFF1</color>
|
||||||
|
<color name="weather_cloud_light_2">#90A4AE</color>
|
||||||
|
<color name="weather_cloud_medium_1">#546E7A</color>
|
||||||
|
<color name="weather_cloud_medium_2">#455a64</color>
|
||||||
|
<color name="weather_cloud_dark_1">#37474F</color>
|
||||||
|
<color name="weather_cloud_dark_2">#263238</color>
|
||||||
|
<color name="weather_snow">#E0E0E0</color>
|
||||||
|
<color name="weather_rain">@color/blue</color>
|
||||||
|
<color name="weather_hail">#BBDEFB</color>
|
||||||
|
<color name="weather_hot">@color/red</color>
|
||||||
|
<color name="weather_cold">@color/lightblue</color>
|
||||||
|
<color name="weather_wind">#90A4AE</color>
|
||||||
|
<color name="weather_wind_dark">#546E7A</color>
|
||||||
|
<color name="weather_fog">@color/weather_cloud_light_2</color>
|
||||||
|
<color name="weather_lightning_bolt">@color/amber</color>
|
||||||
|
</resources>
|
||||||
Loading…
x
Reference in New Issue
Block a user