Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
Project
Overview
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
sobot_android
Sobot_module_Dev
Commits
63307c87
Commit
63307c87
authored
Mar 19, 2024
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
album 1.0.1 common 1.6.6 picture 1.1.9
parent
14ee710a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
182 additions
and
19 deletions
+182
-19
build.gradle
app/build.gradle
+1
-1
build.gradle
sobot_album/build.gradle
+1
-1
sobot-album_publish-mavencentral.gradle
sobot_album/sobot-album_publish-mavencentral.gradle
+1
-1
build.gradle
sobot_common/build.gradle
+3
-3
sobot-common-publish-mavencentral.gradle
sobot_common/sobot-common-publish-mavencentral.gradle
+1
-1
README.md
sobot_pictureframe/README.md
+1
-1
sobot-picture-publish-mavencentral.gradle
sobot_pictureframe/sobot-picture-publish-mavencentral.gradle
+1
-1
SobotUILImageLoader.java
...main/java/com/sobot/pictureframe/SobotUILImageLoader.java
+16
-8
UriToPathUtils.java
.../src/main/java/com/sobot/pictureframe/UriToPathUtils.java
+155
-0
SobotPhotoView.java
...java/com/sobot/widget/image/photoview/SobotPhotoView.java
+2
-2
No files found.
app/build.gradle
View file @
63307c87
...
@@ -41,7 +41,7 @@ dependencies {
...
@@ -41,7 +41,7 @@ dependencies {
// api 'com.sobot.library:sobotcommon_x:1.0'
// api 'com.sobot.library:sobotcommon_x:1.0'
implementation
'com.github.bumptech.glide:glide:4.9.0'
implementation
'com.github.bumptech.glide:glide:4.9.0'
implementation
'com.sobot.chat:sobotsupport-glidev4:
2.3
'
implementation
'com.sobot.chat:sobotsupport-glidev4:
3.1
'
// implementation 'com.facebook.fresco:fresco:1.13.0'
// implementation 'com.facebook.fresco:fresco:1.13.0'
//android x 可以用这个 ,普通版不能用这个
//android x 可以用这个 ,普通版不能用这个
// implementation 'com.facebook.fresco:fresco:2.6.0'
// implementation 'com.facebook.fresco:fresco:2.6.0'
...
...
sobot_album/build.gradle
View file @
63307c87
...
@@ -23,7 +23,7 @@ dependencies {
...
@@ -23,7 +23,7 @@ dependencies {
compileOnly
'androidx.appcompat:appcompat:1.0.0'
compileOnly
'androidx.appcompat:appcompat:1.0.0'
compileOnly
'androidx.recyclerview:recyclerview:1.0.0'
compileOnly
'androidx.recyclerview:recyclerview:1.0.0'
api
'com.sobot.library:widget_x:1.2.1'
api
'com.sobot.library:widget_x:1.2.1'
api
'com.sobot.library:picture_x:1.1.
8
'
api
'com.sobot.library:picture_x:1.1.
9
'
}
}
...
...
sobot_album/sobot-album_publish-mavencentral.gradle
View file @
63307c87
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'album'
//项目名
PUBLISH_ARTIFACT_ID
=
'album'
//项目名
PUBLISH_VERSION
=
'1.0.
0
'
//版本号
PUBLISH_VERSION
=
'1.0.
1
'
//版本号
}
}
...
...
sobot_common/build.gradle
View file @
63307c87
...
@@ -11,7 +11,7 @@ android {
...
@@ -11,7 +11,7 @@ android {
//这里就是打jar包
//这里就是打jar包
task
makeJar
(
type:
Copy
)
{
task
makeJar
(
type:
Copy
)
{
//删除旧的jar包
//删除旧的jar包
delete
'build/libs/sobot_common_x_1.6.
5
.jar'
delete
'build/libs/sobot_common_x_1.6.
6
.jar'
//原地址
//原地址
from
(
'build/intermediates/packaged-classes/release/'
)
from
(
'build/intermediates/packaged-classes/release/'
)
//导出jar包的地址
//导出jar包的地址
...
@@ -19,7 +19,7 @@ android {
...
@@ -19,7 +19,7 @@ android {
//包含的jar包
//包含的jar包
include
(
'classes.jar'
)
include
(
'classes.jar'
)
//重命名jar包为mysdk
//重命名jar包为mysdk
rename
(
'classes.jar'
,
'sobot_common_x_1.6.
5
.jar'
)
rename
(
'classes.jar'
,
'sobot_common_x_1.6.
6
.jar'
)
}
}
makeJar
.
dependsOn
(
build
)
makeJar
.
dependsOn
(
build
)
}
}
...
@@ -34,7 +34,7 @@ dependencies {
...
@@ -34,7 +34,7 @@ dependencies {
api
'com.sobot.library:utils:1.1.3'
api
'com.sobot.library:utils:1.1.3'
api
'com.sobot.library:picture_x:1.1.
7
'
api
'com.sobot.library:picture_x:1.1.
9
'
api
'com.sobot.library:net:1.2.2'
api
'com.sobot.library:net:1.2.2'
api
'com.sobot.library:gson:1.1.1'
api
'com.sobot.library:gson:1.1.1'
}
}
...
...
sobot_common/sobot-common-publish-mavencentral.gradle
View file @
63307c87
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'sobotcommon_x'
//项目名
PUBLISH_ARTIFACT_ID
=
'sobotcommon_x'
//项目名
PUBLISH_VERSION
=
'1.6.
5
'
//版本号
PUBLISH_VERSION
=
'1.6.
6
'
//版本号
}
}
...
...
sobot_pictureframe/README.md
View file @
63307c87
...
@@ -80,7 +80,7 @@ Gradle窗口 --> sobot_pictureframe --> Tasks --> build --> publishing --> 点
...
@@ -80,7 +80,7 @@ Gradle窗口 --> sobot_pictureframe --> Tasks --> build --> publishing --> 点
3、 在使用4.9.0(包含4.9.0)以上版本的glide时,需额外添加依赖,之前的版本不需要
3、 在使用4.9.0(包含4.9.0)以上版本的glide时,需额外添加依赖,之前的版本不需要
```
```
implementation 'com.sobot.chat:sobotsupport-glidev4:
2
.1'
implementation 'com.sobot.chat:sobotsupport-glidev4:
3
.1'
```
```
4、picasso不支持显示本地图片
4、picasso不支持显示本地图片
...
...
sobot_pictureframe/sobot-picture-publish-mavencentral.gradle
View file @
63307c87
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'picture_x'
//项目名
PUBLISH_ARTIFACT_ID
=
'picture_x'
//项目名
PUBLISH_VERSION
=
'1.1.
8
'
//版本号
PUBLISH_VERSION
=
'1.1.
9
'
//版本号
}
}
...
...
sobot_pictureframe/src/main/java/com/sobot/pictureframe/SobotUILImageLoader.java
View file @
63307c87
...
@@ -2,9 +2,11 @@ package com.sobot.pictureframe;
...
@@ -2,9 +2,11 @@ package com.sobot.pictureframe;
import
android.content.Context
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Bitmap
;
import
androidx.annotation.DrawableRes
;
import
androidx.annotation.DrawableRes
;
import
android.net.Uri
;
import
android.net.Uri
;
import
android.text.TextUtils
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
...
@@ -52,6 +54,7 @@ public class SobotUILImageLoader extends SobotImageLoader {
...
@@ -52,6 +54,7 @@ public class SobotUILImageLoader extends SobotImageLoader {
}
}
},
null
);
},
null
);
}
}
@Override
@Override
public
void
displayImage
(
Context
context
,
ImageView
imageView
,
Uri
imgUri
,
@DrawableRes
int
loadingResId
,
@DrawableRes
int
failResId
,
int
width
,
int
height
,
final
SobotDisplayImageListener
listener
)
{
public
void
displayImage
(
Context
context
,
ImageView
imageView
,
Uri
imgUri
,
@DrawableRes
int
loadingResId
,
@DrawableRes
int
failResId
,
int
width
,
int
height
,
final
SobotDisplayImageListener
listener
)
{
initImageLoader
(
context
);
initImageLoader
(
context
);
...
@@ -65,15 +68,20 @@ public class SobotUILImageLoader extends SobotImageLoader {
...
@@ -65,15 +68,20 @@ public class SobotUILImageLoader extends SobotImageLoader {
.
bitmapConfig
(
Bitmap
.
Config
.
RGB_565
)
.
bitmapConfig
(
Bitmap
.
Config
.
RGB_565
)
.
build
();
.
build
();
ImageSize
imageSize
=
width
!=
0
||
height
!=
0
?
new
ImageSize
(
width
,
height
)
:
null
;
ImageSize
imageSize
=
width
!=
0
||
height
!=
0
?
new
ImageSize
(
width
,
height
)
:
null
;
try
{
ImageLoader
.
getInstance
().
displayImage
(
imgUri
,
new
ImageViewAware
(
imageView
),
options
,
imageSize
,
new
SimpleImageLoadingListener
()
{
String
path
=
UriToPathUtils
.
getRealPathFromUri
(
context
,
imgUri
);
@Override
if
(!
TextUtils
.
isEmpty
(
path
))
{
public
void
onLoadingComplete
(
String
imageUri
,
View
view
,
Bitmap
loadedImage
)
{
ImageLoader
.
getInstance
().
displayImage
(
path
,
new
ImageViewAware
(
imageView
),
options
,
imageSize
,
new
SimpleImageLoadingListener
()
{
if
(
listener
!=
null
)
{
@Override
listener
.
onSuccess
(
view
,
imageUri
);
public
void
onLoadingComplete
(
String
imageUri
,
View
view
,
Bitmap
loadedImage
)
{
}
if
(
listener
!=
null
)
{
listener
.
onSuccess
(
view
,
imageUri
);
}
}
},
null
);
}
}
},
null
);
}
catch
(
Exception
e
)
{
}
}
}
@Override
@Override
...
...
sobot_pictureframe/src/main/java/com/sobot/pictureframe/UriToPathUtils.java
0 → 100644
View file @
63307c87
package
com
.
sobot
.
pictureframe
;
import
android.annotation.SuppressLint
;
import
android.content.ContentResolver
;
import
android.content.ContentUris
;
import
android.content.Context
;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.provider.BaseColumns
;
import
android.provider.DocumentsContract
;
import
android.provider.MediaStore
;
public
class
UriToPathUtils
{
/**
* 根据Uri获取图片的绝对路径
*
* @param context 上下文对象
* @param uri 图片的Uri
* @return 如果Uri对应的图片存在, 那么返回该图片的绝对路径, 否则返回null
*/
public
static
String
getRealPathFromUri
(
Context
context
,
Uri
uri
)
{
// Uri分为三个部分 域名://主机名/路径/id
// content://media/extenral/images/media/17766
// content://com.android.providers.media.documents/document/image:2706
// file://com.xxxx.xxxxx ---- 7.0 有限制
int
sdkVersion
=
Build
.
VERSION
.
SDK_INT
;
if
(
sdkVersion
>=
19
)
{
// api >= 19
return
getRealPathFromUriAboveApi19
(
context
,
uri
);
}
else
{
// api < 19
return
getRealPathFromUriBelowAPI19
(
context
,
uri
);
}
}
/**
* 适配api19以下(不包括api19),根据uri获取图片的绝对路径
*
* @param context 上下文对象
* @param uri 图片的Uri
* @return 如果Uri对应的图片存在, 那么返回该图片的绝对路径, 否则返回null
*/
private
static
String
getRealPathFromUriBelowAPI19
(
Context
context
,
Uri
uri
)
{
final
String
scheme
=
uri
.
getScheme
();
String
data
=
null
;
if
(
scheme
==
null
)
data
=
uri
.
getPath
();
else
if
(
ContentResolver
.
SCHEME_FILE
.
equals
(
scheme
))
{
data
=
uri
.
getPath
();
}
else
if
(
ContentResolver
.
SCHEME_CONTENT
.
equals
(
scheme
))
{
data
=
getDataColumn
(
context
,
uri
,
null
,
null
);
}
return
data
;
}
/**
* 适配api19及以上,根据uri获取图片的绝对路径
*
* @param context 上下文对象
* @param uri 图片的Uri
* @return 如果Uri对应的图片存在, 那么返回该图片的绝对路径, 否则返回null
*/
@SuppressLint
(
"NewApi"
)
private
static
String
getRealPathFromUriAboveApi19
(
Context
context
,
Uri
uri
)
{
String
filePath
=
null
;
if
(
DocumentsContract
.
isDocumentUri
(
context
,
uri
))
{
// 如果是document类型的 uri, 则通过document id来进行处理
String
documentId
=
DocumentsContract
.
getDocumentId
(
uri
);
if
(
isMediaDocument
(
uri
))
{
// MediaProvider
final
String
[]
divide
=
documentId
.
split
(
":"
);
final
String
type
=
divide
[
0
];
Uri
mediaUri
=
null
;
if
(
"image"
.
equals
(
type
))
{
mediaUri
=
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
if
(
"video"
.
equals
(
type
))
{
mediaUri
=
MediaStore
.
Video
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
if
(
"audio"
.
equals
(
type
))
{
mediaUri
=
MediaStore
.
Audio
.
Media
.
EXTERNAL_CONTENT_URI
;
}
else
{
return
null
;
}
String
selection
=
BaseColumns
.
_ID
+
"=?"
;
String
[]
selectionArgs
=
{
divide
[
1
]};
filePath
=
getDataColumn
(
context
,
mediaUri
,
selection
,
selectionArgs
);
}
else
if
(
isDownloadsDocument
(
uri
))
{
// DownloadsProvider
Uri
contentUri
=
ContentUris
.
withAppendedId
(
Uri
.
parse
(
"content://downloads/public_downloads"
),
Long
.
valueOf
(
documentId
));
filePath
=
getDataColumn
(
context
,
contentUri
,
null
,
null
);
}
else
if
(
isExternalStorageDocument
(
uri
))
{
String
[]
split
=
documentId
.
split
(
":"
);
if
(
split
.
length
>=
2
)
{
String
type
=
split
[
0
];
if
(
"primary"
.
equalsIgnoreCase
(
type
))
{
filePath
=
Environment
.
getExternalStorageDirectory
()
+
"/"
+
split
[
1
];
}
}
}
}
else
if
(
ContentResolver
.
SCHEME_CONTENT
.
equalsIgnoreCase
(
uri
.
getScheme
()))
{
// 如果是 content 类型的 Uri
filePath
=
getDataColumn
(
context
,
uri
,
null
,
null
);
}
else
if
(
ContentResolver
.
SCHEME_FILE
.
equals
(
uri
.
getScheme
()))
{
// 如果是 file 类型的 Uri,直接获取图片对应的路径
filePath
=
uri
.
getPath
();
}
return
filePath
;
}
/**
* 获取数据库表中的 _data 列,即返回Uri对应的文件路径
*
* @return
*/
private
static
String
getDataColumn
(
Context
context
,
Uri
uri
,
String
selection
,
String
[]
selectionArgs
)
{
String
path
=
null
;
String
[]
projection
=
new
String
[]{
MediaStore
.
Images
.
Media
.
DATA
};
Cursor
cursor
=
null
;
try
{
cursor
=
context
.
getContentResolver
().
query
(
uri
,
projection
,
selection
,
selectionArgs
,
null
);
if
(
cursor
!=
null
&&
cursor
.
moveToFirst
())
{
int
columnIndex
=
cursor
.
getColumnIndexOrThrow
(
projection
[
0
]);
path
=
cursor
.
getString
(
columnIndex
);
}
}
catch
(
Exception
e
)
{
if
(
cursor
!=
null
)
{
cursor
.
close
();
}
}
return
path
;
}
/**
* @param uri the Uri to check
* @return Whether the Uri authority is MediaProvider
*/
private
static
boolean
isMediaDocument
(
Uri
uri
)
{
return
"com.android.providers.media.documents"
.
equals
(
uri
.
getAuthority
());
}
/**
* @param uri the Uri to check
* @return Whether the Uri authority is DownloadsProvider
*/
private
static
boolean
isDownloadsDocument
(
Uri
uri
)
{
return
"com.android.providers.downloads.documents"
.
equals
(
uri
.
getAuthority
());
}
private
static
boolean
isExternalStorageDocument
(
Uri
uri
)
{
return
"com.android.externalstorage.documents"
.
equals
(
uri
.
getAuthority
());
}
}
sobot_widget/src/main/java/com/sobot/widget/image/photoview/SobotPhotoView.java
View file @
63307c87
...
@@ -20,11 +20,11 @@ import android.graphics.Matrix;
...
@@ -20,11 +20,11 @@ import android.graphics.Matrix;
import
android.graphics.RectF
;
import
android.graphics.RectF
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.Drawable
;
import
android.net.Uri
;
import
android.net.Uri
;
import
androidx.appcompat.widget.AppCompatImageView
;
import
android.util.AttributeSet
;
import
android.util.AttributeSet
;
import
android.view.GestureDetector
;
import
android.view.GestureDetector
;
import
android.widget.ImageView
;
public
class
SobotPhotoView
extends
AppCompat
ImageView
{
public
class
SobotPhotoView
extends
ImageView
{
private
PhotoViewAttacher
attacher
;
private
PhotoViewAttacher
attacher
;
private
ScaleType
pendingScaleType
;
private
ScaleType
pendingScaleType
;
...
...
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