2
0
mirror of https://github.com/KDE/kdeconnect-android synced 2025-08-31 14:15:14 +00:00

Migrate MediaStoreHelper to Kotlin

This commit is contained in:
TPJ Schikhof
2024-08-21 15:06:55 +00:00
committed by Albert Vaca Cintora
parent 3f8170eae8
commit ab1b1f7ecc
2 changed files with 20 additions and 23 deletions

View File

@@ -1,23 +0,0 @@
/*
* SPDX-FileCopyrightText: 2023 Albert Vaca Cintora <albertvaka@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
package org.kde.kdeconnect.Helpers;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
public class MediaStoreHelper {
//Maybe this class could batch successive calls together
public static void indexFile(Context context, Uri path) {
Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
mediaScanIntent.setData(path);
context.sendBroadcast(mediaScanIntent);
}
}

View File

@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2023 Albert Vaca Cintora <albertvaka@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
package org.kde.kdeconnect.Helpers
import android.content.Context
import android.content.Intent
import android.net.Uri
object MediaStoreHelper {
// Maybe this class could batch successive calls together
@JvmStatic
fun indexFile(context: Context, path: Uri?) {
val mediaScanIntent = Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE)
mediaScanIntent.setData(path)
context.sendBroadcast(mediaScanIntent)
}
}