Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
Scan QR Code Barcode Reader
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
Scan QR Code Barcode Reader
Commits
71f83fde
Commit
71f83fde
authored
Dec 30, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
dbea0a0b
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
60 additions
and
86 deletions
+60
-86
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+10
-0
AdState.kt
app/src/main/java/com/base/scanqr/ads/AdState.kt
+1
-62
AdInsertMgr.kt
app/src/main/java/com/base/scanqr/ads/admob/AdInsertMgr.kt
+2
-2
AdOpenMgr.kt
app/src/main/java/com/base/scanqr/ads/admob/AdOpenMgr.kt
+8
-2
MaxInsertMgr.kt
...rc/main/java/com/base/scanqr/ads/applovin/MaxInsertMgr.kt
+2
-2
MaxOpenMgr.kt
app/src/main/java/com/base/scanqr/ads/applovin/MaxOpenMgr.kt
+2
-2
NotificationSendBean.kt
...rc/main/java/com/base/scanqr/bean/NotificationSendBean.kt
+2
-2
NotificationManager.kt
...a/com/base/scanqr/fcm/notification/NotificationManager.kt
+4
-4
ScreenStatusReceiver.kt
...java/com/base/scanqr/fcm/receiver/ScreenStatusReceiver.kt
+9
-3
MainActivity.kt
app/src/main/java/com/base/scanqr/ui/main/MainActivity.kt
+7
-1
StartActivity.kt
app/src/main/java/com/base/scanqr/ui/start/StartActivity.kt
+13
-5
stay_notification_small_scan.xml
app/src/main/res/layout/stay_notification_small_scan.xml
+0
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
71f83fde
...
@@ -35,6 +35,14 @@
...
@@ -35,6 +35,14 @@
android:theme=
"@style/Theme.ScanQR"
android:theme=
"@style/Theme.ScanQR"
tools:targetApi=
"31"
>
tools:targetApi=
"31"
>
<activity
android:name=
"com.google.android.gms.ads.AdActivity"
android:configChanges=
"keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:exported=
"false"
android:multiprocess=
"true"
android:theme=
"@android:style/Theme.Translucent"
tools:ignore=
"MissingClass"
/>
<activity
<activity
android:name=
".ui.start.StartActivity"
android:name=
".ui.start.StartActivity"
android:exported=
"true"
android:exported=
"true"
...
@@ -48,6 +56,8 @@
...
@@ -48,6 +56,8 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</intent-filter>
</activity>
</activity>
<activity
<activity
android:name=
".ui.main.MainActivity"
android:name=
".ui.main.MainActivity"
android:exported=
"false"
android:exported=
"false"
...
...
app/src/main/java/com/base/scanqr/ads/
BaseAdMgr
.kt
→
app/src/main/java/com/base/scanqr/ads/
AdState
.kt
View file @
71f83fde
package
com.base.scanqr.ads
package
com.base.scanqr.ads
import
android.app.Activity
import
android.app.Activity
import
android.app.Dialog
import
android.app.Dialog
import
android.content.Context
import
java.lang.ref.WeakReference
import
java.lang.ref.WeakReference
class
a
dState
<
T
>()
{
class
A
dState
<
T
>()
{
var
adDialog
:
Dialog
?
=
null
var
adDialog
:
Dialog
?
=
null
...
@@ -84,63 +83,3 @@ class adState<T>() {
...
@@ -84,63 +83,3 @@ class adState<T>() {
}
}
}
}
/**
* 特定广告管理基类
* @param T 缓存广告的类
*/
abstract
class
BaseAdMgr
<
T
>
{
/**
* 广告展示回调
*/
protected
var
showCallBack
:
AdsShowCallBack
?
=
null
/**
* 当前缓存的广告
*/
protected
var
currentAd
:
T
?
=
null
/**
* 是否正在缓存加载广告
*/
protected
var
loadingAd
:
Boolean
=
false
/**
* 是否正在显示广告
*/
protected
var
showingAd
:
Boolean
=
false
/**
* 用于保存引用现有页面,在此页面显示广告(因为要等待广告加载完毕)
*/
protected
var
activityRef
:
WeakReference
<
Activity
>?
=
null
/**
* 上一次的缓存成功时间
*/
protected
var
lastLoadTime
:
Long
=
0
/**
* 预加载广告
*
* @param context 加载所用的上下文,一般使用appContext
*/
abstract
fun
loadAd
(
context
:
Context
,
isUnLimit
:
Boolean
=
true
,
adEvent
:
AdEvent
)
/**
* 广告显示
*
* @param activity 当前页面
*/
abstract
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
=
true
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?
=
null
)
/**
* 预加载的缓存超时判断
*
* @return true:没有超时 false:超时需要重新加载
*/
abstract
fun
adAvailable
():
Boolean
}
\ No newline at end of file
app/src/main/java/com/base/scanqr/ads/admob/AdInsertMgr.kt
View file @
71f83fde
...
@@ -8,7 +8,7 @@ import com.base.scanqr.ads.AdEvent
...
@@ -8,7 +8,7 @@ import com.base.scanqr.ads.AdEvent
import
com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.ads.AdsType
import
com.base.scanqr.ads.AdsType
import
com.base.scanqr.ads.LimitUtils
import
com.base.scanqr.ads.LimitUtils
import
com.base.scanqr.ads.
a
dState
import
com.base.scanqr.ads.
A
dState
import
com.google.android.gms.ads.AdError
import
com.google.android.gms.ads.AdError
import
com.google.android.gms.ads.AdRequest
import
com.google.android.gms.ads.AdRequest
import
com.google.android.gms.ads.FullScreenContentCallback
import
com.google.android.gms.ads.FullScreenContentCallback
...
@@ -22,7 +22,7 @@ import java.lang.ref.WeakReference
...
@@ -22,7 +22,7 @@ import java.lang.ref.WeakReference
*/
*/
class
AdInsertMgr
{
class
AdInsertMgr
{
private
var
adState
=
a
dState
<
InterstitialAd
>()
private
var
adState
=
A
dState
<
InterstitialAd
>()
private
var
showCallBack
:
AdsShowCallBack
?
=
null
private
var
showCallBack
:
AdsShowCallBack
?
=
null
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?)
{
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?)
{
...
...
app/src/main/java/com/base/scanqr/ads/admob/AdOpenMgr.kt
View file @
71f83fde
...
@@ -2,12 +2,14 @@ package com.base.scanqr.ads.admob
...
@@ -2,12 +2,14 @@ package com.base.scanqr.ads.admob
import
android.app.Activity
import
android.app.Activity
import
android.content.Context
import
android.content.Context
import
android.nfc.Tag
import
com.base.scanqr.GlobalConfig
import
com.base.scanqr.GlobalConfig
import
com.base.scanqr.ads.AdEvent
import
com.base.scanqr.ads.AdEvent
import
com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.ads.AdsType
import
com.base.scanqr.ads.AdsType
import
com.base.scanqr.ads.LimitUtils
import
com.base.scanqr.ads.LimitUtils
import
com.base.scanqr.ads.adState
import
com.base.scanqr.ads.AdState
import
com.base.scanqr.utils.LogEx
import
com.google.android.gms.ads.AdError
import
com.google.android.gms.ads.AdError
import
com.google.android.gms.ads.AdRequest
import
com.google.android.gms.ads.AdRequest
import
com.google.android.gms.ads.FullScreenContentCallback
import
com.google.android.gms.ads.FullScreenContentCallback
...
@@ -20,7 +22,8 @@ import java.lang.ref.WeakReference
...
@@ -20,7 +22,8 @@ import java.lang.ref.WeakReference
*/
*/
class
AdOpenMgr
{
class
AdOpenMgr
{
private
val
adState
=
adState
<
AppOpenAd
>()
private
val
TAG
=
"AdOpenMgr"
private
val
adState
=
AdState
<
AppOpenAd
>()
private
var
showCallBack
:
AdsShowCallBack
?
=
null
private
var
showCallBack
:
AdsShowCallBack
?
=
null
...
@@ -62,6 +65,7 @@ class AdOpenMgr {
...
@@ -62,6 +65,7 @@ class AdOpenMgr {
}
}
private
fun
showReadyAd
(
adEvent
:
AdEvent
,
activity
:
Activity
)
{
private
fun
showReadyAd
(
adEvent
:
AdEvent
,
activity
:
Activity
)
{
LogEx
.
logDebug
(
TAG
,
"activity=$activity showReadyAd"
)
adState
.
currentAd
?.
run
{
adState
.
currentAd
?.
run
{
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
override
fun
onAdShowedFullScreenContent
()
{
override
fun
onAdShowedFullScreenContent
()
{
...
@@ -72,6 +76,7 @@ class AdOpenMgr {
...
@@ -72,6 +76,7 @@ class AdOpenMgr {
adState
.
onAdDisplayed
()
adState
.
onAdDisplayed
()
//计数
//计数
LimitUtils
.
addDisplayNum
()
LimitUtils
.
addDisplayNum
()
}
}
override
fun
onAdFailedToShowFullScreenContent
(
adError
:
AdError
)
{
override
fun
onAdFailedToShowFullScreenContent
(
adError
:
AdError
)
{
...
@@ -93,6 +98,7 @@ class AdOpenMgr {
...
@@ -93,6 +98,7 @@ class AdOpenMgr {
adState
.
onAdHidden
()
adState
.
onAdHidden
()
loadAd
(
activity
.
applicationContext
,
false
,
AdmobEvent
(
"openAd"
,
"preload"
))
loadAd
(
activity
.
applicationContext
,
false
,
AdmobEvent
(
"openAd"
,
"preload"
))
}
}
...
...
app/src/main/java/com/base/scanqr/ads/applovin/MaxInsertMgr.kt
View file @
71f83fde
...
@@ -12,7 +12,7 @@ import com.base.scanqr.ads.AdEvent
...
@@ -12,7 +12,7 @@ import com.base.scanqr.ads.AdEvent
import
com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.ads.AdsType
import
com.base.scanqr.ads.AdsType
import
com.base.scanqr.ads.LimitUtils
import
com.base.scanqr.ads.LimitUtils
import
com.base.scanqr.ads.
a
dState
import
com.base.scanqr.ads.
A
dState
import
java.lang.ref.WeakReference
import
java.lang.ref.WeakReference
/**
/**
...
@@ -20,7 +20,7 @@ import java.lang.ref.WeakReference
...
@@ -20,7 +20,7 @@ import java.lang.ref.WeakReference
*/
*/
class
MaxInsertMgr
{
class
MaxInsertMgr
{
private
var
adState
=
a
dState
<
MaxInterstitialAd
>()
private
var
adState
=
A
dState
<
MaxInterstitialAd
>()
private
var
showCallBack
:
AdsShowCallBack
?
=
null
private
var
showCallBack
:
AdsShowCallBack
?
=
null
fun
show
(
fun
show
(
...
...
app/src/main/java/com/base/scanqr/ads/applovin/MaxOpenMgr.kt
View file @
71f83fde
...
@@ -11,7 +11,7 @@ import com.base.scanqr.ads.AdEvent
...
@@ -11,7 +11,7 @@ import com.base.scanqr.ads.AdEvent
import
com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.ads.AdsType
import
com.base.scanqr.ads.AdsType
import
com.base.scanqr.ads.LimitUtils
import
com.base.scanqr.ads.LimitUtils
import
com.base.scanqr.ads.
a
dState
import
com.base.scanqr.ads.
A
dState
import
java.lang.ref.WeakReference
import
java.lang.ref.WeakReference
/**
/**
...
@@ -19,7 +19,7 @@ import java.lang.ref.WeakReference
...
@@ -19,7 +19,7 @@ import java.lang.ref.WeakReference
*/
*/
class
MaxOpenMgr
{
class
MaxOpenMgr
{
private
val
adState
=
a
dState
<
MaxAppOpenAd
>()
private
val
adState
=
A
dState
<
MaxAppOpenAd
>()
private
var
showCallBack
:
AdsShowCallBack
?
=
null
private
var
showCallBack
:
AdsShowCallBack
?
=
null
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?)
{
fun
show
(
activity
:
Activity
,
isUnLimit
:
Boolean
,
adEvent
:
AdEvent
,
showCallBack
:
AdsShowCallBack
?)
{
...
...
app/src/main/java/com/base/scanqr/bean/NotificationSendBean.kt
View file @
71f83fde
...
@@ -30,7 +30,7 @@ class NotificationSendBean(
...
@@ -30,7 +30,7 @@ class NotificationSendBean(
const
val
POPUP_WHERE_FILE_JOB
=
"FileJob"
const
val
POPUP_WHERE_FILE_JOB
=
"FileJob"
const
val
ACTION_ID_STAY_SCAN
=
"action_id_s
can_1
"
const
val
ACTION_ID_STAY_SCAN
=
"action_id_s
tay_scan
"
const
val
ACTION_ID_SCAN
=
"action_id_scan
_2
"
const
val
ACTION_ID_SCAN
=
"action_id_scan"
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/scanqr/fcm/notification/NotificationManager.kt
View file @
71f83fde
...
@@ -149,8 +149,8 @@ object NotificationManager {
...
@@ -149,8 +149,8 @@ object NotificationManager {
//当天推送次数
//当天推送次数
val
count
=
popupConfigBean
.
popupCount
val
count
=
popupConfigBean
.
popupCount
if
(
dayPopupCount
>
count
)
{
if
(
dayPopupCount
>
count
)
{
LogEx
.
logDebug
(
"canSendNotification"
,
"
count"
)
LogEx
.
logDebug
(
TAG
,
"dayPopupCount=$dayPopupCount count=$
count"
)
EventUtils
.
event
(
"Notification_Error"
,
"dayPopupCount=$dayPopupCount count=$count
"
)
EventUtils
.
event
(
"Notification_Error"
,
"dayPopupCount=$dayPopupCount count=$count"
)
return
false
return
false
}
}
...
@@ -160,7 +160,7 @@ object NotificationManager {
...
@@ -160,7 +160,7 @@ object NotificationManager {
val
calendar
=
Calendar
.
getInstance
()
val
calendar
=
Calendar
.
getInstance
()
val
currentHour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)
val
currentHour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)
if
(
currentHour
!
in
start
until
end
)
{
if
(
currentHour
!
in
start
until
end
)
{
LogEx
.
logDebug
(
"canSendNotification"
,
"start-end currentHour=$currentHour start=$start end=$end
"
)
LogEx
.
logDebug
(
TAG
,
"start=$start end=$end currentHour=$currentHour
"
)
EventUtils
.
event
(
"Notification_Error"
,
"start=$start end=$end currentHour=$currentHour"
)
EventUtils
.
event
(
"Notification_Error"
,
"start=$start end=$end currentHour=$currentHour"
)
return
false
return
false
}
}
...
@@ -169,8 +169,8 @@ object NotificationManager {
...
@@ -169,8 +169,8 @@ object NotificationManager {
val
interval
=
popupConfigBean
.
popupInterval
val
interval
=
popupConfigBean
.
popupInterval
val
passedTime
=
System
.
currentTimeMillis
()
-
lastPopupTime
val
passedTime
=
System
.
currentTimeMillis
()
-
lastPopupTime
if
(
passedTime
<
interval
*
60
*
1000L
)
{
if
(
passedTime
<
interval
*
60
*
1000L
)
{
LogEx
.
logDebug
(
TAG
,
"interval=$interval passedTime=$passedTime"
)
EventUtils
.
event
(
"Notification_Error"
,
"interval=$interval passedTime=$passedTime"
)
EventUtils
.
event
(
"Notification_Error"
,
"interval=$interval passedTime=$passedTime"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"interval=$interval passedTime=$passedTime"
)
return
false
return
false
}
}
return
true
return
true
...
...
app/src/main/java/com/base/scanqr/fcm/receiver/ScreenStatusReceiver.kt
View file @
71f83fde
...
@@ -20,7 +20,7 @@ class ScreenStatusReceiver : BroadcastReceiver() {
...
@@ -20,7 +20,7 @@ class ScreenStatusReceiver : BroadcastReceiver() {
private
val
TAG
=
"ScreenStatusReceiver"
private
val
TAG
=
"ScreenStatusReceiver"
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
)
{
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
)
{
LogEx
.
logDebug
(
TAG
,
"onReceive"
)
LogEx
.
logDebug
(
TAG
,
"onReceive"
)
val
action
=
intent
.
action
val
action
=
intent
.
action
when
(
Objects
.
requireNonNull
<
String
?>(
action
))
{
when
(
Objects
.
requireNonNull
<
String
?>(
action
))
{
Intent
.
ACTION_SCREEN_ON
->
isDeviceInteractive
=
true
Intent
.
ACTION_SCREEN_ON
->
isDeviceInteractive
=
true
...
@@ -33,8 +33,12 @@ class ScreenStatusReceiver : BroadcastReceiver() {
...
@@ -33,8 +33,12 @@ class ScreenStatusReceiver : BroadcastReceiver() {
isSecureLockActive
=
false
isSecureLockActive
=
false
if
(
isDeviceInteractive
&&
!
isSecureLockActive
)
{
if
(
isDeviceInteractive
&&
!
isSecureLockActive
)
{
if
(
popupConfigBean
.
screenS
)
{
if
(
popupConfigBean
.
screenS
)
{
LogEx
.
logDebug
(
TAG
,
"onReceive submitSendBean"
)
LogEx
.
logDebug
(
TAG
,
"onReceive submitSendBean"
)
val
sendBean
=
NotificationSendBean
(
context
,
POPUP_WHERE_LOCK
,
canSend
=
{
true
},
sendSuccess
=
{})
val
sendBean
=
NotificationSendBean
(
context
,
POPUP_WHERE_LOCK
,
canSend
=
{
canScreenStatusReceiverPush
()
},
sendSuccess
=
{
saveScreenPushedData
()
})
NotificationManager
.
submitSendBean
(
sendBean
)
NotificationManager
.
submitSendBean
(
sendBean
)
}
}
}
}
...
@@ -118,6 +122,7 @@ class ScreenStatusReceiver : BroadcastReceiver() {
...
@@ -118,6 +122,7 @@ class ScreenStatusReceiver : BroadcastReceiver() {
"popupScreenCount=$popupScreenCount where=$POPUP_WHERE_LOCK"
"popupScreenCount=$popupScreenCount where=$POPUP_WHERE_LOCK"
)
)
}
}
LogEx
.
logDebug
(
TAG
,
"canScreenStatusReceiverPush flag=$flag"
)
return
flag
return
flag
}
}
...
@@ -127,6 +132,7 @@ class ScreenStatusReceiver : BroadcastReceiver() {
...
@@ -127,6 +132,7 @@ class ScreenStatusReceiver : BroadcastReceiver() {
fun
saveScreenPushedData
()
{
fun
saveScreenPushedData
()
{
todayScreenPush
+=
1
todayScreenPush
+=
1
screenLastPushTime
=
System
.
currentTimeMillis
()
screenLastPushTime
=
System
.
currentTimeMillis
()
LogEx
.
logDebug
(
TAG
,
"saveScreenPushedData"
)
}
}
}
}
...
...
app/src/main/java/com/base/scanqr/ui/main/MainActivity.kt
View file @
71f83fde
...
@@ -2,6 +2,7 @@ package com.base.scanqr.ui.main
...
@@ -2,6 +2,7 @@ package com.base.scanqr.ui.main
import
android.content.Intent
import
android.content.Intent
import
android.graphics.Color
import
android.graphics.Color
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.LayoutInflater
import
android.widget.TextView
import
android.widget.TextView
import
androidx.activity.addCallback
import
androidx.activity.addCallback
...
@@ -12,6 +13,7 @@ import com.base.scanqr.ads.AdsMgr
...
@@ -12,6 +13,7 @@ import com.base.scanqr.ads.AdsMgr
import
com.base.scanqr.base.BaseActivity
import
com.base.scanqr.base.BaseActivity
import
com.base.scanqr.bean.ConstObject.mainStartTimes
import
com.base.scanqr.bean.ConstObject.mainStartTimes
import
com.base.scanqr.bean.HomeTabUIBean
import
com.base.scanqr.bean.HomeTabUIBean
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_SCAN
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_STAY_SCAN
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_STAY_SCAN
import
com.base.scanqr.databinding.ActivityMainBinding
import
com.base.scanqr.databinding.ActivityMainBinding
import
com.base.scanqr.databinding.ItemHomeTabBinding
import
com.base.scanqr.databinding.ItemHomeTabBinding
...
@@ -89,6 +91,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
...
@@ -89,6 +91,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
override
fun
onNewIntent
(
intent
:
Intent
?)
{
override
fun
onNewIntent
(
intent
:
Intent
?)
{
super
.
onNewIntent
(
intent
)
super
.
onNewIntent
(
intent
)
LogEx
.
logDebug
(
TAG
,
"onNewIntent"
)
//setIntent需要调用
setIntent
(
intent
)
handleActionIdJump
()
handleActionIdJump
()
}
}
...
@@ -96,12 +101,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
...
@@ -96,12 +101,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::infl
val
actionId
=
intent
.
extras
?.
getString
(
"actionId"
)
val
actionId
=
intent
.
extras
?.
getString
(
"actionId"
)
LogEx
.
logDebug
(
TAG
,
"actionId=$actionId"
)
LogEx
.
logDebug
(
TAG
,
"actionId=$actionId"
)
when
(
actionId
)
{
when
(
actionId
)
{
ACTION_ID_STAY_SCAN
->
{
ACTION_ID_STAY_SCAN
,
ACTION_ID_SCAN
->
{
val
defaultTab
=
binding
.
tabLayout
.
getTabAt
(
1
)
val
defaultTab
=
binding
.
tabLayout
.
getTabAt
(
1
)
defaultTab
?.
select
()
defaultTab
?.
select
()
defaultTab
?.
setSelected
()
defaultTab
?.
setSelected
()
}
}
}
}
intent
.
extras
?.
clear
()
}
}
private
fun
initTab
()
{
private
fun
initTab
()
{
...
...
app/src/main/java/com/base/scanqr/ui/start/StartActivity.kt
View file @
71f83fde
...
@@ -8,6 +8,7 @@ import com.base.scanqr.ads.AdsShowCallBack
...
@@ -8,6 +8,7 @@ import com.base.scanqr.ads.AdsShowCallBack
import
com.base.scanqr.base.BaseActivity
import
com.base.scanqr.base.BaseActivity
import
com.base.scanqr.bean.ConstObject
import
com.base.scanqr.bean.ConstObject
import
com.base.scanqr.bean.ConstObject.isFirstLauncher
import
com.base.scanqr.bean.ConstObject.isFirstLauncher
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_SCAN
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_STAY_SCAN
import
com.base.scanqr.bean.NotificationSendBean.Companion.ACTION_ID_STAY_SCAN
import
com.base.scanqr.databinding.ActivityStartBinding
import
com.base.scanqr.databinding.ActivityStartBinding
import
com.base.scanqr.service.StayJobService.Companion.startJob
import
com.base.scanqr.service.StayJobService.Companion.startJob
...
@@ -110,14 +111,21 @@ class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::i
...
@@ -110,14 +111,21 @@ class StartActivity : BaseActivity<ActivityStartBinding>(ActivityStartBinding::i
val
actionId
=
intent
.
extras
?.
getString
(
"actionId"
)
val
actionId
=
intent
.
extras
?.
getString
(
"actionId"
)
LogEx
.
logDebug
(
TAG
,
"actionId=$actionId"
)
LogEx
.
logDebug
(
TAG
,
"actionId=$actionId"
)
when
(
actionId
)
{
when
(
actionId
)
{
ACTION_ID_STAY_SCAN
->
{
ACTION_ID_STAY_SCAN
,
ACTION_ID_SCAN
->
{
LogEx
.
logDebug
(
TAG
,
"actionId MainActivity"
)
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
actionId
)
addFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
)
})
}
else
->
{
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
actionId
)
addFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
)
})
}
}
}
}
startActivity
(
Intent
(
this
,
MainActivity
::
class
.
java
).
apply
{
addFlags
(
Intent
.
FLAG_ACTIVITY_REORDER_TO_FRONT
)
putExtra
(
"actionId"
,
actionId
)
})
finish
()
finish
()
}
}
...
...
app/src/main/res/layout/stay_notification_small_scan.xml
View file @
71f83fde
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:gravity=
"center"
android:gravity=
"center"
android:orientation=
"vertical"
android:orientation=
"vertical"
android:paddingVertical=
"16dp"
tools:ignore=
"DisableBaselineAlignment"
>
tools:ignore=
"DisableBaselineAlignment"
>
...
...
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