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
2e7fb8e9
Commit
2e7fb8e9
authored
Nov 28, 2024
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
google 分支使用特制的widget 版本1.2.8.3
parent
04b868ae
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
3 additions
and
1039 deletions
+3
-1039
MainActivity.java
app/src/main/java/com/sobot/moduletest/MainActivity.java
+1
-7
sobot-widget-publish-mavencentral.gradle
sobot_widget/sobot-widget-publish-mavencentral.gradle
+1
-1
AndroidManifest.xml
sobot_widget/src/main/AndroidManifest.xml
+0
-3
ExternalLiveData.java
...et/src/main/java/androidx/lifecycle/ExternalLiveData.java
+0
-85
SobotLiveEventBus.java
.../java/com/sobot/widget/livedatabus/SobotLiveEventBus.java
+0
-70
Config.java
...c/main/java/com/sobot/widget/livedatabus/core/Config.java
+0
-69
Console.java
.../main/java/com/sobot/widget/livedatabus/core/Console.java
+0
-19
LiveEvent.java
...ain/java/com/sobot/widget/livedatabus/core/LiveEvent.java
+0
-6
LiveEventBusCore.java
...a/com/sobot/widget/livedatabus/core/LiveEventBusCore.java
+0
-0
Observable.java
...in/java/com/sobot/widget/livedatabus/core/Observable.java
+0
-114
ObservableConfig.java
...a/com/sobot/widget/livedatabus/core/ObservableConfig.java
+0
-31
IpcConfig.java
...om/sobot/widget/livedatabus/ipc/annotation/IpcConfig.java
+0
-15
IpcConst.java
...ava/com/sobot/widget/livedatabus/ipc/consts/IpcConst.java
+0
-11
BooleanProcessor.java
...m/sobot/widget/livedatabus/ipc/core/BooleanProcessor.java
+0
-21
DoubleProcessor.java
...om/sobot/widget/livedatabus/ipc/core/DoubleProcessor.java
+0
-22
FloatProcessor.java
...com/sobot/widget/livedatabus/ipc/core/FloatProcessor.java
+0
-22
IntProcessor.java
...a/com/sobot/widget/livedatabus/ipc/core/IntProcessor.java
+0
-22
LongProcessor.java
.../com/sobot/widget/livedatabus/ipc/core/LongProcessor.java
+0
-22
ParcelableProcessor.java
...obot/widget/livedatabus/ipc/core/ParcelableProcessor.java
+0
-23
Processor.java
...java/com/sobot/widget/livedatabus/ipc/core/Processor.java
+0
-10
ProcessorManager.java
...m/sobot/widget/livedatabus/ipc/core/ProcessorManager.java
+0
-126
SerializableProcessor.java
...ot/widget/livedatabus/ipc/core/SerializableProcessor.java
+0
-24
StringProcessor.java
...om/sobot/widget/livedatabus/ipc/core/StringProcessor.java
+0
-21
LebIpcReceiver.java
...sobot/widget/livedatabus/ipc/receiver/LebIpcReceiver.java
+0
-27
DefaultLogger.java
...va/com/sobot/widget/livedatabus/logger/DefaultLogger.java
+0
-39
Logger.java
...main/java/com/sobot/widget/livedatabus/logger/Logger.java
+0
-10
LoggerManager.java
...va/com/sobot/widget/livedatabus/logger/LoggerManager.java
+0
-42
AppUtils.java
...ain/java/com/sobot/widget/livedatabus/utils/AppUtils.java
+0
-0
ThreadUtils.java
.../java/com/sobot/widget/livedatabus/utils/ThreadUtils.java
+0
-10
SobotBaseActivity.java
...main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
+0
-0
SobotSelectPicAndVideoActivity.java
.../base/picandroidvideo/SobotSelectPicAndVideoActivity.java
+0
-166
SobotWebViewActivity.java
...ava/com/sobot/widget/ui/webview/SobotWebViewActivity.java
+1
-1
No files found.
app/src/main/java/com/sobot/moduletest/MainActivity.java
View file @
2e7fb8e9
...
...
@@ -293,13 +293,7 @@ public class MainActivity extends SobotBaseActivity {
// openAlbum();
// }
// };
if
(
checkIsShowPermissionPop
(
getString
(
R
.
string
.
sobot_memory_card
),
getString
(
R
.
string
.
sobot_memory_card_yongtu
),
1
,
4
))
{
return
;
}
if
(!
checkStoragePermission
(
4
))
{
return
;
}
openAlbum
();
// selectPicFromLocal();
// preview();
...
...
sobot_widget/sobot-widget-publish-mavencentral.gradle
View file @
2e7fb8e9
...
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'widget_x'
//项目名
PUBLISH_VERSION
=
'1.2.
9
'
//版本号
PUBLISH_VERSION
=
'1.2.
8.3
'
//版本号
}
...
...
sobot_widget/src/main/AndroidManifest.xml
View file @
2e7fb8e9
...
...
@@ -5,9 +5,6 @@
<!-- 访问权限 -->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_IMAGES"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_AUDIO"
/>
<uses-permission
android:name=
"android.permission.READ_MEDIA_VIDEO"
/>
<uses-permission
android:name=
"com.google.android.apps.photos.permission.GOOGLE_PHOTOS"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
...
...
sobot_widget/src/main/java/androidx/lifecycle/ExternalLiveData.java
deleted
100644 → 0
View file @
04b868ae
package
androidx
.
lifecycle
;
import
androidx.annotation.NonNull
;
import
java.lang.reflect.Field
;
import
java.lang.reflect.Method
;
import
static
androidx
.
lifecycle
.
Lifecycle
.
State
.
CREATED
;
import
static
androidx
.
lifecycle
.
Lifecycle
.
State
.
DESTROYED
;
/**
* Created by liaohailiang on 2019/3/7.
*/
public
class
ExternalLiveData
<
T
>
extends
MutableLiveData
<
T
>
{
public
static
final
int
START_VERSION
=
LiveData
.
START_VERSION
;
@Override
public
void
observe
(
@NonNull
LifecycleOwner
owner
,
@NonNull
Observer
<?
super
T
>
observer
)
{
if
(
owner
.
getLifecycle
().
getCurrentState
()
==
DESTROYED
)
{
// ignore
return
;
}
try
{
//use ExternalLifecycleBoundObserver instead of LifecycleBoundObserver
LifecycleBoundObserver
wrapper
=
new
ExternalLifecycleBoundObserver
(
owner
,
observer
);
LifecycleBoundObserver
existing
=
(
LifecycleBoundObserver
)
callMethodPutIfAbsent
(
observer
,
wrapper
);
if
(
existing
!=
null
&&
!
existing
.
isAttachedTo
(
owner
))
{
throw
new
IllegalArgumentException
(
"Cannot add the same observer"
+
" with different lifecycles"
);
}
if
(
existing
!=
null
)
{
return
;
}
owner
.
getLifecycle
().
addObserver
(
wrapper
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
int
getVersion
()
{
return
super
.
getVersion
();
}
/**
* determine when the observer is active, means the observer can receive message
* the default value is CREATED, means if the observer's state is above create,
* for example, the onCreate() of activity is called
* you can change this value to CREATED/STARTED/RESUMED
* determine on witch state, you can receive message
*
* @return Lifecycle.State
*/
protected
Lifecycle
.
State
observerActiveLevel
()
{
return
CREATED
;
}
class
ExternalLifecycleBoundObserver
extends
LifecycleBoundObserver
{
ExternalLifecycleBoundObserver
(
@NonNull
LifecycleOwner
owner
,
Observer
<?
super
T
>
observer
)
{
super
(
owner
,
observer
);
}
@Override
boolean
shouldBeActive
()
{
return
mOwner
.
getLifecycle
().
getCurrentState
().
isAtLeast
(
observerActiveLevel
());
}
}
private
Object
getFieldObservers
()
throws
Exception
{
Field
fieldObservers
=
LiveData
.
class
.
getDeclaredField
(
"mObservers"
);
fieldObservers
.
setAccessible
(
true
);
return
fieldObservers
.
get
(
this
);
}
private
Object
callMethodPutIfAbsent
(
Object
observer
,
Object
wrapper
)
throws
Exception
{
Object
mObservers
=
getFieldObservers
();
Class
<?>
classOfSafeIterableMap
=
mObservers
.
getClass
();
Method
putIfAbsent
=
classOfSafeIterableMap
.
getDeclaredMethod
(
"putIfAbsent"
,
Object
.
class
,
Object
.
class
);
putIfAbsent
.
setAccessible
(
true
);
return
putIfAbsent
.
invoke
(
mObservers
,
observer
,
wrapper
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/SobotLiveEventBus.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
;
import
androidx.annotation.NonNull
;
import
com.sobot.widget.livedatabus.core.Config
;
import
com.sobot.widget.livedatabus.core.LiveEvent
;
import
com.sobot.widget.livedatabus.core.LiveEventBusCore
;
import
com.sobot.widget.livedatabus.core.Observable
;
import
com.sobot.widget.livedatabus.core.ObservableConfig
;
public
class
SobotLiveEventBus
{
/**
* get observable by key with type
*
* @param key key
* @param type type
* @param <T> T
* @return Observable
*/
public
static
<
T
>
Observable
<
T
>
get
(
@NonNull
String
key
,
@NonNull
Class
<
T
>
type
)
{
return
LiveEventBusCore
.
get
().
with
(
key
,
type
);
}
/**
* get observable by key
*
* @param key String
* @param <T> T
* @return Observable
*/
public
static
<
T
>
Observable
<
T
>
get
(
@NonNull
String
key
)
{
return
(
Observable
<
T
>)
get
(
key
,
Object
.
class
);
}
/**
* get observable from eventType
*
* @param eventType Class
* @param <T> T
* @return Observable
*/
public
static
<
T
extends
LiveEvent
>
Observable
<
T
>
get
(
@NonNull
Class
<
T
>
eventType
)
{
return
get
(
eventType
.
getName
(),
eventType
);
}
/**
* use the inner class Config to set params
* first of all, call config to get the Config instance
* then, call the method of Config to config LiveEventBus
* call this method in Application.onCreate
* @return Config
*/
public
static
Config
config
()
{
return
LiveEventBusCore
.
get
().
config
();
}
/**
* use the inner class Config to set params
* first of all, call config to get the Config instance
* then, call the method of Config to config LiveEventBus
* call this method in Application.onCreate
* @param key String
* @return Config
*/
public
static
ObservableConfig
config
(
@NonNull
String
key
)
{
return
LiveEventBusCore
.
get
().
config
(
key
);
}
}
\ No newline at end of file
sobot_widget/src/main/java/com/sobot/widget/livedatabus/core/Config.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
core
;
import
android.content.Context
;
import
androidx.annotation.NonNull
;
import
com.sobot.widget.livedatabus.logger.Logger
;
import
com.sobot.widget.livedatabus.utils.AppUtils
;
public
class
Config
{
/**
* lifecycleObserverAlwaysActive
* set if then observer can always receive message
* true: observer can always receive message
* false: observer can only receive message when resumed
*
* @param active boolean
* @return Config
*/
public
Config
lifecycleObserverAlwaysActive
(
boolean
active
)
{
LiveEventBusCore
.
get
().
setLifecycleObserverAlwaysActive
(
active
);
return
this
;
}
/**
* @param clear boolean
* @return true: clear livedata when no observer observe it
* false: not clear livedata unless app was killed
*/
public
Config
autoClear
(
boolean
clear
)
{
LiveEventBusCore
.
get
().
setAutoClear
(
clear
);
return
this
;
}
/**
* config broadcast
* only if you called this method, you can use broadcastValue() to send broadcast message
*
* @param context Context
* @return Config
*/
public
Config
setContext
(
Context
context
)
{
AppUtils
.
init
(
context
);
LiveEventBusCore
.
get
().
registerReceiver
();
return
this
;
}
/**
* setLogger, if not set, use DefaultLogger
*
* @param logger Logger
* @return Config
*/
public
Config
setLogger
(
@NonNull
Logger
logger
)
{
LiveEventBusCore
.
get
().
setLogger
(
logger
);
return
this
;
}
/**
* set logger enable or disable, default enable
*
* @param enable boolean
* @return Config
*/
public
Config
enableLogger
(
boolean
enable
)
{
LiveEventBusCore
.
get
().
enableLogger
(
enable
);
return
this
;
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/core/Console.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
core
;
/**
* 调试信息控制台
*/
public
final
class
Console
{
private
Console
()
{
}
/**
* 获取控制台信息
*
* @return 调试信息
*/
public
static
String
getInfo
()
{
return
LiveEventBusCore
.
get
().
console
.
getConsoleInfo
();
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/core/LiveEvent.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
core
;
import
java.io.Serializable
;
public
interface
LiveEvent
extends
Serializable
{
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/core/LiveEventBusCore.java
deleted
100644 → 0
View file @
04b868ae
This diff is collapsed.
Click to expand it.
sobot_widget/src/main/java/com/sobot/widget/livedatabus/core/Observable.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
core
;
import
androidx.lifecycle.LifecycleOwner
;
import
androidx.lifecycle.Observer
;
import
androidx.annotation.NonNull
;
public
interface
Observable
<
T
>
{
/**
* 进程内发送消息
*
* @param value 发送的消息
*/
void
post
(
T
value
);
/**
* App内发送消息,跨进程使用
*
* @param value 发送的消息
*/
void
postAcrossProcess
(
T
value
);
/**
* App之间发送消息
*
* @param value 发送的消息
*/
void
postAcrossApp
(
T
value
);
/**
* 进程内发送消息,延迟发送
*
* @param value 发送的消息
* @param delay 延迟毫秒数
*/
void
postDelay
(
T
value
,
long
delay
);
/**
* 进程内发送消息,延迟发送,带生命周期
* 如果延时发送消息的时候sender处于非激活状态,消息取消发送
*
* @param sender 消息发送者
* @param value 发送的消息
* @param delay 延迟毫秒数
*/
void
postDelay
(
LifecycleOwner
sender
,
T
value
,
long
delay
);
/**
* 进程内发送消息
* 强制接收到消息的顺序和发送顺序一致
*
* @param value 发送的消息
*/
void
postOrderly
(
T
value
);
/**
* 以广播的形式发送一个消息
* 需要跨进程、跨APP发送消息的时候调用该方法
* 可使用postAcrossProcess or postAcrossApp代替
*
* @param value 发送的消息
*/
@Deprecated
void
broadcast
(
T
value
);
/**
* 以广播的形式发送一个消息
* 需要跨进程、跨APP发送消息的时候调用该方法
*
* @param value 发送的消息
* @param foreground true:前台广播、false:后台广播
* @param onlyInApp true:只在APP内有效、false:全局有效
*/
void
broadcast
(
T
value
,
boolean
foreground
,
boolean
onlyInApp
);
/**
* 注册一个Observer,生命周期感知,自动取消订阅
*
* @param owner LifecycleOwner
* @param observer 观察者
*/
void
observe
(
@NonNull
LifecycleOwner
owner
,
@NonNull
Observer
<
T
>
observer
);
/**
* 注册一个Observer,生命周期感知,自动取消订阅
* 如果之前有消息发送,可以在注册时收到消息(消息同步)
*
* @param owner LifecycleOwner
* @param observer 观察者
*/
void
observeSticky
(
@NonNull
LifecycleOwner
owner
,
@NonNull
Observer
<
T
>
observer
);
/**
* 注册一个Observer,需手动解除绑定
*
* @param observer 观察者
*/
void
observeForever
(
@NonNull
Observer
<
T
>
observer
);
/**
* 注册一个Observer,需手动解除绑定
* 如果之前有消息发送,可以在注册时收到消息(消息同步)
*
* @param observer 观察者
*/
void
observeStickyForever
(
@NonNull
Observer
<
T
>
observer
);
/**
* 通过observeForever或observeStickyForever注册的,需要调用该方法取消订阅
*
* @param observer 观察者
*/
void
removeObserver
(
@NonNull
Observer
<
T
>
observer
);
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/core/ObservableConfig.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
core
;
public
class
ObservableConfig
{
Boolean
lifecycleObserverAlwaysActive
=
null
;
Boolean
autoClear
=
null
;
/**
* lifecycleObserverAlwaysActive
* set if then observer can always receive message
* true: observer can always receive message
* false: observer can only receive message when resumed
*
* @param active boolean
* @return ObservableConfig
*/
public
ObservableConfig
lifecycleObserverAlwaysActive
(
boolean
active
)
{
lifecycleObserverAlwaysActive
=
active
;
return
this
;
}
/**
* @param clear boolean
* @return true: clear livedata when no observer observe it
* false: not clear livedata unless app was killed
*/
public
ObservableConfig
autoClear
(
boolean
clear
)
{
autoClear
=
clear
;
return
this
;
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/annotation/IpcConfig.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
annotation
;
import
com.sobot.widget.livedatabus.ipc.core.Processor
;
import
java.lang.annotation.ElementType
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.RetentionPolicy
;
import
java.lang.annotation.Target
;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Target
(
ElementType
.
TYPE
)
public
@interface
IpcConfig
{
Class
<?
extends
Processor
>
processor
();
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/consts/IpcConst.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
consts
;
public
class
IpcConst
{
public
static
final
String
ACTION
=
"intent.action.ACTION_LEB_IPC"
;
public
static
final
String
KEY
=
"leb_ipc_key"
;
public
static
final
String
KEY_VALUE
=
"leb_ipc_value"
;
public
static
final
String
KEY_PROCESSOR_NAME
=
"leb_ipc_processor_name"
;
public
static
final
String
KEY_BUNDLE
=
"leb_ipc_bundle"
;
public
static
final
String
KEY_CLASS_NAME
=
"leb_ipc_class_name"
;
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/BooleanProcessor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
public
class
BooleanProcessor
implements
Processor
{
@Override
public
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
{
if
(!(
value
instanceof
Boolean
))
{
return
false
;
}
bundle
.
putBoolean
(
IpcConst
.
KEY_VALUE
,
(
boolean
)
value
);
return
true
;
}
@Override
public
Object
createFromBundle
(
Bundle
bundle
)
{
return
bundle
.
getBoolean
(
IpcConst
.
KEY_VALUE
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/DoubleProcessor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
public
class
DoubleProcessor
implements
Processor
{
@Override
public
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
{
if
(!(
value
instanceof
Double
))
{
return
false
;
}
bundle
.
putDouble
(
IpcConst
.
KEY_VALUE
,
(
Double
)
value
);
return
true
;
}
@Override
public
Object
createFromBundle
(
Bundle
bundle
)
{
return
bundle
.
getDouble
(
IpcConst
.
KEY_VALUE
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/FloatProcessor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
public
class
FloatProcessor
implements
Processor
{
@Override
public
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
{
if
(!(
value
instanceof
Float
))
{
return
false
;
}
bundle
.
putFloat
(
IpcConst
.
KEY_VALUE
,
(
float
)
value
);
return
true
;
}
@Override
public
Object
createFromBundle
(
Bundle
bundle
)
{
return
bundle
.
getFloat
(
IpcConst
.
KEY_VALUE
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/IntProcessor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
public
class
IntProcessor
implements
Processor
{
@Override
public
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
{
if
(!(
value
instanceof
Integer
))
{
return
false
;
}
bundle
.
putInt
(
IpcConst
.
KEY_VALUE
,
(
int
)
value
);
return
true
;
}
@Override
public
Object
createFromBundle
(
Bundle
bundle
)
{
return
bundle
.
getInt
(
IpcConst
.
KEY_VALUE
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/LongProcessor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
public
class
LongProcessor
implements
Processor
{
@Override
public
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
{
if
(!(
value
instanceof
Long
))
{
return
false
;
}
bundle
.
putLong
(
IpcConst
.
KEY_VALUE
,
(
long
)
value
);
return
true
;
}
@Override
public
Object
createFromBundle
(
Bundle
bundle
)
{
return
bundle
.
getLong
(
IpcConst
.
KEY_VALUE
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/ParcelableProcessor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
import
android.os.Parcelable
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
public
class
ParcelableProcessor
implements
Processor
{
@Override
public
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
{
if
(!(
value
instanceof
Parcelable
))
{
return
false
;
}
bundle
.
putParcelable
(
IpcConst
.
KEY_VALUE
,
(
Parcelable
)
value
);
return
true
;
}
@Override
public
Object
createFromBundle
(
Bundle
bundle
)
{
return
bundle
.
getParcelable
(
IpcConst
.
KEY_VALUE
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/Processor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
public
interface
Processor
{
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
throws
Exception
;
Object
createFromBundle
(
Bundle
bundle
)
throws
Exception
;
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/ProcessorManager.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.content.Intent
;
import
android.os.Bundle
;
import
com.sobot.widget.livedatabus.ipc.annotation.IpcConfig
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
public
class
ProcessorManager
{
private
static
class
SingletonHolder
{
private
static
final
ProcessorManager
INSTANCE
=
new
ProcessorManager
();
}
public
static
ProcessorManager
getManager
()
{
return
SingletonHolder
.
INSTANCE
;
}
private
final
List
<
Processor
>
baseProcessors
;
private
final
Map
<
String
,
Processor
>
processorMap
;
{
baseProcessors
=
new
LinkedList
<>(
Arrays
.
asList
(
new
StringProcessor
(),
new
IntProcessor
(),
new
BooleanProcessor
(),
new
DoubleProcessor
(),
new
FloatProcessor
(),
new
LongProcessor
(),
new
SerializableProcessor
(),
new
ParcelableProcessor
()));
processorMap
=
new
HashMap
<>();
for
(
Processor
processor
:
baseProcessors
)
{
processorMap
.
put
(
processor
.
getClass
().
getName
(),
processor
);
}
}
private
ProcessorManager
()
{
}
public
boolean
writeTo
(
Intent
intent
,
Object
value
)
{
if
(
intent
==
null
||
value
==
null
)
{
return
false
;
}
Bundle
bundle
=
new
Bundle
();
boolean
processed
=
false
;
//用指定的processor处理
IpcConfig
config
=
value
.
getClass
().
getAnnotation
(
IpcConfig
.
class
);
if
(
config
!=
null
)
{
Class
<?
extends
Processor
>
processorType
=
config
.
processor
();
String
processorTypeName
=
processorType
.
getName
();
if
(!
processorMap
.
containsKey
(
processorTypeName
))
{
try
{
processorMap
.
put
(
processorTypeName
,
processorType
.
newInstance
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
Processor
processor
=
processorMap
.
get
(
processorTypeName
);
if
(
processor
!=
null
)
{
try
{
boolean
handle
=
processor
.
writeToBundle
(
bundle
,
value
);
if
(
handle
)
{
intent
.
putExtra
(
IpcConst
.
KEY_PROCESSOR_NAME
,
processor
.
getClass
().
getName
());
intent
.
putExtra
(
IpcConst
.
KEY_BUNDLE
,
bundle
);
processed
=
true
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
if
(
processed
)
{
return
true
;
}
}
//用默认的processor处理
for
(
Processor
processor
:
baseProcessors
)
{
try
{
boolean
handle
=
processor
.
writeToBundle
(
bundle
,
value
);
if
(
handle
)
{
intent
.
putExtra
(
IpcConst
.
KEY_PROCESSOR_NAME
,
processor
.
getClass
().
getName
());
intent
.
putExtra
(
IpcConst
.
KEY_BUNDLE
,
bundle
);
processed
=
true
;
break
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
processed
;
}
public
Object
createFrom
(
Intent
intent
)
{
if
(
intent
==
null
)
{
return
null
;
}
String
processorName
=
intent
.
getStringExtra
(
IpcConst
.
KEY_PROCESSOR_NAME
);
Bundle
bundle
=
intent
.
getBundleExtra
(
IpcConst
.
KEY_BUNDLE
);
if
(
processorName
==
null
||
processorName
.
length
()
==
0
||
bundle
==
null
)
{
return
null
;
}
if
(!
processorMap
.
containsKey
(
processorName
))
{
try
{
processorMap
.
put
(
processorName
,
(
Processor
)
Class
.
forName
(
processorName
).
newInstance
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
Processor
processor
=
processorMap
.
get
(
processorName
);
if
(
processor
==
null
)
{
return
null
;
}
try
{
return
processor
.
createFromBundle
(
bundle
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/SerializableProcessor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
import
java.io.Serializable
;
public
class
SerializableProcessor
implements
Processor
{
@Override
public
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
{
if
(!(
value
instanceof
Serializable
))
{
return
false
;
}
bundle
.
putSerializable
(
IpcConst
.
KEY_VALUE
,
(
Serializable
)
value
);
return
true
;
}
@Override
public
Object
createFromBundle
(
Bundle
bundle
)
{
return
bundle
.
getSerializable
(
IpcConst
.
KEY_VALUE
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/core/StringProcessor.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
core
;
import
android.os.Bundle
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
public
class
StringProcessor
implements
Processor
{
@Override
public
boolean
writeToBundle
(
Bundle
bundle
,
Object
value
)
{
if
(!(
value
instanceof
String
))
{
return
false
;
}
bundle
.
putString
(
IpcConst
.
KEY_VALUE
,
(
String
)
value
);
return
true
;
}
@Override
public
Object
createFromBundle
(
Bundle
bundle
)
{
return
bundle
.
getString
(
IpcConst
.
KEY_VALUE
);
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/ipc/receiver/LebIpcReceiver.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
ipc
.
receiver
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
com.sobot.widget.livedatabus.SobotLiveEventBus
;
import
com.sobot.widget.livedatabus.ipc.consts.IpcConst
;
import
com.sobot.widget.livedatabus.ipc.core.ProcessorManager
;
public
class
LebIpcReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
if
(
IpcConst
.
ACTION
.
equals
(
intent
.
getAction
()))
{
try
{
String
key
=
intent
.
getStringExtra
(
IpcConst
.
KEY
);
Object
value
=
ProcessorManager
.
getManager
().
createFrom
(
intent
);
if
(
key
!=
null
&&
value
!=
null
)
{
SobotLiveEventBus
.
get
(
key
).
post
(
value
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/logger/DefaultLogger.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
logger
;
import
android.util.Log
;
import
java.util.logging.Level
;
public
class
DefaultLogger
implements
Logger
{
private
static
final
String
TAG
=
"[LiveEventBus]"
;
@Override
public
void
log
(
Level
level
,
String
msg
)
{
if
(
level
==
Level
.
SEVERE
)
{
Log
.
e
(
TAG
,
msg
);
}
else
if
(
level
==
Level
.
WARNING
)
{
Log
.
w
(
TAG
,
msg
);
}
else
if
(
level
==
Level
.
INFO
)
{
Log
.
i
(
TAG
,
msg
);
}
else
if
(
level
==
Level
.
CONFIG
)
{
Log
.
d
(
TAG
,
msg
);
}
else
if
(
level
!=
Level
.
OFF
)
{
Log
.
v
(
TAG
,
msg
);
}
}
@Override
public
void
log
(
Level
level
,
String
msg
,
Throwable
th
)
{
if
(
level
==
Level
.
SEVERE
)
{
Log
.
e
(
TAG
,
msg
,
th
);
}
else
if
(
level
==
Level
.
WARNING
)
{
Log
.
w
(
TAG
,
msg
,
th
);
}
else
if
(
level
==
Level
.
INFO
)
{
Log
.
i
(
TAG
,
msg
,
th
);
}
else
if
(
level
==
Level
.
CONFIG
)
{
Log
.
d
(
TAG
,
msg
,
th
);
}
else
if
(
level
!=
Level
.
OFF
)
{
Log
.
v
(
TAG
,
msg
,
th
);
}
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/logger/Logger.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
logger
;
import
java.util.logging.Level
;
public
interface
Logger
{
void
log
(
Level
level
,
String
msg
);
void
log
(
Level
level
,
String
msg
,
Throwable
th
);
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/logger/LoggerManager.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
logger
;
import
java.util.logging.Level
;
public
class
LoggerManager
implements
Logger
{
private
Logger
logger
;
private
boolean
enable
=
true
;
public
LoggerManager
(
Logger
logger
)
{
this
.
logger
=
logger
;
}
public
boolean
isEnable
()
{
return
enable
;
}
public
void
setEnable
(
boolean
enable
)
{
this
.
enable
=
enable
;
}
public
Logger
getLogger
()
{
return
logger
;
}
public
void
setLogger
(
Logger
logger
)
{
this
.
logger
=
logger
;
}
@Override
public
void
log
(
Level
level
,
String
msg
)
{
if
(
enable
)
{
logger
.
log
(
level
,
msg
);
}
}
@Override
public
void
log
(
Level
level
,
String
msg
,
Throwable
th
)
{
if
(
enable
)
{
logger
.
log
(
level
,
msg
,
th
);
}
}
}
sobot_widget/src/main/java/com/sobot/widget/livedatabus/utils/AppUtils.java
deleted
100644 → 0
View file @
04b868ae
This diff is collapsed.
Click to expand it.
sobot_widget/src/main/java/com/sobot/widget/livedatabus/utils/ThreadUtils.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
livedatabus
.
utils
;
import
android.os.Looper
;
public
final
class
ThreadUtils
{
public
static
boolean
isMainThread
()
{
return
Looper
.
myLooper
()
==
Looper
.
getMainLooper
();
}
}
sobot_widget/src/main/java/com/sobot/widget/ui/base/SobotBaseActivity.java
View file @
2e7fb8e9
This diff is collapsed.
Click to expand it.
sobot_widget/src/main/java/com/sobot/widget/ui/base/picandroidvideo/SobotSelectPicAndVideoActivity.java
deleted
100644 → 0
View file @
04b868ae
package
com
.
sobot
.
widget
.
ui
.
base
.
picandroidvideo
;
import
android.Manifest
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.provider.Settings
;
import
android.view.View
;
import
android.widget.Button
;
import
android.widget.TextView
;
import
androidx.core.content.ContextCompat
;
import
androidx.recyclerview.widget.GridLayoutManager
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.sobot.utils.SobotDensityUtil
;
import
com.sobot.widget.R
;
import
com.sobot.widget.refresh.layout.callback.SobotRecyclerCallBack
;
import
com.sobot.widget.ui.SobotBaseConstant
;
import
com.sobot.widget.ui.base.SobotBaseActivity
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* android 14 部分权限 允许后的回显界面
*/
public
class
SobotSelectPicAndVideoActivity
extends
SobotBaseActivity
{
private
TextView
tv_go_to_settring
;
private
RecyclerView
sobot_rcy
;
private
Button
sobot_btn_submit
;
private
SobotSelectPicAndVideoAdapter
picAdapter
;
private
List
<
SobotAlbumFile
>
albumFileList
;
private
int
selectType
=
1
;
@Override
protected
int
getContentViewResId
()
{
return
R
.
layout
.
sobot_activity_select_pic_and_video
;
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
if
(
albumFileList
==
null
)
{
albumFileList
=
new
ArrayList
<>();
}
albumFileList
.
clear
();
albumFileList
=
SobotMediaReaderScanUtils
.
getAllMedia
(
getSobotBaseActivity
(),
selectType
);
if
(
albumFileList
==
null
)
{
albumFileList
=
new
ArrayList
<>();
}
albumFileList
.
add
(
new
SobotAlbumFile
());
if
(
picAdapter
!=
null
)
{
picAdapter
.
setmSelectedPos
(-
1
);
picAdapter
.
updateList
(
albumFileList
);
}
else
{
finish
();
}
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
if
(
selectType
==
1
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
UPSIDE_DOWN_CAKE
&&
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_IMAGES
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
//如果android 14 手机有永久权限 直接关闭当前界面
finish
();
}
}
else
if
(
selectType
==
2
){
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
UPSIDE_DOWN_CAKE
&&
ContextCompat
.
checkSelfPermission
(
getSobotBaseActivity
(),
Manifest
.
permission
.
READ_MEDIA_VIDEO
)
==
PackageManager
.
PERMISSION_GRANTED
)
{
//如果android 14 手机有永久权限 直接关闭当前界面
finish
();
}
}
}
@Override
protected
void
initView
()
{
tv_go_to_settring
=
findViewById
(
R
.
id
.
tv_go_to_settring
);
sobot_rcy
=
findViewById
(
R
.
id
.
sobot_rcy
);
sobot_btn_submit
=
findViewById
(
R
.
id
.
sobot_btn_submit
);
sobot_btn_submit
.
setAlpha
(
0.5f
);
sobot_btn_submit
.
setClickable
(
false
);
setTitle
(
getString
(
R
.
string
.
sobot_str_select_pic_video
));
displayInNotch
(
sobot_rcy
);
tv_go_to_settring
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
//去设置打开权限
Uri
packageURI
=
Uri
.
parse
(
"package:"
+
getPackageName
());
Intent
intent
=
new
Intent
(
Settings
.
ACTION_APPLICATION_DETAILS_SETTINGS
,
packageURI
);
startActivity
(
intent
);
}
});
}
protected
void
initData
()
{
selectType
=
getIntent
().
getIntExtra
(
"selectType"
,
1
);
albumFileList
=
SobotMediaReaderScanUtils
.
getAllMedia
(
getSobotBaseActivity
(),
selectType
);
if
(
albumFileList
==
null
)
{
albumFileList
=
new
ArrayList
<>();
}
albumFileList
.
add
(
new
SobotAlbumFile
());
picAdapter
=
new
SobotSelectPicAndVideoAdapter
(
this
,
albumFileList
,
new
SobotRecyclerCallBack
()
{
@Override
public
void
onItemClickListener
(
View
view
,
int
position
)
{
}
@Override
public
void
onItemLongClickListener
(
View
view
,
int
position
)
{
}
});
picAdapter
.
setClickListener
(
new
SobotSelectPicAndVideoAdapter
.
myClickListener
()
{
@Override
public
void
onClickOtherListener
()
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
if
(
selectType
==
3
)
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_IMAGES
,
Manifest
.
permission
.
READ_MEDIA_VIDEO
,
Manifest
.
permission
.
READ_MEDIA_AUDIO
,
Manifest
.
permission
.
READ_MEDIA_VISUAL_USER_SELECTED
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
}
else
if
(
selectType
==
2
)
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_VIDEO
,
Manifest
.
permission
.
READ_MEDIA_VISUAL_USER_SELECTED
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
}
else
{
requestPermissions
(
new
String
[]{
Manifest
.
permission
.
READ_MEDIA_IMAGES
,
Manifest
.
permission
.
READ_MEDIA_VISUAL_USER_SELECTED
},
SobotBaseConstant
.
REQUEST_CODE_PICTURE
);
}
}
}
@Override
public
void
onCheckListener
()
{
if
(
picAdapter
.
getmSelectedPos
()
>
-
1
)
{
sobot_btn_submit
.
setAlpha
(
1
f
);
sobot_btn_submit
.
setClickable
(
true
);
}
else
{
sobot_btn_submit
.
setAlpha
(
0.5f
);
sobot_btn_submit
.
setClickable
(
false
);
}
}
});
sobot_rcy
.
setAdapter
(
picAdapter
);
GridLayoutManager
gridlayoutmanager
=
new
GridLayoutManager
(
SobotSelectPicAndVideoActivity
.
this
,
4
);
sobot_rcy
.
addItemDecoration
(
new
SpaceItemDecoration
(
SobotDensityUtil
.
dp2px
(
SobotSelectPicAndVideoActivity
.
this
,
3
),
SobotDensityUtil
.
dp2px
(
SobotSelectPicAndVideoActivity
.
this
,
1.5f
),
0
,
SpaceItemDecoration
.
GRIDLAYOUT
));
sobot_rcy
.
setLayoutManager
(
gridlayoutmanager
);
sobot_btn_submit
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
if
(
albumFileList
!=
null
&&
albumFileList
.
size
()
>
0
&&
picAdapter
!=
null
&&
picAdapter
.
getmSelectedPos
()
>
-
1
)
{
SobotAlbumFile
albumFile
=
albumFileList
.
get
(
picAdapter
.
getmSelectedPos
());
Intent
intent
=
new
Intent
();
intent
.
setData
(
albumFile
.
getUri
());
setResult
(
RESULT_OK
,
intent
);
finish
();
}
}
});
}
}
\ No newline at end of file
sobot_widget/src/main/java/com/sobot/widget/ui/webview/SobotWebViewActivity.java
View file @
2e7fb8e9
...
...
@@ -405,7 +405,7 @@ public class SobotWebViewActivity extends SobotBaseActivity implements View.OnCl
* 打开相机拍照
*/
private
void
openCapture
()
{
openCamera
();
}
/**
...
...
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