Skip to content

Commit

Permalink
remove Dotted line
Browse files Browse the repository at this point in the history
  • Loading branch information
BrayanDSO committed Dec 25, 2024
1 parent a711700 commit da0d221
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import android.text.TextUtils
import android.util.AttributeSet
import android.view.View
import android.widget.ArrayAdapter
import android.widget.LinearLayout
import android.widget.ListView
import androidx.appcompat.app.AlertDialog
import androidx.core.view.isVisible
Expand Down Expand Up @@ -219,15 +218,16 @@ class ControlPreferenceDialogFragment : DialogFragment() {

private fun setupRemoveControlEntries(view: View) {
val bindings = preference.getMappableBindings().toMutableList()
val listView = view.findViewById<ListView>(R.id.list_view)
if (bindings.isEmpty()) {
view.findViewById<LinearLayout>(R.id.remove_layout).isVisible = false
listView.isVisible = false
return
}
val titles =
bindings.map {
getString(R.string.binding_remove_binding, it.toDisplayString(requireContext()))
}
view.findViewById<ListView>(R.id.list_view).apply {
listView.apply {
adapter = ArrayAdapter(requireContext(), R.layout.control_preference_list_item, titles)
setOnItemClickListener { _, _, index, _ ->
bindings.removeAt(index)
Expand Down
9 changes: 0 additions & 9 deletions AnkiDroid/src/main/res/drawable/dotted_line.xml

This file was deleted.

23 changes: 4 additions & 19 deletions AnkiDroid/src/main/res/layout/control_preference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,25 +52,10 @@
android:textAppearance="?attr/textAppearanceBodyLarge"
/>

<LinearLayout
android:id="@+id/remove_layout"
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<View
android:layout_width="match_parent"
android:layout_height="8dp"
android:background="@drawable/dotted_line"
android:layout_marginHorizontal="32dp"
android:layout_marginVertical="4dp"/>

<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="@null"
/>

</LinearLayout>
android:divider="@null"
/>
</LinearLayout>

0 comments on commit da0d221

Please sign in to comment.