Click an image

@param index
@return True if handled here; False, let the caller handle it, i.e. launch 3rd party app to open attachment
768096
public boolean clickOn(int index) {
		ImageItem item = getItem(index);
		if (item == null || TextUtils.isEmpty(item.mimeType)) {
			return false;
		}
		// For non-image items, the first tap will start it downloading
		if (!Util.isMimeTypeImage(item.mimeType)) {
			// It is being downloaded, do nothing (prevent double tap, etc)
			if (downloadItems.contains(item.originalPath)) {
				return true;
			} else {
				// If no write permission, do not try to download. Instead let caller handles it by launching browser
				if (!bHasWritePermission) {
					return false;
				}
				File localFile = new File(item.localCachePath);
				if (localFile.exists() && ApptentiveAttachmentLoader.getInstance().isFileCompletelyDownloaded(item.localCachePath)) {
					// If have right permission, and already downloaded, let caller open 3rd app to view it
					return false;
				} else {
					// First tap detected and never download before, start download
					downloadItems.add(item.originalPath);
					notifyDataSetChanged();
					return true;
				}
			}
		}
		return false;
	}
1284500
public function isFile($index)
	{
		if (isset($this->_list[$index])) {
			return ($this->_list[$index]->Type == self::OLE_PPS_TYPE_FILE);
		}
		return false;
	}
1354093
public boolean scrollRecyclerViewToBottom(int index) {
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "scrollRecyclerViewToBottom("+index+")");
		}
		
		if(!config.shouldScroll) {
			return true;
		}
		
		View recyclerView = viewFetcher.getRecyclerView(index, Timeout.getSmallTimeout());
		
		scroller.scrollViewAllTheWay(recyclerView, Scroller.DOWN);
		
		return false;
	}
390970
public WebDriver window(int index) {
    try {
      return Wait().until(windowToBeAvailableAndSwitchToIt(index));
    }
    catch (TimeoutException e) {
      throw new NoSuchWindowException("No window found with index: " + index, e);
    }
  }
921063
@Override
    public boolean has(int index, Scriptable start)
    {
        if (externalData != null) {
            return (index < externalData.getArrayLength());
        }
        return null != slotMap.query(null, index);
    }
772366
public boolean indexExists(String indexName) {
        return this.client.admin().indices().prepareExists(indexName).execute().actionGet().isExists();
    }
1008164
function crawlImage ($,result, img, callback) {
      var parentUrl = result.url;

      var link = $(img).attr('src');
      var alt = $(img).attr('alt');
      if (link) {
          var linkUri = URI.linkToURI(parentUrl, link);
          pm.crawlImage(parentUrl, linkUri, alt, function(){
            addLinkToQueue(result, parentUrl, linkUri, null, null, callback);
          });
      }
      else {
        callback();
      }
}
225397
def click_button_with_image_src_contains(image_filename)
        all_buttons = button_elements
        found = nil
        all_buttons.select do |x|
          if x["src"] =~ /#{Regexp.escape(image_filename)}/
            found = x
            break
          end
        end

        raise "not image button with src: #{image_filename} found" if found.nil?
        found.click
      end
991659
public static boolean isImage(String extension)
  {
    return extension != null ? IMAGE_FILE_EXTENSIONS.contains(extension.toLowerCase()) : false;
  }
351292
@OnClick(R.id.iv_thumbnail) void onThubmnailClicked() {
    Toast.makeText(getActivity(), posterTitle, Toast.LENGTH_SHORT).show();
  }
473457
public synchronized boolean replace(XEvent event, int index)
			throws IOException {
		// check for index sanity
		if (index < 0 || index >= size) {
			throw new IndexOutOfBoundsException();
		}
		// determine and set appropriate file pointer position
		navigateToIndex(index);
		storage.seek(position);
		long atePosition = position;
		// read navigation data
		int fwd = storage.readInt();
		// skip backwards pointer and payload size, not relevant
		storage.skipBytes(8);
		int segmentSize = fwd - 12;
		// encode event
		byte[] evtEnc = encode(event);
		boolean success = false;
		if (evtEnc.length <= segmentSize) {
			// overwrite event
			storage.seek(atePosition + 8);
			storage.writeInt(evtEnc.length);
			// insert new padding
			byte segmentPadding[] = new byte[segmentSize - evtEnc.length];
			Arrays.fill(segmentPadding, (byte) 0);
			storage.write(evtEnc);
			storage.write(segmentPadding);
			success = true;
		} else {
			success = false;
		}
		// return to prior position
		this.position = atePosition;
		storage.seek(this.position);
		return success;
	}
1192456
public boolean applyTo(ImageView imageView, String tag) {
        if (mUri != null) {
            imageView.setImageURI(mUri);
            /*
            if ("http".equals(mUri.getScheme()) || "https".equals(mUri.getScheme())) {
                DrawerImageLoader.getInstance().setImage(imageView, mUri, tag);
            } else {

            }
            */
        } else if (mIcon != null) {
            imageView.setImageDrawable(mIcon);
        } else if (mBitmap != null) {
            imageView.setImageBitmap(mBitmap);
        } else if (mIconRes != -1) {
            imageView.setImageResource(mIconRes);
        } else {
            imageView.setImageBitmap(null);
            return false;
        }
        return true;
    }
954185
private boolean updateTrgPic(int index) {
		SubPicture picSrc = subtitleStream.getSubPicture(index);
		SubPicture picTrg = subPictures[index];
		double scaleX = (double) picTrg.getWidth() / picSrc.getWidth();
		double scaleY = (double) picTrg.getHeight() / picSrc.getHeight();
		double fx;
		double fy;
		if (configuration.getApplyFreeScale()) {
			fx = configuration.getFreeScaleFactorX();
			fy = configuration.getFreeScaleFactorY();
		} else {
			fx = 1.0;
			fy = 1.0;
		}

		int wOld = picTrg.getImageWidth();
		int hOld = picTrg.getImageHeight();
		int wNew = (int) (picSrc.getImageWidth() * scaleX * fx + 0.5);
		if (wNew < MIN_IMAGE_DIMENSION) {
			wNew = picSrc.getImageWidth();
		} else if (wNew > picTrg.getWidth()) {
			wNew = picTrg.getWidth();
		}
		int hNew = (int) (picSrc.getImageHeight() * scaleY * fy + 0.5);
		if (hNew < MIN_IMAGE_DIMENSION) {
			hNew = picSrc.getImageHeight();
		} else if (hNew > picTrg.getHeight()) {
			hNew = picTrg.getHeight();
		}
		picTrg.setImageWidth(wNew);
		picTrg.setImageHeight(hNew);
		if (wNew != wOld) {
			int xOfs = (int) (picSrc.getXOffset() * scaleX + 0.5);
			int spaceSrc = (int) ((picSrc.getWidth() - picSrc.getImageWidth())
					* scaleX + 0.5);
			int spaceTrg = picTrg.getWidth() - wNew;
			xOfs += (spaceTrg - spaceSrc) / 2;
			if (xOfs < 0) {
				xOfs = 0;
			} else if (xOfs + wNew > picTrg.getWidth()) {
				xOfs = picTrg.getWidth() - wNew;
			}
			picTrg.setOfsX(xOfs);
		}
		if (hNew != hOld) {
			int yOfs = (int) (picSrc.getYOffset() * scaleY + 0.5);
			int spaceSrc = (int) ((picSrc.getHeight() - picSrc.getImageHeight())
					* scaleY + 0.5);
			int spaceTrg = picTrg.getHeight() - hNew;
			yOfs += (spaceTrg - spaceSrc) / 2;
			if (yOfs + hNew > picTrg.getHeight()) {
				yOfs = picTrg.getHeight() - hNew;
			}
			picTrg.setOfsY(yOfs);
		}
		// was image cropped?
		return (wNew != wOld) || (hNew != hOld);
	}
39083
public synchronized boolean has(int index, Scriptable start) {
        Integer key = new Integer(index);
        return indexedProps.containsKey(key);
    }
1222208
public XEvent remove(int index) {
		try {
			XEvent result = events.remove(index);
			return result;
		} catch (IOException e) {
			e.printStackTrace();
			return null;
		}
	}
90846
function onLinkClick(event) {
    // Resolve anchor link
    var page = url.format( url.resolve(location, this.getAttribute('href')) );

    // Load new page
    piccolo.loadPage( page );
    event.preventDefault();
    return false;
  }
138252
public ImageButton getImageButton(int index) {
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "getImageButton("+index+")");
		}
		
		return getter.getView(ImageButton.class, index);
	}