-
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.
Merge pull request #110 from INFRAcp/seungmin
[feat] #109 Hot Project Server Connection
- Loading branch information
Showing
14 changed files
with
706 additions
and
533 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
29 changes: 29 additions & 0 deletions
29
app/src/main/java/com/example/infraandroid/chat/model/ChatRoomDB.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,29 @@ | ||
package com.example.infraandroid.chat.model | ||
|
||
import android.content.Context | ||
import androidx.room.Database | ||
import androidx.room.Room | ||
import androidx.room.RoomDatabase | ||
|
||
@Database(entities = [ChatRoomEntity::class], version = 1) | ||
abstract class ChatRoomDB: RoomDatabase() { | ||
abstract fun chatRoomDAO(): ChatRoomDao | ||
|
||
companion object{ | ||
private var INSTANCE: ChatRoomDB? = null | ||
|
||
@Synchronized | ||
fun getInstance(context: Context): ChatRoomDB? { | ||
if (INSTANCE == null) { | ||
synchronized(ChatRoomDB::class) { | ||
INSTANCE = Room.databaseBuilder( | ||
context.applicationContext, | ||
ChatRoomDB::class.java, | ||
"chatRoomDB" | ||
).build() | ||
} | ||
} | ||
return INSTANCE | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/src/main/java/com/example/infraandroid/chat/model/ChatRoomDao.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,14 @@ | ||
package com.example.infraandroid.chat.model | ||
|
||
import androidx.room.Dao | ||
import androidx.room.Insert | ||
import androidx.room.Query | ||
|
||
@Dao | ||
interface ChatRoomDao { | ||
@Query("SELECT * FROM CHATROOM WHERE opponentNickName = :opponentNickName") | ||
fun checkOpponent(opponentNickName: String): List<ChatRoomEntity> | ||
|
||
@Insert() | ||
fun insert(chatRoom : ChatRoomEntity) | ||
} |
11 changes: 11 additions & 0 deletions
11
app/src/main/java/com/example/infraandroid/chat/model/ChatRoomEntity.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,11 @@ | ||
package com.example.infraandroid.chat.model | ||
|
||
import androidx.room.ColumnInfo | ||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "chatRoom") | ||
data class ChatRoomEntity ( | ||
@PrimaryKey(autoGenerate = true) var index: Int?, | ||
@ColumnInfo(name = "opponentNickName") var opponentNickName: 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
28 changes: 28 additions & 0 deletions
28
app/src/main/java/com/example/infraandroid/home/model/ResponseHotProjectData.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,28 @@ | ||
package com.example.infraandroid.home.model | ||
|
||
data class ResponseHotProjectData( | ||
val isSuccess: Boolean, | ||
val code: Int, | ||
val message: String, | ||
val result: ArrayList<Result> | ||
) | ||
{ | ||
data class Result( | ||
val hashtag: ArrayList<String>, | ||
val pj_categoryName: String, | ||
val pj_daysub: Int, | ||
val pj_deadline: String, | ||
val pj_header: String, | ||
val pj_like: Int, | ||
val pj_num: Int, | ||
val pj_photo: ArrayList<String>, | ||
val pj_progress: String, | ||
val pj_recruit: String, | ||
val pj_recruitPerson: Int, | ||
val pj_subCategoryName: String, | ||
val pj_totalPerson: Int, | ||
val pj_views: Int, | ||
val pj_views_1day: Int, | ||
val user_id: 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
Oops, something went wrong.