Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
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
Easy Cleaner Junk
Commits
747216ec
Commit
747216ec
authored
Jul 01, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
48342092
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
102 additions
and
16 deletions
+102
-16
SettingActivity.kt
...com/test/easy/easycleanerjunk/activity/SettingActivity.kt
+35
-13
ConfigHelper.kt
.../java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
+1
-1
activity_setting.xml
app/src/main/res/layout/activity_setting.xml
+66
-2
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/activity/SettingActivity.kt
View file @
747216ec
...
...
@@ -4,10 +4,13 @@ import android.content.Intent
import
android.net.Uri
import
android.os.Build
import
com.test.easy.easycleanerjunk.databinding.ActivitySettingBinding
import
com.test.easy.easycleanerjunk.fcm.FCMUtil.subscribeToTopic
import
com.test.easy.easycleanerjunk.fcm.FCMUtil.unsubscribeFromTopic
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.ConfigHelper.
all
Notification
import
com.test.easy.easycleanerjunk.helps.ConfigHelper.
fcm
Notification
import
com.test.easy.easycleanerjunk.helps.ConfigHelper.remainNotification
import
com.test.easy.easycleanerjunk.service.PermanentNotificationService
import
com.test.easy.easycleanerjunk.view.RateStarPop
...
...
@@ -22,19 +25,29 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>() {
override
fun
initListener
()
{
binding
.
ivBack
.
setOnClickListener
{
// AdmobUtils.showInterstitialAd(this) {
finishToMain
()
// }
}
// binding.switchRemainNotification.setOnCheckedChangeListener { buttonView, isChecked ->
// remainNotification = isChecked
// if (isChecked) {
// startNotification()
// } else {
// val serviceIntent = Intent(this, NotificationService::class.java)
// stopService(serviceIntent)
// }
// }
binding
.
switchRemainNotification
.
isChecked
=
remainNotification
binding
.
switchFcmNotification
.
isChecked
=
fcmNotification
binding
.
switchRemainNotification
.
setOnCheckedChangeListener
{
buttonView
,
isChecked
->
remainNotification
=
isChecked
if
(
isChecked
)
{
startNotification
()
}
else
{
val
serviceIntent
=
Intent
(
this
,
PermanentNotificationService
::
class
.
java
)
stopService
(
serviceIntent
)
}
}
binding
.
switchFcmNotification
.
setOnCheckedChangeListener
{
buttonView
,
isChecked
->
fcmNotification
=
isChecked
if
(
isChecked
)
{
subscribeToTopic
(
ConfigHelper
.
packageName
)
}
else
{
unsubscribeFromTopic
(
ConfigHelper
.
packageName
)
}
}
binding
.
cardPrivacy
.
setOnClickListener
{
val
intent
=
Intent
(
...
...
@@ -44,7 +57,16 @@ class SettingActivity : BaseActivity<ActivitySettingBinding>() {
startActivity
(
intent
)
}
binding
.
idLlScore
.
setOnClickListener
{
RateStarPop
.
show
(
this
,
true
)
RateStarPop
.
show
(
this
,
true
)
}
}
private
fun
startNotification
()
{
val
intent
=
Intent
(
this
,
PermanentNotificationService
::
class
.
java
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
startForegroundService
(
intent
)
}
else
{
startService
(
intent
)
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
View file @
747216ec
...
...
@@ -72,7 +72,7 @@ object ConfigHelper {
field
=
value
SPUtils
.
getInstance
().
put
(
"remainNotification"
,
value
,
true
)
}
var
all
Notification
=
true
var
fcm
Notification
=
true
get
()
{
return
SPUtils
.
getInstance
().
getBoolean
(
"fcmNotification"
,
field
)
}
...
...
app/src/main/res/layout/activity_setting.xml
View file @
747216ec
...
...
@@ -34,6 +34,68 @@
tools:ignore=
"HardcodedText"
/>
</FrameLayout>
<androidx.cardview.widget.CardView
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_marginHorizontal=
"16dp"
android:layout_marginTop=
"20dp"
app:cardBackgroundColor=
"@color/white"
app:cardCornerRadius=
"15dp"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"12dp"
android:text=
"Notification toolbar"
android:textColor=
"@color/black"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<androidx.appcompat.widget.SwitchCompat
android:id=
"@+id/switch_remain_notification"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"15dp"
android:layout_marginBottom=
"5dp"
android:thumb=
"@drawable/bg_switch_thumb_ffffff"
app:thumbTint=
"@color/white"
app:track=
"@drawable/bg_switch_track"
app:trackTint=
"@color/color_switch_track_selector"
/>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:layout_width=
"match_parent"
android:layout_height=
"60dp"
android:layout_marginHorizontal=
"16dp"
android:layout_marginTop=
"20dp"
app:cardBackgroundColor=
"@color/white"
app:cardCornerRadius=
"15dp"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginStart=
"12dp"
android:text=
"All Notification message"
android:textColor=
"@color/black"
android:textSize=
"16sp"
tools:ignore=
"HardcodedText"
/>
<androidx.appcompat.widget.SwitchCompat
android:id=
"@+id/switch_fcm_notification"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical|end"
android:layout_marginEnd=
"15dp"
android:layout_marginBottom=
"5dp"
android:thumb=
"@drawable/bg_switch_thumb_ffffff"
app:thumbTint=
"@color/white"
app:track=
"@drawable/bg_switch_track"
app:trackTint=
"@color/color_switch_track_selector"
/>
</androidx.cardview.widget.CardView>
<androidx.appcompat.widget.LinearLayoutCompat
android:id=
"@+id/id_ll_score"
android:layout_width=
"match_parent"
...
...
@@ -55,7 +117,8 @@
android:text=
"Score"
android:textColor=
"#000000"
android:textSize=
"15sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width=
"wrap_content"
...
...
@@ -85,7 +148,8 @@
android:text=
"Privacy Policy"
android:textColor=
"#000000"
android:textSize=
"15sp"
android:textStyle=
"bold"
/>
android:textStyle=
"bold"
tools:ignore=
"HardcodedText"
/>
<androidx.appcompat.widget.AppCompatImageView
android:layout_width=
"wrap_content"
...
...
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