Merge pull request #179 from FineFindus/fix/version-name-footer

fix(settings/footer): use footer item
This commit is contained in:
LucasGGamerM 2023-04-21 12:19:58 -03:00 committed by GitHub
commit 02545f3dd2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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); 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) { private void updatePublishText(Button btn) {
@ -955,9 +955,11 @@ public class SettingsFragment extends MastodonToolbarFragment{
private class FooterItem extends Item{ private class FooterItem extends Item{
private String text; private String text;
private Runnable onClick;
public FooterItem(String text){ public FooterItem(String text, Runnable onClick){
this.text=text; this.text=text;
this.onClick=onClick;
} }
@Override @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; private final TextView text;
public FooterViewHolder(){ public FooterViewHolder(){
super(getActivity(), R.layout.item_settings_footer, list); super(getActivity(), R.layout.item_settings_footer, list);
@ -1247,6 +1249,11 @@ public class SettingsFragment extends MastodonToolbarFragment{
public void onBind(FooterItem item){ public void onBind(FooterItem item){
text.setText(item.text); text.setText(item.text);
} }
@Override
public void onClick(){
item.onClick.run();
}
} }
private class UpdateViewHolder extends BindableViewHolder<UpdateItem>{ private class UpdateViewHolder extends BindableViewHolder<UpdateItem>{