Sha256: 749fd6af24ca1da9b6504107de4075582d2f152285a02322f454d95fafe5998d

Contents?: true

Size: 851 Bytes

Versions: 14

Compression:

Stored size: 851 Bytes

Contents

class BitmapDrawableWrapper
  def initialize(drawable)
    @native = drawable
  end
  
  def native
    @native
  end
  
  def to_bitmap
    @native.getBitmap
  end
  
  def height
    @native.getIntrinsicHeight
  end
  
  def width
    @native.getIntrinsicWidth
  end
end

class AssetHandler
  
  def initialize(url)
    @url = url
  end
  
  def self.download(url)
    AssetHandler.new(url)
  end
  
  def start
    async.perform {
      result = BitmapDrawableWrapper.new(Java::com.droiuby.client.core.utils.Utils.loadAppAssetRuby(_execution_bundle, _current_app, _current_activity,
      @url, Java::com.droiuby.client.core.utils.Utils::ASSET_TYPE_IMAGE, Java::com.droiuby.client.core.utils.Utils::HTTP_GET))
      result
    }.done { |result|
      @block.call(result)
    }.start
  end
  
  def done(&block)
    @block = block
    self
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
droiuby-0.3.3 lib/droiuby/support/asset.rb
droiuby-0.3.2 lib/droiuby/support/asset.rb
droiuby-0.3.1 lib/droiuby/support/asset.rb
droiuby-0.3.0 lib/droiuby/support/asset.rb
droiuby-0.2.9 lib/droiuby/support/asset.rb
droiuby-0.2.8 lib/droiuby/support/asset.rb
droiuby-0.2.7 lib/droiuby/support/asset.rb
droiuby-0.2.6 lib/droiuby/support/asset.rb
droiuby-0.2.5 lib/droiuby/support/asset.rb
droiuby-0.2.4 lib/droiuby/support/asset.rb
droiuby-0.2.3 lib/droiuby/support/asset.rb
droiuby-0.2.2 lib/droiuby/support/asset.rb
droiuby-0.2.1 lib/droiuby/support/asset.rb
droiuby-0.2.0 lib/droiuby/support/asset.rb