public ItemAdapter(Context context) { inflater = LayoutInflater.from(context); items = new List <SmcItem>(); // dateFormat = new SimpleDateFormat("dd-MM-yyyy"); // lint dateFormat = DateFormat.DateInstance; }
public NodeListAdapter(Context context, IFileCancelListener fileCancelListener) { mContext = context; mInflater = LayoutInflater.from(mContext); mNodeInfoList = new CopyOnWriteArrayList <NodeInfo>(); mFileCancelListener = fileCancelListener; }
public FileListAdapter(Context context) { mContext = context; mInflater = LayoutInflater.from(mContext); mFileList = new List <string>(); mCheckedFileList = new List <string>(); }
public Holder onCreateViewHolder(ViewGroup parent, int viewType) { if (viewType == TYPE_PLACEHOLDER) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.material_view_pager_placeholder, parent, false); return(new Holder(view)); } else { return(super.onCreateViewHolder(parent, viewType)); } }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void addBypassAction(FcContext fcContext, android.widget.LinearLayout linearLayout, final FcActionItem fcActionItem, int buttonText) private void addBypassAction(FcContext fcContext, LinearLayout linearLayout, FcActionItem fcActionItem, int buttonText) { Button bypassButton = (Button)LayoutInflater.from(fcContext.Context).inflate(R.layout.bypass_action_button, mDeviceActions, false); // bypassButton.setBackground(fcActionItem.getIcon(fcContext)); bypassButton.Enabled = fcActionItem.Enabled; bypassButton.Visibility = fcActionItem.Visible ? View.VISIBLE : View.GONE; bypassButton.Text = fcContext.Context.Resources.getString(buttonText); bypassButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this, fcActionItem); DrawableTool.setBackground(bypassButton, 0, 1, fcContext); linearLayout.addView(bypassButton); }
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: private void addActionButton(final android.widget.LinearLayout linearLayout, final FcActionItem fcActionItem, final int resId, final int index, final int numberOfElements, final FcContext fcContext, final boolean adjustBackgroundToPositionInLayout) private void addActionButton(LinearLayout linearLayout, FcActionItem fcActionItem, int resId, int index, int numberOfElements, FcContext fcContext, bool adjustBackgroundToPositionInLayout) { ImageButton imageButton = (ImageButton)LayoutInflater.from(fcContext.Context).inflate(resId, mDeviceActions, false); imageButton.ImageDrawable = fcActionItem.getIcon(fcContext); imageButton.Enabled = fcActionItem.Enabled; imageButton.Visibility = fcActionItem.Visible ? View.VISIBLE : View.GONE; imageButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper3(this, fcActionItem); if (adjustBackgroundToPositionInLayout) { DrawableTool.setBackground(imageButton, index, numberOfElements, fcContext); } linearLayout.addView(imageButton); }
/// <summary> /// This method creates button to jump to applicaction. It sets its looks as well as bahaviour. /// </summary> /// <returns> Button to open application which actions are respresented by this layout. </returns> private View createOpenButtonLayout() { Bundle bundle = mData.mAppInfo.Configuration; LinearLayout layout = (LinearLayout)LayoutInflater.from(Context).inflate(R.layout.open_buttons_layout, this, false); if (bundle != null && bundle.getIntArray(APP_RET_BUTTONS) != null && bundle.getIntArray(APP_RET_BUTTONS_OPTIONS) != null) { int[] openRes = bundle.getIntArray(APP_RET_BUTTONS); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int[] openOptions = bundle.getIntArray(APP_RET_BUTTONS_OPTIONS); int[] openOptions = bundle.getIntArray(APP_RET_BUTTONS_OPTIONS); for (int i = 0; i < openRes.Length; ++i) { ImageButton openButton = (ImageButton)LayoutInflater.from(Context).inflate(R.layout.open_btn_view, layout, false); Drawable drawable = getDrawableFromApp(mData.mAppInfo, openRes[i]); if (drawable != null) { openButton.ImageDrawable = drawable; } string appName = AppName; if (appName != null && appName.Length > 0) { openButton.ContentDescription = Resources.getString([email protected]_app_btn_desc, appName); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int mode = openOptions[i]; int mode = openOptions[i]; openButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper(this, mode); layout.addView(openButton); } return(layout); } else { ImageButton openButton = (ImageButton)LayoutInflater.from(Context).inflate(R.layout.open_btn_view, this, false); string appName = AppName; if (appName != null && appName.Length > 0) { openButton.ContentDescription = Resources.getString([email protected]_app_btn_desc, appName); } openButton.OnClickListener = new OnClickListenerAnonymousInnerClassHelper2(this); return(openButton); } }
private void createActionList() { mActionButtons = new List <View>(); mActionButtonsLayout = (LinearLayout)LayoutInflater.from(Context).inflate(R.layout.open_buttons_layout, this, false); createActionButtons(); if (this is MainDeviceLayout) { mActionButtons.Add(mActionButtonsLayout); mActionButtons.Add(mButtonsView); } else { mActionButtons.Add(mButtonsView); mActionButtons.Add(mActionButtonsLayout); } checkInvisibles(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: private synchronized void init(android.content.Context activity, Info info, int res) throws NotActivityException private void init(Context activity, Info info, int res) { lock (this) { if (!(activity is Activity)) { throw new NotActivityException(); } LayoutInflater.from(Context).inflate(res, this, true); LayoutDirection = LAYOUT_DIRECTION_INHERIT; mInfo = info; this.mActionsLayouts = new SortedDictionary <string, DeviceActionsLayout>(); this.setControlBar(); this.setDevicesLayout(); initHorizontalScrolling(); this.mBarHandler.OnLongClickListener = new MyLongTounchListener(this); this.mBarHandler.Id = Context.GetHashCode(); this.mEnd = (ImageView)findViewById(R.id.end); //if (mEndImageRes != null && mEndImageRes.containsKey(getOrientation())) this.mEnd // .setImageResource(mEndImageRes.get(getOrientation())); // else this.mEnd.setImageResource(android.R.color.transparent); if (mInfo.mListHidden || this.mActionsLayouts == null || this.mActionsLayouts.Count == 0) { this.mEnd.Visibility = LinearLayout.GONE; } else { this.mEnd.Visibility = LinearLayout.VISIBLE; } //if (getOrientation() == LinearLayout.HORIZONTAL) mEnd.setLayoutParams(new LayoutParams( // LayoutParams.WRAP_CONTENT, DeviceActionsLayout.BUTTON_HEIGHT)); //else mEnd.setLayoutParams(new LayoutParams(DeviceActionsLayout.BUTTON_HEIGHT, // LayoutParams.WRAP_CONTENT)); this.mSapaAppService = null; this.Orientation = Orientation; } }
private View createActionView(SapaActionInfo info, int res) { ImageButton button = null; try { button = (ImageButton)LayoutInflater.from(Context).inflate(res, mActionButtonsLayout, false); button.ImageDrawable = info.getIcon(Context); if (!info.Enabled) { button.Enabled = false; } button.OnClickListener = new OnActionClickListener(this, this.mData.mSapaApp, info.Id); string actionName = info.getName(Context); if (actionName != null) { button.ContentDescription = actionName; } } catch (NameNotFoundException) { Log.w(TAG, "Action " + info.Id + " could not be shown."); } catch (Resources.NotFoundException) { Log.w(TAG, "Action " + info.Id + " could not be shown."); } button.Tag = info; if (info.Visible) { button.Visibility = View.VISIBLE; } else { button.Visibility = View.GONE; } return(button); }
public override View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; ChatMessage message = this.messagesList[position]; holder = new ViewHolder(this); int type = VIEW_TYPE_ROW_SENT; type = getItemViewType(position); if (convertView == null) { holder = new ViewHolder(this); switch (type) { case VIEW_TYPE_ROW_SENT: convertView = LayoutInflater.from(Context).inflate(R.layout.sent_msg_row_layout, parent, false); holder.viewType = VIEW_TYPE_ROW_SENT; break; case VIEW_TYPE_ROW_RECEIVED: convertView = LayoutInflater.from(Context).inflate(R.layout.received_msg_row_layout, parent, false); holder.viewType = VIEW_TYPE_ROW_RECEIVED; break; case VIEW_TYPE_ROW_SENT_GROUP: convertView = LayoutInflater.from(Context).inflate(R.layout.group_sent_msg_row_layout, parent, false); holder.viewType = VIEW_TYPE_ROW_SENT_GROUP; break; case VIEW_TYPE_ROW_RECEIVED_GROUP: convertView = LayoutInflater.from(Context).inflate(R.layout.group_received_msg_row_layout, parent, false); holder.viewType = VIEW_TYPE_ROW_RECEIVED_GROUP; break; } if (!messagesGroup) { holder.aliasText = (TextView)convertView.findViewById(R.id.msg_alias); holder.timestampText = (TextView)convertView.findViewById(R.id.msg_time); holder.arrowView = (ImageView)convertView.findViewById(R.id.arrow_row); } holder.rowDividerView = (View)convertView.findViewById(R.id.row_divider); holder.messageText = (TextView)convertView.findViewById(R.id.msg_text); convertView.Tag = holder; } else { holder = (ViewHolder)convertView.Tag; } if (holder.viewType != VIEW_TYPE_ROW_RECEIVED_GROUP && holder.viewType != VIEW_TYPE_ROW_SENT_GROUP) { //msg alias holder.aliasText.Text = message.SenderAlias; //msg time SimpleDateFormat ft = new SimpleDateFormat("hh:mm a"); holder.timestampText.Text = ft.format(new DateTime(message.Timestamp)).ToString(); } //msg txt holder.messageText.Text = message.Text; //divider if (position == this.MessagesList.Count - 1) { holder.rowDividerView.Visibility = View.VISIBLE; } else { holder.rowDividerView.Visibility = View.GONE; } return(convertView); }
internal DotAdapter(Context context) { this.inflater = LayoutInflater.from(context); }
private View createCustomAnimationView() { val customView = LayoutInflater.from(this).inflate(R.layout.marker_view, null) }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override public Boolean handleNotification(EngagementReachInteractiveContent content) throws RuntimeException public virtual bool?handleNotification(EngagementReachInteractiveContent content) { /* System notification case */ if (content.SystemNotification) { /* Big picture handling */ Bitmap bigPicture = null; string bigPictureURL = content.NotificationBigPicture; if (bigPictureURL != null && Build.VERSION.SDK_INT >= 16) { /* Schedule picture download if needed, or load picture if download completed. */ long?downloadId = content.DownloadId; if (downloadId == null) { EngagementNotificationUtilsV11.downloadBigPicture(mContext, content); return(null); } else { bigPicture = EngagementNotificationUtilsV11.getBigPicture(mContext, downloadId.Value); } } /* Generate notification identifier */ int notificationId = getNotificationId(content); /* Build notification using support lib to manage compatibility with old Android versions */ NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext); /* Icon for ticker and content icon */ builder.SmallIcon = mNotificationIcon; /* * Large icon, handled only since API Level 11 (needs down scaling if too large because it's * cropped otherwise by the system). */ Bitmap notificationImage = content.NotificationImage; if (notificationImage != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { builder.LargeIcon = scaleBitmapForLargeIcon(mContext, notificationImage); } /* Texts */ string notificationTitle = content.NotificationTitle; string notificationMessage = content.NotificationMessage; string notificationBigText = content.NotificationBigText; builder.ContentTitle = notificationTitle; builder.ContentText = notificationMessage; /* * Replay: display original date and don't replay all the tickers (be as quiet as possible * when replaying). */ long?notificationFirstDisplayedDate = content.NotificationFirstDisplayedDate; if (notificationFirstDisplayedDate != null) { builder.When = notificationFirstDisplayedDate; } else { builder.Ticker = notificationTitle; } /* Big picture */ if (bigPicture != null) { builder.Style = (new NotificationCompat.BigPictureStyle()).bigPicture(bigPicture).setBigContentTitle(notificationTitle).setSummaryText(notificationMessage); } /* Big text */ else if (notificationBigText != null) { builder.Style = (new NotificationCompat.BigTextStyle()).bigText(notificationBigText); } /* Vibration/sound if not a replay */ if (notificationFirstDisplayedDate == null) { int defaults = 0; if (content.NotificationSound) { defaults |= Notification.DEFAULT_SOUND; } if (content.NotificationVibrate) { defaults |= Notification.DEFAULT_VIBRATE; } builder.Defaults = defaults; } /* Launch the receiver on action */ Intent actionIntent = new Intent(INTENT_ACTION_ACTION_NOTIFICATION); EngagementReachAgent.setContentIdExtra(actionIntent, content); actionIntent.putExtra(INTENT_EXTRA_NOTIFICATION_ID, notificationId); Intent intent = content.Intent; if (intent != null) { actionIntent.putExtra(INTENT_EXTRA_COMPONENT, intent.Component); } actionIntent.Package = mContext.PackageName; PendingIntent contentIntent = PendingIntent.getBroadcast(mContext, (int)content.LocalId, actionIntent, FLAG_CANCEL_CURRENT); builder.ContentIntent = contentIntent; /* Also launch receiver if the notification is exited (clear button) */ Intent exitIntent = new Intent(INTENT_ACTION_EXIT_NOTIFICATION); exitIntent.putExtra(INTENT_EXTRA_NOTIFICATION_ID, notificationId); EngagementReachAgent.setContentIdExtra(exitIntent, content); exitIntent.Package = mContext.PackageName; PendingIntent deleteIntent = PendingIntent.getBroadcast(mContext, (int)content.LocalId, exitIntent, FLAG_CANCEL_CURRENT); builder.DeleteIntent = deleteIntent; /* Can be dismissed ? */ Notification notification = builder.build(); if (!content.NotificationCloseable) { notification.flags |= Notification.FLAG_NO_CLEAR; } /* Allow overriding */ if (onNotificationPrepared(notification, content)) /* * Submit notification, replacing the previous one if any (this should happen only if the * application process is restarted). */ { mNotificationManager.notify(notificationId, notification); } } /* Activity embedded notification case */ else { /* Get activity */ Activity activity = EngagementActivityManager.Instance.CurrentActivity.get(); /* Cannot notify in app if no activity provided */ if (activity == null) { return(false); } /* Get notification area */ string category = content.Category; int areaId = getInAppAreaId(category).Value; View notificationAreaView = activity.findViewById(areaId); /* No notification area, check if we can install overlay */ if (notificationAreaView == null) { /* Check overlay is not disabled in this activity */ Bundle activityConfig = EngagementUtils.getActivityMetaData(activity); if (!activityConfig.getBoolean(METADATA_NOTIFICATION_OVERLAY, true)) { return(false); } /* Inflate overlay layout and get reference to notification area */ View overlay = LayoutInflater.from(mContext).inflate(getOverlayLayoutId(category), null); activity.addContentView(overlay, new LayoutParams(MATCH_PARENT, MATCH_PARENT)); notificationAreaView = activity.findViewById(areaId); } /* Otherwise check if there is an overlay containing the area to restore visibility */ else { View overlay = activity.findViewById(getOverlayViewId(category)); if (overlay != null) { overlay.Visibility = View.VISIBLE; } } /* Make the notification area visible */ notificationAreaView.Visibility = View.VISIBLE; /* Prepare area */ prepareInAppArea(content, notificationAreaView); } /* Success */ return(true); }
public NodeListGridAdapter(Context context, bool isResponseEnabled) { mContext = context; mInflater = LayoutInflater.from(mContext); mNodeInfoList = new CopyOnWriteArrayList <NodeInfo>(); }