-
-
Save illuzor/6c9497abf114140abebc5ac72b45e47c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import androidx.annotation.IntDef | |
abstract class ActionBar { | |
// Создаём набор констант | |
companion object { | |
const val NAVIGATION_MODE_STANDARD = 0 | |
const val NAVIGATION_MODE_LIST = 1 | |
const val NAVIGATION_MODE_TABS = 2 | |
} | |
// Определяем собственную аннотацию NavigationMode | |
// В @IntDef задаём константы | |
@Retention(AnnotationRetention.SOURCE) | |
@IntDef(NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS) | |
annotation class NavigationMode | |
// Помечаем параметр метода созданной аннотацией | |
fun setNavigationMode(@NavigationMode mode: Int) { | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment