-
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.
Get QuestionAnswer from firebase and set to datasource
- Loading branch information
Showing
6 changed files
with
84 additions
and
38 deletions.
There are no files selected for viewing
39 changes: 25 additions & 14 deletions
39
app/src/main/java/com/example/chiecnonkydieu/data/DataSource.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,20 +1,31 @@ | ||
package com.example.chiecnonkydieu.data | ||
|
||
import android.content.Context | ||
import com.example.chiecnonkydieu.R | ||
import com.example.chiecnonkydieu.model.Hint | ||
import com.example.chiecnonkydieu.model.QuestionAnswer | ||
import com.google.firebase.database.DatabaseReference | ||
import com.google.firebase.database.ktx.database | ||
import com.google.firebase.ktx.Firebase | ||
|
||
|
||
val hintList:MutableList<Hint> = mutableListOf( | ||
Hint("Đây là hint 1"), | ||
Hint("Đây là hint 2"), | ||
Hint("Đây là hint 3") | ||
) | ||
val questionAnswerList: List<QuestionAnswer> = mutableListOf( | ||
QuestionAnswer("Thủ đô của Việt Nam nằm ở đâu?", "HA NOI", "Hà Nội", hintList), | ||
QuestionAnswer("Loại hình thể thao nào được yêu thích nhất ở Việt Nam?", "BONG DA", "Bóng Đá", hintList), | ||
QuestionAnswer("Bộ phim khoa học viễn tưởng nào là một trong những tác phẩm nổi tiếng nhất?", "STARWARS", "STARWARS", hintList), | ||
QuestionAnswer("Đâu là bộ phim có tựa đề \"Dặm xanh\"?", "THE GREEN MILES", "THE GREEN MILES", hintList), | ||
) | ||
val database: DatabaseReference = Firebase.database.reference | ||
const val REFERENCE_CAUHOI = "CAU HOI" | ||
val questionAnswerList: MutableList<QuestionAnswer> = mutableListOf( | ||
QuestionAnswer( | ||
"Hà Nội", | ||
"HA NOI", | ||
"Thủ đô của Việt Nam nằm ở đâu?", | ||
"Hint1", | ||
"Hint2", | ||
"Hint3", | ||
"Thong tin" | ||
), | ||
QuestionAnswer( | ||
"Hà Nội", | ||
"HA NOI", | ||
"Thủ đô của Việt Nam nằm ở đâu?", | ||
"Hint1", | ||
"Hint2", | ||
"Hint3", | ||
"Thong tin" | ||
), | ||
|
||
) |
12 changes: 8 additions & 4 deletions
12
app/src/main/java/com/example/chiecnonkydieu/model/QuestionAnswer.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,8 +1,12 @@ | ||
package com.example.chiecnonkydieu.model | ||
|
||
|
||
data class QuestionAnswer( | ||
val question: String = "Thủ đô của Việt Nam nằm ở đâu?", | ||
val answer: String = "HA NOI", | ||
val answerCoDau: String = "Hà Nội", | ||
val hintList: MutableList<Hint> = mutableListOf() | ||
var DoiTuong : String = "", | ||
var DoiTuongInHoa : String = "", | ||
var CauHoi : String = "", | ||
var Hint1 : String = "", | ||
var Hint2 : String = "", | ||
var Hint3 : String = "", | ||
var ThongTin : String = "" | ||
) |
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