Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-16742

Android: Inconsistency in the handling of leading '/' of ImageView

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Duplicate
    • Affects Version/s: Release 3.2.2
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
      None
    • Environment:

      Titanium Studio 3.2.1

      Description

      Steps to Reproduce

      Starting from the default alloy project, simply copy the appicon.png under app/assets/images/alloy.png and notice an inconsistency in the handling of leading '/' of ImageView

      Test case

      index.xml

       
      <Alloy>
      	<Window id="win" backgroundColor="white">
      		<TableView id="table">
      			<TableViewSection headerTitle="Image">
      				<TableViewRow>
      					<Label text="Leading /" />
      					<ImageView image="/images/alloy.png" />
      				</TableViewRow>
      				<TableViewRow>
      					<Label text="No leading /" />
      					<ImageView image="images/alloy.png" />
      				</TableViewRow>
      			</TableViewSection>
      			<TableViewSection headerTitle="BackgroundImage">
      				<TableViewRow>
      					<Label text="Leading /" />
      					<ImageView backgroundImage="/images/alloy.png" />
      				</TableViewRow>
      				<TableViewRow>
      					<Label text="No leading /" />
      					<ImageView backgroundImage="images/alloy.png" />
      				</TableViewRow>
      			</TableViewSection>
      			<TableViewSection headerTitle="Image from code">
      				<TableViewRow>
      					<Label text="Leading /" />
      					<ImageView id="image1" />
      				</TableViewRow>
      				<TableViewRow>
      					<Label text="No leading /" />
      					<ImageView id="image2" />
      				</TableViewRow>
      			</TableViewSection>
      			<TableViewSection headerTitle="BackgroundImage from code">
      				<TableViewRow>
      					<Label text="Leading /" />
      					<ImageView id="image3" />
      				</TableViewRow>
      				<TableViewRow>
      					<Label text="No leading /" />
      					<ImageView id="image4" />
      				</TableViewRow>
      			</TableViewSection>
      		</TableView>
      	</Window>
      </Alloy>
      

      index.tss

       
      "TableViewRow":
      {
      	layout: "horizontal",
      	height: Ti.UI.SIZE
      },
      "ImageView":
      {
      	height : "128px",
      	width: "128px"
      }
      

      index.js

       
      $.image1.setImage('/images/alloy.png');
      $.image2.setImage('images/alloy.png');
      $.image3.setBackgroundImage('/images/alloy.png');
      $.image4.setBackgroundImage('images/alloy.png');
       
      $.win.open();
      

      Actual Result

      iOS Simulator:
      Imageviews work both with and without leading '/' wether it’s for the image property to the Imageview Property

      Android:
      ImageViews don’t work without leading '/'.

      Mobileweb deployed in root folder of server (e.g.www.site.com/index.html):
      Imageviews work both with and without leading '/' wether it’s for the image property to the Imageview Property

      Mobileweb deployed elsewhere than the root (e.g. www.site.com/test/index.html):
      Imageviews don’t work with leading '/' for the image property.
      Imageviews work both with and without leading '/' for the backgroundImage property

      Expected Result

      The bare minimum would be for Imageviews to work as expected with the leading '/' for the image property wherever the mobile web app is deployed (absolute paths should be considered relative to root of the app). It's already done properly for the backgroundImage property, clearly showing it's a bug for the image property.

      Additionally, all platforms should work the same, inconsistencies create the unnecessary need for customized code/files per platform.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                kayl Kevin Frugier
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-18543
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code