Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
A
appzxhy
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
appzxhy
Commits
c6fbde61
Commit
c6fbde61
authored
Jan 08, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
....
parent
ba913e9f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
138 additions
and
1 deletion
+138
-1
StartActivity.kt
app/src/main/java/com/base/appzxhy/ui/start/StartActivity.kt
+26
-0
LogDialog.kt
app/src/main/java/com/base/appzxhy/ui/views/LogDialog.kt
+31
-0
ClickTimesUtils.kt
app/src/main/java/com/base/appzxhy/utils/ClickTimesUtils.kt
+51
-0
activity_start.xml
app/src/main/res/layout/activity_start.xml
+11
-0
dialog_log_content.xml
app/src/main/res/layout/dialog_log_content.xml
+18
-0
themes.xml
app/src/main/res/values/themes.xml
+1
-1
No files found.
app/src/main/java/com/base/appzxhy/ui/start/StartActivity.kt
View file @
c6fbde61
package
com.base.appzxhy.ui.start
import
android.annotation.SuppressLint
import
com.base.appzxhy.base.BaseActivity
import
com.base.appzxhy.bean.config.ConfigBean
import
com.base.appzxhy.databinding.ActivityStartBinding
import
com.base.appzxhy.ui.views.LogDialog.showLogDialog
import
com.base.appzxhy.utils.ClickTimesUtils.isContinuousTimesClick
import
com.google.gson.Gson
class
StartActivity
:
BaseActivity
<
ActivityStartBinding
>(
ActivityStartBinding
::
inflate
)
{
override
fun
initView
()
{
super
.
initView
()
}
@SuppressLint
(
"SetTextI18n"
)
override
fun
initListener
()
{
super
.
initListener
()
binding
.
tv
.
setOnClickListener
{
if
(
isContinuousTimesClick
())
{
val
sb
=
StringBuilder
()
val
gson
=
Gson
()
sb
.
append
(
"ut:${ConfigBean.configBean.ut}"
).
append
(
"\n"
)
val
adLog
=
gson
.
toJson
(
ConfigBean
.
configBean
.
adConfigBean
).
replace
(
","
,
",\n"
)
sb
.
append
(
adLog
).
append
(
"\n"
)
val
popupLog
=
gson
.
toJson
(
ConfigBean
.
configBean
.
popupConfigBean
).
replace
(
","
,
",\n"
)
sb
.
append
(
popupLog
)
showLogDialog
(
sb
.
toString
())
}
}
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/ui/views/LogDialog.kt
0 → 100644
View file @
c6fbde61
package
com.base.appzxhy.ui.views
import
android.app.AlertDialog
import
android.content.Context
import
android.text.method.ScrollingMovementMethod
import
android.view.LayoutInflater
import
com.base.appzxhy.databinding.DialogLogContentBinding
object
LogDialog
{
fun
Context
.
showLogDialog
(
log
:
String
)
{
val
dialog
=
AlertDialog
.
Builder
(
this
).
create
()
val
binding
=
DialogLogContentBinding
.
inflate
(
LayoutInflater
.
from
(
this
))
dialog
.
setView
(
binding
.
root
)
dialog
.
setCanceledOnTouchOutside
(
true
)
dialog
.
show
()
val
params
=
dialog
.
window
?.
attributes
// params?.width = resources.getDimensionPixelOffset(R.dimen.dp_320)
// params?.height = LinearLayout.LayoutParams.WRAP_CONTENT
// params?.gravity = Gravity.BOTTOM
// params?.y = 50
dialog
.
window
?.
attributes
=
params
dialog
.
window
?.
setBackgroundDrawableResource
(
android
.
R
.
color
.
transparent
)
binding
.
tvLog
.
movementMethod
=
ScrollingMovementMethod
()
binding
.
tvLog
.
text
=
log
}
}
\ No newline at end of file
app/src/main/java/com/base/appzxhy/utils/ClickTimesUtils.kt
0 → 100644
View file @
c6fbde61
package
com.base.appzxhy.utils
import
kotlinx.coroutines.Dispatchers
import
kotlinx.coroutines.Job
import
kotlinx.coroutines.MainScope
import
kotlinx.coroutines.delay
import
kotlinx.coroutines.launch
object
ClickTimesUtils
{
private
val
TAG
=
"ClickTimesUtils"
private
var
lastClickTime
=
0L
private
var
continuousTimes
=
0
private
var
resetJob
:
Job
?
=
null
private
fun
startResetJob
()
{
if
(
resetJob
==
null
)
{
resetJob
=
MainScope
().
launch
(
Dispatchers
.
IO
)
{
delay
(
3000
)
lastClickTime
=
0L
continuousTimes
=
0
resetJob
=
null
LogEx
.
logDebug
(
TAG
,
"reset job"
)
}
}
}
fun
isContinuousTimesClick
(
times
:
Int
=
8
):
Boolean
{
startResetJob
()
val
lastClickInterval
=
System
.
currentTimeMillis
()
-
lastClickTime
val
thisContinue
=
lastClickInterval
<
500L
||
lastClickTime
==
0L
LogEx
.
logDebug
(
TAG
,
"lastClickInterval=$lastClickInterval lastClickTime=$lastClickTime continuousTimes=$continuousTimes"
)
if
(
thisContinue
)
{
continuousTimes
++
lastClickTime
=
System
.
currentTimeMillis
()
if
(
continuousTimes
>=
times
)
{
lastClickTime
=
0
continuousTimes
=
0
resetJob
?.
cancel
()
resetJob
=
null
LogEx
.
logDebug
(
TAG
,
"reset times click"
)
return
true
}
}
return
false
}
}
\ No newline at end of file
app/src/main/res/layout/activity_start.xml
View file @
c6fbde61
...
...
@@ -7,4 +7,15 @@
android:layout_height=
"match_parent"
tools:context=
".ui.start.StartActivity"
>
<TextView
android:id=
"@+id/tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Click"
android:textSize=
"30dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/layout/dialog_log_content.xml
0 → 100644
View file @
c6fbde61
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/white"
>
<TextView
android:id=
"@+id/tvLog"
android:layout_width=
"match_parent"
android:layout_height=
"360dp"
android:layout_margin=
"30dp"
android:gravity=
"center_horizontal"
android:scrollbars=
"vertical"
android:textSize=
"16sp"
tools:text=
"Test log"
/>
</FrameLayout>
\ No newline at end of file
app/src/main/res/values/themes.xml
View file @
c6fbde61
...
...
@@ -8,7 +8,7 @@
<style
name=
"Theme.LocalWeatherWhite"
parent=
"Base.Theme.LocalWeatherWhite"
/>
<style
name=
"splash.theme"
parent=
"Theme.AppCompat.DayNight.NoActionBar"
>
<item
name=
"android:windowBackground"
>
@drawable/splash_bp
</item
>
<!-- <item name="android:windowBackground">@drawable/splash_bp</item>--
>
<item
name=
"android:windowFullscreen"
>
false
</item>
</style>
</resources>
\ 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