Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
A
AnchorCollect
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
hywang
AnchorCollect
Commits
377866d4
Commit
377866d4
authored
May 11, 2023
by
hywang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.增加登录日期判断,2020年以前的禁止登录
parent
98c33772
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
12 deletions
+44
-12
build.gradle
app/build.gradle
+2
-2
RetrofitClient.java
.../main/java/com/phlx/anchorcollect/net/RetrofitClient.java
+4
-4
LoginActivity.java
...n/java/com/phlx/anchorcollect/ui/login/LoginActivity.java
+16
-0
LoginVM.java
...rc/main/java/com/phlx/anchorcollect/ui/login/LoginVM.java
+8
-0
DateUtils.java
app/src/main/java/com/phlx/anchorcollect/util/DateUtils.java
+14
-6
No files found.
app/build.gradle
View file @
377866d4
...
...
@@ -9,8 +9,8 @@ android {
applicationId
"com.phlx.anchorcollect"
minSdkVersion
21
targetSdkVersion
29
versionCode
6
versionName
"
1.0.5
"
versionCode
7
versionName
"
2.0.1
"
testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner"
...
...
app/src/main/java/com/phlx/anchorcollect/net/RetrofitClient.java
View file @
377866d4
...
...
@@ -50,15 +50,15 @@ public class RetrofitClient {
private
static
final
int
CACHE_TIMEOUT
=
10
*
1024
*
1024
;
//服务端根路径
public
static
String
baseUrl
=
//
"serve.xlglmnmyzspt.org.cn"//正式
"serve.xlglmnmyzspt.org.cn"
//正式
// "39.101.170.186"//阿里云测试
"192.168.8.135"
//董
//
"192.168.8.135"//董
// "192.168.43.154"//张敏
;
public
static
String
port
=
//
""//正式
""
//正式
// "9000"//阿里云测试
"9000"
//董
//
"9000"//董
;
private
static
Context
mContext
=
Utils
.
getContext
();
...
...
app/src/main/java/com/phlx/anchorcollect/ui/login/LoginActivity.java
View file @
377866d4
...
...
@@ -99,6 +99,22 @@ public class LoginActivity extends BaseActivity<ActivityLoginBinding, LoginVM> {
}
}
});
viewModel
.
dateEvent
.
observe
(
this
,
new
Observer
<
Integer
>()
{
@Override
public
void
onChanged
(
Integer
integer
)
{
new
MaterialDialog
.
Builder
(
LoginActivity
.
this
).
canceledOnTouchOutside
(
false
).
title
(
"系统提示"
).
content
(
"日期错误,请联网自动获取日期"
).
positiveText
(
"退出"
).
onAny
(
new
MaterialDialog
.
SingleButtonCallback
()
{
@Override
public
void
onClick
(
@NonNull
MaterialDialog
dialog
,
@NonNull
DialogAction
which
)
{
if
(
which
==
DialogAction
.
POSITIVE
)
{
ModuleManager
.
destroyLibSO
();
finish
();
android
.
os
.
Process
.
killProcess
(
android
.
os
.
Process
.
myPid
());
}
}
}).
show
();
}
});
}
@Override
...
...
app/src/main/java/com/phlx/anchorcollect/ui/login/LoginVM.java
View file @
377866d4
...
...
@@ -25,6 +25,7 @@ import com.phlx.anchorcollect.params.BaseResponse;
import
com.phlx.anchorcollect.params.CollectResponse
;
import
com.phlx.anchorcollect.ui.main.MainActivity
;
import
com.phlx.anchorcollect.ui.splash.SplashActivity
;
import
com.phlx.anchorcollect.util.DateUtils
;
import
com.phlx.anchorcollect.util.StringUtil
;
import
com.phlx.anchorcollect.util.TextUtil
;
...
...
@@ -63,6 +64,9 @@ public class LoginVM extends BaseViewModel<Repository> {
//更新app
public
SingleLiveEvent
<
Integer
>
appUpdateEvent
=
new
SingleLiveEvent
<>();
//手机时间问题,退出软件
public
SingleLiveEvent
<
Integer
>
dateEvent
=
new
SingleLiveEvent
<>();
public
int
loginType
;
//登录后是否跳转, 0跳转main 1不跳转
...
...
@@ -109,6 +113,10 @@ public class LoginVM extends BaseViewModel<Repository> {
public
BindingCommand
loginOnClickCommand
=
new
BindingCommand
(
new
BindingAction
()
{
@Override
public
void
call
()
{
if
(
Integer
.
parseInt
(
DateUtils
.
getYear
())<
2020
){
dateEvent
.
call
();
return
;
}
if
(
Configs
.
isOnLine
)
{
login
();
}
else
{
...
...
app/src/main/java/com/phlx/anchorcollect/util/DateUtils.java
View file @
377866d4
package
com
.
phlx
.
anchorcollect
.
util
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Date
;
public
class
DateUtils
{
public
static
String
getYear
()
{
public
static
String
getYear
()
{
String
year
=
""
;
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy"
);
year
=
simpleDateFormat
.
format
(
new
Date
());
return
year
;
}
}
public
static
long
getYearLong
()
{
Calendar
c1
=
Calendar
.
getInstance
();
c1
.
set
(
Integer
.
parseInt
(
getYear
()),
0
,
1
,
0
,
0
,
0
);
return
c1
.
getTimeInMillis
();
}
}
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