<commit_before>var win = Ti.UI.currentWindow;

var imageDisplay = null;

var infoLabel = Ti.UI.createLabel({
	top:20,
	width:'auto',
	height:'auto'
});

var showDisplay = Ti.UI.createButton({
	title:'Get image from picker',
	bottom:140,
	width:200,
	height:40
});
showDisplay.addEventListener('click', function() {
	Titanium.Contacts.showContacts({
	selectedPerson: function(e) {
		var image = e.person.image;
		if (image == null) {
			infoLabel.text = 'No image';
			imageDisplay.image = null;
		}
		else {
			infoLabel.text = 'Image for '+e.person.fullName;
			if (imageDisplay == null) {
				imageDisplay = Ti.UI.createImageView({
					image:image,
					width:100,
					height:100,
					top:50
				});
				win.add(imageDisplay);
			}
			else {
				imageDisplay.image = image;
			}
		}
	}
	});
});

var removeDisplay = Ti.UI.createButton({
	title:'Remove image via picker',
	bottom:80,
	width:200,
	height:40
});
removeDisplay.addEventListener('click', function() {
	Titanium.Contacts.showContacts({
		selectedPerson: function(e) {
			e.person.image = null;
			infoLabel.text = 'Removed image for '+e.person.fullName;
		}
	});
});

var sampleImage = Ti.Filesystem.getFile('images/chat.png').read();
var setDisplay = Ti.UI.createButton({
	title:'Set image via picker',
	bottom:20,
	height:40,
	width:200
});
setDisplay.addEventListener('click', function() {
	Titanium.Contacts.showContacts({
		selectedPerson: function(e) {
			e.person.image = sampleImage;
			infoLabel.text = 'Set image for '+e.person.fullName;
		}
	});
});
win.add(infoLabel);
win.add(removeDisplay);
win.add(setDisplay);
win.add(showDisplay);<commit_msg>Fix for Contacts->Images KS test; contact was not saved to DB after modifying a property.<commit_after>var win = Ti.UI.currentWindow;

var imageDisplay = null;

var infoLabel = Ti.UI.createLabel({
	top:20,
	width:'auto',
	height:'auto'
});

var showDisplay = Ti.UI.createButton({
	title:'Get image from picker',
	bottom:140,
	width:200,
	height:40
});
showDisplay.addEventListener('click', function() {
	Titanium.Contacts.showContacts({
	selectedPerson: function(e) {
		var image = e.person.image;
		if (image == null) {
			infoLabel.text = 'No image';
			imageDisplay.image = null;
		}
		else {
			infoLabel.text = 'Image for '+e.person.fullName;
			if (imageDisplay == null) {
				imageDisplay = Ti.UI.createImageView({
					image:image,
					width:100,
					height:100,
					top:50
				});
				win.add(imageDisplay);
			}
			else {
				imageDisplay.image = image;
			}
		}
	}
	});
});

var removeDisplay = Ti.UI.createButton({
	title:'Remove image via picker',
	bottom:80,
	width:200,
	height:40
});
removeDisplay.addEventListener('click', function() {
	Titanium.Contacts.showContacts({
		selectedPerson: function(e) {
			e.person.image = null;
			infoLabel.text = 'Removed image for '+e.person.fullName;
			Titanium.Contacts.save();
		}
	});
});

var sampleImage = Ti.Filesystem.getFile('images/chat.png').read();
var setDisplay = Ti.UI.createButton({
	title:'Set image via picker',
	bottom:20,
	height:40,
	width:200
});
setDisplay.addEventListener('click', function() {
	Titanium.Contacts.showContacts({
		selectedPerson: function(e) {
			e.person.image = sampleImage;
			infoLabel.text = 'Set image for '+e.person.fullName;
			Titanium.Contacts.save();
		}
	});
});
win.add(infoLabel);
win.add(removeDisplay);
win.add(setDisplay);
win.add(showDisplay);
{'fraction_non_alphanumeric': 0.15602836879432624, 'fraction_numerical': 0.018912529550827423, 'mean_word_length': 4.105580693815988, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6609942', 'n_tokens_mistral': 1347, 'n_tokens_neox': 1176, 'n_words': 229}