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

Method FileItem

src/main/java/io/file/browse/Browser.java:236–262  ·  view source on GitHub ↗
(File file)

Source from the content-addressed store, hash-verified

234 private int type;
235
236 public FileItem(File file) {
237 super(RosterIcons.getInstance());
238 this.file = file;
239 //TODO: file icons
240 iconIndex = file.isDirectory() ? RosterIcons.ICON_COLLAPSED_INDEX : RosterIcons.ICON_PROFILE_INDEX;
241
242 String ext = file.getName().substring(file.getName().lastIndexOf('.') + 1).toLowerCase();
243 String imgs = "png.bmp.jpg.jpeg.gif";
244 String snds = "wav.mid.amr.wav.mp3.aac";
245 String txts = "txt.log";
246
247 if (txts.indexOf(ext) >= 0) {
248 iconIndex = RosterIcons.ICON_PRIVACY_ACTIVE;
249 type = ShowFile.TYPE_TEXT;
250 return;
251 }
252 if (imgs.indexOf(ext) >= 0) {
253 iconIndex = RosterIcons.ICON_IMAGES_INDEX;
254 type = ShowFile.TYPE_IMAGE;
255 return;
256 }
257 if (snds.indexOf(ext) >= 0) {
258 iconIndex = RosterIcons.ICON_SOUNDS_INDEX;
259 type = ShowFile.TYPE_TEXT;
260 return;
261 }
262 }
263
264 public int getImageIndex() {
265 return iconIndex;

Callers

nothing calls this directly

Calls 3

getInstanceMethod · 0.95
toLowerCaseMethod · 0.80
getNameMethod · 0.65

Tested by

no test coverage detected