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
Hide 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 {
}
else
{
utils
.
dialog
(
CartActivity
.
this
,
true
,
getLayoutInflater
().
inflate
(
R
.
layout
.
alert_dialog
,
null
),
"Warning"
,
"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;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.fragment.app.FragmentManager
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.ImageButton
;
public
class
ForgotPasswordActivity
extends
AppCompatActivity
{
...
...
@@ -16,6 +19,11 @@ public class ForgotPasswordActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
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
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
...
...
app/src/main/java/com/yono/messeripos/LoginState.java
View file @
64f8dc9a
...
...
@@ -144,19 +144,17 @@ public class LoginState extends BottomSheetDialogFragment {
.
observe
((
LifecycleOwner
)
context
,
usersModelsDataResponse
->
{
if
(
usersModelsDataResponse
!=
null
)
{
final
View
customLayout
=
getLayoutInflater
()
.
inflate
(
R
.
layout
.
alert_dialog
,
null
);
switch
(
usersModelsDataResponse
.
getMessageData
().
toLowerCase
())
{
case
"invalid username or password"
:
setAllLayoutToTrue
();
errUserPass
(
customLayout
);
errUserPass
();
break
;
case
"please activate your email first"
:
setAllLayoutToTrue
();
activateEmail
(
customLayout
);
activateEmail
();
default
:
break
;
...
...
@@ -206,10 +204,10 @@ public class LoginState extends BottomSheetDialogFragment {
closeBtn
.
setEnabled
(
false
);
}
private
void
activateEmail
(
View
customLayout
)
{
private
void
activateEmail
()
{
utils
=
new
Utils
(
customLayout
);
utils
.
dialog
(
context
,
false
,
customLayout
,
"Please Verify Email"
,
utils
=
new
Utils
();
utils
.
dialog
(
context
,
false
,
"Please Verify Email"
,
"Please verify your email before login"
,
"close"
,
"verify"
)
.
show
();
...
...
@@ -230,10 +228,10 @@ public class LoginState extends BottomSheetDialogFragment {
});
}
private
void
errUserPass
(
View
customLayout
)
{
private
void
errUserPass
()
{
utils
=
new
Utils
(
customLayout
);
utils
.
dialog
(
context
,
false
,
customLayout
,
"Wrong Username or Password"
,
utils
=
new
Utils
();
utils
.
dialog
(
context
,
false
,
"Wrong Username or Password"
,
"The username or password is incorrect. Please try again!"
,
"Try Again"
)
.
show
();
...
...
app/src/main/java/com/yono/messeripos/RegisterState.java
View file @
64f8dc9a
...
...
@@ -193,10 +193,10 @@ public class RegisterState extends BottomSheetDialogFragment {
return
sheetDialog2
;
}
private
void
activateEmail
(
View
customLayout
)
{
private
void
activateEmail
()
{
utils
=
new
Utils
(
customLayout
);
utils
.
dialog
(
context
,
false
,
customLayout
,
"Please Verifiy Email"
,
utils
=
new
Utils
();
utils
.
dialog
(
context
,
false
,
"Please Verifiy Email"
,
"Please verify your email before login"
,
"close"
,
"verify"
)
.
show
();
...
...
app/src/main/java/com/yono/messeripos/utils/Utils.java
View file @
64f8dc9a
...
...
@@ -8,6 +8,7 @@ import android.graphics.BitmapFactory;
import
android.os.Build
;
import
android.util.Base64
;
import
android.util.Log
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.widget.TextView
;
import
android.widget.Toast
;
...
...
@@ -223,12 +224,13 @@ public class Utils {
* Alert Dialog
* @param context
* @param cancelable
* @param view
* @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
)
.
setCancelable
(
cancelable
)
...
...
@@ -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
);
CardView
btCard
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick
);
CardView
bt
n
Card
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick
);
// set title and message
if
(
titles
!=
null
){
...
...
@@ -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
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
...
...
@@ -289,16 +300,18 @@ public class Utils {
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
View
view
,
@Nullable
String
titles
,
@Nullable
String
messages
,
@Nullable
String
dismiss
)
{
final
View
view
=
View
.
inflate
(
context
,
R
.
layout
.
alert_dialog
,
null
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
TextView
button2
=
view
.
findViewById
(
R
.
id
.
tvTextBtn2
);
CardView
btnCard2
=
view
.
findViewById
(
R
.
id
.
cvAlertOnClick2
);
// set title and message
if
(
titles
!=
null
){
title
.
setText
(
titles
);
...
...
@@ -327,7 +340,6 @@ public class Utils {
public
AlertDialog
dialog
(
Context
context
,
Boolean
cancelable
,
View
view
,
@Nullable
String
titles
,
@Nullable
String
messages
,
@Nullable
String
dismiss
,
...
...
@@ -338,6 +350,8 @@ public class Utils {
* Button2 untuk link
*/
final
View
view
=
View
.
inflate
(
context
,
R
.
layout
.
alert_dialog
,
null
);
TextView
title
=
view
.
findViewById
(
R
.
id
.
alertTitles
);
TextView
message
=
view
.
findViewById
(
R
.
id
.
alertBody
);
TextView
button
=
view
.
findViewById
(
R
.
id
.
tvTextBtn
);
...
...
app/src/main/res/layout/alert_dialog.xml
View file @
64f8dc9a
...
...
@@ -21,6 +21,7 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:paddingVertical=
"20dp"
android:orientation=
"vertical"
>
<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