示例#1
0
 @Override
 public PointDescription getObjectName(Object o) {
   if (o instanceof Recording) {
     Recording rec = (Recording) o;
     if (rec.getName(activity).isEmpty()) {
       return new PointDescription(
           rec.getSearchHistoryType(),
           view.getResources().getString(R.string.recording_default_name));
     }
     return new PointDescription(rec.getSearchHistoryType(), ((Recording) o).getName(activity));
   }
   return null;
 }
示例#2
0
 public void getRecordingsFromPoint(
     PointF point, RotatedTileBox tileBox, List<? super Recording> am) {
   int ex = (int) point.x;
   int ey = (int) point.y;
   int compare = getRadiusPoi(tileBox);
   int radius = compare * 3 / 2;
   for (Recording n : plugin.getAllRecordings()) {
     int x = (int) tileBox.getPixXFromLatLon(n.getLatitude(), n.getLongitude());
     int y = (int) tileBox.getPixYFromLatLon(n.getLatitude(), n.getLongitude());
     if (calculateBelongs(ex, ey, x, y, compare)) {
       compare = radius;
       am.add(n);
     }
   }
 }
示例#3
0
 @Override
 public void onPrepareBufferImage(Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
   if (tileBox.getZoom() >= startZoom) {
     DataTileManager<Recording> recs = plugin.getRecordings();
     final QuadRect latlon = tileBox.getLatLonBounds();
     List<Recording> objects =
         recs.getObjects(latlon.top, latlon.left, latlon.bottom, latlon.right);
     for (Recording o : objects) {
       int x = (int) tileBox.getPixXFromLatLon(o.getLatitude(), o.getLongitude());
       int y = (int) tileBox.getPixYFromLatLon(o.getLatitude(), o.getLongitude());
       Bitmap b;
       if (o.isPhoto()) {
         b = photo;
       } else if (o.isAudio()) {
         b = audio;
       } else {
         b = video;
       }
       canvas.drawBitmap(b, x - b.getWidth() / 2, y - b.getHeight() / 2, paintIcon);
     }
   }
 }
示例#4
0
 @Override
 public void populateObjectContextMenu(Object o, ContextMenuAdapter adapter) {
   if (o instanceof Recording) {
     final Recording r = (Recording) o;
     OnContextMenuClick listener =
         new ContextMenuAdapter.OnContextMenuClick() {
           @Override
           public boolean onContextMenuClick(
               ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) {
             if (itemId == R.string.recording_context_menu_play
                 || itemId == R.string.recording_context_menu_show) {
               plugin.playRecording(view.getContext(), r);
             } else if (itemId == R.string.recording_context_menu_delete) {
               deleteRecording(r);
             }
             return true;
           }
         };
     if (r.isPhoto()) {
       adapter
           .item(R.string.recording_context_menu_show)
           .iconColor(R.drawable.ic_action_view)
           .listen(listener)
           .reg();
     } else {
       adapter
           .item(R.string.recording_context_menu_play)
           .iconColor(R.drawable.ic_action_play_dark)
           .listen(listener)
           .reg();
     }
     adapter
         .item(R.string.recording_context_menu_delete)
         .iconColor(R.drawable.ic_action_delete_dark)
         .listen(listener)
         .reg();
   }
 }