Skip to content

Commit

Permalink
Merge pull request #215 from nowwater/feature-issue147-bookmarkview
Browse files Browse the repository at this point in the history
bookmark first success
  • Loading branch information
o-star authored May 27, 2021
2 parents abdc2a9 + fdaf810 commit ee6affa
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ import com.example.chattingapp.dto.Message

@Dao
interface BookmarkDao {

@Query("SELECT * FROM BOOKMARK WHERE room_id == :roomID")
fun getAll(roomID : Int) : LiveData<List<Bookmark>>

@Query("SELECT count(*) FROM BOOKMARK")
fun getAllCount() : Int

@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insert(bookmark : Bookmark)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AddBookmarkActivity : AppCompatActivity() {

val r = Runnable {
val bookmark = Bookmark(
1,
AppDatabase.getInstance(this).BookmarkDao().getAllCount() + 1,
roomId,
bookmark_input.text.toString(),
bookmark_contents.text.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class BookmarkActivity : AppCompatActivity() {

AppDatabase.getInstance(this).BookmarkDao().getAll(roomId).observe(this) {
bookmarkList = it as ArrayList<Bookmark>;
Log.e("isis", it[0].toString())


total_bookmark_nums.text = bookmarkList.size.toString();
// 북마크 갯수 출력
Expand Down

0 comments on commit ee6affa

Please sign in to comment.