-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add download button to lightbox to bottom app bar
- Loading branch information
chimnayajith
committed
Dec 12, 2024
1 parent
28b3536
commit fb8bab9
Showing
15 changed files
with
372 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 34 additions & 1 deletion
35
android/app/src/main/kotlin/com/zulip/flutter/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,39 @@ | ||
package com.zulip.flutter | ||
|
||
import android.media.MediaScannerConnection | ||
import android.net.Uri | ||
import io.flutter.embedding.android.FlutterActivity | ||
import io.flutter.embedding.engine.FlutterEngine | ||
import io.flutter.plugin.common.MethodChannel | ||
|
||
class MainActivity: FlutterActivity() { | ||
class MainActivity : FlutterActivity() { | ||
private val CHANNEL = "gallery_saver" | ||
|
||
override fun configureFlutterEngine(flutterEngine: FlutterEngine) { | ||
super.configureFlutterEngine(flutterEngine) | ||
|
||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result -> | ||
if (call.method == "scanFile") { | ||
val filePath = call.argument<String>("path") | ||
if (filePath != null) { | ||
scanFile(filePath) | ||
result.success("MediaScanner invoked for $filePath") | ||
} else { | ||
result.error("INVALID_ARGUMENT", "File path is null", null) | ||
} | ||
} else { | ||
result.notImplemented() | ||
} | ||
} | ||
} | ||
|
||
private fun scanFile(filePath: String) { | ||
MediaScannerConnection.scanFile( | ||
applicationContext, | ||
arrayOf(filePath), | ||
null | ||
) { _, _ -> | ||
// Intentionally left empty | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.