diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20__8_09__Changes_1.xml b/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20__8_09__Changes_1.xml
deleted file mode 100644
index 22d0758..0000000
--- a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20__8_09__Changes_1.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20__8_10__Changes_.xml b/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20__8_10__Changes_.xml
deleted file mode 100644
index 23a2159..0000000
--- a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20__8_10__Changes_.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git "a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20_\354\230\244\355\233\204_8_09_[Changes]1/shelved.patch" "b/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20_\354\230\244\355\233\204_8_09_[Changes]1/shelved.patch"
deleted file mode 100644
index a8e9477..0000000
--- "a/.idea/shelf/Uncommitted_changes_before_Checkout_at_2024-04-20_\354\230\244\355\233\204_8_09_[Changes]1/shelved.patch"
+++ /dev/null
@@ -1,95 +0,0 @@
-Index: UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt
-IDEA additional info:
-Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
-<+>package com.example.umc_6th\r\n\r\nimport android.os.Bundle\r\nimport androidx.fragment.app.Fragment\r\nimport android.view.LayoutInflater\r\nimport android.view.View\r\nimport android.view.ViewGroup\r\nimport androidx.core.os.bundleOf\r\nimport androidx.fragment.app.setFragmentResult\r\nimport com.example.umc_6th.databinding.FragmentHomeBinding\r\n\r\nclass HomeFragment : Fragment() {\r\n\r\n lateinit var binding : FragmentHomeBinding\r\n\r\n override fun onCreate(savedInstanceState: Bundle?) {\r\n super.onCreate(savedInstanceState)\r\n }\r\n\r\n override fun onCreateView(\r\n inflater: LayoutInflater, container: ViewGroup?,\r\n savedInstanceState: Bundle?\r\n ): View? {\r\n binding = FragmentHomeBinding.inflate(inflater, container, false)\r\n\r\n binding.homeAlbumImgIv1.setOnClickListener {\r\n setFragmentResult(\"TitleInfo\", bundleOf(\"title\" to binding.titleLilac.text.toString()))\r\n setFragmentResult(\"SingerInfo\", bundleOf(\"singer\" to binding.singerIu.text.toString()))\r\n\r\n (context as MainActivity)\r\n .supportFragmentManager.beginTransaction()\r\n .replace(R.id.main_frm, AlbumFragment()).commitAllowingStateLoss()\r\n }\r\n return binding.root\r\n }\r\n}
-Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
-<+>UTF-8
-===================================================================
-diff --git a/UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt b/UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt
---- a/UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt
-+++ b/UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt
-@@ -32,5 +32,7 @@
- .replace(R.id.main_frm, AlbumFragment()).commitAllowingStateLoss()
- }
- return binding.root
-+
-+
- }
- }
-\ No newline at end of file
-Index: UMC_6th/app/src/main/res/layout/fragment_home.xml
-IDEA additional info:
-Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
-<+>\r\n\r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
-Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
-<+>UTF-8
-===================================================================
-diff --git a/UMC_6th/app/src/main/res/layout/fragment_home.xml b/UMC_6th/app/src/main/res/layout/fragment_home.xml
---- a/UMC_6th/app/src/main/res/layout/fragment_home.xml
-+++ b/UMC_6th/app/src/main/res/layout/fragment_home.xml
-@@ -11,15 +11,15 @@
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
--
-+ app:layout_constraintTop_toTopOf="parent"/>
-
-
-
-
-+ app:layout_constraintTop_toBottomOf="@id/home_pannel_background_vp"/>
-
-
-+ app:layout_constraintTop_toBottomOf="@id/home_pannel_background_vp"/>
-
-
-+ app:layout_constraintTop_toBottomOf="@id/home_pannel_background_vp"/>
-
-
-+ app:layout_constraintTop_toBottomOf="@id/home_pannel_background_vp"/>
-
- package com.example.umc_6th\r\n\r\nimport android.os.Bundle\r\nimport androidx.fragment.app.Fragment\r\nimport android.view.LayoutInflater\r\nimport android.view.View\r\nimport android.view.ViewGroup\r\nimport androidx.core.os.bundleOf\r\nimport androidx.fragment.app.setFragmentResult\r\nimport androidx.viewpager2.widget.ViewPager2\r\nimport com.example.umc_6th.databinding.FragmentHomeBinding\r\n\r\nclass HomeFragment : Fragment() {\r\n\r\n lateinit var binding : FragmentHomeBinding\r\n\r\n\r\n override fun onCreate(savedInstanceState: Bundle?) {\r\n super.onCreate(savedInstanceState)\r\n }\r\n\r\n override fun onCreateView(\r\n inflater: LayoutInflater, container: ViewGroup?,\r\n savedInstanceState: Bundle?\r\n ): View? {\r\n binding = FragmentHomeBinding.inflate(inflater, container, false)\r\n\r\n binding.homeAlbumImgIv1.setOnClickListener {\r\n setFragmentResult(\"TitleInfo\", bundleOf(\"title\" to binding.titleLilac.text.toString()))\r\n setFragmentResult(\"SingerInfo\", bundleOf(\"singer\" to binding.singerIu.text.toString()))\r\n\r\n (context as MainActivity)\r\n .supportFragmentManager.beginTransaction()\r\n .replace(R.id.main_frm, AlbumFragment()).commitAllowingStateLoss()\r\n }\r\n\r\n val bannerAdapter = BannerVPAdapter(this)\r\n bannerAdapter.addFragment(BannerFragment(R.drawable.img_home_viewpager_exp))\r\n bannerAdapter.addFragment(BannerFragment(R.drawable.img_home_viewpager_exp2))\r\n binding.homeBannerVp.adapter = bannerAdapter\r\n binding.homeBannerVp.orientation = ViewPager2.ORIENTATION_HORIZONTAL\r\n\r\n return binding.root\r\n }\r\n}
-Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
-<+>UTF-8
-===================================================================
-diff --git a/UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt b/UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt
---- a/UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt (revision b1026ff4cff5c29159da84eb52592a6e3142581b)
-+++ b/UMC_6th/app/src/main/java/com/example/umc_6th/HomeFragment.kt (date 1713611347065)
-@@ -41,5 +41,7 @@
- binding.homeBannerVp.orientation = ViewPager2.ORIENTATION_HORIZONTAL
-
- return binding.root
-+
-+
- }
- }
-\ No newline at end of file
-Index: UMC_6th/app/src/main/res/layout/fragment_home.xml
-IDEA additional info:
-Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
-<+>\r\n\r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n \r\n\r\n
-Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
-<+>UTF-8
-===================================================================
-diff --git a/UMC_6th/app/src/main/res/layout/fragment_home.xml b/UMC_6th/app/src/main/res/layout/fragment_home.xml
---- a/UMC_6th/app/src/main/res/layout/fragment_home.xml (revision b1026ff4cff5c29159da84eb52592a6e3142581b)
-+++ b/UMC_6th/app/src/main/res/layout/fragment_home.xml (date 1713611347073)
-@@ -11,15 +11,15 @@
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
--
-+ app:layout_constraintTop_toTopOf="parent"/>
-
-
-
-
-+ app:layout_constraintTop_toBottomOf="@id/home_pannel_background_vp"/>
-
-
-+ app:layout_constraintTop_toBottomOf="@id/home_pannel_background_vp"/>
-
-
-+ app:layout_constraintTop_toBottomOf="@id/home_pannel_background_vp"/>
-
-
-+ app:layout_constraintTop_toBottomOf="@id/home_pannel_background_vp"/>
-
- @style/Theme.UMC_6th
+
+
+ @style/Theme.UMC_6th
+
+
@style/Theme.UMC_6th
@@ -91,9 +96,17 @@
-
+
+
+
+
+
-
+
+
+
+
+
@@ -103,7 +116,7 @@
-
+
@@ -130,11 +143,11 @@
@@ -154,7 +167,7 @@
@@ -198,28 +211,28 @@
- {
- "keyToString": {
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "RunOnceActivity.cidr.known.project.marker": "true",
- "SHARE_PROJECT_CONFIGURATION_FILES": "true",
- "cf.first.check.clang-format": "false",
- "cidr.known.project.marker": "true",
- "git-widget-placeholder": "maro/#13",
- "last_opened_file_path": "C:/android/MARO_HW1/UMC_6th/app/src/main/res/drawable",
- "project.structure.last.edited": "Modules",
- "project.structure.proportion": "0.17",
- "project.structure.side.proportion": "0.2",
- "settings.editor.selected.configurable": "configurable.group.appearance"
+
+}]]>
@@ -663,7 +676,23 @@
1713619638120
-
+
+
+ 1713629487729
+
+
+
+ 1713629487729
+
+
+
+ 1713629535223
+
+
+
+ 1713629535223
+
+
@@ -699,6 +728,7 @@
-
+
+
\ No newline at end of file
diff --git a/UMC_6th/app/src/main/AndroidManifest.xml b/UMC_6th/app/src/main/AndroidManifest.xml
index eee2f74..ef2aee8 100644
--- a/UMC_6th/app/src/main/AndroidManifest.xml
+++ b/UMC_6th/app/src/main/AndroidManifest.xml
@@ -13,17 +13,21 @@
android:theme="@style/Theme.UMC_6th"
tools:targetApi="31">
-
+
+
+
\ No newline at end of file
diff --git a/UMC_6th/app/src/main/java/com/example/umc_6th/MainActivity.kt b/UMC_6th/app/src/main/java/com/example/umc_6th/MainActivity.kt
index 7b4292f..e929398 100644
--- a/UMC_6th/app/src/main/java/com/example/umc_6th/MainActivity.kt
+++ b/UMC_6th/app/src/main/java/com/example/umc_6th/MainActivity.kt
@@ -42,6 +42,9 @@ class MainActivity : AppCompatActivity() {
val intent = Intent(this, SongActivity::class.java)
intent.putExtra("title", song.title)
intent.putExtra("singer", song.singer)
+ intent.putExtra("second", song.second)
+ intent.putExtra("playTime", song.playTime)
+ intent.putExtra("isPlaying", song.isPlaying)
activityResultLauncher.launch(intent)
}
}
diff --git a/UMC_6th/app/src/main/java/com/example/umc_6th/SongActivity.kt b/UMC_6th/app/src/main/java/com/example/umc_6th/SongActivity.kt
index dbb9c6a..2765905 100644
--- a/UMC_6th/app/src/main/java/com/example/umc_6th/SongActivity.kt
+++ b/UMC_6th/app/src/main/java/com/example/umc_6th/SongActivity.kt
@@ -3,19 +3,26 @@ package com.example.umc_6th
import android.content.Intent
import android.os.Bundle
import android.os.PersistableBundle
+import android.util.Log
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.example.umc_6th.databinding.ActivitySongBinding
+import java.util.Timer
class SongActivity : AppCompatActivity() {
lateinit var binding : ActivitySongBinding
+ lateinit var song : Song
+ lateinit var timer : Timer
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivitySongBinding.inflate(layoutInflater)
setContentView(binding.root)
+ initSong()
+ setPlayer(song)
+
var title : String? = null
var singer : String? = null
@@ -40,10 +47,35 @@ class SongActivity : AppCompatActivity() {
binding.songPauseIv.setOnClickListener {
setPlayerStatus(false)
}
+ }
+ private fun initSong() {
+ if(intent.hasExtra("title") && intent.hasExtra("singer")) {
+ song = Song(
+ intent.getStringExtra("title")!!,
+ intent.getStringExtra("singer")!!,
+ intent.getIntExtra("second", 0),
+ intent.getIntExtra("playTime", 0),
+ intent.getBooleanExtra("isPlaying", false)
+ )
+ }
+ startTimer()
+ }
+ private fun startTimer() {
+ timer = Timer(song.playTime, song.isPlaying)
+ timer.start()
}
+ private fun setPlayer(song : Song) {
+ binding.songMusicTitleTv.text = intent.getStringExtra("title")!!
+ binding.songSingerNameTv.text = intent.getStringExtra("singer")!!
+ binding.songStartTimeTv.text = String.format("%02d:%02d", song.second / 60, song.second % 60)
+ binding.songEndTimeTv.text = String.format("%02d:%02d", song.playTime / 60, song.playTime % 60)
+ binding.songProgressSb.progress = (song.second * 1000 / song.playTime)
+
+ setPlayerStatus(song.isPlaying)
+ }
fun setPlayerStatus (isPlaying : Boolean){
@@ -55,4 +87,45 @@ class SongActivity : AppCompatActivity() {
binding.songPauseIv.visibility = View.GONE
}
}
+
+ inner class Timer(private val playTime: Int,var isPlaying: Boolean = true):Thread() {
+
+ private var second: Int = 0
+ private var mills: Float = 0f
+
+ override fun run() {
+ super.run()
+ try {
+ while (true) {
+
+ if (second >= playTime) {
+ break
+ }
+
+ if (isPlaying) {
+ sleep(50)
+ mills += 50
+
+ runOnUiThread {
+ binding.songProgressSb.progress = ((mills / playTime) * 100).toInt()
+ }
+
+ if (mills % 1000 == 0f) {
+ runOnUiThread {
+ binding.songStartTimeTv.text =
+ String.format("%02d:%02d", second / 60, second % 60)
+ }
+ second++
+ }
+
+ }
+
+ }
+
+ } catch (e: InterruptedException) {
+ Log.d("Song", "쓰레드가 죽었습니다. ${e.message}")
+ }
+
+ }
+ }
}
\ No newline at end of file
diff --git a/UMC_6th/app/src/main/java/com/example/umc_6th/song.kt b/UMC_6th/app/src/main/java/com/example/umc_6th/song.kt
index 00b2ab9..faf7ffd 100644
--- a/UMC_6th/app/src/main/java/com/example/umc_6th/song.kt
+++ b/UMC_6th/app/src/main/java/com/example/umc_6th/song.kt
@@ -2,5 +2,8 @@ package com.example.umc_6th
data class Song(
val title : String = "",
- val singer : String = ""
+ val singer : String = "",
+ var second : Int = 0,
+ var playTime : Int = 60,
+ var isPlaying : Boolean = false
)
diff --git a/UMC_6th/app/src/main/res/layout/activity_song.xml b/UMC_6th/app/src/main/res/layout/activity_song.xml
index 0e186c6..db15b4f 100644
--- a/UMC_6th/app/src/main/res/layout/activity_song.xml
+++ b/UMC_6th/app/src/main/res/layout/activity_song.xml
@@ -149,7 +149,7 @@
+ app:layout_constraintTop_toBottomOf="@+id/song_like_iv_layout" />