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
64f8dc9a
Commit
64f8dc9a
authored
Sep 04, 2020
by
fauzi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix utils
parent
3bbcccda
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
22 deletions
+42
-22
CartActivity.java
app/src/main/java/com/yono/messeripos/CartActivity.java
+0
-1
ForgotPasswordActivity.java
...main/java/com/yono/messeripos/ForgotPasswordActivity.java
+8
-0
LoginState.java
app/src/main/java/com/yono/messeripos/LoginState.java
+8
-10
RegisterState.java
app/src/main/java/com/yono/messeripos/RegisterState.java
+3
-3
Utils.java
app/src/main/java/com/yono/messeripos/utils/Utils.java
+22
-8
alert_dialog.xml
app/src/main/res/layout/alert_dialog.xml
+1
-0
No files found.
app/src/main/java/com/yono/messeripos/CartActivity.java
View file @
64f8dc9a
...
@@ -173,7 +173,6 @@ public class CartActivity extends AppCompatActivity {
...
@@ -173,7 +173,6 @@ public class CartActivity extends AppCompatActivity {
}
else
{
}
else
{
utils
.
dialog
(
CartActivity
.
this
,
utils
.
dialog
(
CartActivity
.
this
,
true
,
true
,
getLayoutInflater
().
inflate
(
R
.
layout
.
alert_dialog
,
null
),
"Warning"
,
"Warning"
,
"Item stock does not meet"
).
show
();
"Item stock does not meet"
).
show
();
}
}
...
...
app/src/main/java/com/yono/messeripos/ForgotPasswordActivity.java
View file @
64f8dc9a
...
@@ -3,8 +3,11 @@ package com.yono.messeripos;
...
@@ -3,8 +3,11 @@ package com.yono.messeripos;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.fragment.app.FragmentManager
;
import
androidx.fragment.app.FragmentManager
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.ImageButton
;
import
android.widget.ImageButton
;
public
class
ForgotPasswordActivity
extends
AppCompatActivity
{
public
class
ForgotPasswordActivity
extends
AppCompatActivity
{
...
@@ -16,6 +19,11 @@ public class ForgotPasswordActivity extends AppCompatActivity {
...
@@ -16,6 +19,11 @@ public class ForgotPasswordActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_forgot_password
);
setContentView
(
R
.
layout
.
activity_forgot_password
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
KITKAT
)
{
Window
w
=
getWindow
();
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
}
btnReset
=
findViewById
(
R
.
id
.
btn_reset_password
);
btnReset
=
findViewById
(
R
.
id
.
btn_reset_password
);
btnReset
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btnReset
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
...
...
app/src/main/java/com/yono/messeripos/LoginState.java
View file @
64f8dc9a
...
@@ -144,19 +144,17 @@ public class LoginState extends BottomSheetDialogFragment {
...
@@ -144,19 +144,17 @@ public class LoginState extends BottomSheetDialogFragment {
.
observe
((
LifecycleOwner
)
context
,
usersModelsDataResponse
->
{
.
observe
((
LifecycleOwner
)
context
,
usersModelsDataResponse
->
{
if
(
usersModelsDataResponse
!=
null
)
{
if
(
usersModelsDataResponse
!=
null
)
{
final
View
customLayout
=
getLayoutInflater
()
.
inflate
(
R
.
layout
.
alert_dialog
,
null
);
switch
(
usersModelsDataResponse
.
getMessageData
().
toLowerCase
())
{
switch
(
usersModelsDataResponse
.
getMessageData
().
toLowerCase
())
{
case
"invalid username or password"
:
case
"invalid username or password"
:
setAllLayoutToTrue
();
setAllLayoutToTrue
();
errUserPass
(
customLayout
);
errUserPass
();
break
;
break
;
case
"please activate your email first"
:
case
"please activate your email first"
:
setAllLayoutToTrue
();
setAllLayoutToTrue
();
activateEmail
(
customLayout
);
activateEmail
();
default
:
default
:
break
;
break
;
...
@@ -206,10 +204,10 @@ public class LoginState extends BottomSheetDialogFragment {
...
@@ -206,10 +204,10 @@ public class LoginState extends BottomSheetDialogFragment {
closeBtn
.
setEnabled
(
false
);
closeBtn
.
setEnabled
(
false
);
}
}
private
void
activateEmail
(
View
customLayout
)
{
private
void
activateEmail
()
{
utils
=
new
Utils
(
customLayout
);
utils
=
new
Utils
();
utils
.
dialog
(
context
,
false
,
customLayout
,
"Please Verify Email"
,
utils
.
dialog
(
context
,
false
,
"Please Verify Email"
,
"Please verify your email before login"
,
"Please verify your email before login"
,
"close"
,
"verify"
)
"close"
,
"verify"
)
.
show
();
.
show
();
...
@@ -230,10 +228,10 @@ public class LoginState extends BottomSheetDialogFragment {
...
@@ -230,10 +228,10 @@ public class LoginState extends BottomSheetDialogFragment {
});
});
}
}
private
void
errUserPass
(
View
customLayout
)
{
private
void
errUserPass
()
{
utils
=
new
Utils
(
customLayout
);
utils
=
new
Utils
();
utils
.
dialog
(
context
,
false
,
customLayout
,
"Wrong Username or Password"
,
utils
.
dialog
(
context
,
false
,
"Wrong Username or Password"
,
"The username or password is incorrect. Please try again!"
,
"The username or password is incorrect. Please try again!"
,
"Try Again"
)
"Try Again"
)
.
show
();
.
show
();
...
...
app/src/main/java/com/yono/messeripos/RegisterState.java
View file @
64f8dc9a
...
@@ -193,10 +193,10 @@ public class RegisterState extends BottomSheetDialogFragment {
...
@@ -193,10 +193,10 @@ public class RegisterState extends BottomSheetDialogFragment {
return
sheetDialog2
;
return
sheetDialog2
;
}
}
private
void
activateEmail
(
View
customLayout
)
{
private
void
activateEmail
()
{
utils
=
new
Utils
(
customLayout
);
utils
=
new
Utils
();
utils
.
dialog
(
context
,
false
,
customLayout
,
"Please Verifiy Email"
,
utils
.
dialog
(
context
,
false
,
"Please Verifiy Email"
,
"Please verify your email before login"
,
"Please verify your email before login"
,
"close"
,
"verify"
)
"close"
,
"verify"
)
.
show
();
.
show
();
...
...
app/src/main/java/com/yono/messeripos/utils/Utils.java
View file @
64f8dc9a
...
@@ -8,6 +8,7 @@ import android.graphics.BitmapFactory;
...
@@ -8,6 +8,7 @@ import android.graphics.BitmapFactory;
import
android.os.Build
;
import
android.os.Build
;
import
android.util.Base64
;
import
android.util.Base64
;
import
android.util.Log
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.View
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
android.widget.Toast
;
...
@@ -223,12 +224,13 @@ public class Utils {
...
@@ -223,12 +224,13 @@ public class Utils {
* Alert Dialog
* Alert Dialog
* @param context
* @param context
* @param cancelable
* @param cancelable
* @param view
* @return
* @return
*/
*/
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
View
view
)
{
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
)
{
CardView
btCard
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick
);
final
View
view
=
View
.
inflate
(
context
,
R
.
layout
.
alert_dialog
,
null
);
CardView
btnCard
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick
);
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
)
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
context
)
.
setCancelable
(
cancelable
)
.
setCancelable
(
cancelable
)
...
@@ -241,10 +243,14 @@ public class Utils {
...
@@ -241,10 +243,14 @@ public class Utils {
}
}
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
View
view
,
@Nullable
String
titles
)
{
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
@Nullable
String
titles
)
{
final
View
view
=
View
.
inflate
(
context
,
R
.
layout
.
alert_dialog
,
null
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
CardView
btCard
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick
);
CardView
bt
n
Card
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick
);
// set title and message
// set title and message
if
(
titles
!=
null
){
if
(
titles
!=
null
){
...
@@ -262,7 +268,12 @@ public class Utils {
...
@@ -262,7 +268,12 @@ public class Utils {
}
}
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
View
view
,
@Nullable
String
titles
,
@Nullable
String
messages
)
{
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
@Nullable
String
titles
,
@Nullable
String
messages
)
{
final
View
view
=
View
.
inflate
(
context
,
R
.
layout
.
alert_dialog
,
null
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
TextView
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
...
@@ -289,16 +300,18 @@ public class Utils {
...
@@ -289,16 +300,18 @@ public class Utils {
public
AlertDialog
dialog
(
Context
context
,
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
Boolean
cancelable
,
View
view
,
@Nullable
String
titles
,
@Nullable
String
titles
,
@Nullable
String
messages
,
@Nullable
String
messages
,
@Nullable
String
dismiss
)
{
@Nullable
String
dismiss
)
{
final
View
view
=
View
.
inflate
(
context
,
R
.
layout
.
alert_dialog
,
null
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
TextView
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
TextView
button2
=
view
.
findViewById
(
R
.
id
.
tvTextBtn2
);
TextView
button2
=
view
.
findViewById
(
R
.
id
.
tvTextBtn2
);
CardView
btnCard2
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick2
);
CardView
btnCard2
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick2
);
// set title and message
// set title and message
if
(
titles
!=
null
){
if
(
titles
!=
null
){
title
.
setText
(
titles
);
title
.
setText
(
titles
);
...
@@ -327,7 +340,6 @@ public class Utils {
...
@@ -327,7 +340,6 @@ public class Utils {
public
AlertDialog
dialog
(
Context
context
,
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
Boolean
cancelable
,
View
view
,
@Nullable
String
titles
,
@Nullable
String
titles
,
@Nullable
String
messages
,
@Nullable
String
messages
,
@Nullable
String
dismiss
,
@Nullable
String
dismiss
,
...
@@ -338,6 +350,8 @@ public class Utils {
...
@@ -338,6 +350,8 @@ public class Utils {
* Button2 untuk link
* Button2 untuk link
*/
*/
final
View
view
=
View
.
inflate
(
context
,
R
.
layout
.
alert_dialog
,
null
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
TextView
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
TextView
button
=
view
.
findViewById
(
R
.
id
.
tvTextBtn
);
TextView
button
=
view
.
findViewById
(
R
.
id
.
tvTextBtn
);
...
...
app/src/main/res/layout/alert_dialog.xml
View file @
64f8dc9a
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
<LinearLayout
<LinearLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:paddingVertical=
"20dp"
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<TextView
<TextView
...
...
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