Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6_3_X][TIMOB-25284] Android: Fixed bug where images from "res" folder fail to load. (Introduced in 6.2.0.) #9436

Merged
merged 1 commit into from Sep 15, 2017

Conversation

jquick-axway
Copy link
Contributor

JIRA: https://jira.appcelerator.org/browse/TIMOB-25284

Cherry pick of: #9434

Note:
This is an Android show-stopper issue that was deemed necessary to be in 6.3.X.

…to load. (Introduced in 6.2.0.)

- This bug prevented density scaled images from being loaded from the APK's "res" folder via the following features:
  * ImageView.image property
  * NotificationManager "BigPictureStyle"
  * Toolbar images
Copy link
Contributor

@ypbnv ypbnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CR: Pass

@lokeshchdhry
Copy link
Contributor

FR Passed.

var win = Ti.UI.createWindow({backgroundColor: 'grey'});

//Toolbar test
var toolbar = Ti.UI.createToolbar({
    width: Ti.UI.FILL,
    height: 50,
    extendBackground: false,
    top: 50
});

var button = Ti.UI.createButton({
    title: 'Button',
    right: 10,
    top: 0
});

button.addEventListener('click', function(e) {
    Ti.API.info('BackgroundColor is ' + toolbar.getBackgroundColor());
    Ti.API.info('Title is ' + toolbar.getTitle());
    Ti.API.info('Subtitle is ' + toolbar.getSubtitle());
    Ti.API.info('Logo is ' + JSON.stringify(toolbar.getLogo()));
    Ti.API.info('Overflow icon is ' + JSON.stringify(toolbar.getOverflowIcon()));
    Ti.API.info('Navigation icon is ' + JSON.stringify(toolbar.getNavigationIcon()));
  
    toolbar.showOverflowMenu();
  
    setTimeout(function() {
        Ti.API.info('Is overflow menu showed? - ' + toolbar.isOverflowMenuShowing());
      
        toolbar.hideOverflowMenu();
        toolbar.setLogo('/images/logo2.jpg');
        toolbar.collapseActionView();
        toolbar.dismissPopupMenus();
        toolbar.setBackgroundColor('red');
        toolbar.setTitle('New Title');
        toolbar.setTitleTextColor('orange');
        toolbar.setSubtitle('New Subtitle');
        toolbar.setSubtitleTextColor('blue');
        toolbar.contentInsetStartWithNavigation = 0;
      
        Ti.API.info('Content inset end is ' + toolbar.getContentInsetEnd());
        Ti.API.info('Content inset end with actions is ' + toolbar.getContentInsetEndWithActions());
        Ti.API.info('Content inset left is ' + toolbar.getContentInsetLeft());
        Ti.API.info('Content inset right is ' + toolbar.getContentInsetRight());
        Ti.API.info('Content inset start is ' + toolbar.getContentInsetStart());
        Ti.API.info('Content inset start with navigation is ' + toolbar.getContentInsetStartWithNavigation());
    }, 3000);
});

toolbar.setItems([button]);
win.add(toolbar);

win.activity.onCreateOptionsMenu = function(e) {
    var menu = e.menu;
    
    var menuItem = menu.add({
        title: 'Item 1',
        showAsAction: Ti.Android.SHOW_AS_ACTION_NEVER
    });
    
    menuItem.addEventListener('click', function(e) {
        Ti.API.debug('Item 1 was clicked');
    });
    
    var menuItem2 = menu.add({
        title: 'Item 2',
        showAsAction: Ti.Android.SHOW_AS_ACTION_NEVER
    });
    
    var menuItem3 = menu.add({
        title: 'Item 3',
        showAsAction: Ti.Android.SHOW_AS_ACTION_NEVER
    });
    
    var menuItem4 = menu.add({
        title: 'Item 4',
        showAsAction: Ti.Android.SHOW_AS_ACTION_NEVER
    });
};

win.activity.supportToolbar = toolbar;

win.addEventListener('open', function() {
    toolbar.setBackgroundColor('green');
    toolbar.setTitle('Title');
    toolbar.setTitleTextColor('red');
    toolbar.setSubtitle('Subtitle');
    toolbar.setSubtitleTextColor('green');
    toolbar.setLogo('/images/logo.png');
    toolbar.setNavigationIcon('/images/navi.png');
    toolbar.setOverflowIcon('/images/logo.png');
    //toolbar.setContentInsetEndWithActions(10);
    //toolbar.setContentInsetStartWithNavigation(11);
    //toolbar.setContentInsetsAbsolute(12,12);
    toolbar.setContentInsetsRelative(13, 13);
});

//Imageview & button test
var imgView = Ti.UI.createImageView({
	height: 200,
	width: 200,
	image: '/images/mario.png',
	left: 10,
	bottom: 40
});

var but = Ti.UI.createButton({
	width: 100,
	height: 100,
	bottom: 5,
	title: 'MARIO',
	backgroundImage: '/images/mario.png',
	right: 5,
	bottom: 40
});

imgView.addEventListener('click', function(){
	Ti.API.info(imgView.getImage());
});

//Bigpicture test
var bigPictureStyle = Titanium.Android.createBigPictureStyle({ 
	bigPicture: "/images/mario.png", 
	bigContentTitle: "This is big picture", 
	summaryText: "Summary for big picture" 
});

var notification = Titanium.Android.createNotification({ 
	contentTitle: 'Something Happened', 
	contentText : 'Click to return to the application.', 
	style: bigPictureStyle, 
	time: Date.now() 
});

setTimeout(function(){
	Titanium.Android.NotificationManager.notify(1, notification);
}, 3000);

win.add([imgView, but]);
win.open();

Studio Ver: 4.9.1.201707200100
SDK Ver: 6.3.0 local build
OS Ver: 10.12.3
Xcode Ver: Xcode 8.3.3
Appc NPM: 4.2.9
Appc CLI: 6.2.4
Ti CLI Ver: 5.0.14
Alloy Ver: 1.9.14
Node Ver: 7.10.1
Java Ver: 1.8.0_101
Devices: ⇨ google Nexus 5 --- Android 6.0.1
⇨ google Pixel --- Android 7.1.1
Emulator : Android 4.4.2

@lokeshchdhry lokeshchdhry merged commit d538f68 into tidev:6_3_X Sep 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants