forked from ankidroid/Anki-Android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move flag related stuff to Flags.kt
- Loading branch information
Showing
6 changed files
with
85 additions
and
58 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
* Copyright (c) 2023 Brayan Oliveira <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License as published by the Free Software | ||
* Foundation; either version 3 of the License, or (at your option) any later | ||
* version. | ||
* | ||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License along with | ||
* this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.ichi2.anki | ||
|
||
import androidx.annotation.IntDef | ||
|
||
const val FLAG_NONE = 0 | ||
const val FLAG_RED = 1 | ||
const val FLAG_ORANGE = 2 | ||
const val FLAG_GREEN = 3 | ||
const val FLAG_BLUE = 4 | ||
const val FLAG_PINK = 5 | ||
const val FLAG_TURQUOISE = 6 | ||
const val FLAG_PURPLE = 7 | ||
|
||
@Retention(AnnotationRetention.SOURCE) | ||
@IntDef( | ||
FLAG_NONE, | ||
FLAG_RED, | ||
FLAG_ORANGE, | ||
FLAG_GREEN, | ||
FLAG_BLUE, | ||
FLAG_PINK, | ||
FLAG_TURQUOISE, | ||
FLAG_PURPLE | ||
) | ||
annotation class Flag | ||
|
||
fun getFlagDrawable(@Flag flag: Int): Int { | ||
return when (flag) { | ||
FLAG_RED -> R.drawable.ic_flag_red | ||
FLAG_ORANGE -> R.drawable.ic_flag_orange | ||
FLAG_GREEN -> R.drawable.ic_flag_green | ||
FLAG_BLUE -> R.drawable.ic_flag_blue | ||
FLAG_PINK -> R.drawable.ic_flag_pink | ||
FLAG_TURQUOISE -> R.drawable.ic_flag_turquoise | ||
FLAG_PURPLE -> R.drawable.ic_flag_purple | ||
FLAG_NONE -> R.drawable.ic_flag_transparent | ||
else -> TODO("Unsupported flag") | ||
} | ||
} |
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
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
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
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