Skip to content

Commit

Permalink
New samples added
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuvaraj-Gajaraj committed Oct 1, 2020
1 parent 2c9f06e commit 18b260c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
4 changes: 3 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Syncfusion Flutter UI Widgets"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,31 @@

import java.io.File;

import io.flutter.app.FlutterActivity;
import io.flutter.plugin.common.MethodCall;
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugins.GeneratedPluginRegistrant;

public class MainActivity extends FlutterActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
GeneratedPluginRegistrant.registerWith(this);
new MethodChannel(getFlutterView(), "launchFile").setMethodCallHandler(new MethodChannel.MethodCallHandler() {
@Override
public void onMethodCall(MethodCall call, MethodChannel.Result result) {
if (call.method.equals("viewPdf") || call.method.equals("viewExcel")) {
String path = call.argument("file_path");
if(!checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE)){
requestPermission(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE});
} else {
launchFile(path);
}
}
}
});
}

@Override
public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
new MethodChannel(flutterEngine.getDartExecutor().getBinaryMessenger(), "launchFile")
.setMethodCallHandler(
(call, result) -> {
if (call.method.equals("viewPdf") || call.method.equals("viewExcel")) {
String path = call.argument("file_path");
if(!checkPermission(Manifest.permission.READ_EXTERNAL_STORAGE)){
requestPermission(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE});
} else {
launchFile(path);
}
}
}
);
}
private void requestPermission(String[] permission){
ActivityCompat.requestPermissions(this, permission, 1);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:
syncfusion_flutter_datepicker: ^18.3.35-beta
syncfusion_flutter_charts: ^18.3.35
syncfusion_flutter_gauges: ^18.3.35
syncfusion_flutter_sliders: ^18.3.35
syncfusion_flutter_sliders: ^18.3.35-beta
syncfusion_flutter_pdf: ^18.3.35-beta
syncfusion_flutter_barcodes: ^18.3.35
syncfusion_officechart: ^18.3.35-beta
Expand Down

0 comments on commit 18b260c

Please sign in to comment.