Trim strings in donation campaigns

This commit is contained in:
Grishka 2024-09-10 13:43:48 +03:00
parent e915aab2fb
commit 81ac72e4eb
3 changed files with 5 additions and 4 deletions

View File

@ -744,9 +744,10 @@ public class HomeTimelineFragment extends StatusListFragment implements ToolbarD
}
TextView text=donationBanner.findViewById(R.id.banner_text);
SpannableStringBuilder ssb=new SpannableStringBuilder(campaign.bannerMessage);
if(!campaign.bannerMessage.endsWith("\n"))
ssb.append(' ');
int start=ssb.length();
ssb.append(campaign.bannerButtonText);
ssb.append(campaign.bannerButtonText.trim());
ssb.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.masterialDark_colorGoldenrodContainer, getActivity().getTheme())), start, ssb.length(), 0);
ssb.setSpan(new UnderlineSpan(), start, ssb.length(), 0);
ssb.setSpan(new TypefaceSpan("sans-serif-medium"), start, ssb.length(), 0);

View File

@ -35,7 +35,7 @@ public class SettingsDebugFragment extends BaseSettingsFragment<Void>{
new ListItem<>("Reset search info banners", null, this::onResetDiscoverBannersClick),
new ListItem<>("Reset pre-reply sheets", null, this::onResetPreReplySheetsClick),
new ListItem<>("Clear dismissed donation campaigns", null, this::onClearDismissedCampaignsClick),
donationsStagingItem=new CheckableListItem<>("Use staging environment for donations", null, CheckableListItem.Style.SWITCH, getPrefs().getBoolean("donationsStaging", false), this::toggleCheckableItem)
donationsStagingItem=new CheckableListItem<>("Use staging environment for donations", "Restart app to apply", CheckableListItem.Style.SWITCH, getPrefs().getBoolean("donationsStaging", false), this::toggleCheckableItem)
));
if(!GithubSelfUpdater.needSelfUpdating()){
resetUpdateItem.isEnabled=selfUpdateItem.isEnabled=false;

View File

@ -66,7 +66,7 @@ public class DonationSheet extends BottomSheet{
UiUtils.getThemeColor(context, R.attr.colorM3Primary), 0.05f)), !UiUtils.isDarkTheme());
TextView text=findViewById(R.id.text);
text.setText(campaign.donationMessage);
text.setText(campaign.donationMessage.trim());
onceTab=findViewById(R.id.once);
monthlyTab=findViewById(R.id.monthly);