/// <summary> /// Get drawable resource identifier from application meta-data. </summary> /// <param name="appMetaData"> application meta-data. </param> /// <param name="metaName"> meta-data key corresponding to the drawable resource name. </param> /// <returns> drawable resource identifier or 0 if not found. </returns> private int getIcon(Bundle appMetaData, string metaName) { /* Get drawable resource identifier from its name */ string iconName = appMetaData.getString(metaName); if (iconName != null) { return(EngagementResourcesUtils.getDrawableId(mContext, iconName)); } return(0); }
/// <summary> /// This function is called when the notification area view must be prepared, e.g. change texts, /// icon etc... based on the specified content. This is the responsibility of this method to /// associate actions to the buttons. </summary> /// <param name="content"> content. </param> /// <param name="notifAreaView"> notification area view. </param> /// <exception cref="RuntimeException"> on any error the content will be dropped. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected void prepareInAppArea(final EngagementReachInteractiveContent content, android.view.View notifAreaView) throws RuntimeException //JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: protected internal virtual void prepareInAppArea(EngagementReachInteractiveContent content, View notifAreaView) { /* Set icon */ ImageView iconView = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_ICON); if (content.hasNotificationIcon()) { iconView.Visibility = View.VISIBLE; iconView.ImageResource = mNotificationIcon; } else { iconView.Visibility = View.GONE; } /* Set title and message */ View textArea = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_TEXT); if (content.NotificationTitle == null && content.NotificationMessage == null) { textArea.Visibility = View.GONE; } else { /* Show text area */ textArea.Visibility = View.VISIBLE; /* Title */ TextView titleView = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_TITLE); if (content.NotificationTitle == null) { titleView.Visibility = View.GONE; } else { titleView.Visibility = View.VISIBLE; titleView.Text = content.NotificationTitle; } /* Message */ TextView messageView = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_MESSAGE); if (content.NotificationMessage == null) { messageView.Visibility = View.GONE; } else { messageView.Visibility = View.VISIBLE; messageView.Text = content.NotificationMessage; } } /* Set image */ ImageView imageView = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_IMAGE); Bitmap notificationImage = content.NotificationImage; if (notificationImage == null) { imageView.Visibility = View.GONE; } else { imageView.Visibility = View.VISIBLE; imageView.ImageBitmap = notificationImage; } /* Set intent action */ //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.view.View notificationAreaViewFinal = notifAreaView; View notificationAreaViewFinal = notifAreaView; notifAreaView.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this, content, notificationAreaViewFinal); /* * Configure close button if not removed from layout (it was not mandatory in previous Reach SDK * version). */ View closeButton = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_CLOSE); if (closeButton != null) { /* Set close action if closeable */ if (content.NotificationCloseable) { closeButton.Visibility = View.VISIBLE; closeButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this, content, notificationAreaViewFinal); } /* Otherwise hide the close button */ else { closeButton.Visibility = View.GONE; } } /* * This optional view is used to ensure that the close button does not overlap the image or * text, this is an invisible area. If we hide the text area in the provided layout, the close * button area won't be right aligned, that's why we have both an invisible button and an actual * button that is always right aligned. If you know a way to avoid that without breaking other * possible layouts (every text or icon is optional), please contact us. */ View closeButtonArea = EngagementResourcesUtils.getView(notifAreaView, LAYOUT_NOTIFICATION_CLOSE_AREA); if (closeButtonArea != null) { if (content.NotificationCloseable) { closeButtonArea.Visibility = View.INVISIBLE; } else { closeButtonArea.Visibility = View.GONE; } } }
/// <summary> /// Get resource identifier from its name. </summary> /// <param name="name"> resource name. </param> /// <returns> resource identifier. </returns> private int getId(string name) { return(EngagementResourcesUtils.getId(mContext, name)); }
/// <summary> /// This function is called when an overlay is about to be inflated. It returns the overlay layout /// resource identifier (R.layout... not the view identifier) for the specified category. </summary> /// <param name="category"> content category. </param> /// <returns> overlay layout resource identifier. </returns> protected internal virtual int getOverlayLayoutId(string category) { return(EngagementResourcesUtils.getLayoutId(mContext, LAYOUT_NOTIFICATION_OVERLAY)); }