@Override public View getView(int position, View convertView, ViewGroup parent) { View view = null; if (convertView == null) { LayoutInflater inflator = context.getLayoutInflater(); view = inflator.inflate(R.layout.filter_color_listview_row, parent, false); final ViewHolder viewHolder = new ViewHolder(); viewHolder.checkbox = (CheckBox) view.findViewById(R.id.check_color); viewHolder.text = (TextView) view.findViewById(R.id.label_color); viewHolder.textcolor = (TextView) view.findViewById(R.id.color_display_txt); viewHolder.checkbox.setOnCheckedChangeListener( new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { Model element = (Model) viewHolder.checkbox.getTag(); element.setSelected(buttonView.isChecked()); } }); view.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub viewHolder.checkbox.setChecked(!viewHolder.checkbox.isChecked()); } }); view.setTag(viewHolder); viewHolder.checkbox.setTag(list.get(position)); } else { view = convertView; ((ViewHolder) view.getTag()).checkbox.setTag(list.get(position)); } ViewHolder holder = (ViewHolder) view.getTag(); holder.text.setTextSize(5 * context.getResources().getDisplayMetrics().density); holder.checkbox.setChecked(list.get(position).isSelected()); JSONArray object; try { object = new JSONArray(list.get(position).getName()); final float scale = context.getResources().getDisplayMetrics().density; GradientDrawable gd = new GradientDrawable(); gd.setColor( Color.parseColor( object.getString( 1))); // Changes this drawbale to use a single color instead of a gradient gd.setCornerRadius((int) (2 * scale + 0.5f)); gd.setStroke((int) (2 * scale + 0.5f), Color.parseColor("#000000")); holder.textcolor.setBackgroundDrawable(gd); holder.text.setText(object.getString(0)); // holder.textcolor.setBackgroundColor(Color.parseColor(object.getString(1))); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } return view; }
private void createListHeader(String header_text, View view, boolean hasBios) { if (hasBios) { final View childview = parentActivity.getLayoutInflater().inflate(R.layout.bios_list_item, null, false); ((TextView) childview.findViewById(R.id.item_name)).setText(R.string.boot_bios); childview.setTag(null); orig_bg = childview.getBackground(); childview .findViewById(R.id.childview) .setOnClickListener( new OnClickListener() { public void onClick(View view) { File f = (File) view.getTag(); vib.vibrate(50); mCallback.onGameSelected(f != null ? Uri.fromFile(f) : Uri.EMPTY); vib.vibrate(250); } }); childview .findViewById(R.id.childview) .setOnTouchListener( new OnTouchListener() { @SuppressWarnings("deprecation") public boolean onTouch(View view, MotionEvent arg1) { if (arg1.getActionMasked() == MotionEvent.ACTION_DOWN) { view.setBackgroundColor(0xFF4F3FFF); } else if (arg1.getActionMasked() == MotionEvent.ACTION_CANCEL || arg1.getActionMasked() == MotionEvent.ACTION_UP) { view.setBackgroundDrawable(orig_bg); } return false; } }); ((ViewGroup) view).addView(childview); } final View headerView = parentActivity.getLayoutInflater().inflate(R.layout.head_list_item, null, false); ((ImageView) headerView.findViewById(R.id.item_icon)).setImageResource(R.drawable.open_folder); ((TextView) headerView.findViewById(R.id.item_name)).setText(header_text); ((TextView) headerView.findViewById(R.id.item_name)).setTypeface(Typeface.DEFAULT_BOLD); ((ViewGroup) view).addView(headerView); }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = context.getLayoutInflater().inflate(R.layout.custom_listview, parent, false); } noticeTitle = (TextView) convertView.findViewById(R.id.notice_title); mNetworkImageView = (NetworkImageView) convertView.findViewById(R.id.networkImageView); createdAt = (TextView) convertView.findViewById(R.id.created_at); department = (TextView) convertView.findViewById(R.id.department); mImageLoader = CustomVolleyRequestQueue.getInstance(context).getImageLoader(); // Image URL - This can point to any image file supported by Android final String url = data.get(position).getImage(); mImageLoader.get( url, ImageLoader.getImageListener( mNetworkImageView, R.mipmap.ic_launcher, android.R.drawable.ic_dialog_alert)); mNetworkImageView.setImageUrl(url, mImageLoader); noticeTitle.setText(data.get(position).getNotice()); noticPostDate = formateStringDate(data.get(position).getCreatedAt()); createdAt.setText(noticPostDate); department.setText("Notice From - " + data.get(position).getDepartment()); Log.d("simul", noticPostDate); return convertView; }
// Adds a reminder to the displayed list of reminders. // Returns true if successfully added reminder, false if no reminders can // be added. static boolean addReminder( Activity activity, View.OnClickListener listener, ArrayList<LinearLayout> items, ArrayList<Integer> values, ArrayList<String> labels, int minutes) { if (items.size() >= MAX_REMINDERS) { return false; } LayoutInflater inflater = activity.getLayoutInflater(); LinearLayout parent = (LinearLayout) activity.findViewById(R.id.reminder_items_container); LinearLayout reminderItem = (LinearLayout) inflater.inflate(R.layout.edit_reminder_item, null); parent.addView(reminderItem); Spinner spinner = (Spinner) reminderItem.findViewById(R.id.reminder_value); Resources res = activity.getResources(); spinner.setPrompt(res.getString(R.string.reminders_title)); int resource = android.R.layout.simple_spinner_item; ArrayAdapter<String> adapter = new ArrayAdapter<String>(activity, resource, labels); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); ImageButton reminderRemoveButton; reminderRemoveButton = (ImageButton) reminderItem.findViewById(R.id.reminder_remove); reminderRemoveButton.setOnClickListener(listener); int index = findMinutesInReminderList(values, minutes); spinner.setSelection(index); items.add(reminderItem); return true; }
@Override public View getView(int position, View convertView, ViewGroup parent) { Activity activity = (Activity) getContext(); LayoutInflater inflater = activity.getLayoutInflater(); View rowView = inflater.inflate(R.layout.news, null); Article article = getItem(position); TextView textView = (TextView) rowView.findViewById(R.id.article_title_text); textView.setText(article.getTitle()); TextView dateView = (TextView) rowView.findViewById(R.id.article_listing_smallprint); String pubDate = article.getPubDate(); // SimpleDateFormat df = new SimpleDateFormat("EEE, dd MMM yyyy kk:mm:ss Z", Locale.ENGLISH); // Date pDate; // pDate = (Date) df.parse(pubDate); pubDate = "published " + "by " + article.getAuthor(); // pubDate = article.getGuid(); // + DateUtils.getDateDifference(pDate) + dateView.setText(pubDate); if (!article.isRead()) { LinearLayout row = (LinearLayout) rowView.findViewById(R.id.article_row_layout); row.setBackgroundColor(Color.WHITE); textView.setTypeface(Typeface.DEFAULT_BOLD); } return rowView; }
public OfficeAdapter(List<Bill> items, Activity activity, int type) { super(); this.items = items; this.activity = activity; this.type = type; inflater = activity.getLayoutInflater(); }
@Override public Dialog onCreateDialog(final Bundle savedInstanceState) { Activity activity = getActivity(); Bundle arguments = getArguments(); final AlertDialog dialog = createDialog(); dialog.setButton(BUTTON_NEGATIVE, activity.getString(R.string.cancel), this); dialog.setButton(BUTTON_NEUTRAL, activity.getString(R.string.clear), this); LayoutInflater inflater = activity.getLayoutInflater(); ListView view = (ListView) inflater.inflate(R.layout.dialog_list_view, null); view.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { onClick(dialog, position); } }); ArrayList<Milestone> choices = getChoices(); int selected = arguments.getInt(ARG_SELECTED_CHOICE); MilestoneListAdapter adapter = new MilestoneListAdapter( inflater, choices.toArray(new Milestone[choices.size()]), selected); view.setAdapter(adapter); if (selected >= 0) view.setSelection(selected); dialog.setView(view); return dialog; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { LayoutInflater inflater = activity.getLayoutInflater(); convertView = inflater.inflate(R.layout.view_list_transaction_history, parent, false); holder = new ViewHolder(convertView); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } modelTransaction = getItem(position); holder.txtName.setText(modelTransaction.getRecipient_name()); holder.txtStatus.setText( modelTransaction.getTransfer_status() == 0 ? "Processing" : "Accepted"); try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-mm-dd hh:mm:ss"); Date newFormat = sdf.parse(modelTransaction.getTransfer_datecreated()); sdf = new SimpleDateFormat("MMM dd, yyyy hh:mm a"); holder.txtDate.setText(sdf.format(newFormat).toUpperCase()); } catch (ParseException e) { e.printStackTrace(); } return convertView; }
@Override public View getView(int position, View view, ViewGroup parent) { InfoGruppoBean g = groups.get(position); LayoutInflater inflater = context.getLayoutInflater(); View rowView = inflater.inflate(R.layout.elemento_lista_gruppi, null, true); TextView groupName = (TextView) rowView.findViewById(R.id.group_name); ImageView groupLogo = (ImageView) rowView.findViewById(R.id.group_logo); TextView citta = (TextView) rowView.findViewById(R.id.group_city); groupName.setText(groups.get(position).getNome()); citta.setText(groups.get(position).getCitta()); if (g.getAperto()) { Picasso.with(getContext()) .load(R.drawable.group_open) .transform(new CircleTransform()) .placeholder(R.mipmap.ic_launcher) .error(R.mipmap.ic_launcher) .into(groupLogo); } else { Picasso.with(getContext()) .load(R.drawable.group_closed) .transform(new CircleTransform()) .placeholder(R.drawable.group_closed) .error(R.drawable.group_closed) .into(groupLogo); } return rowView; }
public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflator = context.getLayoutInflater(); final View view = inflator.inflate(R.layout.directory_list_row, null); view.setOnClickListener( new DirectoryOnClickListener(position) { @Override public void onClick(View v) { for (int i = 0; i < directoryFr.contentList.getChildCount(); i++) { directoryFr.contentList.getChildAt(i).setBackgroundResource(R.drawable.cellfw); } view.setBackgroundResource(R.drawable.cellfw_selected); ArrayList<HashMap<String, String>> tmpData = new ArrayList<HashMap<String, String>>(); tmpData.add(list.get(this.position)); gotoBusiness(tmpData); } }); TextView txtCategoryName = (TextView) view.findViewById(R.id.directory_cell_categoryname); HashMap<String, String> data = list.get(position); txtCategoryName.setText((String) data.get("bus_category_name")); return view; }
@Override public View getChildView( int groupPosition, final int childPosition, boolean isLastChild, View rowView, ViewGroup parent) { if (rowView == null) { LayoutInflater inflater = context.getLayoutInflater(); rowView = inflater.inflate(R.layout.adapter_listview_about, null); // configure view holder ViewHolder viewHolder = new ViewHolder(); viewHolder.image = (ImageView) rowView.findViewById(R.id.img); viewHolder.text = (TextView) rowView.findViewById(R.id.txt); viewHolder.text2 = (TextView) rowView.findViewById(R.id.description); rowView.setTag(viewHolder); } DeveloperBean developer = childData.get(headers.get(groupPosition)).get(childPosition); ViewHolder holder = (ViewHolder) rowView.getTag(); holder.image.setImageDrawable(developer.getImage()); holder.text.setText(developer.getTitle()); holder.text2.setText(developer.getDescription()); return rowView; }
public void registerContainer(String[] entityColumns, int[] rowFields) { if (entityColumns.length != rowFields.length) throw new RuntimeException( "Cannot assign " + entityColumns.length + " columns to " + rowFields.length + " fields on the row"); if (buttonIds.length != buttonListeners.length) throw new RuntimeException( "Cannot assign " + buttonListeners.length + " actions to " + buttonIds.length + " buttons"); ViewGroup container = (ViewGroup) activity.findViewById(layoutId); for (Entity e : list) { View newRow = activity.getLayoutInflater().inflate(rowLayoutId, container, false); newRow.setId((int) e.getId()); populateFields(entityColumns, rowFields, newRow, e); addButtonHandlers(newRow); container.addView(newRow); } }
@Override public View getView(int position, View convertView, ViewGroup parent) { // ViewHolder will buffer the assess to the individual fields of the row // layout ViewHolder holder; // Recycle existing view if passed as parameter // This will save memory and time on Android // This only works if the base layout for all classes are the same View rowView = convertView; if (rowView == null) { LayoutInflater inflater = context.getLayoutInflater(); rowView = inflater.inflate(R.layout.detours_list_item, null, true); holder = new ViewHolder(); holder.description = (TextView) rowView.findViewById(R.id.SD_description); holder.routes = (TextView) rowView.findViewById(R.id.SD_routes); rowView.setTag(holder); } else { holder = (ViewHolder) rowView.getTag(); } holder.routes.setText(items.get(position).getRoutes()); holder.description.setText(items.get(position).getDesc()); return rowView; }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder view; LayoutInflater inflater = activity.getLayoutInflater(); if (convertView == null) { view = new ViewHolder(); convertView = inflater.inflate(R.layout.activity_main_row, null); if (!hasText) { convertView.findViewById(R.id.mainTextView).setVisibility(View.GONE); } view.imageView = (SquaredImageView) convertView.findViewById(R.id.mainImageView); convertView.setTag(view); } else { view = (ViewHolder) convertView.getTag(); } ImageObject image = images.get(position); String imgUrl = image.getUrl(); // Trigger the download of the URL asynchronously into the image view. Picasso.with(activity) .load(imgUrl) .placeholder(R.drawable.placeholder) .fit() .tag(activity) .into(view.imageView); return convertView; }
@Override public View getDropDownView( int position, View convertView, ViewGroup parent) { // This view starts when we click the spinner. View row = convertView; if (row == null) { LayoutInflater inflater = context.getLayoutInflater(); row = inflater.inflate(R.layout.spinner_row_my_children, parent, false); } PatientChildData item = spinnerItems.get(position); if (item != null) { // Parse the data from each object and set it. TextView myChildName = (TextView) row.findViewById(R.id.spinnerTxtTitle); ImageView patientPhoto = (ImageView) row.findViewById(R.id.patientPhoto); if (myChildName != null) myChildName.setText(item.getFirtname() + " " + item.getLastname()); byte[] childPhotoData = item.getPatientphoto(); if (childPhotoData != null) { Log.d("ROBERT BTE", childPhotoData.length + ""); Bitmap bMap = BitmapFactory.decodeByteArray(childPhotoData, 0, childPhotoData.length); patientPhoto.setBackground(Utils.resizedBitmapDisplayPatientQueue(context, bMap)); } } return row; }
/** * Creates an instance of {@link EnhancedBookmarkManager}. It also initializes resources, bookmark * models and jni bridges. * * @param activity The activity context to use. */ public EnhancedBookmarkManager(Activity activity) { mActivity = activity; mEnhancedBookmarksModel = new EnhancedBookmarksModel(); mMainView = (ViewGroup) mActivity.getLayoutInflater().inflate(R.layout.eb_main, null); mDrawer = (DrawerLayout) mMainView.findViewById(R.id.eb_drawer_layout); mDrawerListView = (EnhancedBookmarkDrawerListView) mMainView.findViewById(R.id.eb_drawer_list); mContentView = (EnhancedBookmarkContentView) mMainView.findViewById(R.id.eb_content_view); mViewSwitcher = (ViewSwitcher) mMainView.findViewById(R.id.eb_view_switcher); mUndoController = new EnhancedBookmarkUndoController( activity, mEnhancedBookmarksModel, ((SnackbarManageable) activity).getSnackbarManager()); mSearchView = (EnhancedBookmarkSearchView) getView().findViewById(R.id.eb_search_view); mEnhancedBookmarksModel.addObserver(mBookmarkModelObserver); initializeIfBookmarkModelLoaded(); // Load partner bookmarks explicitly. We load partner bookmarks in the deferred startup // code, but that might be executed much later. Especially on L, showing loading // progress bar blocks that so it won't be loaded. http://crbug.com/429383 PartnerBookmarksShim.kickOffReading(activity); mLargeIconBridge = new LargeIconBridge(Profile.getLastUsedProfile().getOriginalProfile()); ActivityManager activityManager = ((ActivityManager) ApplicationStatus.getApplicationContext().getSystemService(Context.ACTIVITY_SERVICE)); int maxSize = Math.min(activityManager.getMemoryClass() / 4 * 1024 * 1024, FAVICON_MAX_CACHE_SIZE_BYTES); mLargeIconBridge.createCache(maxSize); }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub LayoutInflater inflater = actividad.getLayoutInflater(); View view = inflater.inflate(com.jorgeldra.seio.R.layout.twitter_detail_item, parent, false); ImageView image = (ImageView) view.findViewById(com.jorgeldra.seio.R.id.itemListTweetImage); // image.setImageBitmap(getImageBitmap(lista.get(position).getUrlImage())); imageDownloader.download(lista.get(position).getUrlImage(), image); TextView txtNombre = (TextView) view.findViewById(com.jorgeldra.seio.R.id.itemListTweetName); txtNombre.setTypeface(null, Typeface.BOLD); txtNombre.setText(lista.get(position).getName()); TextView txtIdentifier = (TextView) view.findViewById(com.jorgeldra.seio.R.id.itemListTweetIdentifier); txtIdentifier.setTextColor( parent.getContext().getResources().getColor(com.jorgeldra.seio.R.color.gris1)); txtIdentifier.setText(lista.get(position).getIdentifier()); TextView txtTiempo = (TextView) view.findViewById(com.jorgeldra.seio.R.id.itemListTweetTime); txtTiempo.setTextColor( parent.getContext().getResources().getColor(com.jorgeldra.seio.R.color.gris1)); txtTiempo.setText(fechaDesde(lista.get(position).getTime().getTime())); TextView txtText = (TextView) view.findViewById(com.jorgeldra.seio.R.id.itemListTweetTexto); txtText.setText(lista.get(position).getText()); return view; }
public View getView(int position, View convertView, ViewGroup parent) { View rowView = convertView; ViewHolder viewHolder; if (rowView == null) { LayoutInflater inflater = context.getLayoutInflater(); rowView = inflater.inflate(resourceId, null); viewHolder = new ViewHolder(); viewHolder.labelTv = (TextView) rowView.findViewById(R.id.sliding_menu_label); rowView.setTag(viewHolder); } else { viewHolder = (ViewHolder) rowView.getTag(); } MenuItem item = list.get(position); int iconResId = item.getIconResId(); if (iconResId != 0) { viewHolder.labelTv.setCompoundDrawablesWithIntrinsicBounds( context.getResources().getDrawable(iconResId), null, null, null); } viewHolder.labelTv.setText(item.getLabel()); return rowView; }
public View getChildView( int groupPosition, int childPosition, boolean isExpanded, View convertView, ViewGroup parent) { try { if (convertView == null) { LayoutInflater inflater = mActivity.getLayoutInflater(); convertView = inflater.inflate(R.layout.track_list_item_child, null); GuiUtil.fixItemHeight(mActivity, convertView); } Artist artist = (Artist) getGroup(groupPosition); Album album = artist.getAlbums().get(childPosition); TextView textView = null; textView = (TextView) convertView.findViewById(R.id.line1); textView.setText(album.getName()); textView = (TextView) convertView.findViewById(R.id.line2); textView.setText(album.getItems().size() + " items"); ImageView imageView = (ImageView) convertView.findViewById(R.id.icon); imageView.setBackgroundResource(R.drawable.albumart_mp_unknown_list); imageView.setPadding(0, 0, 1, 0); return convertView; } catch (Exception ex) { GuiUtil.showErrorAndFinish(mActivity, ex); return null; } }
@Override public View setNewViewHolder(Activity context, View convertView) { convertView = context.getLayoutInflater().inflate(layout, null); holder = new ViewHolder(convertView); convertView.setTag(holder); return convertView; }
private void addSaveButton(ViewGroup parentView, Activity activity) { View view = activity.getLayoutInflater().inflate(R.layout.form_field_save_button, parentView, true); int viewId = View.generateViewId(); view.setId(viewId); view.setOnClickListener((View.OnClickListener) activity); }
/** * 弹出日期时间选择框方法 * * @param inputDate :为需要设置的日期时间文本编辑框 * @return */ public AlertDialog dateTimePicKDialog(final TextView inputDate) { LinearLayout dateTimeLayout = (LinearLayout) activity.getLayoutInflater().inflate(R.layout.common_datetime, null); datePicker = (DatePicker) dateTimeLayout.findViewById(R.id.datepicker); init(datePicker); ad = new AlertDialog.Builder(activity) .setTitle(initDateTime) .setView(dateTimeLayout) .setPositiveButton( "设置", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { inputDate.setText(dateTime); } }) .setNegativeButton( "取消", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { inputDate.setText(""); } }) .show(); onDateChanged(null, 0, 0, 0); return ad; }
@Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub LayoutInflater inflater = activity.getLayoutInflater(); if (convertView == null) { convertView = inflater.inflate(R.layout.col_row, null); txtFirst = (TextView) convertView.findViewById(R.id.mag); txtSecond = (TextView) convertView.findViewById(R.id.place); } HashMap<String, String> map = list.get(position); txtFirst.setText(map.get("FIRST")); txtSecond.setText(map.get("SECOND")); float myMag = Float.valueOf(map.get("FIRST")); if (myMag < 3) { txtFirst.setTextColor(Color.GREEN); } else if (myMag < 6) { txtFirst.setTextColor(Color.YELLOW); } else { txtFirst.setTextColor(Color.RED); } return convertView; }
public View getView(int position, View convertView, ViewGroup parent) { View release = convertView; ReleaseStubHolder holder = null; if (release == null) { LayoutInflater inflater = context.getLayoutInflater(); release = inflater.inflate(layoutId, parent, false); holder = new ReleaseStubHolder(release); release.setTag(holder); } else { holder = (ReleaseStubHolder) release.getTag(); } ReleaseStub stub = releaseStubs.get(position); holder.getTitle().setText(stub.getTitle()); holder.getArtist().setText(StringFormat.commaSeparateArtists(stub.getArtists())); holder.getCountry().setText(stub.getCountryCode()); holder.getDate().setText(stub.getDate()); if (layoutId == R.layout.list_release) { holder .getTrackNum() .setText(stub.getTracksNum() + " " + context.getString(R.string.label_tracks)); holder .getFormat() .setText(StringMapper.buildReleaseFormatsString(getContext(), stub.getFormats())); holder.getLabels().setText(StringFormat.commaSeparate(stub.getLabels())); } return release; }
public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; if (row == null) { LayoutInflater inflater = context.getLayoutInflater(); row = inflater.inflate(R.layout.list_row, null); } else row.setTag(""); // when reused, don't pretend to be something else TextView name = (TextView) row.findViewById(R.id.row_label); name.setText(mItems.get(position).mLabel); if (mLoadingBar == position || mItems.get(position).icon() == R.drawable.now_playing || mItems.get(position).icon() == R.drawable.now_paused) { ViewSwitcher switcher = (ViewSwitcher) row.findViewById(R.id.row_view_switcher); row.findViewById(R.id.row_view_switcher).setVisibility(View.VISIBLE); switcher.setDisplayedChild(mLoadingBar == position ? 1 : 0); ((ImageView) row.findViewById(R.id.row_disclosure_icon)) .setImageResource(mItems.get(position).icon()); } else { row.findViewById(R.id.row_view_switcher).setVisibility(View.GONE); } row.findViewById(R.id.row_icon).setVisibility(View.VISIBLE); ((ImageView) row.findViewById(R.id.row_icon)).setScaleType(ImageView.ScaleType.CENTER); ((ImageView) row.findViewById(R.id.row_icon)).setImageResource(R.drawable.list_icon_station); if (position == mItems.size() - 1) { row.setBackgroundResource(R.drawable.list_entry_rounded_bottom); row.setTag("bottom"); } else row.setBackgroundResource(R.drawable.list_entry); return row; }
public PostListAdapter(Activity value) { mContext = value; post_item = mContext.getString(R.string.post_item); // post_author = mContext.getString(R.string.post_author); // post_floor = mContext.getString(R.string.post_floor); post_content = mContext.getString(R.string.post_content); post_datetime = mContext.getString(R.string.post_datetime); post_comment = mContext.getString(R.string.post_comment); post_subtitle = mContext.getString(R.string.post_subtitle); post_comment_author = mContext.getString(R.string.post_comment_author); post_comment_content = mContext.getString(R.string.post_comment_content); post_user_info1 = mContext.getString(R.string.post_user_info1); post_user_info2 = mContext.getString(R.string.post_user_info2); post_user_info3 = mContext.getString(R.string.post_user_info3); post_user_info4 = mContext.getString(R.string.post_user_info4); keyword_url = mContext.getString(R.string.keyword_url); pageinfoList = new ArrayList<PageInfo>(); postInfoList = new ArrayList<PostInfo>(); tempInfo = new HashMap<String, String>(); randKey = new Random(); title = (TextView) mContext.getLayoutInflater().inflate(R.layout.post_list_title, null); }
public static void showInputDialog( Activity context, int title, int hint, String prefillInput, final InputCallback callback) { @SuppressLint("InflateParams") final View view = context.getLayoutInflater().inflate(R.layout.dialog_input, null); MaterialDialog.Builder dialog = new MaterialDialog.Builder(context) .title(title) .positiveText(android.R.string.ok) .negativeText(android.R.string.cancel) .callback( new MaterialDialog.ButtonCallback() { @Override public void onPositive(MaterialDialog dialog) { if (callback != null) { EditText input = (EditText) view.findViewById(R.id.input); callback.onInput(input.getText().toString().trim()); } } }) .customView(view, true); final EditText input = (EditText) view.findViewById(R.id.input); if (hint != 0) input.setHint(hint); if (prefillInput != null) input.append(prefillInput); MaterialDialog alert = dialog.build(); alert.setOnDismissListener( new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { if (callback instanceof InputCancelCallback) ((InputCancelCallback) callback).onCancel(); } }); alert.show(); }
/** * On button click, the check dialog will be brought up. * * @param button */ public Check(Button button) { Activity activity = (Activity) button.getContext(); // inflate the dialog view from the resource and create the dialog with // that view AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle("Check"); LayoutInflater inflater = activity.getLayoutInflater(); View v = inflater.inflate(R.layout.check_dialog, null); builder.setView(v); builder.setPositiveButton( R.string.ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { // no special action when user clicks ok } }); this.dialog = builder.create(); // get references to the dynamic controls in the view this.checkTest = (TextView) v.findViewById(R.id.check_test); this.checkTargetProgress = (ProgressBar) v.findViewById(R.id.check_target_progress); this.checkActualProgress = (ProgressBar) v.findViewById(R.id.check_actual_progress); this.checkResult = (TextView) v.findViewById(R.id.check_result); this.maxRoll = button.getResources().getInteger(R.integer.max_roll); this.wrapper = new Wrapper(); button.setOnClickListener(wrapper); }
public ChartListAdapter(Activity activity) { this.setDownloadInfos(new ArrayList<AppStats>()); this.layoutInflater = activity.getLayoutInflater(); this.activity = activity; this.scale = activity.getResources().getDisplayMetrics().density; this.dateFormat = new SimpleDateFormat(Preferences.getDateFormatShort(activity)); }
public ExportOptionsDialog(final List<cgCache> caches, final Activity activity) { super(activity); View layout = activity.getLayoutInflater().inflate(R.layout.gpx_export_dialog, null); setView(layout); final TextView text = (TextView) layout.findViewById(R.id.info); text.setText(getString(R.string.export_gpx_info, Settings.getGpxExportDir())); final CheckBox shareOption = (CheckBox) layout.findViewById(R.id.share); shareOption.setChecked(Settings.getShareAfterExport()); shareOption.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { Settings.setShareAfterExport(shareOption.isChecked()); } }); layout .findViewById(R.id.export) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { dismiss(); new ExportTask(caches, activity).execute((Void) null); } }); }