src/main/java/de/blau/android/photos/PhotoIndex.java
/**
     * Create or update the index of images on the device
     */
Create or update the index of images on the device
Create or update the index of images on the device
public synchronized void createOrUpdateIndex() {
        Log.d(DEBUG_TAG, "starting scan");
        indexDirectories();
        Logic logic = App.getLogic();
        Preferences prefs = logic != null ? logic.getPrefs() : null;
        if (prefs != null) {
            if (prefs.scanMediaStore() && (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q
                    || ContextCompat.checkSelfPermission(context, Manifest.permission.ACCESS_MEDIA_LOCATION) == PackageManager.PERMISSION_GRANTED)) {
                indexMediaStore();
            } else {
                SQLiteDatabase db = null;
                try {
                    db = getWritableDatabase();
                    db.delete(PHOTOS_TABLE, SOURCE_COLUMN + "= ?", new String[] { MEDIA_STORE });
                    updateSources(db, MEDIA_STORE, "", 0);
                } finally {
                    SavingHelper.close(db);
                }
            }
        }
    }
public synchronized void createOrUpdateIndex ( ) { Log . d ( DEBUG_TAG , "starting scan" ) ; indexDirectories ( ) ; Logic logic = App . getLogic ( ) ; Preferences prefs = logic != null ? logic . getPrefs ( ) : null ; if ( prefs != null ) { if ( prefs . scanMediaStore ( ) && ( Build . VERSION . SDK_INT < Build . VERSION_CODES . Q || ContextCompat . checkSelfPermission ( context , Manifest . permission . ACCESS_MEDIA_LOCATION ) == PackageManager . PERMISSION_GRANTED ) ) { indexMediaStore ( ) ; } else { SQLiteDatabase db = null ; try { db = getWritableDatabase ( ) ; db . delete ( PHOTOS_TABLE , SOURCE_COLUMN + "= ?" , new String [ ] { MEDIA_STORE } ) ; updateSources ( db , MEDIA_STORE , "" , 0 ) ; } finally { SavingHelper . close ( db ) ; } } } }
Create or update the index of images on the device
Create or update the index of images on the device
// delete scanned photos from index