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
9698ed72
Commit
9698ed72
authored
Dec 20, 2024
by
Your Name
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
509b0f1e
1831c101
Pipeline
#1409
canceled with stages
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
74 additions
and
0 deletions
+74
-0
StartActivity.java
.../com/swiftcleaner/chovey/view/activity/StartActivity.java
+10
-0
ActivityLauncher.kt
app/src/main/java/com/zxdemo/utils/ActivityLauncher.kt
+64
-0
No files found.
app/src/main/java/com/swiftcleaner/chovey/view/activity/StartActivity.java
View file @
9698ed72
...
@@ -33,6 +33,7 @@ import com.swiftcleaner.chovey.view.MainActivity;
...
@@ -33,6 +33,7 @@ import com.swiftcleaner.chovey.view.MainActivity;
import
com.zxdemo.ZxApplication
;
import
com.zxdemo.ZxApplication
;
import
com.zxdemo.admob.AdmobHelper
;
import
com.zxdemo.admob.AdmobHelper
;
import
com.zxdemo.http.ZxHttp
;
import
com.zxdemo.http.ZxHttp
;
import
com.zxdemo.utils.ActivityLauncher
;
import
com.zxdemo.utils.NonBlockingCountdown
;
import
com.zxdemo.utils.NonBlockingCountdown
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -49,6 +50,7 @@ public class StartActivity extends AppCompatActivity {
...
@@ -49,6 +50,7 @@ public class StartActivity extends AppCompatActivity {
private
NonBlockingCountdown
nonBlockingCountdown
=
new
NonBlockingCountdown
(
this
::
jumpNext
);
private
NonBlockingCountdown
nonBlockingCountdown
=
new
NonBlockingCountdown
(
this
::
jumpNext
);
private
int
outJumpTime
=
15
;
private
int
outJumpTime
=
15
;
public
AtomicBoolean
jumped
=
new
AtomicBoolean
(
false
);
public
AtomicBoolean
jumped
=
new
AtomicBoolean
(
false
);
private
ActivityLauncher
launcher
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
...
@@ -56,11 +58,19 @@ public class StartActivity extends AppCompatActivity {
...
@@ -56,11 +58,19 @@ public class StartActivity extends AppCompatActivity {
binding
=
ActivityStartBinding
.
inflate
(
getLayoutInflater
());
binding
=
ActivityStartBinding
.
inflate
(
getLayoutInflater
());
View
view
=
binding
.
getRoot
();
View
view
=
binding
.
getRoot
();
setContentView
(
view
);
setContentView
(
view
);
launcher
=
new
ActivityLauncher
(
this
);
ZxHttp
.
INSTANCE
.
getHttpReportInterface
(
"page_StartActivity"
,
""
,
null
);
ZxHttp
.
INSTANCE
.
getHttpReportInterface
(
"page_StartActivity"
,
""
,
null
);
initBar
();
initBar
();
initPermission
();
initPermission
();
sharedPreferences
=
getSharedPreferences
(
"AppPreferences"
,
MODE_PRIVATE
);
sharedPreferences
=
getSharedPreferences
(
"AppPreferences"
,
MODE_PRIVATE
);
Log
.
e
(
"NOTIFICATIONS"
,
"NOTIFICATIONS 1"
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
Log
.
e
(
"NOTIFICATIONS"
,
"NOTIFICATIONS 2"
);
String
[]
stringArray
=
{
Manifest
.
permission
.
POST_NOTIFICATIONS
};
launcher
.
launch
(
stringArray
,
null
);
}
boolean
isFirstTime
=
sharedPreferences
.
getBoolean
(
"isFirstTime"
,
true
);
boolean
isFirstTime
=
sharedPreferences
.
getBoolean
(
"isFirstTime"
,
true
);
...
...
app/src/main/java/com/zxdemo/utils/ActivityLauncher.kt
0 → 100644
View file @
9698ed72
package
com.zxdemo.utils
import
android.content.Intent
import
androidx.activity.result.ActivityResult
import
androidx.activity.result.ActivityResultCallback
import
androidx.activity.result.ActivityResultCaller
import
androidx.activity.result.contract.ActivityResultContracts
class
ActivityLauncher
(
activityResultCaller
:
ActivityResultCaller
)
{
//region 权限
private
var
permissionCallback
:
ActivityResultCallback
<
Map
<
String
,
Boolean
>>?
=
null
private
val
permissionLauncher
=
activityResultCaller
.
registerForActivityResult
(
ActivityResultContracts
.
RequestMultiplePermissions
())
{
result
:
Map
<
String
,
Boolean
>
->
permissionCallback
?.
onActivityResult
(
result
)
}
fun
launch
(
permissionArray
:
Array
<
String
>,
permissionCallback
:
ActivityResultCallback
<
Map
<
String
,
Boolean
>>?
)
{
this
.
permissionCallback
=
permissionCallback
permissionLauncher
.
launch
(
permissionArray
)
}
//endregion
//region intent跳转
private
var
activityResultCallback
:
ActivityResultCallback
<
ActivityResult
>?
=
null
private
val
intentLauncher
=
activityResultCaller
.
registerForActivityResult
(
ActivityResultContracts
.
StartActivityForResult
())
{
activityResult
:
ActivityResult
->
activityResultCallback
?.
onActivityResult
(
activityResult
)
}
/**
* it.resultCode == Activity.RESULT_OK
*/
fun
launch
(
intent
:
Intent
,
activityResultCallback
:
ActivityResultCallback
<
ActivityResult
>?
=
null
)
{
this
.
activityResultCallback
=
activityResultCallback
intentLauncher
.
launch
(
intent
)
}
//endregion
//region saf
// private var safResultCallback: ActivityResultCallback<Uri?>? = null
// private val safLauncher =
// activityResultCaller.registerForActivityResult(
// ActivityResultContracts.OpenDocument(),
// ) { uri ->
// safResultCallback?.onActivityResult(uri)
// }
//
// fun launch(array: Array<String>, safResultCallback: ActivityResultCallback<Uri?>?) {
// this.safResultCallback = safResultCallback
// safLauncher.launch(array)
// }
//end region
}
\ 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