@Override public void populateContextMenu( ContextMenu menu, AdapterView.AdapterContextMenuInfo acmi, int num) { try { if (acmi.position != 0) { Item item = (Item) getItem(acmi.position); if (!item.dir && ".zip".equals(Utils.getFileExt(item.name))) { menu.add(0, R.id.open, 0, R.string.open); menu.add(0, R.id.extract, 0, R.string.extract_zip); } if (item.dir && num == 1 && android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO) menu.add(0, R.id.rescan_dir, 0, R.string.rescan); } super.populateContextMenu(menu, acmi, num); } catch (Exception e) { Log.e(TAG, "", e); } }
@Override public boolean readSource(Uri tmp_uri, String pass_back_on_done) { try { // if( worker != null ) worker.reqStop(); if (tmp_uri != null) { // Log.d( TAG, "New URI: " + tmp_uri.toString() ); setUri(tmp_uri); } if (uri == null) { Log.e(TAG, "No URI"); return false; } ArrayList<SAFItem> tmp_list = getChildren(uri); if (tmp_list == null) { SAFAdapter.saveURI(ctx, null); commander.showError(s(R.string.fail)); commander.Navigate(Uri.parse(HomeAdapter.DEFAULT_LOC), null, null); return false; } items = new SAFItem[tmp_list.size()]; tmp_list.toArray(items); reSort(items); super.setCount(items.length); parentLink = isRootDoc(uri) ? SLS : PLS; startThumbnailCreation(); notifyDataSetChanged(); notify(pass_back_on_done); return true; } catch (Exception e) { Log.e(TAG, "readSource() exception", e); } catch (OutOfMemoryError err) { Log.e(TAG, "Out Of Memory", err); notify(s(R.string.oom_err), Commander.OPERATION_FAILED); } return false; }
@Override public void prepareToDestroy() { super.prepareToDestroy(); if (tht != null) tht.interrupt(); }