Java Code Examples for android.widget.ImageView

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project 2Degrees-Toolbox, under directory /Toolbox/src/biz/shadowservices/DegreesToolbox/Preferences/.

Source file: WidgetPreferencesActivity.java

  18 
vote

@Override public void onResume(){
  super.onResume();
  widget=(WidgetInstance)getIntent().getSerializableExtra("widget");
  TextView widgetName=(TextView)findViewById(R.id.WidgetName);
  widgetName.setText(widget.toString());
  Gallery g=(Gallery)findViewById(R.id.gallery);
  Log.d(TAG,"background:" + widget.getSelectedBackgroundId(this));
  int background=widget.getSelectedBackgroundId(this);
  g.setSelection(background);
  ImageView preview=(ImageView)findViewById(R.id.previewImage);
  preview.setImageResource(Values.backgroundIds[background]);
  SeekBar s=(SeekBar)findViewById(R.id.transparencySeekBar);
  s.setProgress(widget.getTransparency(this));
}
 

Example 2

From project ActionBarSherlock, under directory /samples/known-bugs/src/com/actionbarsherlock/sample/knownbugs/.

Source file: Issue331.java

  18 
vote

public boolean onOptionsItemSelected(MenuItem item){
  ImageView iv=(ImageView)LayoutInflater.from(this).inflate(R.layout.issue331_action_view,null);
  Animation r=AnimationUtils.loadAnimation(this,R.anim.issue331_refresh);
  r.setRepeatCount(Animation.INFINITE);
  iv.startAnimation(r);
  item.setActionView(iv);
  return true;
}
 

Example 3

From project AlarmApp-Android, under directory /src/org/alarmapp/activities/adapters/.

Source file: AlarmedUserAdapter.java

  18 
vote

@Override public View getView(AlarmedUser item,View row,ViewGroup parent){
  TextView tvName=(TextView)row.findViewById(R.id.tvTitle);
  ImageView ivStatus=(ImageView)row.findViewById(R.id.ivStatus);
  tvName.setText(item.getFullName());
  ivStatus.setImageLevel(item.getAlarmState().getId());
  return (row);
}
 

Example 4

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/cwac/thumbnail/.

Source file: ThumbnailAdapter.java

  18 
vote

public void onReceive(final ThumbnailMessage message){
  final ImageView image=message.getImageView();
  host.runOnUiThread(new Runnable(){
    public void run(){
      if (image.getTag() != null && image.getTag().toString().equals(message.getUrl())) {
        image.setImageDrawable(cache.get(message.getUrl()));
      }
    }
  }
);
}
 

Example 5

From project and-bible, under directory /AndBible/src/net/bible/android/view/activity/readingplan/.

Source file: DailyReading.java

  18 
vote

private void updateTicksAndDone(){
  ReadingStatus status=mReadingPlanControl.getReadingStatus(mDay);
  for (int i=0; i < mImageTickList.size(); i++) {
    ImageView imageTick=mImageTickList.get(i);
    if (status.isRead(i)) {
      imageTick.setImageResource(R.drawable.btn_check_buttonless_on);
    }
 else {
      imageTick.setImageResource(R.drawable.btn_check_buttonless_off);
    }
  }
  mDoneButton.setEnabled(status.isAllRead());
}
 

Example 6

From project andlytics, under directory /src/com/github/andlyticsproject/chart/.

Source file: ChartTextSwitcher.java

  18 
vote

/** 
 * Sets the text of the text view that is currently showing.  This does not perform the animations.
 * @param text the new text to display
 */
public void setCurrentText(CharSequence text,Drawable image){
  RelativeLayout r=(RelativeLayout)getCurrentView();
  r=(RelativeLayout)r.getChildAt(0);
  ImageView i=(ImageView)r.getChildAt(0);
  if (image == null) {
    i.setVisibility(View.GONE);
  }
 else {
    i.setVisibility(View.VISIBLE);
    i.setImageDrawable(image);
  }
  TextView t=(TextView)r.getChildAt(1);
  t.setText(text);
}
 

Example 7

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: PhotoSyncActivity.java

  18 
vote

/** 
 * {@inheritDoc}
 */
@Override public void onItemClick(final AdapterView<?> parent,final View view,final int position,final long id){
  final MobeelizerFile photo=((FileSyncEntity)parent.getItemAtPosition(position)).getPhoto();
  Dialog dialog=new Dialog(this,R.style.MobeelizerDialogTheme);
  dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  dialog.setContentView(R.layout.photo_dialog);
  dialog.setCancelable(true);
  dialog.setCanceledOnTouchOutside(true);
  ImageView photoView=(ImageView)dialog.findViewById(R.id.dialogPhoto);
  photoView.setImageDrawable(BitmapDrawable.createFromStream(photo.getInputStream(),photo.getName()));
  dialog.show();
}
 

Example 8

From project Android-automation, under directory /TmtsApp/src/com/taobao/tmts/framework/app/.

Source file: ImageAdapter.java

  18 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  ImageView i=new ImageView(context);
  i.setImageResource(images[position]);
  i.setLayoutParams(new Gallery.LayoutParams(256,256));
  i.setScaleType(ImageView.ScaleType.FIT_XY);
  return i;
}
 

Example 9

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: DirListActivity.java

  18 
vote

@Override public void onListItemClick(ListView list,View view,int pos,long id){
  ImageView v;
  if (pos == BOOKMARK_POS)   return;
  if (mLastIndicater != null)   mLastIndicater.setVisibility(View.GONE);
  v=(ImageView)view.findViewById(R.id.list_arrow);
  v.setVisibility(View.VISIBLE);
  mLastIndicater=v;
  if (mChangeLocList != null)   mChangeLocList.onChangeLocation(mDirList.get(pos));
}
 

Example 10

From project Android-GifStitch, under directory /src/com/phunkosis/gifstitch/adapters/.

Source file: GifBrowserAdapter.java

  18 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  if (convertView == null)   convertView=new ImageView(this.mContext);
  int desiredSize=parent.getResources().getDimensionPixelSize(R.dimen.browser_thumb_size);
  String imagePath=this.mImageIds.get(position);
  ImageView iv=(ImageView)convertView;
  iv.setAdjustViewBounds(true);
  iv.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
  this.mImageLoader.DisplayImage(imagePath,this.mActivity,iv,desiredSize,desiredSize,true);
  return iv;
}
 

Example 11

From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.

Source file: ListAccountsActivity.java

  18 
vote

public View getView(int position,View convertView,ViewGroup parent){
  LayoutInflater inflater=getLayoutInflater();
  View row=inflater.inflate(R.layout.listaccountcell,parent,false);
  TextView label=(TextView)row.findViewById(R.id.label);
  label.setText(accounts.get(position).getUsername());
  TextView sublabel=(TextView)row.findViewById(R.id.sublabel);
  sublabel.setText(getAccountServer(accounts.get(position)));
  ImageView icon=(ImageView)row.findViewById(R.id.account_type_icon);
  icon.setImageResource(setAccountIcon(accounts.get(position)));
  return row;
}
 

Example 12

From project android-shuffle, under directory /client/src/org/dodgybits/shuffle/android/editor/activity/.

Source file: IconPickerActivity.java

  18 
vote

public View getView(int position,View convertView,ViewGroup parent){
  ImageView i=new ImageView(IconPickerActivity.this);
  Integer iconId=mIconIds[position];
  i.setImageResource(iconId);
  i.setScaleType(ImageView.ScaleType.FIT_CENTER);
  return i;
}
 

Example 13

From project android-wheel, under directory /wheel-demo/src/kankan/wheel/demo/.

Source file: CitiesActivity.java

  18 
vote

@Override public View getItem(int index,View cachedView,ViewGroup parent){
  View view=super.getItem(index,cachedView,parent);
  ImageView img=(ImageView)view.findViewById(R.id.flag);
  img.setImageResource(flags[index]);
  return view;
}
 

Example 14

From project android-wheel_1, under directory /wheel-demo/src/kankan/wheel/demo/.

Source file: CitiesActivity.java

  18 
vote

@Override public View getItem(int index,View cachedView,ViewGroup parent){
  View view=super.getItem(index,cachedView,parent);
  ImageView img=(ImageView)view.findViewById(R.id.flag);
  img.setImageResource(flags[index]);
  return view;
}
 

Example 15

From project android-xbmcremote-sandbox, under directory /src/org/xbmc/android/remotesandbox/ui/base/.

Source file: BaseFragmentTabsActivity.java

  18 
vote

/** 
 * Adds a new tab to the pager. Run this only from  {@link #onCreateTabs()}.
 * @param key A unique name for the tab
 * @param labelResId Resource ID for the label shown in the tab
 * @param fragment Which fragment should be instantiated
 * @param imageResId Resource ID for the icon shown in the tab
 */
protected void addTab(String key,int labelResId,Class<?> fragment,int imageResId){
  final long start=System.currentTimeMillis();
  Log.d(TAG,"Starting addTab()...");
  final View tabIndicator=LayoutInflater.from(this).inflate(R.layout.tab,mTabWidget,false);
  final TextView title=(TextView)tabIndicator.findViewById(R.id.tab_title);
  final ImageView icon=(ImageView)tabIndicator.findViewById(R.id.tab_icon);
  title.setText(labelResId);
  icon.setImageResource(imageResId);
  mTabsAdapter.addTab(mTabHost.newTabSpec(key).setIndicator(tabIndicator),null,fragment,null);
  Log.d(TAG,"addTab() done in " + (System.currentTimeMillis() - start) + "ms.");
}
 

Example 16

From project androidquery, under directory /src/com/androidquery/.

Source file: AbstractAQuery.java

  18 
vote

/** 
 * Set the image of an ImageView.
 * @param resid the resource id
 * @return self
 * @see testImage1
 */
public T image(int resid){
  if (view instanceof ImageView) {
    ImageView iv=(ImageView)view;
    iv.setTag(AQuery.TAG_URL,null);
    if (resid == 0) {
      iv.setImageBitmap(null);
    }
 else {
      iv.setImageResource(resid);
    }
  }
  return self();
}
 

Example 17

From project androidZenWriter, under directory /src/com/javaposse/android/zenwriter/.

Source file: ImageAdapter.java

  18 
vote

public View getView(int position,View convertView,ViewGroup parent){
  ImageView imageView=new ImageView(mContext);
  imageView.setImageResource(mImageIds[position]);
  imageView.setLayoutParams(new Gallery.LayoutParams(150,100));
  imageView.setScaleType(ImageView.ScaleType.FIT_XY);
  imageView.setBackgroundResource(mGalleryItemBackground);
  return imageView;
}
 

Example 18

From project Android_1, under directory /LeftNavBarExample/LeftNavBarLibrary/src/com/example/google/tv/leftnavbar/.

Source file: OptionsDisplay.java

  18 
vote

private View configureOption(View option,CharSequence title,boolean active){
  ImageView iconView=getOptionIcon(option);
  iconView.setEnabled(active);
  getOptionTitle(option).setText(title);
  return option;
}
 

Example 19

From project android_7, under directory /src/org/immopoly/android/fragments/.

Source file: ItemsFragment.java

  18 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  ImmopolyActionItem item=mActionItems.get(position);
  View inflate=mInflater.inflate(R.layout.action_item,null);
  ImageView image=(ImageView)inflate.findViewById(R.id.image);
  mDownloader.download(item.getImageUrl(),image);
  ((TextView)inflate.findViewById(R.id.title)).setText(item.getText() + " (" + item.getAmount()+ ")");
  return inflate;
}
 

Example 20

From project android_8, under directory /src/com/defuzeme/playqueue/.

Source file: PlayQueue.java

  18 
vote

public void onStartDrag(View itemView){
  if (itemView != null) {
    itemView.setVisibility(View.INVISIBLE);
    defaultBackground=itemView.getBackground();
    itemView.setBackgroundResource(com.defuzeme.R.drawable.play_queue_item_hover);
    final ImageView iv=(ImageView)itemView.findViewById(com.defuzeme.R.id.ImageView01);
    if (iv != null)     iv.setVisibility(View.INVISIBLE);
  }
}
 

Example 21

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/bluetooth/.

Source file: BluetoothDevicePreference.java

  18 
vote

@Override protected void onBindView(View view){
  if (null != findPreferenceInHierarchy("bt_checkbox")) {
    setDependency("bt_checkbox");
  }
  super.onBindView(view);
  ImageView btClass=(ImageView)view.findViewById(R.id.btClass);
  btClass.setImageResource(mCachedDevice.getBtClassDrawable());
  btClass.setAlpha(isEnabled() ? 255 : sDimAlpha);
}
 

Example 22

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AASettings.java

  17 
vote

/** 
 * Creates and returns the current view in the list
 */
@Override public View getView(int position,View convertView,ViewGroup parent){
  LayoutInflater inflater=AASettings.this.getLayoutInflater();
  SharedPreferences settings=AASettings.this.settings;
  View row;
  if (convertView == null)   row=inflater.inflate(R.layout.color_row,null);
 else   row=convertView;
  TextView tv_colorType=(TextView)row.findViewById(R.id.tv_colorType);
  ImageView iv_colorDisplay=(ImageView)row.findViewById(R.id.iv_colorDiplay);
  DisplayTypes[] displayTypes=DisplayTypes.values();
  ColorDrawable color=new ColorDrawable(settings.getInt(displayTypes[position].toString(),getDefaultColor(position)));
  iv_colorDisplay.setBackgroundResource(R.drawable.topbar);
  iv_colorDisplay.setImageDrawable(color);
  tv_colorType.setText(this.getItem(position));
  return row;
}
 

Example 23

From project aksunai, under directory /src/org/androidnerds/app/aksunai/ui/.

Source file: ChatSwitcher.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  requestWindowFeature(Window.FEATURE_NO_TITLE);
  setContentView(R.layout.chat_switcher_dialog);
  mContainer=(ViewGroup)findViewById(R.id.pseudogallery);
synchronized (mServer.mMessageLists) {
    for (    MessageList c : mServer.mMessageLists.values()) {
      LayoutInflater inflater=(LayoutInflater)mCtx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      View v=inflater.inflate(R.layout.chat_switcher_item,null);
      TextView tv=(TextView)v.findViewById(R.id.switcher_chat_title);
      tv.setText(c.mName);
      ImageView iv=(ImageView)v.findViewById(R.id.avatar);
      if (c.mType == MessageList.Type.PRIVATE) {
        iv.setImageResource(R.drawable.chat);
      }
 else       if (c.mType == MessageList.Type.CHANNEL) {
        iv.setImageResource(R.drawable.channel);
      }
 else {
        iv.setImageResource(R.drawable.server);
      }
      v.setOnClickListener(mClickListener);
      mContainer.addView(v);
    }
  }
  mContainer.requestLayout();
}
 

Example 24

From project Alerte-voirie-android, under directory /src/com/c4mprod/utils/.

Source file: ImageDownloader.java

  17 
vote

/** 
 * Once the image is downloaded, associates it to the imageView
 */
@Override protected void onPostExecute(Bitmap bitmap){
  if (isCancelled()) {
    bitmap=null;
  }
  addBitmapToCache(url,bitmap);
  if (imageViewReference != null) {
    ImageView imageView=imageViewReference.get();
    BitmapDownloaderTask bitmapDownloaderTask=getBitmapDownloaderTask(imageView);
    if ((this == bitmapDownloaderTask) || (mode != Mode.CORRECT)) {
      imageView.setImageBitmap(bitmap);
      imageView.setBackgroundDrawable(null);
      if (listener != null) {
        listener.onImageDownloaded(imageView,url,mfolder + "/" + URLEncoder.encode(url),imageView.getDrawable().getIntrinsicWidth(),imageView.getDrawable().getIntrinsicHeight());
      }
    }
  }
}
 

Example 25

From project Amantech, under directory /Android/action_bar_sherlock/src/com/actionbarsherlock/widget/.

Source file: ActivityChooserView.java

  17 
vote

public View getView(int position,View convertView,ViewGroup parent){
  final int itemViewType=getItemViewType(position);
switch (itemViewType) {
case ITEM_VIEW_TYPE_FOOTER:
    if (convertView == null || convertView.getId() != ITEM_VIEW_TYPE_FOOTER) {
      convertView=LayoutInflater.from(getContext()).inflate(R.layout.abs__activity_chooser_view_list_item,parent,false);
      convertView.setId(ITEM_VIEW_TYPE_FOOTER);
      TextView titleView=(TextView)convertView.findViewById(R.id.abs__title);
      titleView.setText(mContext.getString(R.string.abs__activity_chooser_view_see_all));
    }
  return convertView;
case ITEM_VIEW_TYPE_ACTIVITY:
if (convertView == null || convertView.getId() != R.id.abs__list_item) {
  convertView=LayoutInflater.from(getContext()).inflate(R.layout.abs__activity_chooser_view_list_item,parent,false);
}
PackageManager packageManager=mContext.getPackageManager();
ImageView iconView=(ImageView)convertView.findViewById(R.id.abs__icon);
ResolveInfo activity=(ResolveInfo)getItem(position);
iconView.setImageDrawable(activity.loadIcon(packageManager));
TextView titleView=(TextView)convertView.findViewById(R.id.abs__title);
titleView.setText(activity.loadLabel(packageManager));
if (IS_HONEYCOMB) {
if (mShowDefaultActivity && position == 0 && mHighlightDefaultActivity) {
SetActivated.invoke(convertView,true);
}
 else {
SetActivated.invoke(convertView,false);
}
}
return convertView;
default :
throw new IllegalArgumentException();
}
}
 

Example 26

From project android-bankdroid, under directory /src/com/liato/bankdroid/adapters/.

Source file: AccountsAdapter.java

  17 
vote

public View newBankView(Bank bank,ViewGroup parent,View convertView){
  if (convertView == null) {
    convertView=inflater.inflate(R.layout.listitem_accounts_group,parent,false);
  }
  ImageView icon=(ImageView)convertView.findViewById(R.id.imgListitemAccountsGroup);
  ((TextView)convertView.findViewById(R.id.txtListitemAccountsGroupAccountname)).setText(bank.getDisplayName());
  ((TextView)convertView.findViewById(R.id.txtListitemAccountsGroupBankname)).setText(bank.getName());
  ((TextView)convertView.findViewById(R.id.txtListitemAccountsGroupTotal)).setText(Helpers.formatBalance(bank.getBalance(),bank.getCurrency(),prefs.getBoolean("round_balance",false) || !bank.getDisplayDecimals()));
  icon.setImageResource(bank.getImageResource());
  ImageView warning=(ImageView)convertView.findViewById(R.id.imgWarning);
  if (bank.isDisabled()) {
    warning.setVisibility(View.VISIBLE);
  }
 else {
    warning.setVisibility(View.INVISIBLE);
  }
  return convertView;
}
 

Example 27

From project android-context, under directory /defunct/shared/.

Source file: AboutActivity.java

  17 
vote

public View getView(int position,View convertView,ViewGroup parent){
  AboutItem item=items.get(position);
  if (item.isSeparator()) {
    View aboutView=LayoutInflater.from(context).inflate(R.layout.aboutseparator,null);
    TextView titleTextView=(TextView)aboutView.findViewById(R.id.title);
    titleTextView.setText(item.getTitle());
    return aboutView;
  }
  View aboutView=LayoutInflater.from(context).inflate(R.layout.aboutitem,null);
  TextView titleTextView=(TextView)aboutView.findViewById(R.id.title);
  titleTextView.setText(item.getTitle());
  TextView detailsTextView=(TextView)aboutView.findViewById(R.id.details);
  detailsTextView.setText(item.getDescription());
  if (item.getIcon() > 0) {
    ImageView iconImageView=(ImageView)aboutView.findViewById(R.id.icon);
    iconImageView.setImageResource(item.getIcon());
  }
  return aboutView;
}
 

Example 28

From project Android-File-Manager, under directory /src/com/nexes/manager/.

Source file: ProcessManager.java

  17 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  View view=convertView;
  String pkg_name=display_process.get(position).processName;
  if (view == null) {
    LayoutInflater inflater=getLayoutInflater();
    view=inflater.inflate(R.layout.tablerow,parent,false);
  }
  TextView bottom_label=(TextView)view.findViewById(R.id.bottom_view);
  TextView top_label=(TextView)view.findViewById(R.id.top_view);
  ImageView icon=(ImageView)view.findViewById(R.id.row_image);
  icon.setAdjustViewBounds(true);
  icon.setMaxHeight(40);
  top_label.setText(parse_name(pkg_name));
  bottom_label.setText(String.format("%s, pid: %d",display_process.get(position).processName,display_process.get(position).pid));
  try {
    icon.setImageDrawable(pk.getApplicationIcon(pkg_name));
  }
 catch (  NameNotFoundException e) {
    icon.setImageResource(R.drawable.processinfo);
  }
  return view;
}
 

Example 29

From project Android-Flashcards, under directory /src/com/secretsockssoftware/androidflashcards/.

Source file: AndroidFlashcards.java

  17 
vote

public View getView(int position,View convertView,ViewGroup parent){
  View row=convertView;
  if (row == null) {
    LayoutInflater inflater=getLayoutInflater();
    row=inflater.inflate(R.layout.lesson_list,parent,false);
    row.setTag(R.id.list_label,row.findViewById(R.id.list_label));
    row.setTag(R.id.list_desc,row.findViewById(R.id.list_desc));
    row.setTag(R.id.list_count,row.findViewById(R.id.list_count));
    row.setTag(R.id.list_icon,row.findViewById(R.id.list_icon));
  }
  ((TextView)row.getTag(R.id.list_label)).setText(items[position].name);
  ((TextView)row.getTag(R.id.list_desc)).setText(items[position].desc);
  ((TextView)row.getTag(R.id.list_count)).setText(items[position].count);
  ImageView icon=(ImageView)row.getTag(R.id.list_icon);
  if (items[position].isDir)   icon.setImageResource(R.drawable.folder);
 else   icon.setImageResource(R.drawable.list_icon);
  return (row);
}
 

Example 30

From project android-joedayz, under directory /Proyectos/FBConnectTest/src/com/facebook/android/.

Source file: FbDialog.java

  17 
vote

private void createCrossImage(){
  mCrossImage=new ImageView(getContext());
  mCrossImage.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mListener.onCancel();
      FbDialog.this.dismiss();
    }
  }
);
  Drawable crossDrawable=getContext().getResources().getDrawable(R.drawable.close);
  mCrossImage.setImageDrawable(crossDrawable);
  mCrossImage.setVisibility(View.INVISIBLE);
}
 

Example 31

From project android-tether, under directory /facebook/src/com/facebook/android/.

Source file: FbDialog.java

  17 
vote

private void createCrossImage(){
  mCrossImage=new ImageView(getContext());
  mCrossImage.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      mListener.onCancel();
      FbDialog.this.dismiss();
    }
  }
);
  Drawable crossDrawable=getContext().getResources().getDrawable(R.drawable.close);
  mCrossImage.setImageDrawable(crossDrawable);
  mCrossImage.setVisibility(View.INVISIBLE);
}
 

Example 32

From project android-xbmcremote, under directory /src/org/xbmc/android/remote/presentation/controller/.

Source file: HomeController.java

  17 
vote

public View getView(int position,View convertView,ViewGroup parent){
  View row;
  if (convertView == null) {
    LayoutInflater inflater=mActivity.getLayoutInflater();
    row=inflater.inflate(R.layout.home_item,null);
  }
 else {
    row=convertView;
  }
  HomeItem item=this.getItem(position);
  TextView title=(TextView)row.findViewById(R.id.TitleTextView);
  TextView subtitle=(TextView)row.findViewById(R.id.SubtitleTextView);
  ImageView icon=(ImageView)row.findViewById(R.id.IconImageView);
  title.setText(item.title);
  subtitle.setText(item.subtitle);
  icon.setImageResource(item.icon);
  return row;
}
 

Example 33

From project AndroidDevWeekendDub-BookLibrary, under directory /src/org/curiouscreature/android/shelves/activity/.

Source file: BookDetailsActivity.java

  17 
vote

private void setupViews(){
  final FastBitmapDrawable defaultCover=new FastBitmapDrawable(BitmapFactory.decodeResource(getResources(),R.drawable.unknown_cover));
  final ImageView cover=(ImageView)findViewById(R.id.image_cover);
  cover.setImageDrawable(ImageUtilities.getCachedCover(mBook.getInternalId(),defaultCover));
  setTextOrHide(R.id.label_title,mBook.getTitle());
  setTextOrHide(R.id.label_author,TextUtilities.join(mBook.getAuthors(),", "));
  final int pages=mBook.getPagesCount();
  if (pages > 0) {
    ((TextView)findViewById(R.id.label_pages)).setText(getString(R.string.label_pages,pages));
  }
 else {
    findViewById(R.id.label_pages).setVisibility(View.GONE);
  }
  final Date publicationDate=mBook.getPublicationDate();
  if (publicationDate != null) {
    final String date=new SimpleDateFormat("MMMM yyyy").format(publicationDate);
    ((TextView)findViewById(R.id.label_date)).setText(date);
  }
 else {
    findViewById(R.id.label_date).setVisibility(View.GONE);
  }
  setTextOrHide(R.id.label_publisher,mBook.getPublisher());
  final WebView details=(WebView)findViewById(R.id.html_reviews);
  details.setBackgroundColor(0);
  details.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
  final WebSettings webSettings=details.getSettings();
  webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);
  webSettings.setSavePassword(false);
  webSettings.setSaveFormData(false);
  webSettings.setJavaScriptEnabled(false);
  webSettings.setSupportZoom(false);
  webSettings.setBlockNetworkImage(true);
  details.loadData(mBook.getDescriptions().get(0).toString(),"text/html","utf-8");
}
 

Example 34

From project AndroidLab, under directory /src/src/de/tubs/ibr/android/ldap/core/activities/.

Source file: EditContactActivity.java

  17 
vote

public View getDropDownView(int position,View convertView,ViewGroup parent){
  if (convertView == null) {
    LayoutInflater layoutInflater=getLayoutInflater();
    convertView=layoutInflater.inflate(R.layout.account_entry,parent,false);
  }
  TextView firstAccountLine=(TextView)convertView.findViewById(R.id.firstAccountLine);
  TextView secondAccountLine=(TextView)convertView.findViewById(R.id.secondAccountLine);
  ImageView accountIcon=(ImageView)convertView.findViewById(R.id.accountIcon);
  AccountData data=getItem(position);
  firstAccountLine.setText(data.getName());
  secondAccountLine.setText(data.getTypeLabel());
  Drawable icon=data.getIcon();
  if (icon == null) {
    icon=getResources().getDrawable(android.R.drawable.ic_menu_search);
  }
  accountIcon.setImageDrawable(icon);
  return convertView;
}
 

Example 35

From project androidTileMapEditor_1, under directory /src/it/sineo/android/tileMapEditor/.

Source file: AboutActivity.java

  17 
vote

public View createTabContent(String tag,LayoutInflater inflater){
  Context ctx=inflater.getContext();
  if (TAG_INFO.equals(tag)) {
    View v=inflater.inflate(R.layout.about_info,null,false);
    String version="?";
    try {
      PackageInfo info=ctx.getPackageManager().getPackageInfo(ctx.getPackageName(),0);
      version=info.versionName;
    }
 catch (    PackageManager.NameNotFoundException pmnnfex) {
      pmnnfex.printStackTrace();
    }
    ((TextView)v.findViewById(R.id.about_info_version)).setText(getResources().getString(R.string.about_info_version,version));
    ImageView ivDonate=(ImageView)v.findViewById(R.id.donate_button);
    ivDonate.setOnClickListener(new View.OnClickListener(){
      @Override public void onClick(      View v){
        Intent i=new Intent(Intent.ACTION_VIEW,Uri.parse(getString(R.string.paypal_donate_url)));
        startActivity(i);
      }
    }
);
    return v;
  }
 else   if (TAG_CHANGELOG.equals(tag)) {
    return ChangelogFactory.inflate(ctx,R.xml.changelog);
  }
 else   if (TAG_LICENSE.equals(tag)) {
    return createLicenseView(R.raw.license,inflater);
  }
  Log.e(getClass().getName(),"unknown tag: " + tag);
  return null;
}
 

Example 36

From project android-pulltorefresh, under directory /library/src/com/handmark/pulltorefresh/library/internal/.

Source file: IndicatorLayout.java

  16 
vote

public IndicatorLayout(Context context,PullToRefreshBase.Mode mode){
  super(context);
  mArrowImageView=new ImageView(context);
  final int padding=getResources().getDimensionPixelSize(R.dimen.indicator_internal_padding);
  mArrowImageView.setPadding(padding,padding,padding,padding);
  addView(mArrowImageView);
  int inAnimResId, outAnimResId;
switch (mode) {
case PULL_UP_TO_REFRESH:
    inAnimResId=R.anim.slide_in_from_bottom;
  outAnimResId=R.anim.slide_out_to_bottom;
setBackgroundResource(R.drawable.indicator_bg_bottom);
mArrowImageView.setImageResource(R.drawable.arrow_up);
break;
default :
case PULL_DOWN_TO_REFRESH:
inAnimResId=R.anim.slide_in_from_top;
outAnimResId=R.anim.slide_out_to_top;
setBackgroundResource(R.drawable.indicator_bg_top);
mArrowImageView.setImageResource(R.drawable.arrow_down);
break;
}
mInAnim=AnimationUtils.loadAnimation(context,inAnimResId);
mInAnim.setAnimationListener(this);
mOutAnim=AnimationUtils.loadAnimation(context,outAnimResId);
mOutAnim.setAnimationListener(this);
final Interpolator interpolator=new LinearInterpolator();
mRotateAnimation=new RotateAnimation(0,-180,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
mRotateAnimation.setInterpolator(interpolator);
mRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
mRotateAnimation.setFillAfter(true);
mResetRotateAnimation=new RotateAnimation(-180,0,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);
mResetRotateAnimation.setInterpolator(interpolator);
mResetRotateAnimation.setDuration(DEFAULT_ROTATION_ANIMATION_DURATION);
mResetRotateAnimation.setFillAfter(true);
}
 

Example 37

From project abalone-android, under directory /src/com/bytopia/abalone/.

Source file: GameActivity.java

  15 
vote

public void ballCaptured(final byte side){
  Runnable runnable=new Runnable(){
    @Override public void run(){
      LinearLayout ll1=(LinearLayout)findViewById(R.id.top_balls);
      LinearLayout ll2=(LinearLayout)findViewById(R.id.bottom_balls);
      ImageView iw=new ImageView(bw.getContext());
      iw.setImageResource((side == Side.BLACK) ? R.drawable.black_ball : R.drawable.white_ball);
      iw.setAdjustViewBounds(true);
      iw.setMaxHeight(CAPTURED_BALL_SIZE);
      iw.setMaxWidth(CAPTURED_BALL_SIZE);
      iw.setScaleType(ScaleType.CENTER_INSIDE);
      if (side == Side.BLACK) {
        ll1.addView(iw);
      }
 else {
        ll2.addView(iw);
      }
    }
  }
;
  runOnUiThread(runnable);
}
 

Example 38

From project actionbar, under directory /src/com/kamalan/widget/.

Source file: ActionBar.java

  15 
vote

public void init(){
  mInflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  RelativeLayout barView=(RelativeLayout)mInflater.inflate(R.layout.actionbar,null);
  addView(barView);
  mProgress=(ProgressBar)barView.findViewById(R.id.actionbar_progress);
  mTitleView=(TextView)barView.findViewById(R.id.actionbar_title);
  mImageView=(ImageView)barView.findViewById(R.id.actionbar_menu);
  mImageView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      actionbarClickedListener.eventOccured(v.getId());
    }
  }
);
  ibStage=(ImageButton)barView.findViewById(R.id.actionbar_stage);
  ibStage.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      actionbarClickedListener.eventOccured(v.getId());
    }
  }
);
}
 

Example 39

From project ActionBarCompat, under directory /ActionBarCompat/src/sk/m217/actionbarcompat/.

Source file: ActionBarCompatHoneycomb.java

  15 
vote

public static void setIcon(Activity activity,Drawable icon){
  View v=activity.findViewById(android.R.id.home);
  if (v != null && v instanceof ImageView) {
    ((ImageView)v).setImageDrawable(icon);
  }
}
 

Example 40

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: InfoAdapter.java

  15 
vote

@Override public View getView(final int position,final View convertView,final ViewGroup parent){
  ViewHolder holder;
  View view=convertView;
  if (view == null) {
    view=inflater.inflate(R.layout.widget_info_item,null);
    holder=new ViewHolder();
    holder.icon=(ImageView)view.findViewById(R.id.icon);
    holder.text=(TextView)view.findViewById(R.id.text);
    view.setTag(holder);
  }
 else {
    holder=(ViewHolder)view.getTag();
  }
  final InfoItem item=getItem(position);
  holder.icon.setImageResource(item.iconRes);
  holder.text.setText(resources.getString(item.textRes));
  return view;
}
 

Example 41

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: CommitViewHolder.java

  15 
vote

@Inject public CommitViewHolder(@Assisted View v,ImageSession avatarSession){
  this.avatarSession=avatarSession;
  commit_date=(TextView)v.findViewById(tv_commit_list_item_commit_date);
  commit_shortdesc=(TextView)v.findViewById(tv_commit_list_item_shortdesc);
  gravatar=(ImageView)v.findViewById(iv_commit_list_item_gravatar);
}
 

Example 42

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/adapter/.

Source file: SessionAdapter.java

  15 
vote

private void fillStats(View view,Session session){
  ((TextView)view.findViewById(R.id.session_time)).setText(FormatHelper.timeText(session));
  if (selectedSensor == null) {
    view.findViewById(R.id.avg_container).setVisibility(View.GONE);
    view.findViewById(R.id.peak_container).setVisibility(View.GONE);
  }
 else {
    view.findViewById(R.id.avg_container).setVisibility(View.VISIBLE);
    view.findViewById(R.id.peak_container).setVisibility(View.VISIBLE);
    String name=selectedSensor.getSensorName();
    MeasurementStream stream=session.getStream(name);
    int peak=(int)stream.getPeak();
    int avg=(int)stream.getAvg();
    ((TextView)view.findViewById(R.id.session_peak)).setText(valueOf(peak));
    ((TextView)view.findViewById(R.id.session_average)).setText(valueOf(avg));
    updateImage((ImageView)view.findViewById(R.id.session_average_marker),avg);
    updateImage((ImageView)view.findViewById(R.id.session_peak_marker),peak);
  }
}
 

Example 43

From project Android, under directory /app/src/main/java/com/github/mobile/core/commit/.

Source file: CommitUtils.java

  15 
vote

/** 
 * Bind commit author avatar to image view
 * @param commit
 * @param avatars
 * @param view
 * @return view
 */
public static ImageView bindAuthor(final RepositoryCommit commit,final AvatarLoader avatars,final ImageView view){
  User author=commit.getAuthor();
  if (author != null)   avatars.bind(view,author);
 else {
    Commit rawCommit=commit.getCommit();
    if (rawCommit != null)     avatars.bind(view,rawCommit.getAuthor());
  }
  return view;
}
 

Example 44

From project android-mapviewballoons, under directory /android-mapviewballoons-example/src/mapviewballoons/example/custom/.

Source file: CustomBalloonOverlayView.java

  15 
vote

@Override protected void setupView(Context context,final ViewGroup parent){
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View v=inflater.inflate(R.layout.balloon_overlay_example2,parent);
  title=(TextView)v.findViewById(R.id.balloon_item_title);
  snippet=(TextView)v.findViewById(R.id.balloon_item_snippet);
  image=(ImageView)v.findViewById(R.id.balloon_item_image);
}
 

Example 45

From project android-thaiime, under directory /latinime/src/com/android/inputmethod/deprecated/voice/.

Source file: RecognitionView.java

  15 
vote

public RecognitionView(Context context,OnClickListener clickListener){
  mUiHandler=new Handler();
  LayoutInflater inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  mView=inflater.inflate(R.layout.recognition_status,null);
  mPopupLayout=mView.findViewById(R.id.popup_layout);
  Resources r=context.getResources();
  mListeningBorder=r.getDrawable(R.drawable.vs_dialog_red);
  mWorkingBorder=r.getDrawable(R.drawable.vs_dialog_blue);
  mErrorBorder=r.getDrawable(R.drawable.vs_dialog_yellow);
  mInitializing=r.getDrawable(R.drawable.mic_slash);
  mError=r.getDrawable(R.drawable.caution);
  mImage=(ImageView)mView.findViewById(R.id.image);
  mProgress=mView.findViewById(R.id.progress);
  mSoundIndicator=(SoundIndicator)mView.findViewById(R.id.sound_indicator);
  mButton=(Button)mView.findViewById(R.id.button);
  mButton.setOnClickListener(clickListener);
  mText=(TextView)mView.findViewById(R.id.text);
  mLanguage=(TextView)mView.findViewById(R.id.language);
  mContext=context;
}
 

Example 46

From project android-viewflow, under directory /viewflow-example/src/org/taptwo/android/widget/viewflow/example/.

Source file: ImageAdapter.java

  15 
vote

@Override public View getView(int position,View convertView,ViewGroup parent){
  if (convertView == null) {
    convertView=mInflater.inflate(R.layout.image_item,null);
  }
  ((ImageView)convertView.findViewById(R.id.imgView)).setImageResource(ids[position]);
  return convertView;
}