Skip to content

Commit

Permalink
fix android
Browse files Browse the repository at this point in the history
  • Loading branch information
chavesgu committed Apr 18, 2021
1 parent 1d5c46f commit 451131c
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 42 deletions.
3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 6 additions & 17 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ static boolean saveImage(@NonNull Context context, Bitmap bitmap,String suffix,

static ContentValues contentValues(@NonNull String suffix){
ContentValues values = new ContentValues();
String type = "images/"+suffix;
String type = "image/"+suffix;
if (suffix.equals("jpg") || suffix.equals("jpeg")) {
type = "images/jpeg";
type = "image/jpeg";
}
values.put(MediaStore.Images.Media.MIME_TYPE, type);
values.put(MediaStore.Images.Media.DATE_ADDED, System.currentTimeMillis() / 1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
Expand Down Expand Up @@ -316,7 +317,7 @@ private String copyToTmp(String originPath) {

private void saveImageToGallery(final String path, String albumName) {
boolean status = false;
String suffix = path.substring(path.lastIndexOf('.'));
String suffix = path.substring(path.lastIndexOf('.')+1);
Bitmap bitmap = BitmapFactory.decodeFile(path);
status = FileSaver.saveImage(context, bitmap, suffix, albumName);
_result.success(status);
Expand All @@ -328,7 +329,7 @@ private void saveVideoToGallery(String path, String albumName) {

private boolean hasPermission() {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.M ||
(activity.checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PERMISSION_GRANTED && activity.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PERMISSION_GRANTED);
(ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PERMISSION_GRANTED && ContextCompat.checkSelfPermission(context, Manifest.permission.READ_EXTERNAL_STORAGE) == PERMISSION_GRANTED);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion ios/images_picker.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ A new flutter plugin project.
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.dependency 'ZLPhotoBrowser', '4.1.3'
s.dependency 'ZLPhotoBrowser', '4.1.5'
s.platform = :ios, '10.0'

# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
Expand Down
40 changes: 20 additions & 20 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,49 @@ packages:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.5.0-nullsafety.1"
version: "2.5.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.3"
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.15.0-nullsafety.3"
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
flutter:
dependency: "direct main"
description: flutter
Expand All @@ -66,21 +66,21 @@ packages:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.10-nullsafety.1"
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.1"
version: "1.8.0"
sky_engine:
dependency: transitive
description: flutter
Expand All @@ -92,56 +92,56 @@ packages:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0-nullsafety.2"
version: "1.8.0"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.10.0-nullsafety.1"
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.1"
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0-nullsafety.1"
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0-nullsafety.1"
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.19-nullsafety.2"
version: "0.2.19"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.0-nullsafety.3"
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0-nullsafety.3"
version: "2.1.0"
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.20.0 <2.0.0"
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.12.13+hotfix.5"

0 comments on commit 451131c

Please sign in to comment.