fix(settings/footer): use footer item

This commit is contained in:
FineFindus 2023-04-21 13:30:16 +02:00
parent c4c17e3aea
commit debdda5fed
No known key found for this signature in database
GPG Key ID: 64873EE210FF8E6B
1 changed files with 10 additions and 3 deletions

View File

@ -497,7 +497,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
}
String version = getContext().getString(R.string.mo_settings_app_version, BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE);
items.add(new TextItem(version, () -> UiUtils.copyText(view, version)));
items.add(new FooterItem(version, () -> UiUtils.copyText(view, version)));
}
private void updatePublishText(Button btn) {
@ -955,9 +955,11 @@ public class SettingsFragment extends MastodonToolbarFragment{
private class FooterItem extends Item{
private String text;
private Runnable onClick;
public FooterItem(String text){
public FooterItem(String text, Runnable onClick){
this.text=text;
this.onClick=onClick;
}
@Override
@ -1236,7 +1238,7 @@ public class SettingsFragment extends MastodonToolbarFragment{
}
}
private class FooterViewHolder extends BindableViewHolder<FooterItem>{
private class FooterViewHolder extends BindableViewHolder<FooterItem> implements UsableRecyclerView.Clickable{
private final TextView text;
public FooterViewHolder(){
super(getActivity(), R.layout.item_settings_footer, list);
@ -1247,6 +1249,11 @@ public class SettingsFragment extends MastodonToolbarFragment{
public void onBind(FooterItem item){
text.setText(item.text);
}
@Override
public void onClick(){
item.onClick.run();
}
}
private class UpdateViewHolder extends BindableViewHolder<UpdateItem>{