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