aboutsummaryrefslogtreecommitdiffstats
path: root/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/sources/SdkSourceCategory.java
blob: 5272cd5555a2d9cc0b0963b8fbe491441b25ee54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*
 * Copyright (C) 2010 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.sdklib.internal.repository.sources;

import com.android.sdklib.internal.repository.IDescription;


/**
 * The category of a given {@link SdkSource} (which represents a download site).
 */
public enum SdkSourceCategory implements IDescription {

    /**
     * The default canonical and official Android repository.
     */
    ANDROID_REPO("Android Repository", true),

    /**
     * Repositories contributed by the SDK_UPDATER_URLS env var,
     * only used for local debugging.
     */
    GETENV_REPOS("Custom Repositories", false),

    /**
     * All third-party add-ons fetched from the Android repository.
     */
    ADDONS_3RD_PARTY("Third party Add-ons", true),

    /**
     * All add-ons contributed locally by the user via the "Add Add-on Site" button.
     */
    USER_ADDONS("User Add-ons", false),

    /**
     * Add-ons contributed by the SDK_UPDATER_USER_URLS env var,
     * only used for local debugging.
     */
    GETENV_ADDONS("Custom Add-ons", false);


    private final String mUiName;
    private final boolean mAlwaysDisplay;

    private SdkSourceCategory(String uiName, boolean alwaysDisplay) {
        mUiName = uiName;
        mAlwaysDisplay = alwaysDisplay;
    }

    /**
     * Returns the UI-visible name of the cateogry. Displayed in the available package tree.
     * Cannot be null nor empty.
     */
    public String getUiName() {
        return mUiName;
    }

    /**
     * True if this category must always be displayed by the available package tree, even
     * if empty.
     * When false, the category must not be displayed when empty.
     */
    public boolean getAlwaysDisplay() {
        return mAlwaysDisplay;
    }

    @Override
    public String getLongDescription() {
        return getUiName();
    }

    @Override
    public String getShortDescription() {
        return getUiName();
    }
}