-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
staging for opening file from context menu
- Loading branch information
1 parent
a54b485
commit 8de7429
Showing
2 changed files
with
37 additions
and
3 deletions.
There are no files selected for viewing
37 changes: 35 additions & 2 deletions
37
android/app/src/main/kotlin/com/example/mdeditor/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,5 +1,38 @@ | ||
package com.deathblade666.mdeditor | ||
|
||
import io.flutter.embedding.android.FlutterActivity | ||
//import io.flutter.embedding.android.FlutterActivity | ||
|
||
//class MainActivity: FlutterActivity() | ||
|
||
import android.content.Intent; | ||
import android.net.Uri; | ||
import android.os.Bundle; | ||
import io.flutter.embedding.android.FlutterActivity; | ||
import io.flutter.plugin.common.MethodChannel; | ||
|
||
public class MainActivity extends FlutterActivity { | ||
private static final String CHANNEL = "markdown editor"; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
new MethodChannel(getFlutterEngine().getDartExecutor().getBinaryMessenger(), CHANNEL) | ||
.setMethodCallHandler((call, result) -> { | ||
if (call.method.equals("getFileUri")) { | ||
Intent intent = getIntent(); | ||
String action = intent.getAction(); | ||
Uri data = intent.getData(); | ||
|
||
if (Intent.ACTION_VIEW.equals(action) && data != null) { | ||
result.success(data.toString()); | ||
} else { | ||
result.error("UNAVAILABLE", "File URI not available.", null); | ||
} | ||
} else { | ||
result.notImplemented(); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
class MainActivity: FlutterActivity() |
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