• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2010 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.android.sdklib.internal.repository.sources;
18 
19 import com.android.sdklib.internal.repository.IDescription;
20 
21 
22 /**
23  * The category of a given {@link SdkSource} (which represents a download site).
24  */
25 public enum SdkSourceCategory implements IDescription {
26 
27     /**
28      * The default canonical and official Android repository.
29      */
30     ANDROID_REPO("Android Repository", true),
31 
32     /**
33      * Repositories contributed by the SDK_UPDATER_URLS env var,
34      * only used for local debugging.
35      */
36     GETENV_REPOS("Custom Repositories", false),
37 
38     /**
39      * All third-party add-ons fetched from the Android repository.
40      */
41     ADDONS_3RD_PARTY("Third party Add-ons", true),
42 
43     /**
44      * All add-ons contributed locally by the user via the "Add Add-on Site" button.
45      */
46     USER_ADDONS("User Add-ons", false),
47 
48     /**
49      * Add-ons contributed by the SDK_UPDATER_USER_URLS env var,
50      * only used for local debugging.
51      */
52     GETENV_ADDONS("Custom Add-ons", false);
53 
54 
55     private final String mUiName;
56     private final boolean mAlwaysDisplay;
57 
SdkSourceCategory(String uiName, boolean alwaysDisplay)58     private SdkSourceCategory(String uiName, boolean alwaysDisplay) {
59         mUiName = uiName;
60         mAlwaysDisplay = alwaysDisplay;
61     }
62 
63     /**
64      * Returns the UI-visible name of the cateogry. Displayed in the available package tree.
65      * Cannot be null nor empty.
66      */
getUiName()67     public String getUiName() {
68         return mUiName;
69     }
70 
71     /**
72      * True if this category must always be displayed by the available package tree, even
73      * if empty.
74      * When false, the category must not be displayed when empty.
75      */
getAlwaysDisplay()76     public boolean getAlwaysDisplay() {
77         return mAlwaysDisplay;
78     }
79 
80     @Override
getLongDescription()81     public String getLongDescription() {
82         return getUiName();
83     }
84 
85     @Override
getShortDescription()86     public String getShortDescription() {
87         return getUiName();
88     }
89 }
90