Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
L
LuckyFarm
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
王雪伟
LuckyFarm
Commits
ce77cb3f
Commit
ce77cb3f
authored
Nov 05, 2020
by
wangxuewei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[提交人]:王雪伟
[提交简述] :多多菜园1.0.2 [实现方案] :加入通知开关
parent
bc0f82c8
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
109 additions
and
24 deletions
+109
-24
GameActivity.kt
app/src/main/java/com/ym/game/GameActivity.kt
+30
-21
version.properties
app/version.properties
+1
-1
BaseObserver.java
library/src/main/java/com/ym/library/net/BaseObserver.java
+1
-1
SettingPreference.java
...src/main/java/com/ym/library/utils/SettingPreference.java
+18
-0
SettingActivity.kt
...n/java/com/ym/userinfo/module/activity/SettingActivity.kt
+13
-0
dc_notif_close.png
userinfo/src/main/res/drawable-xhdpi/dc_notif_close.png
+0
-0
dc_notif_open.png
userinfo/src/main/res/drawable-xhdpi/dc_notif_open.png
+0
-0
checkbox_style.xml
userinfo/src/main/res/drawable/checkbox_style.xml
+8
-0
activity_setting.xml
userinfo/src/main/res/layout/activity_setting.xml
+38
-1
No files found.
app/src/main/java/com/ym/game/GameActivity.kt
View file @
ce77cb3f
...
@@ -30,8 +30,6 @@ import com.ym.library.net.ApiClient
...
@@ -30,8 +30,6 @@ import com.ym.library.net.ApiClient
import
com.ym.library.net.BaseObserver
import
com.ym.library.net.BaseObserver
import
com.ym.library.net.RxSchedulers
import
com.ym.library.net.RxSchedulers
import
com.ym.library.net.UserInfoEntity
import
com.ym.library.net.UserInfoEntity
import
com.ym.library.router.RounterApi
import
com.ym.library.router.RounterBus
import
com.ym.library.utils.*
import
com.ym.library.utils.*
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
...
@@ -46,7 +44,7 @@ import java.lang.reflect.Method
...
@@ -46,7 +44,7 @@ import java.lang.reflect.Method
class
GameActivity
:
UnityPlayerActivity
(),
IDialogViewCloseCallback
{
class
GameActivity
:
UnityPlayerActivity
(),
IDialogViewCloseCallback
{
private
var
mOrderString
=
""
;
private
var
mOrderString
=
""
;
private
val
mContext
=
AppliContext
.
get
()
private
val
mContext
=
AppliContext
.
get
()
private
var
mRefreshLoginObservable
:
Observable
<
Boolean
>?
=
null
private
var
mRefreshLoginObservable
:
Observable
<
String
>?
=
null
@SuppressLint
(
"CheckResult"
)
@SuppressLint
(
"CheckResult"
)
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
...
@@ -55,21 +53,28 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -55,21 +53,28 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
if
(
SettingPreference
.
getIsShowGuide
())
{
if
(
SettingPreference
.
getIsShowGuide
())
{
SettingPreference
.
setIsShowGuide
(
false
)
SettingPreference
.
setIsShowGuide
(
false
)
}
}
mRefreshLoginObservable
=
RxBus
.
get
().
register
(
"refresh_login"
,
Boolean
::
class
.
java
)
mRefreshLoginObservable
=
RxBus
.
get
().
register
(
"refresh_login"
,
String
::
class
.
java
)
TurntableDialog
.
initTurntableAnim
()
TurntableDialog
.
initTurntableAnim
()
getUserInfo
()
getUserInfo
()
checkUpdateApp
()
checkUpdateApp
()
mRefreshLoginObservable
?.
observeOn
(
AndroidSchedulers
.
mainThread
())
?.
subscribe
({
mRefreshLoginObservable
?.
observeOn
(
AndroidSchedulers
.
mainThread
())
?.
subscribe
({
SettingPreference
.
setToken
(
""
)
when
(
it
)
{
try
{
"not_login"
->
{
val
intent
=
Intent
(
this
@GameActivity
,
WxLoginActivity
::
class
.
java
)
SettingPreference
.
setToken
(
""
)
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
try
{
AppliContext
.
get
().
startActivity
(
intent
)
val
intent
=
Intent
(
this
,
WxLoginActivity
::
class
.
java
)
}
catch
(
e
:
java
.
lang
.
Exception
)
{
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
)
AppliContext
.
get
().
startActivity
(
intent
)
}
catch
(
e
:
java
.
lang
.
Exception
)
{
}
}
"open_notif"
->
{
openNotif
()
}
"close_notif"
->
{
scc
?.
let
{
unbindService
(
it
)
}
}
}
}
// if (mRefreshLoginObservable!=null){
// RxBus.get().unregister("refresh_login", mRefreshLoginObservable!!)//页面销毁的时候要执行 反注册
// }
},
{
},
{
})
})
...
@@ -1068,16 +1073,20 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
...
@@ -1068,16 +1073,20 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
//打开通知栏
//打开通知栏
private
fun
openNotif
()
{
private
fun
openNotif
()
{
val
intent
=
Intent
(
this
,
NotificationService
::
class
.
java
)
if
(
SettingPreference
.
getNotice
())
{
scc
=
object
:
ServiceConnection
{
val
intent
=
Intent
(
this
,
NotificationService
::
class
.
java
)
override
fun
onServiceConnected
(
name
:
ComponentName
,
service
:
IBinder
)
{
scc
=
object
:
ServiceConnection
{
val
myBinder
:
NotificationService
.
MyBinder
=
service
as
NotificationService
.
MyBinder
override
fun
onServiceConnected
(
name
:
ComponentName
,
service
:
IBinder
)
{
myNotifService
=
myBinder
.
getService
()
val
myBinder
:
NotificationService
.
MyBinder
=
}
service
as
NotificationService
.
MyBinder
myNotifService
=
myBinder
.
getService
()
}
override
fun
onServiceDisconnected
(
name
:
ComponentName
)
{}
override
fun
onServiceDisconnected
(
name
:
ComponentName
)
{}
}
bindService
(
intent
,
scc
as
ServiceConnection
,
BIND_AUTO_CREATE
)
}
}
bindService
(
intent
,
scc
as
ServiceConnection
,
BIND_AUTO_CREATE
)
}
}
}
}
\ No newline at end of file
app/version.properties
View file @
ce77cb3f
PACKAGE_NAME
=
com.ym.ddcy
PACKAGE_NAME
=
com.ym.ddcy
VERSION_CODE
=
3
VERSION_CODE
=
3
VERSION_NAME
=
1.0.2
VERSION_NAME
=
1.0.2
\ No newline at end of file
library/src/main/java/com/ym/library/net/BaseObserver.java
View file @
ce77cb3f
...
@@ -27,7 +27,7 @@ public abstract class BaseObserver<T> implements Observer<Response<T>> {
...
@@ -27,7 +27,7 @@ public abstract class BaseObserver<T> implements Observer<Response<T>> {
onSuccess
(
null
);
onSuccess
(
null
);
}
}
}
else
if
(
TextUtils
.
equals
(
result
.
status
,
"101"
))
{
//重试设备登录和获取用户信息
}
else
if
(
TextUtils
.
equals
(
result
.
status
,
"101"
))
{
//重试设备登录和获取用户信息
RxBus
.
get
().
post
(
"refresh_login"
,
true
);
RxBus
.
get
().
post
(
"refresh_login"
,
"not_login"
);
}
else
if
(
TextUtils
.
equals
(
result
.
status
,
"160"
))
{
}
else
if
(
TextUtils
.
equals
(
result
.
status
,
"160"
))
{
onFailure
(
null
,
"160"
,
"请重试"
);
//该异常可以汇报服务端
onFailure
(
null
,
"160"
,
"请重试"
);
//该异常可以汇报服务端
}
else
{
}
else
{
...
...
library/src/main/java/com/ym/library/utils/SettingPreference.java
View file @
ce77cb3f
...
@@ -129,6 +129,7 @@ public class SettingPreference {
...
@@ -129,6 +129,7 @@ public class SettingPreference {
private
static
final
String
SHOW_PRIVACY_PROTOCOL
=
"show_privacy_protocol"
;
//是否同意隐私协议
private
static
final
String
SHOW_PRIVACY_PROTOCOL
=
"show_privacy_protocol"
;
//是否同意隐私协议
private
static
final
String
SHOW_FIVE_WITHDRAW
=
"show_five_withdraw"
;
//5首提现
private
static
final
String
SHOW_FIVE_WITHDRAW
=
"show_five_withdraw"
;
//5首提现
private
static
final
String
SHOW_NOTIFICATION
=
"show_notification"
;
//通知栏
/**
/**
* 是否第一次进入APP
* 是否第一次进入APP
*
*
...
@@ -236,6 +237,23 @@ public class SettingPreference {
...
@@ -236,6 +237,23 @@ public class SettingPreference {
return
ad
;
return
ad
;
}
}
/**
* SHOW_NOTIFICATION
* 设置通知栏
*/
public
static
void
setNotice
(
Boolean
value
)
{
SharedPreferences
settings
=
AppliContext
.
get
().
getSharedPreferences
(
USER_SETTING
,
0
);
SharedPreferences
.
Editor
editor
=
settings
.
edit
();
editor
.
putBoolean
(
SHOW_NOTIFICATION
,
value
);
editor
.
commit
();
}
public
static
Boolean
getNotice
()
{
SharedPreferences
settings
=
AppliContext
.
get
().
getSharedPreferences
(
USER_SETTING
,
0
);
Boolean
ad
=
settings
.
getBoolean
(
SHOW_NOTIFICATION
,
true
);
return
ad
;
}
/**
/**
* 是否开发设备
* 是否开发设备
...
...
userinfo/src/main/java/com/ym/userinfo/module/activity/SettingActivity.kt
View file @
ce77cb3f
...
@@ -4,6 +4,7 @@ import android.content.ClipData
...
@@ -4,6 +4,7 @@ import android.content.ClipData
import
android.content.ClipboardManager
import
android.content.ClipboardManager
import
android.content.Context
import
android.content.Context
import
android.util.Log
import
android.util.Log
import
android.widget.CompoundButton
import
com.bytedance.sdk.openadsdk.TTNativeExpressAd
import
com.bytedance.sdk.openadsdk.TTNativeExpressAd
import
com.umeng.analytics.MobclickAgent
import
com.umeng.analytics.MobclickAgent
import
com.ym.library.Constant
import
com.ym.library.Constant
...
@@ -39,6 +40,18 @@ class SettingActivity : BaseActivity() {
...
@@ -39,6 +40,18 @@ class SettingActivity : BaseActivity() {
id_iv_copy
.
setOnClickListener
{
id_iv_copy
.
setOnClickListener
{
copy
()
copy
()
}
}
id_notif_check
.
isChecked
=
SettingPreference
.
getNotice
()
//复选框
id_notif_check
.
setOnCheckedChangeListener
(
CompoundButton
.
OnCheckedChangeListener
{
compoundButton
,
b
->
SettingPreference
.
setNotice
(
b
)
if
(
b
)
{
RxBus
.
get
().
post
(
"refresh_login"
,
"open_notif"
)
}
else
{
RxBus
.
get
().
post
(
"refresh_login"
,
"close_notif"
)
}
})
rl_back
.
setOnClickListener
{
finish
()
}
rl_back
.
setOnClickListener
{
finish
()
}
// id_iv_back.setOnClickListener { finish() }
// id_iv_back.setOnClickListener { finish() }
// tv_user_toolbar_title.text = "设置"
// tv_user_toolbar_title.text = "设置"
...
...
userinfo/src/main/res/drawable-xhdpi/dc_notif_close.png
0 → 100644
View file @
ce77cb3f
1.94 KB
userinfo/src/main/res/drawable-xhdpi/dc_notif_open.png
0 → 100644
View file @
ce77cb3f
4.76 KB
userinfo/src/main/res/drawable/checkbox_style.xml
0 → 100644
View file @
ce77cb3f
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:drawable=
"@drawable/dc_notif_open"
android:state_checked=
"true"
/>
<item
android:drawable=
"@drawable/dc_notif_close"
android:state_checked=
"false"
/>
<item
android:drawable=
"@drawable/dc_notif_close"
/>
</selector>
\ No newline at end of file
userinfo/src/main/res/layout/activity_setting.xml
View file @
ce77cb3f
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"
300dp
"
android:layout_height=
"
wrap_content
"
android:layout_marginLeft=
"30dp"
android:layout_marginLeft=
"30dp"
android:layout_marginRight=
"8dp"
android:layout_marginRight=
"8dp"
android:background=
"@drawable/icon_ll_bg"
android:background=
"@drawable/icon_ll_bg"
...
@@ -148,6 +148,43 @@
...
@@ -148,6 +148,43 @@
android:layout_marginRight=
"14dp"
android:layout_marginRight=
"14dp"
android:background=
"@drawable/bg_setting_line"
/>
android:background=
"@drawable/bg_setting_line"
/>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:gravity=
"center_vertical"
android:paddingLeft=
"16dp"
android:paddingTop=
"10dp"
android:paddingRight=
"20dp"
android:paddingBottom=
"10dp"
>
<TextView
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:text=
"通知栏"
android:textColor=
"#642D2D"
android:textSize=
"15sp"
/>
<CheckBox
android:id=
"@+id/id_notif_check"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:button=
"@drawable/checkbox_style"
android:checked=
"true"
/>
</LinearLayout>
<View
android:layout_width=
"match_parent"
android:layout_height=
"3dp"
android:layout_marginLeft=
"14dp"
android:layout_marginRight=
"14dp"
android:background=
"@drawable/bg_setting_line"
/>
<TextView
<TextView
android:id=
"@+id/id_setting_update_version"
android:id=
"@+id/id_setting_update_version"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
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