-
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.
- showing collected treasure in classic mode
- Loading branch information
Showing
18 changed files
with
308 additions
and
262 deletions.
There are no files selected for viewing
34 changes: 0 additions & 34 deletions
34
app/src/classic/java/pl/marianjureczko/poszukiwacz/activity/searching/JustFoundFinder.kt
This file was deleted.
Oops, something went wrong.
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
41 changes: 41 additions & 0 deletions
41
.../pl/marianjureczko/poszukiwacz/activity/searching/n/JustFoundTreasureDescriptionFinder.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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package pl.marianjureczko.poszukiwacz.activity.searching.n | ||
|
||
import android.util.Log | ||
import pl.marianjureczko.poszukiwacz.activity.searching.LocationCalculator | ||
import pl.marianjureczko.poszukiwacz.model.Treasure | ||
import pl.marianjureczko.poszukiwacz.model.TreasureDescription | ||
import pl.marianjureczko.poszukiwacz.model.TreasureType | ||
import pl.marianjureczko.poszukiwacz.shared.Coordinates | ||
|
||
class JustFoundTreasureDescriptionFinder( | ||
private val treasureDescriptions: List<TreasureDescription>, | ||
private val locationCalculator: LocationCalculator = LocationCalculator(), | ||
) { | ||
|
||
private val TAG = javaClass.simpleName | ||
|
||
fun findTreasureDescription( | ||
qrCode: String, | ||
justFoundTreasure: Treasure, | ||
selectedTreasureDescription: TreasureDescription? = null, | ||
userLocation: Coordinates? = null, | ||
): TreasureDescription? { | ||
if (justFoundTreasure.type == TreasureType.KNOWLEDGE) { | ||
return treasureDescriptions.find { td -> | ||
justFoundTreasure.id == td.qrCode | ||
} | ||
} else { | ||
return if (selectedTreasureDescription != null && userLocation != null) { | ||
val distance = locationCalculator.distanceInSteps(selectedTreasureDescription, userLocation) | ||
Log.d(TAG, "Distance is $distance") | ||
if (distance < 60) { | ||
selectedTreasureDescription | ||
} else { | ||
null | ||
} | ||
} else { | ||
null | ||
} | ||
} | ||
} | ||
} |
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
20 changes: 0 additions & 20 deletions
20
...main/java/pl/marianjureczko/poszukiwacz/activity/searching/n/TreasureDescriptionFinder.kt
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.