src/main/java/de/blau/android/photos/PhotoIndex.java
/**
     * Insert a photo in to the on device index
     * 
     * @param db database containing the index
     * @param photo the photo object
     * @param name a short identifying name
     * @param source an indication of where the photo was found on the device
     */
Insert a photo in to the on device index

@param db database containing the index
@param photo the photo object
@param name a short identifying name
@param source an indication of where the photo was found on the device
Insert a photo in to the on device index @param db database containing the index @param photo the photo object @param name a short identifying name @param source an indication of where the photo was found on the device
private void insertPhoto(@NonNull SQLiteDatabase db, @NonNull Photo photo, @NonNull String name, @Nullable String source) {
        try {
            ContentValues values = new ContentValues();
            values.put(LAT_COLUMN, photo.getLat());
            values.put(LON_COLUMN, photo.getLon());
            if (photo.hasDirection()) {
                values.put(DIRECTION_COLUMN, photo.getDirection());
            }
            values.put(URI_COLUMN, photo.getRef());
            values.put(NAME_COLUMN, name);
            if (source != null) {
                values.put(SOURCE_COLUMN, source);
            }
            db.insert(PHOTOS_TABLE, null, values);
        } catch (SQLiteException sqex) {
            Log.d(DEBUG_TAG, sqex.toString());
            ACRAHelper.nocrashReport(sqex, sqex.getMessage());
        } catch (NumberFormatException bfex) {
        } catch (Exception ex) {
            Log.d(DEBUG_TAG, ex.toString());
            ACRAHelper.nocrashReport(ex, ex.getMessage());
        } 
    }
private void insertPhoto ( @ NonNull SQLiteDatabase db , @ NonNull Photo photo , @ NonNull String name , @ Nullable String source ) { try { ContentValues values = new ContentValues ( ) ; values . put ( LAT_COLUMN , photo . getLat ( ) ) ; values . put ( LON_COLUMN , photo . getLon ( ) ) ; if ( photo . hasDirection ( ) ) { values . put ( DIRECTION_COLUMN , photo . getDirection ( ) ) ; } values . put ( URI_COLUMN , photo . getRef ( ) ) ; values . put ( NAME_COLUMN , name ) ; if ( source != null ) { values . put ( SOURCE_COLUMN , source ) ; } db . insert ( PHOTOS_TABLE , null , values ) ; } catch ( SQLiteException sqex ) { Log . d ( DEBUG_TAG , sqex . toString ( ) ) ; ACRAHelper . nocrashReport ( sqex , sqex . getMessage ( ) ) ; } catch ( NumberFormatException bfex ) { } catch ( Exception ex ) { Log . d ( DEBUG_TAG , ex . toString ( ) ) ; ACRAHelper . nocrashReport ( ex , ex . getMessage ( ) ) ; } }
Insert a photo in to the on device index
Insert a photo in to the on device index
// ignore silently, broken pictures are not our business // ignore