fix settings button binding not reset visibility and events
This commit is contained in:
parent
7859f4cd05
commit
336a8194bd
|
@ -1084,14 +1084,17 @@ public class SettingsFragment extends MastodonToolbarFragment implements Provide
|
||||||
button=findViewById(R.id.button);
|
button=findViewById(R.id.button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
@Override
|
@Override
|
||||||
public void onBind(ButtonItem item){
|
public void onBind(ButtonItem item){
|
||||||
text.setText(item.text);
|
text.setText(item.text);
|
||||||
if (item.icon == 0) {
|
icon.setVisibility(item.icon == 0 ? View.GONE : View.VISIBLE);
|
||||||
icon.setVisibility(View.GONE);
|
icon.setImageResource(item.icon == 0 ? 0 : item.icon);
|
||||||
} else {
|
// reset listeners before letting the button consumer consume the button
|
||||||
icon.setImageResource(item.icon);
|
// (and potentially set some listeners, but not others)
|
||||||
}
|
button.setOnTouchListener(null);
|
||||||
|
button.setOnClickListener(null);
|
||||||
|
button.setOnLongClickListener(null);
|
||||||
item.buttonConsumer.accept(button);
|
item.buttonConsumer.accept(button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue