(File file)
| 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; |
nothing calls this directly
no test coverage detected