diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
index 5a3abe0..cee2515 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
@@ -26,13 +26,4 @@
}
return binding.root
}
-
- companion object {
- @JvmStatic
- fun newInstance() =
- PlayFragment().apply {
- arguments = Bundle().apply {
- }
- }
- }
}
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
index 5a3abe0..cee2515 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
@@ -26,13 +26,4 @@
}
return binding.root
}
-
- companion object {
- @JvmStatic
- fun newInstance() =
- PlayFragment().apply {
- arguments = Bundle().apply {
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 12d00ae..1992e0f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,6 +22,11 @@
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
index 5a3abe0..cee2515 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
@@ -26,13 +26,4 @@
}
return binding.root
}
-
- companion object {
- @JvmStatic
- fun newInstance() =
- PlayFragment().apply {
- arguments = Bundle().apply {
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 12d00ae..1992e0f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,6 +22,11 @@
+
+
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
new file mode 100644
index 0000000..e29a9b2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
index 5a3abe0..cee2515 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
@@ -26,13 +26,4 @@
}
return binding.root
}
-
- companion object {
- @JvmStatic
- fun newInstance() =
- PlayFragment().apply {
- arguments = Bundle().apply {
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 12d00ae..1992e0f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,6 +22,11 @@
+
+
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
new file mode 100644
index 0000000..e29a9b2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_instrument_list.xml b/app/src/main/res/layout/fragment_instrument_list.xml
new file mode 100644
index 0000000..4661fb3
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument_list.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
index 5a3abe0..cee2515 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
@@ -26,13 +26,4 @@
}
return binding.root
}
-
- companion object {
- @JvmStatic
- fun newInstance() =
- PlayFragment().apply {
- arguments = Bundle().apply {
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 12d00ae..1992e0f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,6 +22,11 @@
+
+
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
new file mode 100644
index 0000000..e29a9b2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_instrument_list.xml b/app/src/main/res/layout/fragment_instrument_list.xml
new file mode 100644
index 0000000..4661fb3
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument_list.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/sample_instrument_view.xml b/app/src/main/res/layout/sample_instrument_view.xml
new file mode 100644
index 0000000..f6620a6
--- /dev/null
+++ b/app/src/main/res/layout/sample_instrument_view.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
index 5a3abe0..cee2515 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
@@ -26,13 +26,4 @@
}
return binding.root
}
-
- companion object {
- @JvmStatic
- fun newInstance() =
- PlayFragment().apply {
- arguments = Bundle().apply {
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 12d00ae..1992e0f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,6 +22,11 @@
+
+
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
new file mode 100644
index 0000000..e29a9b2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_instrument_list.xml b/app/src/main/res/layout/fragment_instrument_list.xml
new file mode 100644
index 0000000..4661fb3
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument_list.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/sample_instrument_view.xml b/app/src/main/res/layout/sample_instrument_view.xml
new file mode 100644
index 0000000..f6620a6
--- /dev/null
+++ b/app/src/main/res/layout/sample_instrument_view.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..da06d7a
--- /dev/null
+++ b/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
index 5a3abe0..cee2515 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
@@ -26,13 +26,4 @@
}
return binding.root
}
-
- companion object {
- @JvmStatic
- fun newInstance() =
- PlayFragment().apply {
- arguments = Bundle().apply {
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 12d00ae..1992e0f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,6 +22,11 @@
+
+
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
new file mode 100644
index 0000000..e29a9b2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_instrument_list.xml b/app/src/main/res/layout/fragment_instrument_list.xml
new file mode 100644
index 0000000..4661fb3
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument_list.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/sample_instrument_view.xml b/app/src/main/res/layout/sample_instrument_view.xml
new file mode 100644
index 0000000..f6620a6
--- /dev/null
+++ b/app/src/main/res/layout/sample_instrument_view.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..da06d7a
--- /dev/null
+++ b/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/attrs_instrument_view.xml b/app/src/main/res/values/attrs_instrument_view.xml
new file mode 100644
index 0000000..8138515
--- /dev/null
+++ b/app/src/main/res/values/attrs_instrument_view.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index b2c2511..a5fe0f9 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,13 +3,17 @@
diff --git a/app/src/main/java/com/lukas/music/InstrumentView.kt b/app/src/main/java/com/lukas/music/InstrumentView.kt
new file mode 100644
index 0000000..6ac6230
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/InstrumentView.kt
@@ -0,0 +1,52 @@
+package com.lukas.music
+
+import android.content.Context
+import android.graphics.Canvas
+import android.util.AttributeSet
+import android.view.View
+import com.lukas.music.ui.fragments.InstrumentFragment
+
+class InstrumentView : View {
+ val fragment = InstrumentFragment()
+
+ constructor(context: Context) : super(context) {
+ init(null, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {
+ init(attrs, 0)
+ }
+
+ constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(
+ context,
+ attrs,
+ defStyle
+ ) {
+ init(attrs, defStyle)
+ }
+
+ private fun init(attrs: AttributeSet?, defStyle: Int) {
+ val a = context.obtainStyledAttributes(
+ attrs, R.styleable.InstrumentView, defStyle, 0
+ )
+
+ a.recycle()
+ }
+
+ override fun onDraw(canvas: Canvas) {
+ super.onDraw(canvas)
+
+ val paddingLeft = paddingLeft
+ val paddingTop = paddingTop
+ val paddingRight = paddingRight
+ val paddingBottom = paddingBottom
+
+ val contentWidth = width - paddingLeft - paddingRight
+ val contentHeight = height - paddingTop - paddingBottom
+ // fragment.view?.left = paddingLeft
+ // fragment.view?.top = paddingTop
+ // fragment.view?.right = paddingLeft + contentWidth
+ // fragment.view?.bottom = paddingTop + contentHeight
+ fragment.view?.draw(canvas)
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/MainActivity.kt b/app/src/main/java/com/lukas/music/MainActivity.kt
index 5602623..abb2312 100644
--- a/app/src/main/java/com/lukas/music/MainActivity.kt
+++ b/app/src/main/java/com/lukas/music/MainActivity.kt
@@ -7,14 +7,14 @@
import com.lukas.music.databinding.ActivityMainBinding
import com.lukas.music.ui.tab.TabAdapter
import com.lukas.music.ui.fragments.CreditsFragment
+import com.lukas.music.ui.fragments.InstrumentListFragment
import com.lukas.music.ui.fragments.PlayFragment
import com.lukas.music.ui.tab.PageListener
import com.lukas.music.ui.tab.TabListener
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
- private val playFragment = PlayFragment()
- private val tabFragments = listOf(playFragment, CreditsFragment())
+ private val tabFragments = listOf(PlayFragment(), InstrumentListFragment(), CreditsFragment())
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
diff --git a/app/src/main/java/com/lukas/music/instruments/Instrument.kt b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
new file mode 100644
index 0000000..080f689
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/instruments/Instrument.kt
@@ -0,0 +1,5 @@
+package com.lukas.music.instruments
+
+class Instrument(val name: String) {
+ val id = 0
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
new file mode 100644
index 0000000..624d911
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/InstrumentAdapter.kt
@@ -0,0 +1,32 @@
+package com.lukas.music.ui
+
+import android.view.LayoutInflater
+import android.view.ViewGroup
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.databinding.FragmentInstrumentBinding
+import com.lukas.music.instruments.Instrument
+
+
+class InstrumentAdapter : RecyclerView.Adapter() {
+ class InstrumentViewHolder(val binding: FragmentInstrumentBinding) :
+ RecyclerView.ViewHolder(binding.root)
+
+ private val instruments =
+ mutableListOf(Instrument("First Instrument"), Instrument("second instrument"))
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): InstrumentViewHolder {
+ val context = parent.context
+ val inflater = LayoutInflater.from(context)
+ val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
+ return InstrumentViewHolder(binding)
+ }
+
+ override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
+ val instrument = instruments[position]
+ holder.binding.instrumentNameText.text = instrument.name
+ }
+
+ override fun getItemCount(): Int {
+ return instruments.size
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
new file mode 100644
index 0000000..66a31d3
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentFragment.kt
@@ -0,0 +1,21 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.fragment.app.Fragment
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentBinding
+
+class InstrumentFragment() : Fragment(R.layout.fragment_instrument) {
+ private lateinit var binding: FragmentInstrumentBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentBinding.inflate(inflater)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
new file mode 100644
index 0000000..4bbc6ba
--- /dev/null
+++ b/app/src/main/java/com/lukas/music/ui/fragments/InstrumentListFragment.kt
@@ -0,0 +1,28 @@
+package com.lukas.music.ui.fragments
+
+import android.os.Bundle
+import androidx.fragment.app.Fragment
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.recyclerview.widget.LinearLayoutManager
+import androidx.recyclerview.widget.RecyclerView
+import com.lukas.music.MainActivity
+import com.lukas.music.R
+import com.lukas.music.databinding.FragmentInstrumentListBinding
+import com.lukas.music.databinding.FragmentPlayBinding
+import com.lukas.music.ui.InstrumentAdapter
+
+class InstrumentListFragment : Fragment() {
+ lateinit var binding: FragmentInstrumentListBinding
+
+ override fun onCreateView(
+ inflater: LayoutInflater, container: ViewGroup?,
+ savedInstanceState: Bundle?
+ ): View? {
+ binding = FragmentInstrumentListBinding.inflate(inflater)
+ binding.recyclerView.adapter = InstrumentAdapter()
+ binding.recyclerView.layoutManager = LinearLayoutManager(context)
+ return binding.root
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
index 5a3abe0..cee2515 100644
--- a/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
+++ b/app/src/main/java/com/lukas/music/ui/fragments/PlayFragment.kt
@@ -26,13 +26,4 @@
}
return binding.root
}
-
- companion object {
- @JvmStatic
- fun newInstance() =
- PlayFragment().apply {
- arguments = Bundle().apply {
- }
- }
- }
}
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 12d00ae..1992e0f 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -22,6 +22,11 @@
+
+
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
new file mode 100644
index 0000000..e29a9b2
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_instrument_list.xml b/app/src/main/res/layout/fragment_instrument_list.xml
new file mode 100644
index 0000000..4661fb3
--- /dev/null
+++ b/app/src/main/res/layout/fragment_instrument_list.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/sample_instrument_view.xml b/app/src/main/res/layout/sample_instrument_view.xml
new file mode 100644
index 0000000..f6620a6
--- /dev/null
+++ b/app/src/main/res/layout/sample_instrument_view.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..da06d7a
--- /dev/null
+++ b/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/attrs_instrument_view.xml b/app/src/main/res/values/attrs_instrument_view.xml
new file mode 100644
index 0000000..8138515
--- /dev/null
+++ b/app/src/main/res/values/attrs_instrument_view.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..d142c10
--- /dev/null
+++ b/app/src/main/res/values/styles.xml
@@ -0,0 +1,7 @@
+
+
+
+
\ No newline at end of file