Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
swiftcleanerphonehelper
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
swiftcleanerphonehelper
Commits
6101df16
Commit
6101df16
authored
Dec 20, 2024
by
Your Name
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
623e3747
b67973ea
Pipeline
#1376
canceled with stages
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
62 deletions
+86
-62
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+21
-18
StartActivity.java
.../com/swiftcleaner/chovey/view/activity/StartActivity.java
+45
-29
ZxApplication.kt
app/src/main/java/com/zxdemo/ZxApplication.kt
+2
-0
AdmobHelper.kt
app/src/main/java/com/zxdemo/admob/AdmobHelper.kt
+11
-11
NonBlockingCountdown.java
app/src/main/java/com/zxdemo/utils/NonBlockingCountdown.java
+7
-4
No files found.
app/src/main/AndroidManifest.xml
View file @
6101df16
...
@@ -32,6 +32,26 @@
...
@@ -32,6 +32,26 @@
android:supportsRtl=
"true"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.SwiftCleanerPhoneHelper"
android:theme=
"@style/Theme.SwiftCleanerPhoneHelper"
tools:targetApi=
"31"
>
tools:targetApi=
"31"
>
<!-- <receiver-->
<!-- android:name="自定义 Receiver"-->
<!-- android:enabled="true"-->
<!-- android:exported="false" >-->
<!-- <intent-filter>-->
<!-- <action android:name="cn.jpush.android.intent.RECEIVER_MESSAGE" />-->
<!-- <category android:name="com.clean_swift" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<activity
android:name=
".view.activity.StartActivity"
android:exported=
"true"
android:launchMode=
"singleTask"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<!-- 注册广播 -->
<!-- 注册广播 -->
<service
<service
...
@@ -42,15 +62,7 @@
...
@@ -42,15 +62,7 @@
</intent-filter>
</intent-filter>
</service>
</service>
<!-- <receiver-->
<!-- android:name="自定义 Receiver"-->
<!-- android:enabled="true"-->
<!-- android:exported="false" >-->
<!-- <intent-filter>-->
<!-- <action android:name="cn.jpush.android.intent.RECEIVER_MESSAGE" />-->
<!-- <category android:name="com.clean_swift" />-->
<!-- </intent-filter>-->
<!-- </receiver>-->
<activity
<activity
android:name=
".view.activity.SimilarPhotosActivity"
android:name=
".view.activity.SimilarPhotosActivity"
android:exported=
"false"
/>
android:exported=
"false"
/>
...
@@ -81,16 +93,7 @@
...
@@ -81,16 +93,7 @@
<activity
<activity
android:name=
".view.activity.CleanJunkActivity"
android:name=
".view.activity.CleanJunkActivity"
android:exported=
"false"
/>
android:exported=
"false"
/>
<activity
android:name=
".view.activity.StartActivity"
android:exported=
"true"
android:launchMode=
"singleInstance"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
<activity
android:name=
".view.MainActivity"
android:name=
".view.MainActivity"
android:exported=
"false"
/>
<!-- 今日头条autosize 屏幕适配 -->
android:exported=
"false"
/>
<!-- 今日头条autosize 屏幕适配 -->
...
...
app/src/main/java/com/swiftcleaner/chovey/view/activity/StartActivity.java
View file @
6101df16
...
@@ -17,16 +17,13 @@ import android.view.View;
...
@@ -17,16 +17,13 @@ import android.view.View;
import
com.gyf.immersionbar.ImmersionBar
;
import
com.gyf.immersionbar.ImmersionBar
;
import
com.swiftcleaner.chovey.R
;
import
com.swiftcleaner.chovey.R
;
import
com.swiftcleaner.chovey.databinding.ActivityStartBinding
;
import
com.swiftcleaner.chovey.databinding.ActivityStartBinding
;
import
com.swiftcleaner.chovey.model.tool.ToastUtil
;
import
com.swiftcleaner.chovey.model.util.PermissionUtils
;
import
com.swiftcleaner.chovey.model.util.PermissionUtils
;
import
com.swiftcleaner.chovey.view.MainActivity
;
import
com.swiftcleaner.chovey.view.MainActivity
;
import
com.zxdemo.admob.AdmobHelper
;
import
com.zxdemo.admob.AdmobHelper
;
import
com.zxdemo.utils.NonBlockingCountdown
;
import
com.zxdemo.utils.NonBlockingCountdown
;
import
com.zxdemo.utils.TimeOut
;
import
java.util.
function.Functio
n
;
import
java.util.
concurrent.atomic.AtomicBoolea
n
;
import
kotlin.jvm.functions.Function0
;
public
class
StartActivity
extends
AppCompatActivity
{
public
class
StartActivity
extends
AppCompatActivity
{
private
ActivityResultLauncher
<
String
>
requestNotificationPermissionLauncher
;
private
ActivityResultLauncher
<
String
>
requestNotificationPermissionLauncher
;
...
@@ -34,12 +31,9 @@ public class StartActivity extends AppCompatActivity {
...
@@ -34,12 +31,9 @@ public class StartActivity extends AppCompatActivity {
private
SharedPreferences
sharedPreferences
;
private
SharedPreferences
sharedPreferences
;
private
ActivityResultLauncher
<
String
[]>
multiplePermissionsLauncher
;
private
ActivityResultLauncher
<
String
[]>
multiplePermissionsLauncher
;
private
ActivityResultLauncher
<
Intent
>
notificationSettingsLauncher
;
private
ActivityResultLauncher
<
Intent
>
notificationSettingsLauncher
;
private
NonBlockingCountdown
nonBlockingCountdown
=
new
NonBlockingCountdown
(
5
,
new
TimeOut
()
{
private
boolean
adShowing
=
false
;
@Override
private
NonBlockingCountdown
nonBlockingCountdown
=
new
NonBlockingCountdown
(
this
::
jumpNext
);
public
void
timeOut
()
{
private
int
outJumpTime
=
15
;
goToMainActivity
();
}
});
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -49,12 +43,11 @@ public class StartActivity extends AppCompatActivity {
...
@@ -49,12 +43,11 @@ public class StartActivity extends AppCompatActivity {
setContentView
(
view
);
setContentView
(
view
);
initBar
();
initBar
();
initPermission
();
initPermission
();
nonBlockingCountdown
.
start
();
sharedPreferences
=
getSharedPreferences
(
"AppPreferences"
,
MODE_PRIVATE
);
sharedPreferences
=
getSharedPreferences
(
"AppPreferences"
,
MODE_PRIVATE
);
boolean
isFirstTime
=
sharedPreferences
.
getBoolean
(
"isFirstTime"
,
true
);
boolean
isFirstTime
=
sharedPreferences
.
getBoolean
(
"isFirstTime"
,
true
);
//广告
// initAdvertisement
();
showOpenAd
();
if
(!
isFirstTime
)
{
if
(!
isFirstTime
)
{
//点击过start
//点击过start
binding
.
startId
.
setVisibility
(
View
.
GONE
);
binding
.
startId
.
setVisibility
(
View
.
GONE
);
...
@@ -70,6 +63,20 @@ public class StartActivity extends AppCompatActivity {
...
@@ -70,6 +63,20 @@ public class StartActivity extends AppCompatActivity {
}
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
if
(!
adShowing
)
{
nonBlockingCountdown
.
start
(
outJumpTime
);
}
}
@Override
protected
void
onPause
()
{
super
.
onPause
();
nonBlockingCountdown
.
cancel
();
}
private
void
initPermission
()
{
private
void
initPermission
()
{
multiplePermissionsLauncher
=
registerForActivityResult
(
multiplePermissionsLauncher
=
registerForActivityResult
(
new
ActivityResultContracts
.
RequestMultiplePermissions
(),
new
ActivityResultContracts
.
RequestMultiplePermissions
(),
...
@@ -145,6 +152,7 @@ public class StartActivity extends AppCompatActivity {
...
@@ -145,6 +152,7 @@ public class StartActivity extends AppCompatActivity {
binding
.
startId
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
binding
.
startId
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
v
)
{
public
void
onClick
(
View
v
)
{
showOpenAd
();
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putBoolean
(
"isFirstTime"
,
false
);
editor
.
putBoolean
(
"isFirstTime"
,
false
);
editor
.
apply
();
editor
.
apply
();
...
@@ -161,21 +169,24 @@ public class StartActivity extends AppCompatActivity {
...
@@ -161,21 +169,24 @@ public class StartActivity extends AppCompatActivity {
// 在这里执行第三方 SDK 的初始化和其他数据读取操作
// 在这里执行第三方 SDK 的初始化和其他数据读取操作
}
}
// private void initAdvertisement() {
private
void
showOpenAd
()
{
// AdmobHelper.INSTANCE.showAppOpenAd(this,
AdmobHelper
.
INSTANCE
.
showAppOpenAd
(
this
,
// () -> {
()
->
{
// goToMainActivity();
jumpNext
();
// return null;
return
null
;
// },
},
// () -> {
()
->
{
// return null;
adShowing
=
true
;
// },
nonBlockingCountdown
.
cancel
();
// () -> {
return
null
;
// return null;
},
// }
()
->
{
//
jumpNext
();
// );
return
null
;
// }
}
);
}
private
void
setupAgreementTextView
()
{
private
void
setupAgreementTextView
()
{
binding
.
userAgreement
.
setOnClickListener
(
v
->
{
binding
.
userAgreement
.
setOnClickListener
(
v
->
{
...
@@ -190,7 +201,12 @@ public class StartActivity extends AppCompatActivity {
...
@@ -190,7 +201,12 @@ public class StartActivity extends AppCompatActivity {
});
});
}
}
private
void
goToMainActivity
()
{
public
AtomicBoolean
jumped
=
new
AtomicBoolean
(
false
);
private
void
jumpNext
()
{
if
(
jumped
.
get
())
return
;
jumped
.
set
(
true
);
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
Intent
intent
=
new
Intent
(
this
,
MainActivity
.
class
);
startActivity
(
intent
);
startActivity
(
intent
);
finish
();
finish
();
...
...
app/src/main/java/com/zxdemo/ZxApplication.kt
View file @
6101df16
...
@@ -10,6 +10,7 @@ import android.os.Build
...
@@ -10,6 +10,7 @@ import android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.os.PowerManager
import
android.os.PowerManager
import
androidx.annotation.RequiresApi
import
androidx.annotation.RequiresApi
import
com.zxdemo.admob.AdmobHelper
//import com.reyun.solar.engine.SolarEngineConfig
//import com.reyun.solar.engine.SolarEngineConfig
//import com.reyun.solar.engine.SolarEngineManager
//import com.reyun.solar.engine.SolarEngineManager
import
com.zxdemo.receiver.AppInstallReceiver
import
com.zxdemo.receiver.AppInstallReceiver
...
@@ -55,6 +56,7 @@ class ZxApplication : Application() {
...
@@ -55,6 +56,7 @@ class ZxApplication : Application() {
InstallRefeerUtils
.
init
()
InstallRefeerUtils
.
init
()
startOmgNotification
()
startOmgNotification
()
AdmobHelper
.
init
(
this
,
{},
{})
}
}
...
...
app/src/main/java/com/zxdemo/admob/AdmobHelper.kt
View file @
6101df16
...
@@ -112,17 +112,17 @@ object AdmobHelper {
...
@@ -112,17 +112,17 @@ object AdmobHelper {
if
(
useAdmob
)
{
if
(
useAdmob
)
{
MobileAds
.
initialize
(
context
)
{
MobileAds
.
initialize
(
context
)
{
}
}
if
(
isAppOpenAdAvailable
())
{
//
if (isAppOpenAdAvailable()) {
loaded
.
invoke
(
0
)
//
loaded.invoke(0)
return
//
return
}
//
}
if
(
isInterstitialAdAvailable
())
{
//
if (isInterstitialAdAvailable()) {
loaded
.
invoke
(
1
)
//
loaded.invoke(1)
loadAppOpenAd
(
context
)
//
loadAppOpenAd(context)
return
//
return
}
//
}
loadAppOpenAd
(
context
,
{
loaded
.
invoke
(
0
)
},
{
failed
.
invoke
()
})
//
loadAppOpenAd(context, { loaded.invoke(0) }, { failed.invoke() })
loadInterstitialAd
(
context
)
//
loadInterstitialAd(context)
}
else
{
}
else
{
val
initConfig
=
AppLovinSdkInitializationConfiguration
.
builder
(
val
initConfig
=
AppLovinSdkInitializationConfiguration
.
builder
(
MAX_SDK_KEY
,
context
MAX_SDK_KEY
,
context
...
...
app/src/main/java/com/zxdemo/utils/NonBlockingCountdown.java
View file @
6101df16
...
@@ -2,34 +2,37 @@ package com.zxdemo.utils;
...
@@ -2,34 +2,37 @@ package com.zxdemo.utils;
import
android.os.Handler
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.os.Looper
;
import
android.util.Log
;
public
class
NonBlockingCountdown
{
public
class
NonBlockingCountdown
{
private
static
final
long
COUNTDOWN_INTERVAL
=
1000
;
// 倒计时时间间隔,单位毫秒
private
static
final
long
COUNTDOWN_INTERVAL
=
1000
;
// 倒计时时间间隔,单位毫秒
private
final
Handler
handler
=
new
Handler
(
Looper
.
getMainLooper
());
private
final
Handler
handler
=
new
Handler
(
Looper
.
getMainLooper
());
private
Runnable
countdownRunnable
;
private
Runnable
countdownRunnable
;
public
int
seconds
=
0
;
public
NonBlockingCountdown
(
int
s
,
TimeOut
timeOut
)
{
public
NonBlockingCountdown
(
TimeOut
timeOut
)
{
this
.
countdownRunnable
=
new
Runnable
()
{
this
.
countdownRunnable
=
new
Runnable
()
{
int
seconds
=
s
;
@Override
@Override
public
void
run
()
{
public
void
run
()
{
if
(
seconds
>
0
)
{
if
(
seconds
>
0
)
{
seconds
--;
seconds
--;
// 在这里更新UI,显示剩余时间
Log
.
e
(
"NonBlockingCountdown"
,
"seconds="
+
seconds
);
handler
.
postDelayed
(
countdownRunnable
,
COUNTDOWN_INTERVAL
);
handler
.
postDelayed
(
countdownRunnable
,
COUNTDOWN_INTERVAL
);
}
else
{
}
else
{
// 倒计时结束,可以在这里做一些操作,比如通知用户
// 倒计时结束,可以在这里做一些操作,比如通知用户
handler
.
removeCallbacks
(
this
);
handler
.
removeCallbacks
(
this
);
timeOut
.
timeOut
();
timeOut
.
timeOut
();
Log
.
e
(
"NonBlockingCountdown"
,
"timeOut"
);
}
}
}
}
};
};
}
}
public
void
start
()
{
public
void
start
(
int
s
)
{
this
.
seconds
=
s
;
handler
.
postDelayed
(
countdownRunnable
,
COUNTDOWN_INTERVAL
);
handler
.
postDelayed
(
countdownRunnable
,
COUNTDOWN_INTERVAL
);
}
}
...
...
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