Search code examples
androidtitaniumtitanium-mobiletitanium-modules

Is a TiTouchImageView working in an alloy project? [UPDATE]


I am currently developing a titanium app for android and iOs including an imageView which should be scrollable and scalable (via a slider). I already get this to work on iOs but on Android it is really hard to achieve the scrolling behaviour. I decided to use the TiTouchImageView module but the documentation only shows how to use it in a non-Alloy project. My current code looks like this:

if (Ti.Platform.osname == "android") { 
    var TiTouchImageView = require('org.iotashan.TiTouchImageView');
    var androidImageView = TiTouchImageView.createView({
        top: 0,
        left: 0,
        zoom: originalScaleValue,
        maxZoom: originalScaleValue*2,
        minZoom: originalScaleValue,
        image: blob,            });
        $.androidInnerImageScrollView.add(androidImageView);        
} else {    
     $.iosPicture.setImage(blob);
}

But is there a possibility to load this via the view.xml as an alloy component?

EDIT: I tried it using the module tag in alloy:

<ScrollView id="androidInnerImageScrollView">
    <Module module="org.iotashan.titouchimageview" id="androidPicture"></Module>
</ScrollView>

But I keep getting this error message:

Uncaught Error: Requested module not found: org.iotashan.touchimageview

Solution

  • Thanks for your input Arturo, but this was not the problem. I finally figured out how to use a module in an alloy project by reading the guide. My final code looks like this:

    <Module module="org.iotashan.TiTouchImageView" id="androidPicture"></Module>