Skip to content

Commit 31e9e80

Browse files
Fix Kotlin compilation errors in old Visual Editor files
- Update BlocksAdapter to use new layout IDs (tvBlockName instead of tvBlockIcon/tvBlockTitle) - Remove references to non-existent blockContainer and childrenIndicator - Fix paramsContainer reference to layoutParameters in VisualEditorActivity - Simplify BlocksAdapter ViewHolder to match new layout structure Co-authored-by: ARTEMKOPIK <artemkozhin80@gmail.com>
1 parent e7293b6 commit 31e9e80

File tree

2 files changed

+3
-34
lines changed

2 files changed

+3
-34
lines changed

app/src/main/java/com/autoclicker/app/visual/BlocksAdapter.kt

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
package com.autoclicker.app.visual
22

3-
import android.graphics.Color
4-
import android.graphics.drawable.GradientDrawable
53
import android.view.LayoutInflater
64
import android.view.View
75
import android.view.ViewGroup
86
import android.widget.ImageButton
9-
import android.widget.LinearLayout
107
import android.widget.TextView
118
import androidx.recyclerview.widget.RecyclerView
129
import com.autoclicker.app.R
@@ -31,16 +28,12 @@ class BlocksAdapter(
3128
override fun getItemCount() = blocks.size
3229

3330
inner class BlockViewHolder(view: View) : RecyclerView.ViewHolder(view) {
34-
private val blockContainer: LinearLayout = view.findViewById(R.id.blockContainer)
35-
private val tvIcon: TextView = view.findViewById(R.id.tvBlockIcon)
36-
private val tvTitle: TextView = view.findViewById(R.id.tvBlockTitle)
31+
private val tvTitle: TextView = view.findViewById(R.id.tvBlockName)
3732
private val tvParams: TextView = view.findViewById(R.id.tvBlockParams)
3833
private val btnDelete: ImageButton = view.findViewById(R.id.btnDeleteBlock)
39-
private val childrenIndicator: View = view.findViewById(R.id.childrenIndicator)
4034

4135
fun bind(block: ScriptBlock, position: Int) {
42-
tvIcon.text = block.type.icon
43-
tvTitle.text = block.type.title
36+
tvTitle.text = "${block.type.icon} ${block.type.title}"
4437

4538
// Показываем параметры
4639
val paramsText = block.params.entries
@@ -49,30 +42,6 @@ class BlocksAdapter(
4942
tvParams.text = paramsText
5043
tvParams.visibility = if (paramsText.isEmpty()) View.GONE else View.VISIBLE
5144

52-
// Цвет блока по категории
53-
val color = try {
54-
Color.parseColor(block.type.category.color)
55-
} catch (e: Exception) {
56-
Color.parseColor("#8B5CF6")
57-
}
58-
59-
(blockContainer.background as? GradientDrawable)?.apply {
60-
setStroke(2, color)
61-
} ?: run {
62-
val drawable = GradientDrawable().apply {
63-
cornerRadius = 16f * itemView.context.resources.displayMetrics.density
64-
setColor(Color.parseColor("#1A1A24"))
65-
setStroke(2, color)
66-
}
67-
blockContainer.background = drawable
68-
}
69-
70-
// Индикатор вложенных блоков
71-
childrenIndicator.visibility = if (block.type.hasChildren) View.VISIBLE else View.GONE
72-
if (block.type.hasChildren) {
73-
childrenIndicator.setBackgroundColor(color)
74-
}
75-
7645
// Клики
7746
itemView.setOnClickListener { onBlockClick(block, position) }
7847
btnDelete.setOnClickListener { onBlockDelete(position) }

app/src/main/java/com/autoclicker/app/visual/VisualEditorActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class VisualEditorActivity : BaseActivity() {
257257
private fun showEditBlockDialog(block: ScriptBlock, position: Int) {
258258
val dialogView = layoutInflater.inflate(R.layout.dialog_edit_block, null)
259259
val tvBlockTitle = dialogView.findViewById<TextView>(R.id.tvBlockTitle)
260-
val paramsContainer = dialogView.findViewById<LinearLayout>(R.id.paramsContainer)
260+
val paramsContainer = dialogView.findViewById<LinearLayout>(R.id.layoutParameters)
261261

262262
tvBlockTitle.text = "${block.type.icon} ${block.type.title}"
263263

0 commit comments

Comments
 (0)