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
65083371
Commit
65083371
authored
Sep 04, 2020
by
Muhammad Suryono
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dashboard'
parents
635bef40
bce8ab35
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
245 additions
and
169 deletions
+245
-169
Project.xml
.idea/codeStyles/Project.xml
+24
-0
RegisterState.java
app/src/main/java/com/yono/messeripos/RegisterState.java
+57
-23
activity_forgot_password.xml
app/src/main/res/layout/activity_forgot_password.xml
+1
-1
register_form.xml
app/src/main/res/layout/register_form.xml
+163
-145
No files found.
.idea/codeStyles/Project.xml
View file @
65083371
<component
name=
"ProjectCodeStyleConfiguration"
>
<code_scheme
name=
"Project"
version=
"173"
>
<DBN-PSQL>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
/>
</DBN-PSQL>
<DBN-SQL>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
<option
name=
"FUNCTION_CASE"
value=
"lower"
/>
<option
name=
"PARAMETER_CASE"
value=
"lower"
/>
<option
name=
"DATATYPE_CASE"
value=
"lower"
/>
<option
name=
"OBJECT_CASE"
value=
"preserve"
/>
</case-options>
<formatting-settings
enabled=
"false"
>
<option
name=
"STATEMENT_SPACING"
value=
"one_line"
/>
<option
name=
"CLAUSE_CHOP_DOWN"
value=
"chop_down_if_statement_long"
/>
<option
name=
"ITERATION_ELEMENTS_WRAPPING"
value=
"chop_down_if_not_single"
/>
</formatting-settings>
</DBN-SQL>
<DBN-PSQL>
<case-options
enabled=
"true"
>
<option
name=
"KEYWORD_CASE"
value=
"lower"
/>
...
...
app/src/main/java/com/yono/messeripos/RegisterState.java
View file @
65083371
...
...
@@ -14,6 +14,7 @@ import android.text.TextWatcher;
import
android.util.Log
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.ProgressBar
;
import
android.widget.RelativeLayout
;
import
androidx.annotation.NonNull
;
...
...
@@ -44,6 +45,7 @@ import retrofit2.Response;
public
class
RegisterState
extends
BottomSheetDialogFragment
{
private
static
final
String
TAG
=
"RegisterState"
;
private
static
String
DEFAULT_REGISTER
=
"CREATE ACCOUNT"
;
BottomSheetBehavior
sheetBehavior2
;
BottomSheetDialog
sheetDialog2
;
RelativeLayout
registerLayout
;
...
...
@@ -53,10 +55,9 @@ public class RegisterState extends BottomSheetDialogFragment {
Context
context
;
MainViewModels
mainViewModels
;
SharedPreferences
sharedPreferences
;
ProgressBar
pbReg
;
Utils
utils
;
String
busername
,
bemail
,
bpassword
,
brepassword
;
public
RegisterState
(
Context
context
,
MainViewModels
mainViewModels
)
{
this
.
context
=
context
;
this
.
mainViewModels
=
mainViewModels
;
...
...
@@ -79,6 +80,7 @@ public class RegisterState extends BottomSheetDialogFragment {
repassword
=
view
.
findViewById
(
R
.
id
.
ETRePasswordReg
);
registerButton
=
view
.
findViewById
(
R
.
id
.
MBRegister
);
closeBtn
=
view
.
findViewById
(
R
.
id
.
ivclose
);
pbReg
=
view
.
findViewById
(
R
.
id
.
progressReg
);
// create session
sharedPreferences
=
context
.
getSharedPreferences
(
SplashScreen
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
...
...
@@ -87,6 +89,7 @@ public class RegisterState extends BottomSheetDialogFragment {
utils
=
new
Utils
();
sheetDialog2
.
setContentView
(
view
);
pbReg
.
setVisibility
(
View
.
GONE
);
sheetBehavior2
=
BottomSheetBehavior
.
from
((
View
)
(
view
.
getParent
()));
...
...
@@ -108,20 +111,20 @@ public class RegisterState extends BottomSheetDialogFragment {
@Override
public
void
onTextChanged
(
CharSequence
charSequence
,
int
i
,
int
i1
,
int
i2
)
{
if
(
TextUtils
.
isEmpty
(
username
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
email
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
password
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
repassword
.
getText
().
toString
())){
TextUtils
.
isEmpty
(
email
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
password
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
repassword
.
getText
().
toString
()))
{
username
.
setError
(
"This field can't empty"
);
email
.
setError
(
"This field can't empty"
);
password
.
setError
(
"This field can't empty"
);
repassword
.
setError
(
"This field can't empty"
);
}
else
if
(
TextUtils
.
isEmpty
(
username
.
getText
().
toString
()))
{
}
else
if
(
TextUtils
.
isEmpty
(
username
.
getText
().
toString
()))
{
username
.
setError
(
"This field can't empty"
);
}
else
if
(
TextUtils
.
isEmpty
(
email
.
getText
().
toString
()))
{
}
else
if
(
TextUtils
.
isEmpty
(
email
.
getText
().
toString
()))
{
email
.
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"
);
}
else
if
(
TextUtils
.
isEmpty
(
repassword
.
getText
().
toString
()))
{
}
else
if
(
TextUtils
.
isEmpty
(
repassword
.
getText
().
toString
()))
{
repassword
.
setError
(
"This field can't empty"
);
}
else
if
(!
utils
.
isValidEmail
(
charSequence
.
toString
()))
{
}
else
if
(!
utils
.
isValidEmail
(
charSequence
.
toString
()))
{
email
.
setError
(
"Please enter the correct email format"
);
}
...
...
@@ -142,7 +145,14 @@ public class RegisterState extends BottomSheetDialogFragment {
@Override
public
void
onTextChanged
(
CharSequence
charSequence
,
int
i
,
int
i1
,
int
i2
)
{
if
(!
utils
.
isValidPassword
(
charSequence
.
toString
())){
if
(
TextUtils
.
isEmpty
(
username
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
email
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
password
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
repassword
.
getText
().
toString
()))
{
username
.
setError
(
"This field can't empty"
);
email
.
setError
(
"This field can't empty"
);
password
.
setError
(
"This field can't empty"
);
repassword
.
setError
(
"This field can't empty"
);
}
else
if
(!
utils
.
isValidPassword
(
charSequence
.
toString
()))
{
password
.
setError
(
"Password Must Be 8 Character"
);
}
}
...
...
@@ -159,27 +169,25 @@ public class RegisterState extends BottomSheetDialogFragment {
public
void
onClick
(
View
view
)
{
mainViewModels
.
postRegis
(
new
UsersModels
(
username
.
getText
().
toString
(),
email
.
getText
().
toString
(),
password
.
getText
().
toString
(),
email
.
getText
().
toString
(),
password
.
getText
().
toString
(),
repassword
.
getText
().
toString
())).
observe
(
lifecycleOwner
,
new
Observer
<
DataResponse
<
UsersModels
>>()
{
@Override
public
void
onChanged
(
DataResponse
<
UsersModels
>
usersModelsDataResponse
)
{
/**
*
TAMABHAKN RESPONSE DLUH
AGAR ADA PROGRESS DIALOGNYA
*
RESPONSE
AGAR ADA PROGRESS DIALOGNYA
* KETIKA RESPONNYA SUCCESS MAKA PROGRESS DIalog diSMISS
* DAN ALERT ACTIVATE MUNCUL
* */
setAllLayoutToFalse
();
if
(
usersModelsDataResponse
!=
null
)
{
final
View
customLayout
=
getLayoutInflater
()
.
inflate
(
R
.
layout
.
alert_dialog
,
null
);
activateEmail
(
customLayout
);
setAllLayoutToTrue
();
}
}
});
/**
* Jika tombol sign up ditekan
*
*
* kembali ke halaman login utama dengan Snackbar Cek Email
*
* Pakai bahasa inggris ya untuk responnya
*
* */
registerButton
.
setEnabled
(
false
);
}
});
...
...
@@ -193,6 +201,31 @@ public class RegisterState extends BottomSheetDialogFragment {
return
sheetDialog2
;
}
private
void
setAllLayoutToTrue
()
{
pbReg
.
setVisibility
(
View
.
GONE
);
registerButton
.
setText
(
DEFAULT_REGISTER
);
sheetDialog2
.
setCancelable
(
true
);
username
.
setEnabled
(
true
);
email
.
setEnabled
(
true
);
password
.
setEnabled
(
true
);
repassword
.
setEnabled
(
true
);
registerButton
.
setEnabled
(
true
);
closeBtn
.
setEnabled
(
true
);
}
private
void
setAllLayoutToFalse
()
{
pbReg
.
setVisibility
(
View
.
VISIBLE
);
registerButton
.
setText
(
""
);
sheetDialog2
.
setCancelable
(
false
);
username
.
setEnabled
(
false
);
password
.
setEnabled
(
false
);
registerButton
.
setEnabled
(
false
);
closeBtn
.
setEnabled
(
false
);
}
private
void
activateEmail
(
View
customLayout
)
{
utils
=
new
Utils
(
customLayout
);
...
...
@@ -203,7 +236,10 @@ public class RegisterState extends BottomSheetDialogFragment {
utils
.
setListener
(
new
Utils
.
DialogListener
()
{
@Override
public
void
onClickDisimiss
(
AlertDialog
alertDialog
)
{
alertDialog
.
dismiss
();
sheetDialog2
.
dismiss
();
}
@Override
...
...
@@ -216,6 +252,4 @@ public class RegisterState extends BottomSheetDialogFragment {
}
});
}
}
app/src/main/res/layout/activity_forgot_password.xml
View file @
65083371
...
...
@@ -53,7 +53,7 @@
android:layout_width=
"@dimen/logo_w_h"
android:layout_height=
"@dimen/logo_w_h"
android:layout_gravity=
"center_horizontal"
android:src=
"@
mipmap/ic_launcher
"
/>
android:src=
"@
drawable/ic_messer_primary
"
/>
<TextView
android:layout_width=
"wrap_content"
...
...
app/src/main/res/layout/register_form.xml
View file @
65083371
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<layout
xmlns:tools=
"http://schemas.android.com/tools"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<RelativeLayout
android:id=
"@+id/RegisterLayout"
android:padding=
"20dp"
style=
"@style/Widget.Rounded.BottomSheet"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageButton
android:id=
"@+id/ivclose"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:adjustViewBounds=
"true"
android:backgroundTint=
"@android:color/transparent"
android:padding=
"10dp"
android:src=
"@drawable/ic_close"
app:layout_constraintStart_toStartOf=
"parent"
/>
<ScrollView
android:layout_below=
"@id/ivclose"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/ivMeserRegister"
android:layout_width=
"match_parent"
android:layout_height=
"213dp"
android:src=
"@drawable/register_image"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"40dp"
android:layout_centerHorizontal=
"true"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvCreate"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Create Your Account"
android:textColor=
"@color/colorPrimary"
android:textFontWeight=
"600"
android:textSize=
"16sp"
android:layout_below=
"@id/ivMeserRegister"
android:paddingLeft=
"12dp"
/>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/formUsernameReg"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/username"
android:layout_below=
"@id/tvCreate"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETUsernameReg"
android:layout_width=
"match_parent"
android:inputType=
"text"
android:imeOptions=
"actionNext"
android:layout_height=
"wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/formEmailReg"
<RelativeLayout
android:id=
"@+id/RegisterLayout"
style=
"@style/Widget.Rounded.BottomSheet"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/email"
android:layout_marginTop=
"5dp"
android:layout_below=
"@id/formUsernameReg"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETEmailReg"
android:layout_width=
"match_parent"
android:inputType=
"textEmailAddress"
android:imeOptions=
"actionNext"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"match_parent"
android:padding=
"20dp"
>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/FormPasswordReg"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/password"
android:layout_below=
"@id/formEmailReg"
android:layout_marginTop=
"5dp"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETPasswordReg"
android:layout_width=
"match_parent"
android:inputType=
"textPassword"
android:imeOptions=
"actionNext"
android:layout_height=
"wrap_content"
/>
<ImageButton
android:id=
"@+id/ivclose"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:adjustViewBounds=
"true"
android:backgroundTint=
"@android:color/transparent"
android:padding=
"10dp"
android:src=
"@drawable/ic_close"
app:layout_constraintStart_toStartOf=
"parent"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/FormRePasswordReg"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/password_Confirmation"
android:layout_below=
"@id/FormPasswordReg"
android:layout_marginTop=
"5dp"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETRePasswordReg"
<ScrollView
android:layout_width=
"match_parent"
android:inputType=
"textPassword"
android:imeOptions=
"actionDone|actionGo"
android:layout_height=
"wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:id=
"@+id/cbAgree"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"I Agree of terms of use"
android:textColor=
"@color/colorPrimary"
android:layout_below=
"@id/FormRePasswordReg"
android:layout_marginVertical=
"10dp"
app:useMaterialThemeColors=
"true"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/MBRegister"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/cbAgree"
android:text=
"Create Account"
android:layout_below=
"@id/cbAgree"
android:padding=
"20dp"
/>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
android:layout_height=
"match_parent"
android:layout_below=
"@id/ivclose"
android:scrollbars=
"none"
>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<ImageView
android:id=
"@+id/ivMeserRegister"
android:layout_width=
"match_parent"
android:layout_height=
"213dp"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"20dp"
android:layout_marginBottom=
"40dp"
android:src=
"@drawable/register_image"
/>
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/tvCreate"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/ivMeserRegister"
android:paddingLeft=
"12dp"
android:text=
"Create Your Account"
android:textColor=
"@color/colorPrimary"
android:textFontWeight=
"600"
android:textSize=
"16sp"
/>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/formUsernameReg"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/tvCreate"
android:hint=
"@string/username"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETUsernameReg"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:imeOptions=
"actionNext"
android:inputType=
"text"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/formEmailReg"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/formUsernameReg"
android:layout_marginTop=
"5dp"
android:hint=
"@string/email"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETEmailReg"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:imeOptions=
"actionNext"
android:inputType=
"textEmailAddress"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/FormPasswordReg"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/formEmailReg"
android:layout_marginTop=
"5dp"
android:hint=
"@string/password"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETPasswordReg"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:imeOptions=
"actionNext"
android:inputType=
"textPassword"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/FormRePasswordReg"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/FormPasswordReg"
android:layout_marginTop=
"5dp"
android:hint=
"@string/password_Confirmation"
>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETRePasswordReg"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:imeOptions=
"actionDone|actionGo"
android:inputType=
"textPassword"
/>
</com.google.android.material.textfield.TextInputLayout>
<CheckBox
android:id=
"@+id/cbAgree"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_below=
"@id/FormRePasswordReg"
android:layout_marginVertical=
"10dp"
android:text=
"I Agree of terms of use"
android:textColor=
"@color/colorPrimary"
app:useMaterialThemeColors=
"true"
/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/constraintBtn"
android:layout_below=
"@id/cbAgree"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/MBRegister"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:paddingTop=
"20dp"
android:text=
"Create Account"
tools:ignore=
"MissingConstraints"
/>
<ProgressBar
android:id=
"@+id/progressReg"
style=
"?android:attr/progressBarStyle"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:elevation=
"2dp"
app:layout_constraintBottom_toBottomOf=
"@id/MBRegister"
app:layout_constraintTop_toTopOf=
"@id/MBRegister"
app:layout_constraintStart_toStartOf=
"@id/MBRegister"
app:layout_constraintEnd_toEndOf=
"@id/MBRegister"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
\ 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