Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
flutter_plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林生雨
flutter_plugin
Commits
79d3a8d1
Commit
79d3a8d1
authored
Mar 05, 2020
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
f72993a8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
110 additions
and
14 deletions
+110
-14
workspace.xml
.idea/workspace.xml
+0
-0
build.gradle
android/build.gradle
+3
-2
gradle.properties
android/gradle.properties
+3
-1
GengmeiFlutterPlugin.kt
...om/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
+6
-1
PreviewActivity.kt
...com/example/gengmei_flutter_plugin/act/PreviewActivity.kt
+1
-1
VideoActivity.kt
...n/com/example/gengmei_flutter_plugin/act/VideoActivity.kt
+1
-1
PinchImageView.kt
...example/gengmei_flutter_plugin/act/view/PinchImageView.kt
+7
-3
MyUtil.kt
...kotlin/com/example/gengmei_flutter_plugin/utils/MyUtil.kt
+1
-1
PhotoBitmapUtils.java
...xample/gengmei_flutter_plugin/utils/PhotoBitmapUtils.java
+84
-0
GengmeiFlutterPlugin.m
ios/Classes/GengmeiFlutterPlugin.m
+2
-2
MyPlayerViewController.m
ios/Classes/MyPlayerViewController.m
+2
-2
No files found.
.idea/workspace.xml
View file @
79d3a8d1
This diff is collapsed.
Click to expand it.
android/build.gradle
View file @
79d3a8d1
...
...
@@ -31,7 +31,7 @@ android {
defaultConfig
{
minSdkVersion
16
testInstrumentationRunner
"android
.support
.test.runner.AndroidJUnitRunner"
testInstrumentationRunner
"android
x
.test.runner.AndroidJUnitRunner"
ndk
{
abiFilters
'armeabi-v7a'
}
...
...
@@ -49,6 +49,7 @@ dependencies {
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation
"io.reactivex.rxjava2:rxjava:$rxJavaVersion"
implementation
"io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
implementation
'
com.android.support:appcompat-v7:28.0
.0'
implementation
'
androidx.appcompat:appcompat:1.1
.0'
implementation
'com.github.bumptech.glide:glide:4.8.0'
}
android/gradle.properties
View file @
79d3a8d1
org.gradle.jvmargs
=
-Xmx1536M
android.useAndroidX
=
true
android.enableJetifier
=
true
\ No newline at end of file
android/src/main/kotlin/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt
View file @
79d3a8d1
...
...
@@ -14,7 +14,7 @@ import android.os.Build
import
android.os.Environment
import
android.os.Handler
import
android.provider.MediaStore
import
android
.support.v4
.content.FileProvider
import
android
x.core
.content.FileProvider
import
android.util.Log
import
android.widget.Toast
import
com.example.gengmei_flutter_plugin.act.PreviewActivity
...
...
@@ -23,6 +23,7 @@ import com.example.gengmei_flutter_plugin.result.ResultManager
import
com.example.gengmei_flutter_plugin.sharedPrefernces.SharedManager
import
com.example.gengmei_flutter_plugin.utils.DebugUtil
import
com.example.gengmei_flutter_plugin.utils.MyUtil.Companion.getFileName
import
com.example.gengmei_flutter_plugin.utils.PhotoBitmapUtils
import
com.example.gengmei_flutter_plugin.utils.addTo
import
com.example.myimagepicker.luban.Luban
import
com.example.myimagepicker.repository.ImageRespository
...
...
@@ -140,6 +141,10 @@ class GengmeiFlutterPlugin : MethodCallHandler {
if
(
resultCode
==
RESULT_OK
)
{
android
.
util
.
Log
.
e
(
"lsy"
,
" RESULT OKKKKK "
)
if
(
nativeImage
!=
null
&&
nativeImage
!!
.
exists
())
{
val
bitmapDegree
=
PhotoBitmapUtils
.
getBitmapDegree
(
nativeImage
!!
.
absolutePath
)
if
(
bitmapDegree
!=
0
){
PhotoBitmapUtils
.
rotateBitmapByDegree
(
nativeImage
!!
.
absolutePath
,
bitmapDegree
)
}
ImageRespository
.
getInstance
().
scareImg
(
nativeImage
!!
.
absolutePath
).
subscribe
({
val
map
=
HashMap
<
String
,
Any
>()
map
.
put
(
"realPath"
,
it
.
first
)
...
...
android/src/main/kotlin/com/example/gengmei_flutter_plugin/act/PreviewActivity.kt
View file @
79d3a8d1
package
com.example.gengmei_flutter_plugin.act
import
android.os.Bundle
import
android.support.v7.app.AppCompatActivity
import
android.widget.ImageView
import
android.widget.LinearLayout
import
androidx.appcompat.app.AppCompatActivity
import
com.bumptech.glide.Glide
import
com.example.gengmei_flutter_plugin.R
import
com.example.gengmei_flutter_plugin.act.view.PinchImageView
...
...
android/src/main/kotlin/com/example/gengmei_flutter_plugin/act/VideoActivity.kt
View file @
79d3a8d1
...
...
@@ -2,10 +2,10 @@ package com.example.gengmei_flutter_plugin.act
import
android.os.Bundle
import
android.provider.CalendarContract
import
android.support.v7.app.AppCompatActivity
import
android.widget.LinearLayout
import
android.widget.MediaController
import
android.widget.VideoView
import
androidx.appcompat.app.AppCompatActivity
import
com.example.gengmei_flutter_plugin.R
import
com.example.gengmei_flutter_plugin.utils.MyUtil
...
...
android/src/main/kotlin/com/example/gengmei_flutter_plugin/act/view/PinchImageView.kt
View file @
79d3a8d1
...
...
@@ -2,13 +2,17 @@ package com.example.gengmei_flutter_plugin.act.view
import
android.animation.ValueAnimator
import
android.content.Context
import
android.graphics.*
import
android.support.v7.widget.AppCompatImageView
import
android.graphics.Canvas
import
android.graphics.Matrix
import
android.graphics.PointF
import
android.graphics.RectF
import
android.util.AttributeSet
import
android.util.Log
import
android.view.GestureDetector
import
android.view.MotionEvent
import
androidx.appcompat.widget.AppCompatImageView
import
java.util.*
import
kotlin.collections.ArrayList
/**
* 手势缩放ImageView
...
...
android/src/main/kotlin/com/example/gengmei_flutter_plugin/utils/MyUtil.kt
View file @
79d3a8d1
...
...
@@ -13,7 +13,7 @@ import java.io.FileOutputStream
import
java.io.IOException
import
java.lang.Exception
import
android.view.ViewGroup
import
android
.support.v4
.view.ViewCompat.setFitsSystemWindows
import
android
x.core
.view.ViewCompat.setFitsSystemWindows
import
android.app.Activity
import
android.view.WindowManager
import
android.os.Build
...
...
android/src/main/kotlin/com/example/gengmei_flutter_plugin/utils/PhotoBitmapUtils.java
View file @
79d3a8d1
package
com
.
example
.
gengmei_flutter_plugin
.
utils
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.BitmapFactory
;
import
android.graphics.Matrix
;
import
android.media.ExifInterface
;
import
android.text.TextUtils
;
import
java.io.File
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
/**
* @author lsy
* @date 2020-02-26
*/
public
class
PhotoBitmapUtils
{
/**
* 读取图片的旋转的角度
*
* @param path 图片绝对路径
* @return 图片的旋转角度
*/
public
static
int
getBitmapDegree
(
String
path
)
{
int
degree
=
0
;
//被旋转的角度
try
{
// 从指定路径下读取图片,并获取其EXIF信息
ExifInterface
exifInterface
=
new
ExifInterface
(
path
);
// 获取图片的旋转信息
int
orientation
=
exifInterface
.
getAttributeInt
(
ExifInterface
.
TAG_ORIENTATION
,
ExifInterface
.
ORIENTATION_NORMAL
);
switch
(
orientation
)
{
case
ExifInterface
.
ORIENTATION_ROTATE_90
:
degree
=
90
;
break
;
case
ExifInterface
.
ORIENTATION_ROTATE_180
:
degree
=
180
;
break
;
case
ExifInterface
.
ORIENTATION_ROTATE_270
:
degree
=
270
;
break
;
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
degree
;
}
/**
* 将图片按照某个角度进行旋转
*
* @param degree 旋转角度
* @return 旋转后的图片
*/
public
static
boolean
rotateBitmapByDegree
(
String
filePath
,
int
degree
)
{
File
file
=
new
File
(
filePath
);
if
(!
file
.
exists
())
{
return
false
;
}
Bitmap
bm
=
BitmapFactory
.
decodeFile
(
filePath
);
Bitmap
returnBm
=
null
;
FileOutputStream
fos
=
null
;
// 根据旋转角度,生成旋转矩阵
Matrix
matrix
=
new
Matrix
();
matrix
.
postRotate
(
degree
);
try
{
// 将原始图片按照旋转矩阵进行旋转,并得到新的图片
returnBm
=
Bitmap
.
createBitmap
(
bm
,
0
,
0
,
bm
.
getWidth
(),
bm
.
getHeight
(),
matrix
,
true
);
fos
=
new
FileOutputStream
(
file
);
returnBm
.
compress
(
Bitmap
.
CompressFormat
.
JPEG
,
100
,
fos
);
fos
.
flush
();
}
catch
(
OutOfMemoryError
e
)
{
e
.
printStackTrace
();
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
fos
!=
null
)
{
fos
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
true
;
}
}
ios/Classes/GengmeiFlutterPlugin.m
View file @
79d3a8d1
...
...
@@ -562,9 +562,9 @@ PHImageRequestOptions *baseImageRequestOption;
if
([[
self
.
scanMap
allKeys
]
containsObject
:
path
]){
PHAsset
*
assets
=
self
.
scanMap
[
path
];
PHVideoRequestOptions
*
options
=
[[
PHVideoRequestOptions
alloc
]
init
];
options
.
version
=
PHImageRequestOptionsVersionCurrent
;
//
options.version = PHImageRequestOptionsVersionCurrent;
options
.
networkAccessAllowed
=
true
;
options
.
deliveryMode
=
PHVideoRequestOptionsDeliveryModeAutomatic
;
//
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
[[
PHImageManager
defaultManager
]
requestAVAssetForVideo
:
assets
options
:
options
resultHandler
:^
(
AVAsset
*
_Nullable
asset
,
AVAudioMix
*
_Nullable
audioMix
,
NSDictionary
*
_Nullable
info
)
{
AVURLAsset
*
urlAsset
=
(
AVURLAsset
*
)
asset
;
[[
ResultManager
sharedSingleton
]
resultSuccess
:[
NSNumber
numberWithLong
:
resultTempVideo
]
:
[
NSString
stringWithFormat
:
@"%@"
,
urlAsset
.
URL
]];
...
...
ios/Classes/MyPlayerViewController.m
View file @
79d3a8d1
...
...
@@ -35,9 +35,9 @@
dispatch_async
(
self
.
queue
,
^
{
PHVideoRequestOptions
*
options
=
[[
PHVideoRequestOptions
alloc
]
init
];
//
options.version = PHImageRequestOptionsVersionCurrent;
options
.
version
=
PHImageRequestOptionsVersionCurrent
;
options
.
networkAccessAllowed
=
true
;
//
options.deliveryMode = PHVideoRequestOptionsDeliveryModeAutomatic;
options
.
deliveryMode
=
PHVideoRequestOptionsDeliveryModeAutomatic
;
[[
PHImageManager
defaultManager
]
requestAVAssetForVideo
:
assets
options
:
options
resultHandler
:^
(
AVAsset
*
_Nullable
asset
,
AVAudioMix
*
_Nullable
audioMix
,
NSDictionary
*
_Nullable
info
)
{
dispatch_async
(
dispatch_get_main_queue
(),
^
{
AVURLAsset
*
urlAsset
=
(
AVURLAsset
*
)
asset
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment