Home | History | Annotate | Download | only in widget
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package androidx.car.widget;
     18 
     19 import static java.lang.annotation.RetentionPolicy.SOURCE;
     20 
     21 import androidx.annotation.IntDef;
     22 
     23 import java.lang.annotation.Retention;
     24 
     25 /**
     26  * Specifies how the system UI should respond to day/night mode events.
     27  *
     28  * <p>By default, the Android Auto system UI assumes the app content background is light during the
     29  * day and dark during the night. The system UI updates the foreground color (such as status bar
     30  * icon colors) to be dark during day mode and light during night mode. By setting the
     31  * DayNightStyle, the app can specify how the system should respond to a day/night mode event. For
     32  * example, if the app has a dark content background for both day and night time, the app can tell
     33  * the system to use {@link #FORCE_NIGHT} style so the foreground color is locked to light color for
     34  * both cases.
     35  *
     36  * <p>Note: Not all system UI elements can be customized with a DayNightStyle.
     37  */
     38 @IntDef({
     39         DayNightStyle.AUTO,
     40         DayNightStyle.AUTO_INVERSE,
     41         DayNightStyle.ALWAYS_LIGHT,
     42         DayNightStyle.ALWAYS_DARK,
     43         DayNightStyle.FORCE_NIGHT,
     44         DayNightStyle.FORCE_DAY,
     45 })
     46 @Retention(SOURCE)
     47 public @interface DayNightStyle {
     48     /**
     49      * Sets the foreground color to be automatically changed based on day/night mode, assuming the
     50      * app content background is light during the day and dark during the night.
     51      *
     52      * <p>This is the default behavior.
     53      */
     54     int AUTO = 0;
     55 
     56     /**
     57      * Sets the foreground color to be automatically changed based on day/night mode, assuming the
     58      * app content background is dark during the day and light during the night.
     59      */
     60     int AUTO_INVERSE = 1;
     61 
     62     /** Sets the color to be locked to a light variant during day and night. */
     63     int ALWAYS_LIGHT = 2;
     64 
     65     /** Sets the color to be locked ot a dark variant during day and night. */
     66     int ALWAYS_DARK = 3;
     67 
     68     /**
     69      * Sets the foreground color to be locked to the night version, which assumes the app content
     70      * background is always dark during both day and night.
     71      *
     72      * @deprecated Use {@link #ALWAYS_LIGHT} instead.
     73      */
     74     @Deprecated
     75     int FORCE_NIGHT = 4;
     76 
     77     /**
     78      * Sets the foreground color to be locked to the day version, which assumes the app content
     79      * background is always light during both day and night.
     80      *
     81      * @deprecated Use {@link #ALWAYS_DARK} instead.
     82      */
     83     @Deprecated
     84     int FORCE_DAY = 5;
     85 
     86 }
     87