Namespace fix;
This commit is contained in:
parent
56c1c24ea3
commit
7a0256afe9
|
@ -25,7 +25,7 @@
|
|||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.example.filepicker">
|
||||
package="com.mr.filepicker">
|
||||
</manifest>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package com.example.filepicker;
|
||||
package com.mr.filepicker;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.Activity;
|
||||
|
@ -53,6 +53,7 @@ public class FilePickerPlugin implements MethodCallHandler {
|
|||
public void onMethodCall(MethodCall call, Result result) {
|
||||
if (call.method.equals("pickPDF")) {
|
||||
this.result = result;
|
||||
|
||||
startFileExplorer();
|
||||
|
||||
} else {
|
||||
|
@ -60,6 +61,16 @@ public class FilePickerPlugin implements MethodCallHandler {
|
|||
}
|
||||
}
|
||||
|
||||
private String resolveFileType(String type) {
|
||||
switch (type) {
|
||||
case "PDF":
|
||||
break;
|
||||
|
||||
case "IMAGES":
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkPermission() {
|
||||
Activity activity = instance.activity();
|
||||
Log.i("SimplePermission", "Checking permission : " + permission);
|
||||
|
@ -69,18 +80,18 @@ public class FilePickerPlugin implements MethodCallHandler {
|
|||
private void requestPermission() {
|
||||
Activity activity = instance.activity();
|
||||
Log.i("File_Picker", "Requesting permission : " + permission);
|
||||
String[] perm = {permission};
|
||||
String[] perm = { permission };
|
||||
ActivityCompat.requestPermissions(activity, perm, 0);
|
||||
}
|
||||
|
||||
private void startFileExplorer() {
|
||||
|
||||
if(checkPermission()) {
|
||||
if (checkPermission()) {
|
||||
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
|
||||
intent.setType("application/pdf");
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
instance.activity().startActivityForResult(intent, REQUEST_CODE);
|
||||
}else {
|
||||
} else {
|
||||
requestPermission();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue