This repository has been archived by the owner on May 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Move course date types to strings.xml
Course date types were previously in a code file which didn't allow us to get these strings translated. This commits fixes the issue by moving the strings to strings.xml file and changing the code accordingly.
- Loading branch information
1 parent
840ae14
commit b8ff48e
Showing
4 changed files
with
50 additions
and
12 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
21 changes: 13 additions & 8 deletions
21
OpenEdXMobile/src/main/java/org/edx/mobile/util/CourseDateType.kt
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 |
---|---|---|
@@ -1,21 +1,26 @@ | ||
package org.edx.mobile.util | ||
|
||
import org.edx.mobile.R | ||
|
||
/** | ||
* This enum defines the Date type of Course Dates | ||
*/ | ||
enum class CourseDateType { | ||
TODAY, BLANK, VERIFIED_ONLY, COMPLETED, PAST_DUE, DUE_NEXT, NOT_YET_RELEASED, | ||
COURSE_EXPIRED_DATE; | ||
|
||
fun getTitle(): String { | ||
/** | ||
* @return The string resource's ID if it's a valid enum inside [CourseDateType], otherwise -1. | ||
*/ | ||
fun getStringResIdForDateType(): Int { | ||
return when (this) { | ||
TODAY -> "Today" | ||
VERIFIED_ONLY -> "Verified Only" | ||
COMPLETED -> "Completed" | ||
PAST_DUE -> "Past Due" | ||
DUE_NEXT -> "Due Next" | ||
NOT_YET_RELEASED -> "Not Yet Released" | ||
else -> "" | ||
TODAY -> R.string.date_type_today | ||
VERIFIED_ONLY -> R.string.date_type_verified_only | ||
COMPLETED -> R.string.date_type_completed | ||
PAST_DUE -> R.string.date_type_past_due | ||
DUE_NEXT -> R.string.date_type_due_next | ||
NOT_YET_RELEASED -> R.string.date_type_not_yet_released | ||
else -> -1 | ||
} | ||
} | ||
} |
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