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 ; }
Click an image