Skip to content

Commit

Permalink
Merge pull request #4947 from alexzatsepin/fix-banner-strings
Browse files Browse the repository at this point in the history
[android] Fixed the getting title and message for banners in PP
  • Loading branch information
dobriy-eeh authored Dec 9, 2016
2 parents 8cdfcc0 + d3d8485 commit fc11a0b
Showing 1 changed file with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,21 @@ final class BannerController implements View.OnClickListener
private final float mMarginBase;
private final float mMarginHalfPlus;

@NonNull
private final Resources mResources;

private boolean mIsOpened = false;

BannerController(@NonNull View bannerView, @Nullable OnBannerClickListener listener)
{
mFrame = bannerView;
mListener = listener;
Resources res = mFrame.getResources();
mCloseFrameHeight = res.getDimension(R.dimen.placepage_banner_height);
mCloseIconSize = res.getDimension(R.dimen.placepage_banner_icon_size);
mOpenIconSize = res.getDimension(R.dimen.placepage_banner_icon_size_full);
mMarginBase = res.getDimension(R.dimen.margin_base);
mMarginHalfPlus = res.getDimension(R.dimen.margin_half_plus);
mResources = mFrame.getResources();
mCloseFrameHeight = mResources.getDimension(R.dimen.placepage_banner_height);
mCloseIconSize = mResources.getDimension(R.dimen.placepage_banner_icon_size);
mOpenIconSize = mResources.getDimension(R.dimen.placepage_banner_icon_size_full);
mMarginBase = mResources.getDimension(R.dimen.margin_base);
mMarginHalfPlus = mResources.getDimension(R.dimen.margin_half_plus);
mIcon = (ImageView) bannerView.findViewById(R.id.iv__banner_icon);
mTitle = (TextView) bannerView.findViewById(R.id.tv__banner_title);
mMessage = (TextView) bannerView.findViewById(R.id.tv__banner_message);
Expand All @@ -74,9 +77,17 @@ void updateData(@Nullable Banner banner)

loadIcon(banner);
if (mTitle != null)
mTitle.setText(banner.getTitle());
{
String title = mResources.getString(mResources.getIdentifier(banner.getTitle(), "string", mFrame.getContext().getPackageName()));
if (!TextUtils.isEmpty(title))
mTitle.setText(title);
}
if (mMessage != null)
mMessage.setText(banner.getMessage());
{
String message = mResources.getString(mResources.getIdentifier(banner.getMessage(), "string", mFrame.getContext().getPackageName()));
if (!TextUtils.isEmpty(message))
mMessage.setText(message);
}

if (UiUtils.isLandscape(mFrame.getContext()))
open();
Expand Down

0 comments on commit fc11a0b

Please sign in to comment.