MCPcopy Create free account
hub / github.com/BombusMod/BombusMod / setPhoto

Method setPhoto

src/main/java/VCard/VCardView.java:158–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

156
157
158 private void setPhoto() {
159 try {
160 itemsList.removeElement(noPhoto);
161 itemsList.removeElement(badFormat);
162 itemsList.removeElement(photoItem);
163 itemsList.removeElement(photoTooLarge);
164 } catch (Exception e) { }
165
166 if (vcard.hasPhoto) {
167 try {
168 int length=vcard.getPhoto().length;
169 if (length==1) {
170 vcard.setPhoto(null);
171 itemsList.addElement(photoTooLarge);
172 } else {
173 Image photoImg=Image.createImage(vcard.getPhoto(), 0, length);
174 photoItem=new ImageItem(photoImg, "minimized, size: "+String.valueOf(length)+"b.");
175 if (length>10240)
176 photoItem.collapsed=true;
177 itemsList.insertElementAt(photoItem, 0);
178 }
179 } catch (OutOfMemoryError eom) {
180 } catch (Exception e) {
181 itemsList.addElement(badFormat);
182 }
183 } else {
184 itemsList.addElement(noPhoto);
185 }
186 }
187
188//#if FILE_IO
189 public void BrowserFilePathNotify(String pathSelected) {

Callers 1

VCardViewMethod · 0.95

Calls 3

createImageMethod · 0.95
getPhotoMethod · 0.80
addElementMethod · 0.80

Tested by

no test coverage detected