-
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.
Browse files
Browse the repository at this point in the history
[kara/#33] feat : 7주차 구현
- Loading branch information
Showing
26 changed files
with
572 additions
and
170 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
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.myfirstapp | ||
|
||
import androidx.room.Entity | ||
import androidx.room.PrimaryKey | ||
|
||
@Entity(tableName = "AlbumTable") | ||
data class Album( | ||
var title : String? = "", | ||
var singer : String? = "", | ||
var coverImage : Int? = null, | ||
var songs: ArrayList<Song>? = null // 앨범 수록곡 | ||
) | ||
@PrimaryKey(autoGenerate = false) var id: Int = 0, | ||
var title: String? = "", | ||
var singer: String? = "", | ||
var coverImg: Int? = null | ||
) |
21 changes: 21 additions & 0 deletions
21
UMC_6th/app/src/main/java/com/example/myfirstapp/AlbumDao.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,21 @@ | ||
package com.example.myfirstapp | ||
|
||
import androidx.room.* | ||
|
||
@Dao | ||
interface AlbumDao { | ||
@Insert | ||
fun insert(album: Album) | ||
|
||
@Update | ||
fun update(album: Album) | ||
|
||
@Delete | ||
fun delete(album: Album) | ||
|
||
@Query("SELECT * FROM AlbumTable") // 테이블의 모든 값을 가져와라 | ||
fun getAlbums(): List<Album> | ||
|
||
@Query("SELECT * FROM AlbumTable WHERE id = :id") | ||
fun getAlbum(id: Int): Album | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package com.example.myfirstapp | ||
|
||
object Constant { | ||
const val CHANNEL_ID = "ch123" | ||
const val MUSIC_NOTIFICATION_ID = 123 | ||
} |
49 changes: 49 additions & 0 deletions
49
UMC_6th/app/src/main/java/com/example/myfirstapp/CustomSnackbar.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,49 @@ | ||
package com.example.myfirstapp | ||
|
||
import android.view.LayoutInflater | ||
import android.view.View | ||
import androidx.core.content.ContextCompat | ||
import androidx.databinding.DataBindingUtil | ||
import com.example.myfirstapp.databinding.CustomSnackbarBinding | ||
import com.google.android.material.snackbar.Snackbar | ||
|
||
class CustomSnackbar(view: View, private val message: String) { | ||
|
||
companion object { | ||
|
||
fun make(view: View, message: String) = CustomSnackbar(view, message) | ||
} | ||
|
||
private val context = view.context | ||
private val snackbar = Snackbar.make(view, "", 5000) | ||
private val snackbarLayout = snackbar.view as Snackbar.SnackbarLayout | ||
|
||
private val inflater = LayoutInflater.from(context) | ||
private val snackbarBinding: CustomSnackbarBinding | ||
= DataBindingUtil.inflate(inflater, R.layout.custom_snackbar, null, false) | ||
|
||
init { | ||
initView() | ||
initData() | ||
} | ||
|
||
private fun initView() { | ||
with(snackbarLayout) { | ||
removeAllViews() | ||
setPadding(0, 0, 0, 0) | ||
setBackgroundColor(ContextCompat.getColor(context, android.R.color.transparent)) | ||
addView(snackbarBinding.root, 0) | ||
} | ||
} | ||
|
||
private fun initData() { | ||
snackbarBinding.customSnackbarTv.text = message | ||
snackbarBinding.customSnackbarBtn.setOnClickListener { | ||
// OK 버튼을 클릭했을 때 실행할 동작을 정의할 수 있다. | ||
} | ||
} | ||
|
||
fun show() { | ||
snackbar.show() | ||
} | ||
} |
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
Oops, something went wrong.