WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
This repository was archived by the owner on Oct 12, 2025. It is now read-only.

Commit f784022

Browse files
authored
Merge pull request #565 from HackIllinois/aditya/fix
fixed point shop raffle stuff
2 parents 544d6cf + e8f2ce3 commit f784022

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ android {
2424
applicationId "org.hackillinois.android"
2525
minSdkVersion 23
2626
targetSdkVersion 34
27-
versionCode 68
28-
versionName "2025.1.3"
27+
versionCode 69
28+
versionName "2025.1.4"
2929
multiDexEnabled true
3030
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3131
vectorDrawables.useSupportLibrary = true

app/src/main/java/org/hackillinois/android/view/home/CountdownManager.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import java.util.*
77

88
class CountdownManager(val listener: CountDownListener) {
99

10-
// 02-28-2025 : 14:30
10+
// 02-28-2025 : 18:00
1111
private val eventStartTime: Calendar = Calendar.getInstance().apply {
1212
timeZone = TimeZone.getTimeZone("America/Chicago")
13-
timeInMillis = 1740774600000 // 1708723800000
13+
timeInMillis = 1740774600000
1414
}
1515

1616
// 02-28-2025 : 18:00
@@ -19,10 +19,10 @@ class CountdownManager(val listener: CountDownListener) {
1919
timeInMillis = 1740787200000
2020
}
2121

22-
// 03-02-2025 11:30
22+
// 03-02-2025 7:00
2323
private val hackingEndTime: Calendar = Calendar.getInstance().apply {
2424
timeZone = TimeZone.getTimeZone("America/Chicago")
25-
timeInMillis = 1740936600000
25+
timeInMillis = 1740920400000
2626
}
2727

2828
private var times = listOf(eventStartTime, hackingStartTime, hackingEndTime)

app/src/main/java/org/hackillinois/android/view/shop/ShopFragment.kt

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,14 @@ class ShopFragment : Fragment(), ShopAdapter.OnBuyItemListener {
160160

161161
// Called in onCreateView within shopLiveData.observe
162162
private fun updateShopItems(newShop: List<ShopItem>) {
163-
// Split shop items into categories
164163
merchItems = newShop.filter { !it.isRaffle }.sortedBy { it.quantity == 0 }
165164
raffleItems = newShop.filter { it.isRaffle }.sortedBy { it.quantity == 0 }
166165

167-
// **Update only the RecyclerView items**
166+
// Update only the RecyclerView items: skip the first two fixed items for both tabs
168167
val recyclerViewItems = if (showingMerch) {
169168
if (merchItems.size > 2) merchItems.subList(2, merchItems.size) else listOf()
170169
} else {
171-
raffleItems
170+
if (raffleItems.size > 2) raffleItems.subList(2, raffleItems.size) else listOf()
172171
}
173172

174173
// Update adapter
@@ -336,16 +335,26 @@ class ShopFragment : Fragment(), ShopAdapter.OnBuyItemListener {
336335
}
337336

338337
private fun buyFirstItem() {
339-
if (merchItems.isNotEmpty()) {
340-
val firstItem = merchItems[0]
338+
val sortedItems = if (showingMerch) {
339+
merchItems.sortedBy { it.quantity == 0 }
340+
} else {
341+
raffleItems.sortedBy { it.quantity == 0 }
342+
}
343+
if (sortedItems.isNotEmpty()) {
344+
val firstItem = sortedItems[0]
341345
Log.d("ShopFragment", "Buying: ${firstItem.name}")
342346
onBuyItem(firstItem)
343347
}
344348
}
345349

346350
private fun buySecondItem() {
347-
if (merchItems.size >= 2) {
348-
val secondItem = merchItems[1]
351+
val sortedItems = if (showingMerch) {
352+
merchItems.sortedBy { it.quantity == 0 }
353+
} else {
354+
raffleItems.sortedBy { it.quantity == 0 }
355+
}
356+
if (sortedItems.size >= 2) {
357+
val secondItem = sortedItems[1]
349358
Log.d("ShopFragment", "Buying: ${secondItem.name}")
350359
onBuyItem(secondItem)
351360
}

0 commit comments

Comments
 (0)