Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
meser
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Suryono
meser
Commits
39e1dd0a
Commit
39e1dd0a
authored
Sep 03, 2020
by
fauzi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tambahan validatsi email
parent
308655a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
31 deletions
+84
-31
LoginState.java
app/src/main/java/com/yono/messeripos/LoginState.java
+84
-31
No files found.
app/src/main/java/com/yono/messeripos/LoginState.java
View file @
39e1dd0a
...
@@ -120,8 +120,7 @@ public class LoginState extends BottomSheetDialogFragment {
...
@@ -120,8 +120,7 @@ public class LoginState extends BottomSheetDialogFragment {
username
.
setError
(
"This field can't empty"
);
username
.
setError
(
"This field can't empty"
);
}
else
if
(
TextUtils
.
isEmpty
(
password
.
getText
().
toString
())){
}
else
if
(
TextUtils
.
isEmpty
(
password
.
getText
().
toString
())){
password
.
setError
(
"This field can't empty"
);
password
.
setError
(
"This field can't empty"
);
}
else
}
else
{
{
/**
/**
* Jika tombol sign in ditekan
* Jika tombol sign in ditekan
*
*
...
@@ -144,6 +143,35 @@ public class LoginState extends BottomSheetDialogFragment {
...
@@ -144,6 +143,35 @@ public class LoginState extends BottomSheetDialogFragment {
/**
/**
* Jika response atau data ada dan cocok
* Jika response atau data ada dan cocok
*/
*/
switch
(
usersModelsDataResponse
.
getMessageData
().
toLowerCase
())
{
case
"invalid username or password"
:
bar
.
setVisibility
(
View
.
GONE
);
loginButton
.
setText
(
DEFAULT_LOGIN_NAME
);
sheetDialog
.
setCancelable
(
true
);
username
.
setEnabled
(
true
);
password
.
setEnabled
(
true
);
loginButton
.
setEnabled
(
true
);
closeBtn
.
setEnabled
(
true
);
errUserPass
();
break
;
case
"please activate your email first"
:
bar
.
setVisibility
(
View
.
GONE
);
loginButton
.
setText
(
DEFAULT_LOGIN_NAME
);
sheetDialog
.
setCancelable
(
true
);
username
.
setEnabled
(
true
);
password
.
setEnabled
(
true
);
loginButton
.
setEnabled
(
true
);
closeBtn
.
setEnabled
(
true
);
activateEmail
();
}
if
(
usersModelsDataResponse
.
getStatusData
())
{
if
(
usersModelsDataResponse
.
getStatusData
())
{
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
SharedPreferences
.
Editor
editor
=
sharedPreferences
.
edit
();
editor
.
putBoolean
(
SplashScreen
.
SESSION
,
true
);
editor
.
putBoolean
(
SplashScreen
.
SESSION
,
true
);
...
@@ -160,42 +188,40 @@ public class LoginState extends BottomSheetDialogFragment {
...
@@ -160,42 +188,40 @@ public class LoginState extends BottomSheetDialogFragment {
// munculkan tulisan default di button sign in
// munculkan tulisan default di button sign in
loginButton
.
setText
(
DEFAULT_LOGIN_NAME
);
loginButton
.
setText
(
DEFAULT_LOGIN_NAME
);
// ubah sheet dialog jadi tidak bisa di slide atau cancel
sheetDialog
.
setCancelable
(
true
);
// set form jadi enable
// set form jadi enable
username
.
setEnabled
(
true
);
username
.
setEnabled
(
true
);
password
.
setEnabled
(
true
);
password
.
setEnabled
(
true
);
loginButton
.
setEnabled
(
true
);
loginButton
.
setEnabled
(
true
);
closeBtn
.
setEnabled
(
true
);
closeBtn
.
setEnabled
(
true
);
}
else
{
/**
* Jika response atau data tidak cocok
*/
bar
.
setVisibility
(
View
.
GONE
);
loginButton
.
setText
(
DEFAULT_LOGIN_NAME
);
sheetDialog
.
setCancelable
(
true
);
final
View
customLayout
=
getLayoutInflater
()
.
inflate
(
R
.
layout
.
alert_dialog
,
null
);
// tampilkan alert dialog
utils
=
new
Utils
(
customLayout
);
utils
.
dialog
(
context
,
false
,
customLayout
,
"Wrong Username or Password"
,
"The username or password is incorrect. Please try again!"
,
"Try Again"
)
.
show
();
utils
.
setListener
(
Dialog:
:
dismiss
);
username
.
setEnabled
(
true
);
password
.
setEnabled
(
true
);
loginButton
.
setEnabled
(
true
);
closeBtn
.
setEnabled
(
true
);
}
}
// else {
// /**
// * Jika response atau data tidak cocok
// */
//
// bar.setVisibility(View.GONE);
// loginButton.setText(DEFAULT_LOGIN_NAME);
//
// sheetDialog.setCancelable(true);
//
// final View customLayout = getLayoutInflater()
// .inflate(R.layout.alert_dialog, null);
//
// // tampilkan alert dialog
// utils = new Utils(customLayout);
// utils.dialog(context, false, customLayout, "Wrong Username or Password",
// "The username or password is incorrect. Please try again!",
// "Try Again")
// .show();
// utils.setListener(Dialog::dismiss);
//
// username.setEnabled(true);
// password.setEnabled(true);
// loginButton.setEnabled(true);
// closeBtn.setEnabled(true);
//
// }
}
else
{
}
else
{
bar
.
setVisibility
(
View
.
VISIBLE
);
bar
.
setVisibility
(
View
.
VISIBLE
);
utils
.
snackBar
(
v
,
"Oppss! ログイン中にエラーが発生しました。しばらくしてからもう一度お試しください"
).
show
();
utils
.
snackBar
(
v
,
"Oppss! ログイン中にエラーが発生しました。しばらくしてからもう一度お試しください"
).
show
();
...
@@ -205,4 +231,31 @@ public class LoginState extends BottomSheetDialogFragment {
...
@@ -205,4 +231,31 @@ public class LoginState extends BottomSheetDialogFragment {
}
}
loginButton
.
setText
(
DEFAULT_LOGIN_NAME
);
loginButton
.
setText
(
DEFAULT_LOGIN_NAME
);
}
}
private
void
activateEmail
()
{
final
View
customLayout
=
getLayoutInflater
()
.
inflate
(
R
.
layout
.
alert_dialog
,
null
);
// tampilkan alert dialog
utils
=
new
Utils
(
customLayout
);
utils
.
dialog
(
context
,
false
,
customLayout
,
"Please Verifiy Email"
,
"Please verify your email before login"
,
"verify"
)
.
show
();
utils
.
setListener
(
Dialog:
:
dismiss
);
}
private
void
errUserPass
()
{
final
View
customLayout
=
getLayoutInflater
()
.
inflate
(
R
.
layout
.
alert_dialog
,
null
);
// tampilkan alert dialog
utils
=
new
Utils
(
customLayout
);
utils
.
dialog
(
context
,
false
,
customLayout
,
"Wrong Username or Password"
,
"The username or password is incorrect. Please try again!"
,
"Try Again"
)
.
show
();
utils
.
setListener
(
Dialog:
:
dismiss
);
}
}
}
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