1 /* 2 * Copyright 2018 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 com.google.android.setupcompat.partnerconfig; 18 19 // TODO: optimize the enum 20 /** Resources that can be customized by partner overlay APK. */ 21 public enum PartnerConfig { 22 23 // Status bar background color or illustration. 24 CONFIG_STATUS_BAR_BACKGROUND(PartnerConfigKey.KEY_STATUS_BAR_BACKGROUND, ResourceType.DRAWABLE), 25 26 // The same as "WindowLightStatusBar". If set true, the status bar icons will be drawn such 27 // that it is compatible with a light status bar background 28 CONFIG_LIGHT_STATUS_BAR(PartnerConfigKey.KEY_LIGHT_STATUS_BAR, ResourceType.BOOL), 29 30 // Navigation bar background color 31 CONFIG_NAVIGATION_BAR_BG_COLOR(PartnerConfigKey.KEY_NAVIGATION_BAR_BG_COLOR, ResourceType.COLOR), 32 33 // Background color of the footer bar. 34 CONFIG_FOOTER_BAR_BG_COLOR(PartnerConfigKey.KEY_FOOTER_BAR_BG_COLOR, ResourceType.COLOR), 35 36 // The same as "windowLightNavigationBar". If set true, the navigation bar icons will be drawn 37 // such that it is compatible with a light navigation bar background. 38 CONFIG_LIGHT_NAVIGATION_BAR(PartnerConfigKey.KEY_LIGHT_NAVIGATION_BAR, ResourceType.BOOL), 39 40 // The font face used in footer buttons. This must be a string reference to a font that is 41 // available in the system. Font references (@font or @xml) are not allowed. 42 CONFIG_FOOTER_BUTTON_FONT_FAMILY( 43 PartnerConfigKey.KEY_FOOTER_BUTTON_FONT_FAMILY, ResourceType.STRING), 44 45 // The icon for "add another" action. Can be "@null" for no icon. 46 CONFIG_FOOTER_BUTTON_ICON_ADD_ANOTHER( 47 PartnerConfigKey.KEY_FOOTER_BUTTON_ICON_ADD_ANOTHER, ResourceType.DRAWABLE), 48 49 // The icon for "cancel" action. Can be "@null" for no icon. 50 CONFIG_FOOTER_BUTTON_ICON_CANCEL( 51 PartnerConfigKey.KEY_FOOTER_BUTTON_ICON_CANCEL, ResourceType.DRAWABLE), 52 53 // The icon for "clear" action. Can be "@null" for no icon. 54 CONFIG_FOOTER_BUTTON_ICON_CLEAR( 55 PartnerConfigKey.KEY_FOOTER_BUTTON_ICON_CLEAR, ResourceType.DRAWABLE), 56 57 // The icon for "done" action. Can be "@null" for no icon. 58 CONFIG_FOOTER_BUTTON_ICON_DONE( 59 PartnerConfigKey.KEY_FOOTER_BUTTON_ICON_DONE, ResourceType.DRAWABLE), 60 61 // The icon for "next" action. Can be "@null" for no icon. 62 CONFIG_FOOTER_BUTTON_ICON_NEXT( 63 PartnerConfigKey.KEY_FOOTER_BUTTON_ICON_NEXT, ResourceType.DRAWABLE), 64 65 // The icon for "opt-in" action. Can be "@null" for no icon. 66 CONFIG_FOOTER_BUTTON_ICON_OPT_IN( 67 PartnerConfigKey.KEY_FOOTER_BUTTON_ICON_OPT_IN, ResourceType.DRAWABLE), 68 69 // The icon for "skip" action. Can be "@null" for no icon. 70 CONFIG_FOOTER_BUTTON_ICON_SKIP( 71 PartnerConfigKey.KEY_FOOTER_BUTTON_ICON_SKIP, ResourceType.DRAWABLE), 72 73 // The icon for "stop" action. Can be "@null" for no icon. 74 CONFIG_FOOTER_BUTTON_ICON_STOP( 75 PartnerConfigKey.KEY_FOOTER_BUTTON_ICON_STOP, ResourceType.DRAWABLE), 76 77 // Top padding of the footer buttons 78 CONFIG_FOOTER_BUTTON_PADDING_TOP( 79 PartnerConfigKey.KEY_FOOTER_BUTTON_PADDING_TOP, ResourceType.DIMENSION), 80 81 // Bottom padding of the footer buttons 82 CONFIG_FOOTER_BUTTON_PADDING_BOTTOM( 83 PartnerConfigKey.KEY_FOOTER_BUTTON_PADDING_BOTTOM, ResourceType.DIMENSION), 84 85 // Corner radius of the footer buttons 86 CONFIG_FOOTER_BUTTON_RADIUS(PartnerConfigKey.KEY_FOOTER_BUTTON_RADIUS, ResourceType.DIMENSION), 87 88 // Ripple color alpha the footer buttons 89 CONFIG_FOOTER_BUTTON_RIPPLE_COLOR_ALPHA( 90 PartnerConfigKey.KEY_FOOTER_BUTTON_RIPPLE_ALPHA, ResourceType.FRACTION), 91 92 // Text size of the primary footer button 93 CONFIG_FOOTER_BUTTON_TEXT_SIZE( 94 PartnerConfigKey.KEY_FOOTER_BUTTON_TEXT_SIZE, ResourceType.DIMENSION), 95 96 // Background color of the primary footer button 97 CONFIG_FOOTER_PRIMARY_BUTTON_BG_COLOR( 98 PartnerConfigKey.KEY_FOOTER_PRIMARY_BUTTON_BG_COLOR, ResourceType.COLOR), 99 100 // Text color of the primary footer button 101 CONFIG_FOOTER_PRIMARY_BUTTON_TEXT_COLOR( 102 PartnerConfigKey.KEY_FOOTER_PRIMARY_BUTTON_TEXT_COLOR, ResourceType.COLOR), 103 104 // Background color of the secondary footer button 105 CONFIG_FOOTER_SECONDARY_BUTTON_BG_COLOR( 106 PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_BG_COLOR, ResourceType.COLOR), 107 108 // Text color of the secondary footer button 109 CONFIG_FOOTER_SECONDARY_BUTTON_TEXT_COLOR( 110 PartnerConfigKey.KEY_FOOTER_SECONDARY_BUTTON_TEXT_COLOR, ResourceType.COLOR), 111 112 // Background color of layout 113 CONFIG_LAYOUT_BACKGROUND_COLOR(PartnerConfigKey.KEY_LAYOUT_BACKGROUND_COLOR, ResourceType.COLOR), 114 115 // Text color of the header 116 CONFIG_HEADER_TEXT_COLOR(PartnerConfigKey.KEY_HEADER_TEXT_COLOR, ResourceType.COLOR), 117 118 // Text size of the header 119 CONFIG_HEADER_TEXT_SIZE(PartnerConfigKey.KEY_HEADER_TEXT_SIZE, ResourceType.DIMENSION), 120 121 // Font family of the header 122 CONFIG_HEADER_FONT_FAMILY(PartnerConfigKey.KEY_HEADER_FONT_FAMILY, ResourceType.STRING), 123 124 // Gravity of the header, icon and description 125 CONFIG_LAYOUT_GRAVITY(PartnerConfigKey.KEY_LAYOUT_GRAVITY, ResourceType.STRING), 126 127 // Background color of the header area 128 CONFIG_HEADER_AREA_BACKGROUND_COLOR( 129 PartnerConfigKey.KEY_HEADER_AREA_BACKGROUND_COLOR, ResourceType.COLOR), 130 131 // Text size of the description 132 CONFIG_DESCRIPTION_TEXT_SIZE(PartnerConfigKey.KEY_DESCRIPTION_TEXT_SIZE, ResourceType.DIMENSION), 133 134 // Text color of the description 135 CONFIG_DESCRIPTION_TEXT_COLOR(PartnerConfigKey.KEY_DESCRIPTION_TEXT_COLOR, ResourceType.COLOR), 136 137 // Link text color of the description 138 CONFIG_DESCRIPTION_LINK_TEXT_COLOR( 139 PartnerConfigKey.KEY_DESCRIPTION_LINK_TEXT_COLOR, ResourceType.COLOR), 140 141 // Font family of the description 142 CONFIG_DESCRIPTION_FONT_FAMILY(PartnerConfigKey.KEY_DESCRIPTION_FONT_FAMILY, ResourceType.STRING); 143 144 public enum ResourceType { 145 BOOL, 146 COLOR, 147 DRAWABLE, 148 STRING, 149 DIMENSION, 150 FRACTION; 151 } 152 153 private final String resourceName; 154 private final ResourceType resourceType; 155 getResourceType()156 public ResourceType getResourceType() { 157 return resourceType; 158 } 159 getResourceName()160 public String getResourceName() { 161 return resourceName; 162 } 163 PartnerConfig(@artnerConfigKey String resourceName, ResourceType type)164 PartnerConfig(@PartnerConfigKey String resourceName, ResourceType type) { 165 this.resourceName = resourceName; 166 this.resourceType = type; 167 } 168 } 169