Merge "Adjust text and symbol colors on picker fragments (2/2)" into udc-qpr-dev
diff --git a/res/values-w300dp/integers.xml b/res/values-w300dp/integers.xml
new file mode 100644
index 0000000..3bd7f4b
--- /dev/null
+++ b/res/values-w300dp/integers.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <integer name="color_section_num_columns">5</integer>
+</resources>
diff --git a/res/values-w400dp/integers.xml b/res/values-w400dp/integers.xml
new file mode 100644
index 0000000..0bb42e3
--- /dev/null
+++ b/res/values-w400dp/integers.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2019 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<resources>
+ <integer name="color_section_num_columns">6</integer>
+</resources>
diff --git a/src/com/android/customization/model/theme/ThemeBundledWallpaperInfo.java b/src/com/android/customization/model/theme/ThemeBundledWallpaperInfo.java
index d3935e8..4f0cd6c 100644
--- a/src/com/android/customization/model/theme/ThemeBundledWallpaperInfo.java
+++ b/src/com/android/customization/model/theme/ThemeBundledWallpaperInfo.java
@@ -137,13 +137,13 @@
@Override
public void showPreview(Activity srcActivity, InlinePreviewIntentFactory factory,
- int requestCode) {
+ int requestCode, boolean isAssetIdPresent) {
try {
- srcActivity.startActivityForResult(factory.newIntent(srcActivity, this), requestCode);
+ srcActivity.startActivityForResult(factory.newIntent(srcActivity, this,
+ isAssetIdPresent), requestCode);
} catch (ActivityNotFoundException |SecurityException e) {
Log.e(TAG, "App isn't installed or ThemePicker doesn't have permission to launch", e);
}
-
}
@Override
diff --git a/src/com/android/customization/module/ThemePickerInjector.kt b/src/com/android/customization/module/ThemePickerInjector.kt
index 80960aa..7d19400 100644
--- a/src/com/android/customization/module/ThemePickerInjector.kt
+++ b/src/com/android/customization/module/ThemePickerInjector.kt
@@ -80,7 +80,6 @@
import com.android.wallpaper.module.FragmentFactory
import com.android.wallpaper.module.UserEventLogger
import com.android.wallpaper.module.WallpaperPicker2Injector
-import com.android.wallpaper.module.WallpaperPreferences
import com.android.wallpaper.picker.CustomizationPickerActivity
import com.android.wallpaper.picker.ImagePreviewFragment
import com.android.wallpaper.picker.LivePreviewFragment
@@ -105,7 +104,6 @@
) : WallpaperPicker2Injector(mainScope, bgDispatcher), CustomizationInjector {
private var customizationSections: CustomizationSections? = null
private var userEventLogger: UserEventLogger? = null
- private var prefs: WallpaperPreferences? = null
private var wallpaperInteractor: WallpaperInteractor? = null
private var keyguardQuickAffordancePickerInteractor: KeyguardQuickAffordancePickerInteractor? =
null
@@ -181,7 +179,8 @@
mode: Int,
viewAsHome: Boolean,
viewFullScreen: Boolean,
- testingModeEnabled: Boolean
+ testingModeEnabled: Boolean,
+ isAssetIdPresent: Boolean
): Fragment {
return if (wallpaperInfo is LiveWallpaperInfo) LivePreviewFragment()
else
@@ -207,12 +206,6 @@
.also { userEventLogger = it }
}
- @Synchronized
- override fun getPreferences(context: Context): WallpaperPreferences {
- return prefs
- ?: DefaultCustomizationPreferences(context.applicationContext).also { prefs = it }
- }
-
override fun getFragmentFactory(): FragmentFactory? {
return fragmentFactory ?: ThemePickerFragmentFactory().also { fragmentFactory }
}
diff --git a/src/com/android/customization/picker/clock/data/repository/ClockPickerRepositoryImpl.kt b/src/com/android/customization/picker/clock/data/repository/ClockPickerRepositoryImpl.kt
index aeed45e..004103f 100644
--- a/src/com/android/customization/picker/clock/data/repository/ClockPickerRepositoryImpl.kt
+++ b/src/com/android/customization/picker/clock/data/repository/ClockPickerRepositoryImpl.kt
@@ -53,11 +53,12 @@
override val allClocks: Flow<List<ClockMetadataModel>> =
callbackFlow {
fun send() {
+ val activeClockId = registry.activeClockId
val allClocks =
- registry
- .getClocks()
- .filter { "NOT_IN_USE" !in it.clockId }
- .map { it.toModel(isSelected = it.clockId == registry.currentClockId) }
+ registry.getClocks().map {
+ it.toModel(isSelected = it.clockId == activeClockId)
+ }
+
trySend(allClocks)
}
@@ -84,12 +85,12 @@
override val selectedClock: Flow<ClockMetadataModel> =
callbackFlow {
fun send() {
- val currentClockId = registry.currentClockId
+ val activeClockId = registry.activeClockId
val metadata = registry.settings?.metadata
val model =
registry
.getClocks()
- .find { clockMetadata -> clockMetadata.clockId == currentClockId }
+ .find { clockMetadata -> clockMetadata.clockId == activeClockId }
?.toModel(
isSelected = true,
selectedColorId = metadata?.getSelectedColorId(),
diff --git a/src_override/com/android/customization/picker/CustomizationPickerApplication.java b/src_override/com/android/customization/picker/CustomizationPickerApplication.java
index 08303d9..f2000f6 100644
--- a/src_override/com/android/customization/picker/CustomizationPickerApplication.java
+++ b/src_override/com/android/customization/picker/CustomizationPickerApplication.java
@@ -17,7 +17,7 @@
import android.app.Application;
-import com.android.customization.module.ThemePickerInjector;
+import com.android.customization.module.CustomizationInjector;
import com.android.wallpaper.module.InjectorProvider;
import dagger.hilt.android.HiltAndroidApp;
@@ -30,7 +30,8 @@
@HiltAndroidApp(Application.class)
public class CustomizationPickerApplication extends Hilt_CustomizationPickerApplication {
- @Inject ThemePickerInjector mInjector;
+ @Inject
+ CustomizationInjector mInjector;
@Override
public void onCreate() {
diff --git a/src_override/com/android/wallpaper/module/AppModule.kt b/src_override/com/android/wallpaper/module/AppModule.kt
new file mode 100644
index 0000000..95da101
--- /dev/null
+++ b/src_override/com/android/wallpaper/module/AppModule.kt
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.wallpaper.module
+
+import android.content.Context
+import com.android.customization.module.CustomizationInjector
+import com.android.customization.module.DefaultCustomizationPreferences
+import com.android.customization.module.ThemePickerInjector
+import dagger.Binds
+import dagger.Module
+import dagger.Provides
+import dagger.hilt.InstallIn
+import dagger.hilt.android.qualifiers.ApplicationContext
+import dagger.hilt.components.SingletonComponent
+import javax.inject.Singleton
+
+@Module
+@InstallIn(SingletonComponent::class)
+abstract class AppModule {
+ @Binds @Singleton abstract fun bindInjector(impl: ThemePickerInjector): CustomizationInjector
+
+ companion object {
+ @Provides
+ @Singleton
+ fun provideWallpaperPreferences(
+ @ApplicationContext context: Context
+ ): WallpaperPreferences {
+ return DefaultCustomizationPreferences(context)
+ }
+ }
+}