Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
B
Browser White
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
Browser White
Commits
e5c7dbbb
Commit
e5c7dbbb
authored
Aug 27, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
50ec98e3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
654 additions
and
234 deletions
+654
-234
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
MyApplication.kt
app/src/main/java/com/base/browserwhite/MyApplication.kt
+23
-5
NotificationUtil.kt
...c/main/java/com/base/browserwhite/fcm/NotificationUtil.kt
+2
-2
BlackUtils.kt
app/src/main/java/com/base/browserwhite/help/BlackUtils.kt
+85
-0
ConfigHelper.kt
app/src/main/java/com/base/browserwhite/help/ConfigHelper.kt
+2
-3
StayNotificationService.kt
.../com/base/browserwhite/service/StayNotificationService.kt
+5
-5
SplashActivity.kt
.../java/com/base/browserwhite/ui/activity/SplashActivity.kt
+218
-218
PrivacyManager.kt
...om/base/browserwhite/ui/activity/splash/PrivacyManager.kt
+72
-0
Splash2Activity.kt
...m/base/browserwhite/ui/activity/splash/Splash2Activity.kt
+134
-0
StartUtils.kt
...va/com/base/browserwhite/ui/activity/splash/StartUtils.kt
+40
-0
TaskManager.kt
...a/com/base/browserwhite/ui/activity/splash/TaskManager.kt
+72
-0
No files found.
app/src/main/AndroidManifest.xml
View file @
e5c7dbbb
...
...
@@ -31,7 +31,7 @@
tools:targetApi=
"34"
>
<activity
android:name=
".ui.activity.
Splash
Activity"
android:name=
".ui.activity.
splash.Splash2
Activity"
android:exported=
"true"
android:launchMode=
"singleTask"
>
<intent-filter>
...
...
app/src/main/java/com/base/browserwhite/MyApplication.kt
View file @
e5c7dbbb
...
...
@@ -4,8 +4,12 @@ import android.app.Activity
import
android.app.Application
import
android.content.Intent
import
android.os.Bundle
import
com.base.browserwhite.fcm.FCMManager
import
com.base.browserwhite.fcm.ScreenStatusReceiver
import
com.base.browserwhite.help.BlackUtils
import
com.base.browserwhite.help.ConfigHelper
import
com.base.browserwhite.ui.activity.SplashActivity
import
com.base.browserwhite.help.InstallHelps
import
com.base.browserwhite.ui.activity.splash.Splash2Activity
import
com.base.browserwhite.utils.ActivityManagerUtils
import
com.base.browserwhite.utils.LogEx
import
com.facebook.FacebookSdk
...
...
@@ -27,9 +31,21 @@ class MyApplication : Application() {
override
fun
onCreate
()
{
super
.
onCreate
()
context
=
this
}
fun
initApp
()
{
FacebookSdk
.
sdkInitialize
(
applicationContext
)
val
topic
=
ConfigHelper
.
packageName
+
"_push"
LogEx
.
logDebug
(
TAG
,
"topic=${topic}"
)
FCMManager
.
initFirebase
(
this
)
FCMManager
.
subscribeToTopic
(
topic
)
ScreenStatusReceiver
.
setupScreenStatusListener
(
this
)
InstallHelps
.
init
()
BlackUtils
.
requestBlack
()
initLifeListener
()
init
PR
Downloader
()
init
File
Downloader
()
}
...
...
@@ -67,14 +83,14 @@ class MyApplication : Application() {
if
(
activity
.
localClassName
.
contains
(
"AppLovinFullscreenActivity"
))
{
flag
=
false
}
LogEx
.
logDebug
(
TAG
,
"flag=$flag"
+
" activity:"
+
activity
.
localClassName
)
if
(
flag
)
{
topActivity
?.
startActivity
(
Intent
(
topActivity
,
SplashActivity
::
class
.
java
Splash
2
Activity
::
class
.
java
).
apply
{
putExtra
(
"isHotLaunch"
,
true
)
putExtra
(
"type"
,
-
1
)
...
...
@@ -108,7 +124,7 @@ class MyApplication : Application() {
})
}
private
fun
init
PR
Downloader
()
{
private
fun
init
File
Downloader
()
{
// 创建 FileDownloader 的配置对象
// val config = FileDownloader.Config.Builder()
...
...
@@ -121,4 +137,6 @@ class MyApplication : Application() {
// 初始化 FileDownloader
FileDownloader
.
setupOnApplicationOnCreate
(
this
)
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/fcm/NotificationUtil.kt
View file @
e5c7dbbb
...
...
@@ -16,7 +16,7 @@ import androidx.core.graphics.drawable.IconCompat
import
com.base.browserwhite.MyApplication
import
com.base.browserwhite.R
import
com.base.browserwhite.help.EventUtils
import
com.base.browserwhite.ui.activity.
Splash
Activity
import
com.base.browserwhite.ui.activity.
splash.Splash2
Activity
import
com.base.browserwhite.utils.AppPreferences
import
java.text.SimpleDateFormat
import
java.util.Calendar
...
...
@@ -54,7 +54,7 @@ object NotificationUtil {
bigRemoteViews
.
setOnClickPendingIntent
(
0
,
cancelNotificationPendingIntent
(
context
,
actionId
))
//跳转
val
intent
=
Intent
(
context
,
SplashActivity
::
class
.
java
)
val
intent
=
Intent
(
context
,
Splash
2
Activity
::
class
.
java
)
intent
.
putExtra
(
"actionId"
,
actionId
)
val
btnRequestCode
=
Random
().
nextInt
(
1000
)
val
btnPendingIntent
=
PendingIntent
.
getActivity
(
context
,
btnRequestCode
,
intent
,
PendingIntent
.
FLAG_IMMUTABLE
)
...
...
app/src/main/java/com/base/browserwhite/help/BlackUtils.kt
0 → 100644
View file @
e5c7dbbb
package
com.base.browserwhite.help
import
android.os.Build
import
com.base.browserwhite.BuildConfig
import
com.base.browserwhite.ads.AdmobMaxHelper
import
com.base.browserwhite.utils.AppPreferences
import
com.base.browserwhite.utils.LogEx
import
okhttp3.Call
import
okhttp3.Callback
import
okhttp3.MediaType.Companion.toMediaTypeOrNull
import
okhttp3.OkHttpClient
import
okhttp3.Request
import
okhttp3.RequestBody.Companion.toRequestBody
import
okhttp3.Response
import
okhttp3.logging.HttpLoggingInterceptor
import
org.json.JSONObject
import
java.io.IOException
object
BlackUtils
{
private
val
TAG
=
"BlackUtils"
private
val
blcurl
by
lazy
{
val
pkg
=
ConfigHelper
.
packageName
val
url
=
StringBuilder
(
"${ConfigHelper.apiUrl}/${
pkg
.
filter
{
it
.
isLowerCase
()
}.
substring
(
4
,
9
)
}
cl
"
)
url
.
append
(
"?pkg=$pkg"
)
url
.
toString
()
}
fun
requestBlack
()
{
val
pkg
=
ConfigHelper
.
packageName
val
s
=
JSONObject
()
val
s2
=
JSONObject
()
.
put
(
"${pkg}_3"
,
AppPreferences
.
getInstance
().
getString
(
"Equipment"
,
""
))
.
put
(
"${pkg}_4"
,
AppPreferences
.
getInstance
().
getString
(
"Manufacturer"
,
""
))
// .put("${pkg}_5", AppPreferences.getInstance().getString("svn", ""))
.
put
(
"${pkg}_5"
,
Build
.
VERSION
.
SDK_INT
)
.
put
(
"${pkg}_8"
,
BuildConfig
.
VERSION_NAME
)
.
put
(
"${pkg}_9"
,
AppPreferences
.
getInstance
().
getString
(
"uuid"
,
""
))
.
put
(
"${pkg}_10"
,
AppPreferences
.
getInstance
().
getString
(
"gid"
,
""
))
.
put
(
"${pkg}_13"
,
"android"
)
.
put
(
"${pkg}_14"
,
BuildConfig
.
VERSION_CODE
)
.
put
(
"${pkg}_15"
,
"google"
)
.
put
(
"${pkg}_24"
,
BuildConfig
.
BUILD_TYPE
)
val
data
=
JSONObject
()
.
put
(
"data"
,
s
)
.
put
(
"bp"
,
s2
)
.
toString
()
val
body
=
AESHelper
.
encrypt
(
data
)
.
toRequestBody
(
"application/json;charset=utf-8"
.
toMediaTypeOrNull
())
val
client
=
OkHttpClient
.
Builder
().
apply
{
if
(
BuildConfig
.
DEBUG
)
{
addInterceptor
(
HttpLoggingInterceptor
().
apply
{
level
=
HttpLoggingInterceptor
.
Level
.
BODY
})
}
}.
build
()
val
request
=
Request
.
Builder
()
.
url
(
blcurl
)
.
post
(
body
)
.
build
()
client
.
newCall
(
request
).
enqueue
(
object
:
Callback
{
override
fun
onFailure
(
call
:
Call
,
e
:
IOException
)
{
}
override
fun
onResponse
(
call
:
Call
,
response
:
Response
)
{
response
.
body
?.
string
()
?.
let
{
val
i
=
Regex
(
"\"data\":\"(.*?)\""
).
find
(
it
)
if
(
i
.
toString
()
!=
"null"
)
{
i
!!
.
groupValues
[
1
].
let
{
val
str
=
AESHelper
.
decrypt
(
it
)
LogEx
.
logDebug
(
TAG
,
"black str=$str"
)
AdmobMaxHelper
.
isBlack
=
str
.
equals
(
"true"
)
}
}
}
}
})
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/help/ConfigHelper.kt
View file @
e5c7dbbb
package
com.base.browserwhite.help
import
com.base.browserwhite.ui.activity.SplashActivity
import
com.base.browserwhite.ui.activity.splash.Splash2Activity
object
ConfigHelper
{
...
...
@@ -41,7 +40,7 @@ object ConfigHelper {
"adActivity"
,
"AdActivity"
,
"AppLovinFullscreenActivity"
,
// Splash
Activity::class.java.simpleName
Splash2
Activity
::
class
.
java
.
simpleName
// 返回前台时不跳转启动页的 activity
)
...
...
app/src/main/java/com/base/browserwhite/service/StayNotificationService.kt
View file @
e5c7dbbb
...
...
@@ -18,8 +18,8 @@ import androidx.core.graphics.drawable.IconCompat
import
com.base.browserwhite.R
import
com.base.browserwhite.bean.ConstObject
import
com.base.browserwhite.ui.activity.MainActivity
import
com.base.browserwhite.ui.activity.SplashActivity
import
com.base.browserwhite.help.EventUtils
import
com.base.browserwhite.ui.activity.splash.Splash2Activity
import
kotlin.random.Random
...
...
@@ -100,7 +100,7 @@ class StayNotificationService : Service() {
val
expendView
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
stay_notification_big
)
val
requestCode1
=
Random
.
nextInt
(
1800
)
val
intent0
=
Intent
(
context
,
SplashActivity
::
class
.
java
).
apply
{
val
intent0
=
Intent
(
context
,
Splash
2
Activity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
ConstObject
.
ID_JUNK_CLEANER
)
}
val
pendingIntent1
=
...
...
@@ -109,7 +109,7 @@ class StayNotificationService : Service() {
expendView
.
setOnClickPendingIntent
(
R
.
id
.
ll_1
,
pendingIntent1
)
val
requestCode2
=
Random
.
nextInt
(
1800
)
val
intent2
=
Intent
(
context
,
SplashActivity
::
class
.
java
).
apply
{
val
intent2
=
Intent
(
context
,
Splash
2
Activity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
ConstObject
.
ID_NEWS
)
}
val
pendingIntent2
=
...
...
@@ -118,7 +118,7 @@ class StayNotificationService : Service() {
expendView
.
setOnClickPendingIntent
(
R
.
id
.
ll_2
,
pendingIntent2
)
val
requestCode3
=
Random
.
nextInt
(
1800
)
val
intent3
=
Intent
(
context
,
SplashActivity
::
class
.
java
).
apply
{
val
intent3
=
Intent
(
context
,
Splash
2
Activity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
ConstObject
.
ID_SCAN_CODE
)
}
val
pendingIntent3
=
...
...
@@ -128,7 +128,7 @@ class StayNotificationService : Service() {
val
requestCode4
=
Random
.
nextInt
(
1800
)
val
intent4
=
Intent
(
context
,
SplashActivity
::
class
.
java
).
apply
{
val
intent4
=
Intent
(
context
,
Splash
2
Activity
::
class
.
java
).
apply
{
putExtra
(
"actionId"
,
ConstObject
.
ID_APP_PROCESS
)
}
val
pendingIntent4
=
...
...
app/src/main/java/com/base/browserwhite/ui/activity/SplashActivity.kt
View file @
e5c7dbbb
This diff is collapsed.
Click to expand it.
app/src/main/java/com/base/browserwhite/ui/activity/splash/PrivacyManager.kt
0 → 100644
View file @
e5c7dbbb
package
com.base.browserwhite.ui.activity.splash
import
android.app.Activity
import
android.content.Intent
import
android.net.Uri
import
android.text.SpannableString
import
android.text.Spanned
import
android.text.style.UnderlineSpan
import
com.base.browserwhite.MyApplication
import
com.base.browserwhite.bean.ConstObject.ifAgreePrivacy
import
com.base.browserwhite.databinding.ActivitySplashBinding
import
com.base.browserwhite.help.ConfigHelper
class
PrivacyManager
{
private
val
binding
:
ActivitySplashBinding
private
val
context
:
Activity
private
val
listener
:
onUserPrivacyAggreementListener
constructor
(
binding
:
ActivitySplashBinding
,
context
:
Activity
,
listener
:
onUserPrivacyAggreementListener
)
{
this
.
binding
=
binding
this
.
context
=
context
this
.
listener
=
listener
initView
()
}
private
fun
initView
()
{
val
spannableString
=
SpannableString
(
"Privacy Policy"
)
spannableString
.
setSpan
(
UnderlineSpan
(),
0
,
spannableString
.
length
,
Spanned
.
SPAN_EXCLUSIVE_EXCLUSIVE
)
binding
.
idTvPrivacyPolicy
.
text
=
spannableString
binding
.
idTvPrivacyPolicy
.
setOnClickListener
{
val
intent
=
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
ConfigHelper
.
privacyPolicy
)
)
context
.
startActivity
(
intent
)
}
var
clicked
=
false
binding
.
idTvStart
.
setOnClickListener
{
if
(
clicked
)
{
return
@setOnClickListener
}
clicked
=
true
ifAgreePrivacy
=
true
(
context
.
application
as
MyApplication
).
initApp
()
listener
.
onAgreePrivacy
()
}
}
interface
onUserPrivacyAggreementListener
{
fun
onAgreePrivacy
()
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/activity/splash/Splash2Activity.kt
0 → 100644
View file @
e5c7dbbb
package
com.base.browserwhite.ui.activity.splash
import
CloseNotificationReceiver
import
android.Manifest
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.graphics.Color
import
android.os.Build
import
android.os.Handler
import
android.view.KeyEvent
import
androidx.activity.result.contract.ActivityResultContracts
import
com.base.browserwhite.ads.AdmobMaxHelper
import
com.base.browserwhite.bean.ConstObject.ifAgreePrivacy
import
com.base.browserwhite.databinding.ActivitySplashBinding
import
com.base.browserwhite.fcm.NotificationUtil
import
com.base.browserwhite.help.EventUtils
import
com.base.browserwhite.service.StayNotificationService.Companion.startStayNotification
import
com.base.browserwhite.ui.activity.BaseActivity
import
com.base.browserwhite.utils.BarUtils
@SuppressLint
(
"CustomSplashScreen"
)
class
Splash2Activity
:
BaseActivity
<
ActivitySplashBinding
>(),
PrivacyManager
.
onUserPrivacyAggreementListener
,
TaskManager
.
ProgressListener
{
private
val
TAG
=
"NewStartActivity"
private
fun
initStatusBar
()
{
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
if
(
Build
.
VERSION
.
SDK_INT
>=
33
)
{
registerForActivityResult
(
ActivityResultContracts
.
RequestPermission
())
{}.
launch
(
Manifest
.
permission
.
POST_NOTIFICATIONS
)
}
}
override
fun
onKeyDown
(
keyCode
:
Int
,
event
:
KeyEvent
?):
Boolean
{
if
(
keyCode
==
KeyEvent
.
KEYCODE_BACK
)
{
EventUtils
.
event
(
"back"
)
}
return
super
.
onKeyDown
(
keyCode
,
event
)
}
override
val
binding
:
ActivitySplashBinding
by
lazy
{
ActivitySplashBinding
.
inflate
(
layoutInflater
)
}
private
var
mTaskManager
:
TaskManager
?
=
null
var
jumpType
=
0
override
fun
initView
()
{
initStatusBar
()
if
(
isDestroyed
)
{
return
}
NotificationUtil
.
stopNotificationHandler
()
jumpType
=
intent
.
getIntExtra
(
"actionId"
,
0
)
closeNotification
()
mTaskManager
=
TaskManager
(
binding
,
this
)
if
(
ifAgreePrivacy
)
{
onAgreePrivacy
()
}
else
{
PrivacyManager
(
binding
,
this
,
this
)
}
}
private
fun
closeNotification
()
{
sendBroadcast
(
Intent
(
this
,
CloseNotificationReceiver
::
class
.
java
).
apply
{
this
.
action
=
CloseNotificationReceiver
.
Action
this
.
putExtra
(
CloseNotificationReceiver
.
NotificationId
,
jumpType
)
})
}
override
fun
onAgreePrivacy
()
{
EventUtils
.
event
(
"app_start"
)
if
(
jumpType
==
0
)
{
startStayNotification
()
}
AdmobMaxHelper
.
preloadAd
(
this
)
mTaskManager
?.
startProgress
()
loadAd
()
}
override
fun
onProgressMax
()
{
Handler
().
postDelayed
({
StartUtils
.
jumpNextPage
(
this
)
},
500
)
}
private
fun
loadAd
()
{
AdmobMaxHelper
.
admobMaxShowOpenAd
(
this
,
{
mTaskManager
?.
pauseProgress
()
},
{
mTaskManager
?.
pauseProgress
()
runOnUiThread
{
mTaskManager
?.
maxProgress
()
}
})
}
override
fun
onNewIntent
(
intent
:
Intent
)
{
super
.
onNewIntent
(
intent
)
setIntent
(
intent
)
}
private
var
isPause
=
false
override
fun
onStart
()
{
super
.
onStart
()
isPause
=
false
}
override
fun
onPause
()
{
super
.
onPause
()
isPause
=
true
EventUtils
.
event
(
"onPause"
)
}
override
fun
onResume
()
{
super
.
onResume
()
isPause
=
false
EventUtils
.
event
(
"onResume"
)
}
override
fun
onStop
()
{
super
.
onStop
()
isPause
=
true
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/activity/splash/StartUtils.kt
0 → 100644
View file @
e5c7dbbb
package
com.base.browserwhite.ui.activity.splash
import
android.app.Activity
import
android.content.Intent
import
android.util.Log
import
com.base.browserwhite.ui.activity.MainActivity
object
StartUtils
{
private
val
TAG
=
"SplashJumpUtils"
fun
jumpNextPage
(
context
:
Activity
)
{
var
jumpType
=
context
.
intent
.
getIntExtra
(
"actionId"
,
0
)
Log
.
e
(
TAG
,
"actionId: $jumpType"
)
if
(
jumpType
==
0
)
{
val
uri
=
context
.
intent
.
data
val
str
=
(
uri
?.
getQueryParameter
(
"type"
)
?:
"0"
)
jumpType
=
str
.
toIntOrNull
()
?:
0
if
(
jumpType
!=
0
)
{
}
}
when
(
jumpType
)
{
//=================================主动广播=======================================
//================================被动广播=========================================
else
->
{
val
isHotLaunch
=
context
.
intent
?.
extras
?.
getBoolean
(
"isHotLaunch"
,
false
)
?:
false
if
(!
isHotLaunch
)
{
context
.
startActivity
(
Intent
(
context
,
MainActivity
::
class
.
java
))
}
}
}
context
.
finish
()
}
}
\ No newline at end of file
app/src/main/java/com/base/browserwhite/ui/activity/splash/TaskManager.kt
0 → 100644
View file @
e5c7dbbb
package
com.base.browserwhite.ui.activity.splash
import
android.os.Handler
import
android.view.View
import
androidx.core.view.isVisible
import
com.base.browserwhite.databinding.ActivitySplashBinding
class
TaskManager
{
private
val
binding
:
ActivitySplashBinding
private
var
mHandler
:
Handler
private
var
mIsPaused
=
false
private
var
mProgress
=
0
private
val
listener
:
ProgressListener
constructor
(
binding
:
ActivitySplashBinding
,
listener
:
ProgressListener
)
{
this
.
binding
=
binding
this
.
listener
=
listener
mHandler
=
Handler
()
initView
()
}
var
loadTime
:
Int
=
15
private
fun
initView
()
{
//loadTime = SPUtils.getInstance().getInt("loading_page_time", 15)
binding
.
pb
.
max
=
loadTime
binding
.
pb
.
progress
=
0
}
fun
startProgress
()
{
binding
.
idTvStart
.
isVisible
=
false
binding
.
llStart
.
visibility
=
View
.
GONE
binding
.
llProgress
.
visibility
=
View
.
VISIBLE
val
mRunnable
:
Runnable
=
object
:
Runnable
{
override
fun
run
()
{
if
(!
mIsPaused
)
{
mProgress
++
// 计算进度
binding
.
pb
.
progress
=
mProgress
if
(
mProgress
<
loadTime
)
{
mHandler
.
postDelayed
(
this
,
1000
)
// 每秒钟更新一次进度
}
else
{
listener
.
onProgressMax
()
pauseProgress
()
}
}
}
}
mHandler
.
postDelayed
(
mRunnable
,
1000
)
}
fun
pauseProgress
()
{
if
(!
mIsPaused
)
{
mIsPaused
=
true
mHandler
.
removeCallbacksAndMessages
(
null
)
}
}
fun
maxProgress
()
{
binding
.
pb
.
progress
=
binding
.
pb
.
max
listener
.
onProgressMax
()
}
interface
ProgressListener
{
fun
onProgressMax
()
}
}
\ No newline at end of file
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