Skip to content

Commit

Permalink
add guatemala challenge
Browse files Browse the repository at this point in the history
  • Loading branch information
Okuro3499 committed Oct 30, 2024
1 parent 4e5e0e1 commit 91cee5b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 33 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ proguard
# Log files
*.log

# Raw folder
assets

# Android Studio Navigation editor temp folder
.navigation

Expand Down
Binary file added app/src/main/assets/images/october-challenge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N
val currentMonth = calendar.get(Calendar.MONTH)

if (currentMonth == Calendar.OCTOBER) {
if (settings.getString("serverURL", "") == "https://${BuildConfig.PLANET_LEARNING_URL}") {
if (settings.getString("serverURL", "") == "https://${BuildConfig.PLANET_GUATEMALA_URL}") {
val today = LocalDate.now()
val endOfMonth = today.withDayOfMonth(today.lengthOfMonth())
val remainingDays = ChronoUnit.DAYS.between(today, endOfMonth).toInt()
Expand All @@ -252,20 +252,10 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N

private fun challengeDialog(remainingDays: Int) {
val markdownContent = """
## myPlanet issues challenge
## october challenge: $remainingDays days remaining
<img src="file:///android_asset/images/october-challenge.png" width="100%">
![issues challenge](file:///android_asset/images/github-filter-issues.png)
get ready for virtual intern github issues challenge!
**duration:** $remainingDays days remaining
## steps to participate:
- Find an issue on myPlanet
- Take a screenshot/record a video
- create an issue on our github repository using link below
[new myPlanet issue](https://github.com/open-learning-exchange/myplanet/issues/new)
""".trimIndent()

MarkdownDialog.newInstance(markdownContent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N
val currentMonth = calendar.get(Calendar.MONTH)

if (currentMonth == Calendar.OCTOBER) {
if (settings.getString("serverURL", "") == "https://${BuildConfig.PLANET_LEARNING_URL}") {
if (settings.getString("serverURL", "") == "https://${BuildConfig.PLANET_GUATEMALA_URL}") {
val today = LocalDate.now()
val endOfMonth = today.withDayOfMonth(today.lengthOfMonth())
val remainingDays = ChronoUnit.DAYS.between(today, endOfMonth).toInt()
Expand All @@ -252,20 +252,10 @@ class DashboardActivity : DashboardElementActivity(), OnHomeItemClickListener, N

private fun challengeDialog(remainingDays: Int) {
val markdownContent = """
## myPlanet issues challenge
## october challenge: $remainingDays days remaining

![issues challenge](file:///android_asset/images/github-filter-issues.png)
<img src="file:///android_asset/images/october-challenge.png" width="100%">

get ready for virtual intern github issues challenge!

**duration:** $remainingDays days remaining

## steps to participate:
- Find an issue on myPlanet
- Take a screenshot/record a video
- create an issue on our github repository using link below

[new myPlanet issue](https://github.com/open-learning-exchange/myplanet/issues/new)
""".trimIndent()

MarkdownDialog.newInstance(markdownContent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ class MarkdownDialog : DialogFragment() {
setupCloseButton()
}

override fun onStart() {
super.onStart()
val dialog = dialog ?: return

dialog.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}

private fun setupMarkdown() {
setMarkdownText(dialogCampaignChallengeBinding.markdownTextView, markdownContent)
}
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/layout/dialog_campaign_challenge.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Close dialog"
android:contentDescription="close dialog"
android:src="@drawable/baseline_close_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/markdownTextView"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/closeButton" />
Expand Down

0 comments on commit 91cee5b

Please sign in to comment.