ListGroupPreference: Fix change items

[Preference.onClick] is apparently not called on [Item]s, though it is
on [AddButton].

Workaround this by listening on click events on the view.
This commit is contained in:
Jules Aguillon 2023-08-10 19:10:32 +02:00
parent 500f4e41d3
commit febc23776f
2 changed files with 18 additions and 11 deletions

View File

@ -193,17 +193,6 @@ public abstract class ListGroupPreference<E> extends PreferenceGroup
setWidgetLayoutResource(R.layout.pref_listgroup_item_widget);
}
@Override
protected void onClick()
{
select(new SelectionCallback<E>() {
public void select(E value)
{
change_item(_index, value);
}
});
}
@Override
protected View onCreateView(ViewGroup parent)
{
@ -217,6 +206,18 @@ public abstract class ListGroupPreference<E> extends PreferenceGroup
remove_item(_index);
}
});
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View _v)
{
select(new SelectionCallback<E>() {
public void select(E value)
{
change_item(_index, value);
}
});
}
});
return v;
}
}

View File

@ -26,4 +26,10 @@ public final class Logs
_debug_logs.println("swapEnterActionKey: "+conf.swapEnterActionKey);
_debug_logs.println("actionLabel: "+conf.actionLabel);
}
public static void debug(String s)
{
if (_debug_logs != null)
_debug_logs.println(s);
}
}