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

Commit 8b3a2990 authored by George Lin's avatar George Lin Committed by Android (Google) Code Review
Browse files

Merge "Create clock customization section" into tm-qpr-dev

parents b97849bf 391aa685
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -24,22 +24,6 @@ filegroup {
    srcs: [
        "src/**/*.java",
        "src/**/*.kt",
        // Min requirement for CustomizationInjector and StatsLogUserEventLogger to build without Clock and Theme feature.
        "src/com/android/customization/model/clock/BaseClockManager.java",
        "src/com/android/customization/model/clock/Clockface.java",
        "src/com/android/customization/model/clock/ClockManager.java",
        "src/com/android/customization/model/clock/ClockProvider.java",
        "src/com/android/customization/model/theme/OverlayManagerCompat.java",
        "src/com/android/customization/model/theme/ThemeBundleProvider.java",
        "src/com/android/customization/model/theme/ThemeManager.java",
        "src/com/android/customization/model/theme/ThemeBundle.java",
        "src/com/android/customization/model/theme/custom/CustomTheme.java",
    ],
    exclude_srcs: [
        "src/com/android/customization/model/clock/**/*.java",
        "src/com/android/customization/model/theme/**/*.java",
        "src/com/android/customization/picker/clock/**/*.java",
        "src/com/android/customization/picker/theme/**/*.java",
    ],
}

+25 −0
Original line number Diff line number Diff line
<!--
     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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="?attr/colorControlNormal">
    <path
        android:fillColor="@android:color/white"
        android:pathData="M15.3,16.7 L16.7,15.3 13,11.6V7H11V12.4ZM12,22Q9.925,22 8.1,21.212Q6.275,20.425 4.925,19.075Q3.575,17.725 2.788,15.9Q2,14.075 2,12Q2,9.925 2.788,8.1Q3.575,6.275 4.925,4.925Q6.275,3.575 8.1,2.787Q9.925,2 12,2Q14.075,2 15.9,2.787Q17.725,3.575 19.075,4.925Q20.425,6.275 21.212,8.1Q22,9.925 22,12Q22,14.075 21.212,15.9Q20.425,17.725 19.075,19.075Q17.725,20.425 15.9,21.212Q14.075,22 12,22ZM12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12Q12,12 12,12ZM12,20Q15.325,20 17.663,17.663Q20,15.325 20,12Q20,8.675 17.663,6.337Q15.325,4 12,4Q8.675,4 6.338,6.337Q4,8.675 4,12Q4,15.325 6.338,17.663Q8.675,20 12,20Z"/>
</vector>
 No newline at end of file
+54 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     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.
-->
<com.android.customization.picker.clock.ClockSectionView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="?selectableItemBackground"
    android:clickable="true"
    android:paddingVertical="@dimen/section_top_padding"
    android:paddingHorizontal="@dimen/section_horizontal_padding"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/clock_title"
            style="@style/SectionTitleTextStyle" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="@string/clock_description"
            style="@style/SectionSubtitleTextStyle"/>
    </LinearLayout>

    <ImageView
        android:layout_width="@dimen/option_tile_width"
        android:layout_height="@dimen/option_tile_width"
        android:scaleType="center"
        android:src="@drawable/ic_clock_24px"
        android:background="@drawable/option_border_color"
        android:contentDescription="@string/clock_picker_entry_content_description" />

</com.android.customization.picker.clock.ClockSectionView>
 No newline at end of file
+8 −1
Original line number Diff line number Diff line
@@ -24,7 +24,14 @@

    <!-- Title of a section of the customization picker where the user can select a Clock face.
        [CHAR LIMIT=15] -->
    <string name="clock_title">Clock</string>
    <string name="clock_title">Custom Clock</string>

    <!-- Description of a section of the customization picker where the user can select a Clock
        face. [CHAR LIMIT=15] -->
    <string name="clock_description">Pick a custom clock</string>

    <!-- The content description of clock entry. [CHAR LIMIT=NONE] -->
    <string name="clock_picker_entry_content_description">Change a custom clock</string>

    <!-- Title of a section of the customization picker where the user can select a Grid size for
        the home screen. [CHAR LIMIT=15] -->
+47 −0
Original line number Diff line number Diff line
/*
 * 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);
    }
}
Loading