mirror of
https://github.com/KDE/kdeconnect-android
synced 2025-09-03 15:45:10 +00:00
Migrate MediaStoreHelper to Kotlin
This commit is contained in:
committed by
Albert Vaca Cintora
parent
3f8170eae8
commit
ab1b1f7ecc
@@ -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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
20
src/org/kde/kdeconnect/Helpers/MediaStoreHelper.kt
Normal file
20
src/org/kde/kdeconnect/Helpers/MediaStoreHelper.kt
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user