diff --git a/app/build.gradle b/app/build.gradle
index 82aa929..97ec2a0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,7 +56,6 @@
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
diff --git a/app/build.gradle b/app/build.gradle
index 82aa929..97ec2a0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,7 +56,6 @@
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
index 50169c9..d51f62e 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
@@ -25,7 +25,7 @@
val context = parent.context
val inflater = LayoutInflater.from(context)
val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
- return InstrumentViewHolder(binding, this.parent.childFragmentManager)
+ return InstrumentViewHolder(binding, this.parent.childFragmentManager, this)
}
override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
diff --git a/app/build.gradle b/app/build.gradle
index 82aa929..97ec2a0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,7 +56,6 @@
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
index 50169c9..d51f62e 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
@@ -25,7 +25,7 @@
val context = parent.context
val inflater = LayoutInflater.from(context)
val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
- return InstrumentViewHolder(binding, this.parent.childFragmentManager)
+ return InstrumentViewHolder(binding, this.parent.childFragmentManager, this)
}
override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
index 01faccf..b0ec2c5 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
@@ -22,7 +22,8 @@
class InstrumentViewHolder(
val binding: FragmentInstrumentBinding,
- private val childFragmentManager: FragmentManager
+ private val childFragmentManager: FragmentManager,
+ private val adapter: InstrumentAdapter
) :
RecyclerView.ViewHolder(binding.root) {
init {
@@ -55,6 +56,11 @@
Song.currentSong.soloInstrument = null
}
}
+ binding.deleteButton.setOnClickListener {
+ val index = Instrument.instruments.indexOf(instrument)
+ Instrument.instruments -= instrument!!
+ adapter.notifyItemRemoved(index)
+ }
}
companion object {
diff --git a/app/build.gradle b/app/build.gradle
index 82aa929..97ec2a0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,7 +56,6 @@
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
index 50169c9..d51f62e 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
@@ -25,7 +25,7 @@
val context = parent.context
val inflater = LayoutInflater.from(context)
val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
- return InstrumentViewHolder(binding, this.parent.childFragmentManager)
+ return InstrumentViewHolder(binding, this.parent.childFragmentManager, this)
}
override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
index 01faccf..b0ec2c5 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
@@ -22,7 +22,8 @@
class InstrumentViewHolder(
val binding: FragmentInstrumentBinding,
- private val childFragmentManager: FragmentManager
+ private val childFragmentManager: FragmentManager,
+ private val adapter: InstrumentAdapter
) :
RecyclerView.ViewHolder(binding.root) {
init {
@@ -55,6 +56,11 @@
Song.currentSong.soloInstrument = null
}
}
+ binding.deleteButton.setOnClickListener {
+ val index = Instrument.instruments.indexOf(instrument)
+ Instrument.instruments -= instrument!!
+ adapter.notifyItemRemoved(index)
+ }
}
companion object {
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
index 98ebf5b..c0d534a 100644
--- a/app/src/main/res/layout/fragment_instrument.xml
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -72,6 +72,19 @@
app:layout_constraintStart_toEndOf="@+id/muteButton"
app:layout_constraintTop_toTopOf="@+id/editInstrumentButton" />
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 82aa929..97ec2a0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,7 +56,6 @@
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
index 50169c9..d51f62e 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
@@ -25,7 +25,7 @@
val context = parent.context
val inflater = LayoutInflater.from(context)
val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
- return InstrumentViewHolder(binding, this.parent.childFragmentManager)
+ return InstrumentViewHolder(binding, this.parent.childFragmentManager, this)
}
override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
index 01faccf..b0ec2c5 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
@@ -22,7 +22,8 @@
class InstrumentViewHolder(
val binding: FragmentInstrumentBinding,
- private val childFragmentManager: FragmentManager
+ private val childFragmentManager: FragmentManager,
+ private val adapter: InstrumentAdapter
) :
RecyclerView.ViewHolder(binding.root) {
init {
@@ -55,6 +56,11 @@
Song.currentSong.soloInstrument = null
}
}
+ binding.deleteButton.setOnClickListener {
+ val index = Instrument.instruments.indexOf(instrument)
+ Instrument.instruments -= instrument!!
+ adapter.notifyItemRemoved(index)
+ }
}
companion object {
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
index 98ebf5b..c0d534a 100644
--- a/app/src/main/res/layout/fragment_instrument.xml
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -72,6 +72,19 @@
app:layout_constraintStart_toEndOf="@+id/muteButton"
app:layout_constraintTop_toTopOf="@+id/editInstrumentButton" />
+
+
\ 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
index 359c157..3e0a187 100644
--- a/app/src/main/res/values-night/styles.xml
+++ b/app/src/main/res/values-night/styles.xml
@@ -12,6 +12,5 @@
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 82aa929..97ec2a0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,7 +56,6 @@
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
index 50169c9..d51f62e 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
@@ -25,7 +25,7 @@
val context = parent.context
val inflater = LayoutInflater.from(context)
val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
- return InstrumentViewHolder(binding, this.parent.childFragmentManager)
+ return InstrumentViewHolder(binding, this.parent.childFragmentManager, this)
}
override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
index 01faccf..b0ec2c5 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
@@ -22,7 +22,8 @@
class InstrumentViewHolder(
val binding: FragmentInstrumentBinding,
- private val childFragmentManager: FragmentManager
+ private val childFragmentManager: FragmentManager,
+ private val adapter: InstrumentAdapter
) :
RecyclerView.ViewHolder(binding.root) {
init {
@@ -55,6 +56,11 @@
Song.currentSong.soloInstrument = null
}
}
+ binding.deleteButton.setOnClickListener {
+ val index = Instrument.instruments.indexOf(instrument)
+ Instrument.instruments -= instrument!!
+ adapter.notifyItemRemoved(index)
+ }
}
companion object {
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
index 98ebf5b..c0d534a 100644
--- a/app/src/main/res/layout/fragment_instrument.xml
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -72,6 +72,19 @@
app:layout_constraintStart_toEndOf="@+id/muteButton"
app:layout_constraintTop_toTopOf="@+id/editInstrumentButton" />
+
+
\ 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
index 359c157..3e0a187 100644
--- a/app/src/main/res/values-night/styles.xml
+++ b/app/src/main/res/values-night/styles.xml
@@ -12,6 +12,5 @@
\ 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
deleted file mode 100644
index de2c486..0000000
--- a/app/src/main/res/values/attrs_instrument_view.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 82aa929..97ec2a0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,7 +56,6 @@
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
index 50169c9..d51f62e 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
@@ -25,7 +25,7 @@
val context = parent.context
val inflater = LayoutInflater.from(context)
val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
- return InstrumentViewHolder(binding, this.parent.childFragmentManager)
+ return InstrumentViewHolder(binding, this.parent.childFragmentManager, this)
}
override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
index 01faccf..b0ec2c5 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
@@ -22,7 +22,8 @@
class InstrumentViewHolder(
val binding: FragmentInstrumentBinding,
- private val childFragmentManager: FragmentManager
+ private val childFragmentManager: FragmentManager,
+ private val adapter: InstrumentAdapter
) :
RecyclerView.ViewHolder(binding.root) {
init {
@@ -55,6 +56,11 @@
Song.currentSong.soloInstrument = null
}
}
+ binding.deleteButton.setOnClickListener {
+ val index = Instrument.instruments.indexOf(instrument)
+ Instrument.instruments -= instrument!!
+ adapter.notifyItemRemoved(index)
+ }
}
companion object {
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
index 98ebf5b..c0d534a 100644
--- a/app/src/main/res/layout/fragment_instrument.xml
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -72,6 +72,19 @@
app:layout_constraintStart_toEndOf="@+id/muteButton"
app:layout_constraintTop_toTopOf="@+id/editInstrumentButton" />
+
+
\ 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
index 359c157..3e0a187 100644
--- a/app/src/main/res/values-night/styles.xml
+++ b/app/src/main/res/values-night/styles.xml
@@ -12,6 +12,5 @@
\ 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
deleted file mode 100644
index de2c486..0000000
--- a/app/src/main/res/values/attrs_instrument_view.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8073634..b493089 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -40,4 +40,5 @@
Waveform:
Voice:
Add a new instrument
+ Delete this instrument
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 82aa929..97ec2a0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -56,7 +56,6 @@
}
dependencies {
-
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.6.1'
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
index 50169c9..d51f62e 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentAdapter.kt
@@ -25,7 +25,7 @@
val context = parent.context
val inflater = LayoutInflater.from(context)
val binding = FragmentInstrumentBinding.inflate(inflater, parent, false)
- return InstrumentViewHolder(binding, this.parent.childFragmentManager)
+ return InstrumentViewHolder(binding, this.parent.childFragmentManager, this)
}
override fun onBindViewHolder(holder: InstrumentViewHolder, position: Int) {
diff --git a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
index 01faccf..b0ec2c5 100644
--- a/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
+++ b/app/src/main/java/com/lukas/music/ui/adapters/InstrumentViewHolder.kt
@@ -22,7 +22,8 @@
class InstrumentViewHolder(
val binding: FragmentInstrumentBinding,
- private val childFragmentManager: FragmentManager
+ private val childFragmentManager: FragmentManager,
+ private val adapter: InstrumentAdapter
) :
RecyclerView.ViewHolder(binding.root) {
init {
@@ -55,6 +56,11 @@
Song.currentSong.soloInstrument = null
}
}
+ binding.deleteButton.setOnClickListener {
+ val index = Instrument.instruments.indexOf(instrument)
+ Instrument.instruments -= instrument!!
+ adapter.notifyItemRemoved(index)
+ }
}
companion object {
diff --git a/app/src/main/res/layout/fragment_instrument.xml b/app/src/main/res/layout/fragment_instrument.xml
index 98ebf5b..c0d534a 100644
--- a/app/src/main/res/layout/fragment_instrument.xml
+++ b/app/src/main/res/layout/fragment_instrument.xml
@@ -72,6 +72,19 @@
app:layout_constraintStart_toEndOf="@+id/muteButton"
app:layout_constraintTop_toTopOf="@+id/editInstrumentButton" />
+
+
\ 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
index 359c157..3e0a187 100644
--- a/app/src/main/res/values-night/styles.xml
+++ b/app/src/main/res/values-night/styles.xml
@@ -12,6 +12,5 @@
\ 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
deleted file mode 100644
index de2c486..0000000
--- a/app/src/main/res/values/attrs_instrument_view.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8073634..b493089 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -40,4 +40,5 @@
Waveform:
Voice:
Add a new instrument
+ Delete this instrument
\ No newline at end of file
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 9fe8efb..5f0d5d3 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -12,6 +12,5 @@
\ No newline at end of file