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
53410090
Commit
53410090
authored
Sep 02, 2020
by
Alfansyah Fadlian
Browse files
Options
Browse Files
Download
Plain Diff
fix error
parents
d2542572
a847797c
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
330 additions
and
310 deletions
+330
-310
build.gradle
app/build.gradle
+2
-0
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+3
-0
BottomSheets.java
app/src/main/java/com/yono/messeripos/BottomSheets.java
+0
-3
FormProductActivity.java
...rc/main/java/com/yono/messeripos/FormProductActivity.java
+25
-1
LoginActivity.java
app/src/main/java/com/yono/messeripos/LoginActivity.java
+17
-186
LoginState.java
app/src/main/java/com/yono/messeripos/LoginState.java
+151
-0
PaymentActivity.java
app/src/main/java/com/yono/messeripos/PaymentActivity.java
+1
-0
CategoryServise.java
...java/com/yono/messeripos/api/service/CategoryServise.java
+3
-0
activity_payment.xml
app/src/main/res/layout/activity_payment.xml
+14
-9
dashboard_login.xml
app/src/main/res/layout/dashboard_login.xml
+15
-15
login_form.xml
app/src/main/res/layout/login_form.xml
+97
-94
styles.xml
app/src/main/res/values/styles.xml
+2
-2
No files found.
app/build.gradle
View file @
53410090
...
@@ -47,6 +47,8 @@ dependencies {
...
@@ -47,6 +47,8 @@ dependencies {
implementation
'com.github.bumptech.glide:glide:4.3.1'
implementation
'com.github.bumptech.glide:glide:4.3.1'
implementation
'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation
'com.squareup.okhttp3:logging-interceptor:4.2.1'
implementation
'com.ethanhua:skeleton:1.1.2'
implementation
'com.ethanhua:skeleton:1.1.2'
implementation
'com.github.florent37:expansionpanel:1.2.4'
implementation
'com.google.guava:guava:29.0-jre'
implementation
'io.supercharge:shimmerlayout:2.1.0'
implementation
'io.supercharge:shimmerlayout:2.1.0'
implementation
project
(
':library'
)
implementation
project
(
':library'
)
...
...
app/src/main/AndroidManifest.xml
View file @
53410090
...
@@ -6,6 +6,9 @@
...
@@ -6,6 +6,9 @@
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!--NFC PERMISSION AND FEATURE-->
<uses-permission
android:name=
"android.permission.NFC"
/>
<uses-feature
android:name=
"android.hardware.nfc"
/>
<uses-feature
<uses-feature
android:name=
"android.hardware.camera"
android:name=
"android.hardware.camera"
...
...
app/src/main/java/com/yono/messeripos/BottomSheets.java
View file @
53410090
...
@@ -16,9 +16,7 @@ import android.widget.EditText;
...
@@ -16,9 +16,7 @@ import android.widget.EditText;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
android.widget.TextView
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
import
androidx.fragment.app.DialogFragment
;
import
com.google.android.material.bottomsheet.BottomSheetBehavior
;
import
com.google.android.material.bottomsheet.BottomSheetBehavior
;
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
;
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
;
...
@@ -37,7 +35,6 @@ import retrofit2.Response;
...
@@ -37,7 +35,6 @@ import retrofit2.Response;
import
static
com
.
yono
.
messeripos
.
MainActivity
.
CHECKOUT
;
import
static
com
.
yono
.
messeripos
.
MainActivity
.
CHECKOUT
;
import
static
com
.
yono
.
messeripos
.
MainActivity
.
ORDER_ID
;
import
static
com
.
yono
.
messeripos
.
MainActivity
.
ORDER_ID
;
import
static
com
.
yono
.
messeripos
.
MainActivity
.
orderId
;
public
class
BottomSheets
extends
BottomSheetDialogFragment
{
public
class
BottomSheets
extends
BottomSheetDialogFragment
{
...
...
app/src/main/java/com/yono/messeripos/FormProductActivity.java
View file @
53410090
...
@@ -66,6 +66,7 @@ public class FormProductActivity extends AppCompatActivity {
...
@@ -66,6 +66,7 @@ public class FormProductActivity extends AppCompatActivity {
String
locationPath
=
null
;
String
locationPath
=
null
;
int
idCategorySelected
=
0
;
int
idCategorySelected
=
0
;
public
int
id
=
0
;
public
int
id
=
0
;
public
String
categoryName
=
""
;
private
String
[]
permissions
=
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
private
String
[]
permissions
=
new
String
[]{
Manifest
.
permission
.
READ_EXTERNAL_STORAGE
,
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
};
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
};
...
@@ -76,6 +77,7 @@ public class FormProductActivity extends AppCompatActivity {
...
@@ -76,6 +77,7 @@ public class FormProductActivity extends AppCompatActivity {
List
<
String
>
categorySelect
=
new
ArrayList
<>();
List
<
String
>
categorySelect
=
new
ArrayList
<>();
FormCategory
formCategory
;
FormCategory
formCategory
;
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
@Override
@Override
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
public
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
...
@@ -139,6 +141,7 @@ public class FormProductActivity extends AppCompatActivity {
...
@@ -139,6 +141,7 @@ public class FormProductActivity extends AppCompatActivity {
progressDialog
.
show
();
progressDialog
.
show
();
CategoryServise
categoryServise
=
client
.
Client
(
CategoryServise
.
class
);
CategoryServise
categoryServise
=
client
.
Client
(
CategoryServise
.
class
);
categoryServise
.
addCategory
(
categoryModels
).
enqueue
(
new
Callback
<
DataResponse
<
CategoryModels
>>()
{
categoryServise
.
addCategory
(
categoryModels
).
enqueue
(
new
Callback
<
DataResponse
<
CategoryModels
>>()
{
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
@Override
@Override
public
void
onResponse
(
Call
<
DataResponse
<
CategoryModels
>>
call
,
Response
<
DataResponse
<
CategoryModels
>>
response
)
{
public
void
onResponse
(
Call
<
DataResponse
<
CategoryModels
>>
call
,
Response
<
DataResponse
<
CategoryModels
>>
response
)
{
if
(
response
.
body
().
getStatusData
()){
if
(
response
.
body
().
getStatusData
()){
...
@@ -185,7 +188,11 @@ public class FormProductActivity extends AppCompatActivity {
...
@@ -185,7 +188,11 @@ public class FormProductActivity extends AppCompatActivity {
HashSet
<
String
>
set
=
new
HashSet
<>();
HashSet
<
String
>
set
=
new
HashSet
<>();
List
<
String
>
str
=
new
ArrayList
<>();
List
<
String
>
str
=
new
ArrayList
<>();
categoryModels
=
new
ArrayList
<>();
categoryModels
=
new
ArrayList
<>();
str
.
add
(
"SELECT CATEGORY"
);
if
(
productModelsIntent
==
null
){
str
.
add
(
"SELECT CATEGORY"
);
}
else
{
str
.
add
(
getCategoryById
(
productModelsIntent
.
getIdProduct
()));
}
mainViewModels
.
getCategory
().
observe
(
this
,
listDataResponse
->
{
mainViewModels
.
getCategory
().
observe
(
this
,
listDataResponse
->
{
progressDialog
.
dismiss
();
progressDialog
.
dismiss
();
for
(
CategoryModels
cd:
listDataResponse
.
getData
()){
for
(
CategoryModels
cd:
listDataResponse
.
getData
()){
...
@@ -329,6 +336,23 @@ public class FormProductActivity extends AppCompatActivity {
...
@@ -329,6 +336,23 @@ public class FormProductActivity extends AppCompatActivity {
return
id
;
return
id
;
}
}
private
String
getCategoryById
(
int
s
)
{
CategoryServise
categoryServise
=
client
.
Client
(
CategoryServise
.
class
);
categoryServise
.
getCategoryId
(
s
).
enqueue
(
new
Callback
<
DataResponse
<
CategoryModels
>>()
{
@Override
public
void
onResponse
(
Call
<
DataResponse
<
CategoryModels
>>
call
,
Response
<
DataResponse
<
CategoryModels
>>
response
)
{
categoryName
=
response
.
body
().
getData
().
getNameCategory
();
}
@Override
public
void
onFailure
(
Call
<
DataResponse
<
CategoryModels
>>
call
,
Throwable
t
)
{
}
});
return
categoryName
;
}
private
void
openFile
(){
private
void
openFile
(){
requestPermissions
(
permissions
,
REQUEST_PERMISSIONS
);
requestPermissions
(
permissions
,
REQUEST_PERMISSIONS
);
Intent
i
=
new
Intent
(
Intent
.
ACTION_PICK
,
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
);
Intent
i
=
new
Intent
(
Intent
.
ACTION_PICK
,
MediaStore
.
Images
.
Media
.
EXTERNAL_CONTENT_URI
);
...
...
app/src/main/java/com/yono/messeripos/LoginActivity.java
View file @
53410090
...
@@ -11,6 +11,7 @@ import android.util.Log;
...
@@ -11,6 +11,7 @@ import android.util.Log;
import
android.view.View
;
import
android.view.View
;
import
android.view.Window
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.view.WindowManager
;
import
android.widget.ImageButton
;
import
android.widget.ProgressBar
;
import
android.widget.ProgressBar
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.NonNull
;
...
@@ -31,16 +32,18 @@ import com.yono.messeripos.utils.Utils;
...
@@ -31,16 +32,18 @@ import com.yono.messeripos.utils.Utils;
public
class
LoginActivity
extends
AppCompatActivity
{
public
class
LoginActivity
extends
AppCompatActivity
{
TextInputEditText
username
,
password
;
TextInputEditText
username
,
password
;
MaterialButton
btnLogin
;
MaterialButton
btnLogin
,
btnRegister
;
MainViewModels
mainViewModels
;
MainViewModels
mainViewModels
;
ProgressBar
progressBar
;
ProgressBar
progressBar
;
SharedPreferences
sharedPreferences
;
SharedPreferences
sharedPreferences
;
Utils
utils
=
new
Utils
();
Utils
utils
=
new
Utils
();
LoginState
loginState
;
MaterialButton
btnSign
up
,
btnSign
in
;
MaterialButton
btnSignin
;
ConstraintLayout
loginSheetLayout
,
registerSheetLayout
;
ConstraintLayout
loginSheetLayout
;
BottomSheetBehavior
sheetBehavior
,
sheetBehavior2
;
BottomSheetBehavior
sheetBehavior
;
int
height
,
width
;
int
height
,
width
;
ImageButton
closeBtn
;
private
String
TAG
=
"MainActivity"
;
private
String
TAG
=
"MainActivity"
;
...
@@ -53,195 +56,23 @@ public class LoginActivity extends AppCompatActivity {
...
@@ -53,195 +56,23 @@ public class LoginActivity extends AppCompatActivity {
Window
w
=
getWindow
();
Window
w
=
getWindow
();
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
w
.
setFlags
(
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
,
WindowManager
.
LayoutParams
.
FLAG_LAYOUT_NO_LIMITS
);
}
}
// bindUI
btnSignin
=
findViewById
(
R
.
id
.
signInButtonDashboardLogin
);
loginSheetLayout
=
findViewById
(
R
.
id
.
ConstraintLoginLayout
);
btnSignup
=
findViewById
(
R
.
id
.
signUpButtonDashboardLogin
);
registerSheetLayout
=
findViewById
(
R
.
id
.
ConstraintRegisterLayout
);
// get window height
DisplayMetrics
displayMetrics
=
new
DisplayMetrics
();
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
displayMetrics
);
height
=
displayMetrics
.
heightPixels
;
width
=
displayMetrics
.
widthPixels
;
int
maxHeight
=
height
-
((
height
*
10
)
/
100
);
mainViewModels
=
ViewModelProviders
.
of
(
this
).
get
(
MainViewModels
.
class
);
loginSheetLayout
.
setMaxHeight
(
maxHeight
);
// get bottom sheets
// bindUI
sheetBehavior
=
BottomSheetBehavior
.
from
(
loginSheetLayout
);
btnSignin
=
findViewById
(
R
.
id
.
signInButtonDashboardLogin
);
sheetBehavior2
=
BottomSheetBehavior
.
from
(
registerSheetLayout
);
// session login
sharedPreferences
=
getSharedPreferences
(
SplashScreen
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
// button on click
// button
login
on click
btnSignin
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
btnSignin
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
@Override
public
void
onClick
(
View
view
)
{
public
void
onClick
(
View
v
)
{
if
(
sheetBehavior
.
getState
()
!=
BottomSheetBehavior
.
STATE_EXPANDED
)
{
loginState
=
new
LoginState
(
LoginActivity
.
this
,
mainViewModels
);
sheetBehavior
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
loginState
.
setCancelable
(
false
);
loginSheetLayout
.
setMaxHeight
(
height
-
100
);
loginState
.
show
(
getSupportFragmentManager
(),
loginState
.
getTag
());
}
else
{
sheetBehavior
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
}
}
});
//button on click to form register
btnSignup
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
view
)
{
if
(
sheetBehavior2
.
getState
()
!=
BottomSheetBehavior
.
STATE_EXPANDED
)
{
sheetBehavior2
.
setState
(
BottomSheetBehavior
.
STATE_EXPANDED
);
registerSheetLayout
.
setMaxHeight
(
height
-
100
);
}
else
{
sheetBehavior2
.
setState
(
BottomSheetBehavior
.
STATE_COLLAPSED
);
}
}
}
});
});
/*
* LOGIN LOGIKA DIBAWAH INI
* */
//<<<<<<< HEAD
// public void onClick(View v) {
// Snackbar snackbar = Snackbar.make(v, "Oppss! Wrong Username Or Password!", Snackbar.LENGTH_LONG);
//
// if (TextUtils.isEmpty(username.getText().toString()) &&
// TextUtils.isEmpty(password.getText().toString())){
// username.setError("This field can't empty");
// password.setError("This field can't empty");
// }else if (TextUtils.isEmpty(username.getText().toString())){
// username.setError("This field can't empty");
// }else if (TextUtils.isEmpty(password.getText().toString())){
// password.setError("This field can't empty");
// }else{
// progressBar.setVisibility(View.VISIBLE);
// username.setEnabled(false);
// password.setEnabled(false);
// btnLogin.setEnabled(false);
//
// mainViewModels.checkLogin(new UsersModels(username.getText().toString(),
// password.getText().toString())).observe(LoginActivity.this, new Observer<DataResponse<UsersModels>>() {
// @Override
// public void onChanged(DataResponse<UsersModels> usersModelsDataResponse) {
// Log.d("Status", usersModelsDataResponse.getMessageData());
//
// if (usersModelsDataResponse != null){
// if (usersModelsDataResponse.getStatusData()){
// SharedPreferences.Editor editor = sharedPreferences.edit();
// editor.putBoolean(SplashScreen.SESSION, true);
// editor.commit();
//
// startActivity(new Intent(LoginActivity.this, MainActivity.class));
//
// progressBar.setVisibility(View.GONE);
// username.setEnabled(true);
// password.setEnabled(true);
// btnLogin.setEnabled(true);
// }else {
// utils.snackBar(v,"Oppss! Wrong Username Or Password!").show();
// progressBar.setVisibility(View.GONE);
// username.setEnabled(true);
// password.setEnabled(true);
// btnLogin.setEnabled(true);
// }
// }else{
// utils.snackBar(v, "Oppss! ログイン中にエラーが発生しました。しばらくしてからもう一度お試しください").show();
// }
//
// }
// });
//=======
// set Callback
sheetBehavior
.
setBottomSheetCallback
(
new
BottomSheetBehavior
.
BottomSheetCallback
()
{
@Override
public
void
onStateChanged
(
@NonNull
View
bottomSheet
,
int
newState
)
{
switch
(
newState
)
{
case
BottomSheetBehavior
.
STATE_HIDDEN
:
case
BottomSheetBehavior
.
STATE_DRAGGING
:
case
BottomSheetBehavior
.
STATE_SETTLING
:
break
;
case
BottomSheetBehavior
.
STATE_EXPANDED
:
{
Log
.
d
(
TAG
,
"onStateChanged: expanded"
);
}
break
;
case
BottomSheetBehavior
.
STATE_COLLAPSED
:
{
Log
.
d
(
TAG
,
"onStateChanged: collapsed"
);
}
break
;
}
}
@Override
public
void
onSlide
(
@NonNull
View
bottomSheet
,
float
slideOffset
)
{
}
});
//
// setContentView(R.layout.activity_login_m);
// username = findViewById(R.id.tiUsername);
// password = findViewById(R.id.tiPassword);
// btnLogin = findViewById(R.id.btnLogin);
// progressBar = findViewById(R.id.progressBar);
// progressBar.setVisibility(View.GONE);
// mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class);
//
// sharedPreferences = getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
//
// btnLogin.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Snackbar snackbar = Snackbar.make(v, "Oppss! Wrong Username Or Password!", Snackbar.LENGTH_LONG);
//
// if (TextUtils.isEmpty(username.getText().toString()) &&
// TextUtils.isEmpty(password.getText().toString())){
// username.setError("This field can't empty");
// password.setError("This field can't empty");
// }else if (TextUtils.isEmpty(username.getText().toString())){
// username.setError("This field can't empty");
// }else if (TextUtils.isEmpty(password.getText().toString())){
// password.setError("This field can't empty");
// }else{
// progressBar.setVisibility(View.VISIBLE);
// username.setEnabled(false);
// password.setEnabled(false);
// btnLogin.setEnabled(false);
//
// mainViewModels.checkLogin(new UsersModels(username.getText().toString(),
// password.getText().toString())).observe(LoginActivity.this, new Observer<DataResponse<UsersModels>>() {
// @Override
// public void onChanged(DataResponse<UsersModels> usersModelsDataResponse) {
// Log.d("Status", usersModelsDataResponse.getMessageData());
//
// if (usersModelsDataResponse.getStatusData()){
// SharedPreferences.Editor editor = sharedPreferences.edit();
// editor.putBoolean(SplashScreen.SESSION, true);
// editor.commit();
//
// startActivity(new Intent(LoginActivity.this, MainActivity.class));
//
// progressBar.setVisibility(View.GONE);
// username.setEnabled(true);
// password.setEnabled(true);
// btnLogin.setEnabled(true);
// }else {
// snackbar.show();
// progressBar.setVisibility(View.GONE);
// username.setEnabled(true);
// password.setEnabled(true);
// btnLogin.setEnabled(true);
// }
//
// }
// });
// }
// }
// });
}
}
}
}
app/src/main/java/com/yono/messeripos/LoginState.java
0 → 100644
View file @
53410090
package
com
.
yono
.
messeripos
;
import
android.app.Dialog
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.SharedPreferences
;
import
android.content.res.Resources
;
import
android.os.Bundle
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.view.KeyEvent
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.lifecycle.LifecycleOwner
;
import
androidx.lifecycle.Observer
;
import
com.bumptech.glide.load.engine.Resource
;
import
com.google.android.material.bottomsheet.BottomSheetBehavior
;
import
com.google.android.material.bottomsheet.BottomSheetDialog
;
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
;
import
com.google.android.material.button.MaterialButton
;
import
com.google.android.material.snackbar.Snackbar
;
import
com.google.android.material.textfield.TextInputEditText
;
import
com.yono.messeripos.models.MainViewModels
;
import
com.yono.messeripos.models.UsersModels
;
import
com.yono.messeripos.response.DataResponse
;
import
com.yono.messeripos.utils.Utils
;
public
class
LoginState
extends
BottomSheetDialogFragment
{
private
static
final
String
TAG
=
"LoginState"
;
BottomSheetBehavior
sheetBehavior
;
BottomSheetDialog
sheetDialog
;
RelativeLayout
loginLayout
;
TextInputEditText
username
,
password
;
MaterialButton
loginButton
;
ImageView
closeBtn
;
Context
context
;
MainViewModels
mainViewModels
;
SharedPreferences
sharedPreferences
;
Utils
utils
;
public
LoginState
(
Context
context
,
MainViewModels
mainViewModels
)
{
this
.
context
=
context
;
this
.
mainViewModels
=
mainViewModels
;
}
@NonNull
@Override
public
Dialog
onCreateDialog
(
@Nullable
Bundle
savedInstanceState
)
{
sheetDialog
=
(
BottomSheetDialog
)
super
.
onCreateDialog
(
savedInstanceState
);
// inflating layout
View
view
=
View
.
inflate
(
getContext
(),
R
.
layout
.
login_form
,
null
);
// bindUI
loginLayout
=
view
.
findViewById
(
R
.
id
.
LoginLayout
);
username
=
view
.
findViewById
(
R
.
id
.
ETUsernameLogin
);
password
=
view
.
findViewById
(
R
.
id
.
ETPasswordLogin
);
loginButton
=
view
.
findViewById
(
R
.
id
.
SignInButtonInLogin
);
closeBtn
=
view
.
findViewById
(
R
.
id
.
closeBtnLogin
);
// create session
sharedPreferences
=
context
.
getSharedPreferences
(
SplashScreen
.
MY_SHARED_PREFERENCES
,
Context
.
MODE_PRIVATE
);
// utils
utils
=
new
Utils
();
sheetDialog
.
setContentView
(
view
);
sheetBehavior
=
BottomSheetBehavior
.
from
((
View
)
(
view
.
getParent
()));
// get Window size
int
getHeight
=
Resources
.
getSystem
().
getDisplayMetrics
().
heightPixels
;
int
setHeight
=
getHeight
-
(
getHeight
*
10
)
/
100
;
// set max height
sheetBehavior
.
setPeekHeight
(
setHeight
);
loginLayout
.
setMinimumHeight
(
setHeight
);
Log
.
d
(
TAG
,
"onCreateDialog: "
+
sheetBehavior
.
getState
());
loginButton
.
setOnClickListener
(
view1
->
{
if
(
sheetBehavior
.
getState
()
!=
BottomSheetBehavior
.
STATE_EXPANDED
)
loginAuth
(
view1
);
});
// close btn is clicked
closeBtn
.
setOnClickListener
(
view12
->
{
Log
.
d
(
TAG
,
"onCreateDialog: "
+
sheetBehavior
.
getState
());
sheetDialog
.
dismiss
();
});
return
sheetDialog
;
}
private
void
loginAuth
(
View
v
)
{
Snackbar
snackbar
=
Snackbar
.
make
(
v
,
"Oppss! Wrong Username Or Password!"
,
Snackbar
.
LENGTH_LONG
);
if
(
TextUtils
.
isEmpty
(
username
.
getText
().
toString
())
&&
TextUtils
.
isEmpty
(
password
.
getText
().
toString
())){
username
.
setError
(
"This field can't empty"
);
password
.
setError
(
"This field can't empty"
);
}
else
if
(
TextUtils
.
isEmpty
(
username
.
getText
().
toString
())){
username
.
setError
(
"This field can't empty"
);
}
else
if
(
TextUtils
.
isEmpty
(
password
.
getText
().
toString
())){
password
.
setError
(
"This field can't empty"
);
}
else
{
username
.
setEnabled
(
false
);
password
.
setEnabled
(
false
);
loginButton
.
setEnabled
(
false
);
closeBtn
.
setEnabled
(
false
);
mainViewModels
.
checkLogin
(
new
UsersModels
(
username
.
getText
().
toString
(),
password
.
getText
().
toString
())).
observe
((
LifecycleOwner
)
context
,
new
Observer
<
DataResponse
<
UsersModels
>>()
{
@Override
public
void
onChanged
(
DataResponse
<
UsersModels
>
usersModelsDataResponse
)
{
Log
.
d
(
"Status"
,
usersModelsDataResponse
.
getMessageData
());
if
(
usersModelsDataResponse
!=
null
)
{
if
(
usersModelsDataResponse
.
getStatusData
())
{
// SharedPreferences.Editor editor = sharedPreferences.edit();
// editor.putBoolean(SplashScreen.SESSION, true);
// editor.commit();
startActivity
(
new
Intent
(
context
,
MainActivity
.
class
));
username
.
setEnabled
(
true
);
password
.
setEnabled
(
true
);
loginButton
.
setEnabled
(
true
);
closeBtn
.
setEnabled
(
true
);
}
else
{
utils
.
snackBar
(
v
,
"Oppss! Wrong Username Or Password!"
).
show
();
username
.
setEnabled
(
true
);
password
.
setEnabled
(
true
);
loginButton
.
setEnabled
(
true
);
closeBtn
.
setEnabled
(
true
);
}
}
else
{
utils
.
snackBar
(
v
,
"Oppss! ログイン中にエラーが発生しました。しばらくしてからもう一度お試しください"
).
show
();
}
}
});
}
}
}
app/src/main/java/com/yono/messeripos/PaymentActivity.java
View file @
53410090
...
@@ -163,6 +163,7 @@ public class PaymentActivity extends AppCompatActivity {
...
@@ -163,6 +163,7 @@ public class PaymentActivity extends AppCompatActivity {
paymentResponses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png"
,
"mandiri"
));
paymentResponses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/XCsdmmT/Bank-Mandiri-logo.png"
,
"mandiri"
));
paymentResponses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/2n65nCT/bca-bank-central-asia.png"
,
"bca"
));
paymentResponses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/2n65nCT/bca-bank-central-asia.png"
,
"bca"
));
paymentResponses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/RjJQT9K/BNI-logo.png"
,
"bni"
));
paymentResponses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/RjJQT9K/BNI-logo.png"
,
"bni"
));
paymentResponses
.
add
(
new
PaymentResponse
(
"https://i.ibb.co/n1V3ZCf/Whats-App-Image-2020-09-01-at-14-50-13.jpg"
,
"nfc"
));
PaymentAdapter
adapter
=
new
PaymentAdapter
(
paymentResponses
,
this
);
PaymentAdapter
adapter
=
new
PaymentAdapter
(
paymentResponses
,
this
);
rvPayment
.
setAdapter
(
adapter
);
rvPayment
.
setAdapter
(
adapter
);
...
...
app/src/main/java/com/yono/messeripos/api/service/CategoryServise.java
View file @
53410090
...
@@ -26,6 +26,9 @@ public interface CategoryServise {
...
@@ -26,6 +26,9 @@ public interface CategoryServise {
@GET
(
ApiHelper
.
VERSI_API_1
+
"category-name/{id}"
)
@GET
(
ApiHelper
.
VERSI_API_1
+
"category-name/{id}"
)
Call
<
DataResponse
<
List
<
CategoryModels
>>>
getCategoryByName
(
@Path
(
"id"
)
String
name
);
Call
<
DataResponse
<
List
<
CategoryModels
>>>
getCategoryByName
(
@Path
(
"id"
)
String
name
);
@GET
(
ApiHelper
.
VERSI_API_1
+
"category/{id}"
)
Call
<
DataResponse
<
CategoryModels
>>
getCategoryId
(
@Path
(
"id"
)
int
id
);
@POST
(
ApiHelper
.
VERSI_API_1
+
"category"
)
@POST
(
ApiHelper
.
VERSI_API_1
+
"category"
)
Call
<
DataResponse
<
CategoryModels
>>
addCategory
(
@Body
CategoryModels
categoryModels
);
Call
<
DataResponse
<
CategoryModels
>>
addCategory
(
@Body
CategoryModels
categoryModels
);
...
...
app/src/main/res/layout/activity_payment.xml
View file @
53410090
...
@@ -40,7 +40,6 @@
...
@@ -40,7 +40,6 @@
android:nestedScrollingEnabled=
"false"
android:nestedScrollingEnabled=
"false"
android:layout_marginTop=
"20dp"
android:layout_marginTop=
"20dp"
tools:layout_editor_absoluteX=
"10dp"
tools:layout_editor_absoluteX=
"10dp"
tools:listitem=
"@layout/item_checkout"
/>
/>
<com.google.android.material.textview.MaterialTextView
<com.google.android.material.textview.MaterialTextView
...
@@ -59,15 +58,21 @@
...
@@ -59,15 +58,21 @@
/>
/>
<androidx.recyclerview.widget.RecyclerView
<ExpandableListView
android:id=
"@+id/rvPayment"
android:layout_width=
"fill_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_margin=
"10dp"
android:layout_below=
"@+id/tvLabel"
>
android:nestedScrollingEnabled=
"false"
tools:layout_editor_absoluteX=
"10dp"
<androidx.recyclerview.widget.RecyclerView
tools:listitem=
"@layout/payment_list"
android:id=
"@+id/rvPayment"
android:layout_below=
"@id/tvLabel"
/>
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_margin=
"10dp"
android:nestedScrollingEnabled=
"false"
tools:layout_editor_absoluteX=
"10dp"
tools:listitem=
"@layout/payment_list"
/>
</ExpandableListView>
</RelativeLayout>
</RelativeLayout>
</ScrollView>
</ScrollView>
...
...
app/src/main/res/layout/dashboard_login.xml
View file @
53410090
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width=
"match_parent"
<!--<androidx.coordinatorlayout.widget.CoordinatorLayout android:layout_width="match_parent"-->
android:layout_height=
"match_parent"
<!-- android:layout_height="match_parent"-->
xmlns:app=
"http://schemas.android.com/apk/res-auto"
<!-- xmlns:app="http://schemas.android.com/apk/res-auto"-->
xmlns:tools=
"http://schemas.android.com/tools"
<!-- xmlns:tools="http://schemas.android.com/tools"-->
android:background=
"@drawable/gradient"
<!-- android:background="@drawable/gradient"-->
<!-- xmlns:android="http://schemas.android.com/apk/res/android"-->
<!-- tools:context=".LoginActivity">-->
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
tools:context=
".LoginActivity"
>
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
>
<RelativeLayout
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@drawable/gradient"
android:paddingHorizontal=
"20dp"
android:paddingHorizontal=
"20dp"
android:paddingVertical=
"25dp"
>
android:paddingVertical=
"25dp"
>
...
@@ -40,12 +46,11 @@
...
@@ -40,12 +46,11 @@
app:strokeColor=
"#fff"
app:strokeColor=
"#fff"
android:text=
"sign up"
android:text=
"sign up"
android:textStyle=
"bold"
android:textStyle=
"bold"
android:textColor=
"
@color/colorWhite
"
android:textColor=
"
#fff
"
app:strokeWidth=
"2dp"
app:strokeWidth=
"2dp"
app:rippleColor=
"@color/colorWhite"
app:rippleColor=
"@color/colorWhite"
android:padding=
"20dp"
android:padding=
"20dp"
app:cornerRadius=
"5dp"
app:cornerRadius=
"5dp"
android:background=
"@color/colorPrimaryCenter"
android:layout_above=
"@id/signInButtonDashboardLogin"
android:layout_above=
"@id/signInButtonDashboardLogin"
android:layout_marginBottom=
"10dp"
/>
android:layout_marginBottom=
"10dp"
/>
...
@@ -63,11 +68,6 @@
...
@@ -63,11 +68,6 @@
android:textColor=
"@color/colorPrimary"
/>
android:textColor=
"@color/colorPrimary"
/>
</RelativeLayout>
</RelativeLayout>
</layout>
<include
<!--</androidx.coordinatorlayout.widget.CoordinatorLayout>-->
layout=
"@layout/login_form"
/>
<include
layout=
"@layout/register_form"
/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
\ No newline at end of file
app/src/main/res/layout/login_form.xml
View file @
53410090
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:tools=
"http://schemas.android.com/tools"
android:id=
"@+id/ConstraintLoginLayout"
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:orientation=
"vertical"
android:layout_gravity=
"bottom"
app:behavior_hideable=
"false"
android:padding=
"20dp"
style=
"@style/Widget.Rounded.BottomSheet"
app:behavior_peekHeight=
"0dp"
android:background=
"@color/colorWhite"
app:layout_behavior=
"com.google.android.material.bottomsheet.BottomSheetBehavior"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
>
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
<RelativeLayout
app:layout_constraintStart_toStartOf=
"parent"
android:id=
"@+id/LoginLayout"
app:layout_constraintTop_toTopOf=
"parent"
>
android:padding=
"20dp"
style=
"@style/Widget.Rounded.BottomSheet"
<ImageButton
android:id=
"@+id/ivclose"
android:layout_width=
"50dp"
android:layout_height=
"50dp"
android:adjustViewBounds=
"true"
android:backgroundTint=
"@android:color/transparent"
android:padding=
"50dp"
android:scaleType=
"centerInside"
android:src=
"@drawable/ic_close"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<ImageView
android:id=
"@+id/messerLogoInLogin"
android:layout_width=
"215dp"
android:layout_height=
"215dp"
android:src=
"@drawable/ic_messer_primary"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/ivclose"
/>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/formUsernameLogin"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"match_parent"
>
android:hint=
"@string/username"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/messerLogoInLogin"
>
<com.google.android.material.textfield.TextInputEditText
<ImageButton
android:id=
"@+id/closeBtnLogin"
android:layout_width=
"20dp"
android:layout_height=
"20dp"
android:src=
"@drawable/ic_baseline_plus_24"
android:scaleType=
"centerInside"
android:adjustViewBounds=
"true"
android:padding=
"20dp"
android:backgroundTint=
"@android:color/transparent"
android:layout_alignParentTop=
"true"
android:layout_alignParentStart=
"true"
/>
<ImageView
android:id=
"@+id/messerLogoInLogin"
android:layout_width=
"150dp"
android:layout_height=
"150dp"
android:src=
"@drawable/ic_messer_primary"
android:layout_below=
"@id/closeBtnLogin"
android:layout_centerHorizontal=
"true"
android:layout_marginTop=
"20dp"
/>
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/formUsernameLogin"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:hint=
"@string/username"
android:layout_below=
"@id/messerLogoInLogin"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:id=
"@+id/ETUsernameLogin"
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/FormPasswordLogin"
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:hint=
"@string/password"
app:layout_constraintTop_toBottomOf=
"@id/formUsernameLogin"
>
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputLayout
android:id=
"@+id/FormPasswordLogin"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
android:layout_height=
"wrap_content"
android:hint=
"@string/password"
</com.google.android.material.textfield.TextInputLayout>
android:layout_below=
"@id/formUsernameLogin"
android:layout_marginTop=
"20dp"
<CheckBox
style=
"@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
>
android:id=
"@+id/CBRememberMe"
android:layout_width=
"wrap_content"
<com.google.android.material.textfield.TextInputEditText
android:layout_height=
"wrap_content"
android:id=
"@+id/ETPasswordLogin"
android:text=
"Remember Me"
android:layout_width=
"match_parent"
android:textColor=
"@color/colorPrimary"
android:inputType=
"textPassword"
app:layout_constraintStart_toStartOf=
"parent"
android:imeOptions=
"actionDone|actionGo"
app:layout_constraintTop_toBottomOf=
"@id/FormPasswordLogin"
android:layout_height=
"wrap_content"
app:useMaterialThemeColors=
"true"
/>
/>
<com.google.android.material.button.MaterialButton
</com.google.android.material.textfield.TextInputLayout>
android:id=
"@+id/SignInButtonInLogin"
android:layout_width=
"match_parent"
<CheckBox
android:layout_height=
"wrap_content"
android:id=
"@+id/CBRememberMe"
android:padding=
"20dp"
android:layout_width=
"wrap_content"
android:text=
"Sign In"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/CBRememberMe"
/>
android:text=
"Remember Me"
android:textColor=
"@color/colorPrimary"
android:layout_below=
"@id/FormPasswordLogin"
android:layout_marginVertical=
"10dp"
app:useMaterialThemeColors=
"true"
/>
<com.google.android.material.button.MaterialButton
android:id=
"@+id/SignInButtonInLogin"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/CBRememberMe"
android:text=
"Sign In"
android:layout_below=
"@id/CBRememberMe"
android:padding=
"20dp"
/>
<com.google.android.material.textview.MaterialTextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Forgot Password?"
android:layout_below=
"@id/SignInButtonInLogin"
android:layout_marginTop=
"10dp"
android:layout_alignParentEnd=
"true"
android:textColor=
"@color/colorPrimary"
/>
</RelativeLayout>
<com.google.android.material.textview.MaterialTextView
</androidx.coordinatorlayout.widget.CoordinatorLayout>
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:text=
"Forgot Password?"
android:textColor=
"@color/colorPrimary"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@id/SignInButtonInLogin"
/>
</androidx.constraintlayout.widget.ConstraintL
ayout>
</l
ayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
app/src/main/res/values/styles.xml
View file @
53410090
...
@@ -76,8 +76,8 @@
...
@@ -76,8 +76,8 @@
</style>
</style>
<style
name=
"ShapeAppearanceOverlay.Rounded.top"
parent=
""
>
<style
name=
"ShapeAppearanceOverlay.Rounded.top"
parent=
""
>
<item
name=
"cornerSizeTopLeft"
>
1
0dp
</item>
<item
name=
"cornerSizeTopLeft"
>
3
0dp
</item>
<item
name=
"cornerSizeTopRight"
>
1
0dp
</item>
<item
name=
"cornerSizeTopRight"
>
3
0dp
</item>
<item
name=
"cornerFamily"
>
rounded
</item>
<item
name=
"cornerFamily"
>
rounded
</item>
</style>
</style>
...
...
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