summaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorGeorge Lin <giolin@google.com>2022-07-26 14:53:06 +0000
committerGeorge Lin <giolin@google.com>2022-08-16 16:27:31 +0000
commit391aa6852cd6cc613476af268d9e0c23ce39d718 (patch)
treea9862eff4b19b02b05656572136fb5a3af399f91 /src/com/android
parent98e5b2a5e9c4b6af8f9ae8205d9a365ea9e0f893 (diff)
downloadThemePicker-391aa6852cd6cc613476af268d9e0c23ce39d718.tar.gz
Create clock customization section
Created a clock section which shows on the wallpaper picker home page and leads to clock customization. Bug: 241966062 Test: https://screenshot.googleplex.com/64DxwUBSbnfFfPf.png Change-Id: I8a15652bdc580f37cb56efc88e485cb782fc89b7
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/customization/model/clock/ClockSectionController.java47
-rw-r--r--src/com/android/customization/picker/clock/ClockSectionView.kt23
2 files changed, 70 insertions, 0 deletions
diff --git a/src/com/android/customization/model/clock/ClockSectionController.java b/src/com/android/customization/model/clock/ClockSectionController.java
new file mode 100644
index 00000000..cb8b9c8a
--- /dev/null
+++ b/src/com/android/customization/model/clock/ClockSectionController.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2022 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.customization.model.clock;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+
+import androidx.annotation.Nullable;
+
+import com.android.customization.picker.clock.ClockSectionView;
+import com.android.wallpaper.R;
+import com.android.wallpaper.config.Flags;
+import com.android.wallpaper.model.CustomizationSectionController;
+
+/** A {@link CustomizationSectionController} for clock customization. */
+public class ClockSectionController implements CustomizationSectionController<ClockSectionView> {
+
+ private final CustomizationSectionNavigationController mNavigationController;
+
+ public ClockSectionController(CustomizationSectionNavigationController navigationController) {
+ mNavigationController = navigationController;
+ }
+
+ @Override
+ public boolean isAvailable(@Nullable Context context) {
+ return Flags.enableClockCustomization;
+ }
+
+ @Override
+ public ClockSectionView createView(Context context) {
+ return (ClockSectionView) LayoutInflater.from(context).inflate(R.layout.clock_section_view,
+ null);
+ }
+}
diff --git a/src/com/android/customization/picker/clock/ClockSectionView.kt b/src/com/android/customization/picker/clock/ClockSectionView.kt
new file mode 100644
index 00000000..c0432094
--- /dev/null
+++ b/src/com/android/customization/picker/clock/ClockSectionView.kt
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2022 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.customization.picker.clock
+
+import android.content.Context
+import android.util.AttributeSet
+import com.android.wallpaper.picker.SectionView
+
+/** The [SectionView] for app clock. */
+class ClockSectionView(context: Context?, attrs: AttributeSet?) : SectionView(context, attrs) \ No newline at end of file