Commit 5b669715 authored by Muhammad Suryono's avatar Muhammad Suryono

Merge branch 'cart' into dev

parents dbdfc6c5 22bec9ae
...@@ -61,5 +61,6 @@ dependencies { ...@@ -61,5 +61,6 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.4' implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.4'
implementation 'com.google.zxing:core:3.3.2' implementation 'com.google.zxing:core:3.3.2'
implementation 'com.github.florent37:expansionpanel:1.2.4'
} }
\ No newline at end of file
...@@ -38,9 +38,6 @@ ...@@ -38,9 +38,6 @@
<activity <activity
android:name=".CartActivity" android:name=".CartActivity"
android:theme="@style/AppTheme.appbar" /> android:theme="@style/AppTheme.appbar" />
<activity
android:name=".ProductActivity"
android:theme="@style/AppTheme.appbar" />
<activity android:name=".SplashScreen"> <activity android:name=".SplashScreen">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />
......
...@@ -32,16 +32,17 @@ import com.yono.messeripos.utils.Utils; ...@@ -32,16 +32,17 @@ import com.yono.messeripos.utils.Utils;
public class LoginActivity extends AppCompatActivity { public class LoginActivity extends AppCompatActivity {
TextInputEditText username, password; TextInputEditText username, password;
MaterialButton btnLogin;
MainViewModels mainViewModels; MainViewModels mainViewModels;
ProgressBar progressBar;
SharedPreferences sharedPreferences; SharedPreferences sharedPreferences;
Utils utils = new Utils(); Utils utils = new Utils();
//State
LoginState loginState; LoginState loginState;
RegisterState registerState;
MaterialButton btnSignin;
MaterialButton btnSignup, btnSignIn; MaterialButton btnSignup, btnSignIn;
ConstraintLayout loginSheetLayout, registerSheetLayout; ConstraintLayout loginSheetLayout, registerSheetLayout;
BottomSheetBehavior sheetBehavior,sheetBehavior2;
int height, width; int height, width;
ImageButton closeBtn; ImageButton closeBtn;
...@@ -50,7 +51,7 @@ public class LoginActivity extends AppCompatActivity { ...@@ -50,7 +51,7 @@ public class LoginActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.dashboard_login); setContentView(R.layout.payment_method);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow(); Window w = getWindow();
...@@ -58,98 +59,41 @@ public class LoginActivity extends AppCompatActivity { ...@@ -58,98 +59,41 @@ public class LoginActivity extends AppCompatActivity {
} }
mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class); mainViewModels = ViewModelProviders.of(this).get(MainViewModels.class);
// bindUI
// get window height
DisplayMetrics displayMetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
height = displayMetrics.heightPixels;
width = displayMetrics.widthPixels;
// get bottom sheets // registerSheetLayout = findViewById(R.id.ConstraintRegisterLayout);
sheetBehavior = BottomSheetBehavior.from(loginSheetLayout);
sheetBehavior2 = BottomSheetBehavior.from(registerSheetLayout);
// button on click to form login
btnSignIn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
loginSheetLayout.setMaxHeight(height - 100);
} else {
sheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
}
}
});
// sheetBehavior2 = BottomSheetBehavior.from(registerSheetLayout);
//button on click to form register //button on click to form register
btnSignup.setOnClickListener(new View.OnClickListener() { // btnSignup.setOnClickListener(new View.OnClickListener() {
@Override // @Override
public void onClick(View view) { // public void onClick(View view) {
if (sheetBehavior2.getState() != BottomSheetBehavior.STATE_EXPANDED) { // if (sheetBehavior2.getState() != BottomSheetBehavior.STATE_EXPANDED) {
sheetBehavior2.setState(BottomSheetBehavior.STATE_EXPANDED); // sheetBehavior2.setState(BottomSheetBehavior.STATE_EXPANDED);
registerSheetLayout.setMaxHeight(height - 100); // registerSheetLayout.setMaxHeight(height - 100);
} else { // } else {
sheetBehavior2.setState(BottomSheetBehavior.STATE_COLLAPSED); // sheetBehavior2.setState(BottomSheetBehavior.STATE_COLLAPSED);
} // }
} // }
}); // });
// bindUI
btnSignIn = findViewById(R.id.signInButtonDashboardLogin);
btnSignup = findViewById(R.id.signUpButtonDashboardLogin);
// //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();
// }
//
// }
// });
//=======
// session login // session login
sharedPreferences = getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE); sharedPreferences = getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
...@@ -158,9 +102,18 @@ public class LoginActivity extends AppCompatActivity { ...@@ -158,9 +102,18 @@ public class LoginActivity extends AppCompatActivity {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
loginState = new LoginState(LoginActivity.this, mainViewModels); loginState = new LoginState(LoginActivity.this, mainViewModels);
loginState.setCancelable(false);
loginState.show(getSupportFragmentManager(), loginState.getTag()); loginState.show(getSupportFragmentManager(), loginState.getTag());
} }
}); });
btnSignup.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
registerState = new RegisterState(LoginActivity.this,mainViewModels);
registerState.setCancelable(false);
registerState.show(getSupportFragmentManager(),registerState.getTag());
}
});
} }
} }
package com.yono.messeripos; package com.yono.messeripos;
import android.app.Dialog; import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.res.Resources; import android.content.res.Resources;
...@@ -11,10 +13,12 @@ import android.util.Log; ...@@ -11,10 +13,12 @@ import android.util.Log;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.LifecycleOwner;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
...@@ -23,6 +27,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior; ...@@ -23,6 +27,7 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior;
import com.google.android.material.bottomsheet.BottomSheetDialog; import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.google.android.material.bottomsheet.BottomSheetDialogFragment; import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
import com.google.android.material.button.MaterialButton; import com.google.android.material.button.MaterialButton;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import com.google.android.material.textfield.TextInputEditText; import com.google.android.material.textfield.TextInputEditText;
import com.yono.messeripos.models.MainViewModels; import com.yono.messeripos.models.MainViewModels;
...@@ -33,6 +38,7 @@ import com.yono.messeripos.utils.Utils; ...@@ -33,6 +38,7 @@ import com.yono.messeripos.utils.Utils;
public class LoginState extends BottomSheetDialogFragment { public class LoginState extends BottomSheetDialogFragment {
private static final String TAG = "LoginState"; private static final String TAG = "LoginState";
private static String DEFAULT_LOGIN_NAME = "sign in";
BottomSheetBehavior sheetBehavior; BottomSheetBehavior sheetBehavior;
BottomSheetDialog sheetDialog; BottomSheetDialog sheetDialog;
RelativeLayout loginLayout; RelativeLayout loginLayout;
...@@ -43,6 +49,10 @@ public class LoginState extends BottomSheetDialogFragment { ...@@ -43,6 +49,10 @@ public class LoginState extends BottomSheetDialogFragment {
MainViewModels mainViewModels; MainViewModels mainViewModels;
SharedPreferences sharedPreferences; SharedPreferences sharedPreferences;
Utils utils; Utils utils;
ProgressBar bar;
AlertDialog alertDialog;
ProgressDialog dialog;
public LoginState(Context context, MainViewModels mainViewModels) { public LoginState(Context context, MainViewModels mainViewModels) {
this.context = context; this.context = context;
...@@ -56,6 +66,8 @@ public class LoginState extends BottomSheetDialogFragment { ...@@ -56,6 +66,8 @@ public class LoginState extends BottomSheetDialogFragment {
sheetDialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState); sheetDialog = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
dialog = new ProgressDialog(context);
// inflating layout // inflating layout
View view = View.inflate(getContext(), R.layout.login_form, null); View view = View.inflate(getContext(), R.layout.login_form, null);
...@@ -65,6 +77,10 @@ public class LoginState extends BottomSheetDialogFragment { ...@@ -65,6 +77,10 @@ public class LoginState extends BottomSheetDialogFragment {
password = view.findViewById(R.id.ETPasswordLogin); password = view.findViewById(R.id.ETPasswordLogin);
loginButton = view.findViewById(R.id.SignInButtonInLogin); loginButton = view.findViewById(R.id.SignInButtonInLogin);
closeBtn = view.findViewById(R.id.closeBtnLogin); closeBtn = view.findViewById(R.id.closeBtnLogin);
bar = view.findViewById(R.id.progressLogin);
// set progress bar gone
bar.setVisibility(View.GONE);
// create session // create session
sharedPreferences = context.getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE); sharedPreferences = context.getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
...@@ -78,16 +94,28 @@ public class LoginState extends BottomSheetDialogFragment { ...@@ -78,16 +94,28 @@ public class LoginState extends BottomSheetDialogFragment {
// get Window size // get Window size
int getHeight = Resources.getSystem().getDisplayMetrics().heightPixels; int getHeight = Resources.getSystem().getDisplayMetrics().heightPixels;
int setHeight = getHeight - (getHeight * 10) / 100; int setHeight = getHeight - (getHeight * 5) / 100;
// set max height // set max height
sheetBehavior.setPeekHeight(setHeight); sheetBehavior.setPeekHeight(setHeight);
loginLayout.setMinimumHeight(setHeight); loginLayout.setMinimumHeight(setHeight);
Log.d(TAG, "onCreateDialog: "+sheetBehavior.getState()); // alert dialog buat nampilin error
alertDialog = new AlertDialog.Builder(context)
.setTitle("Username dan Password Salah")
.setMessage("Oppss! Username dan Password yang kamu masukan salah!")
.setPositiveButton("Coba Lagi", null)
.setCancelable(false)
.create();
loginButton.setOnClickListener(view1 -> { loginButton.setOnClickListener(view1 -> {
if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) loginAuth(view1); if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) {
bar.setVisibility(View.VISIBLE);
loginButton.setText("");
sheetDialog.setCancelable(false);
loginAuth(view1);
}
}); });
// close btn is clicked // close btn is clicked
...@@ -100,7 +128,6 @@ public class LoginState extends BottomSheetDialogFragment { ...@@ -100,7 +128,6 @@ public class LoginState extends BottomSheetDialogFragment {
} }
private void loginAuth(View v) { private void loginAuth(View v) {
Snackbar snackbar = Snackbar.make(v, "Oppss! Wrong Username Or Password!", Snackbar.LENGTH_LONG);
if (TextUtils.isEmpty(username.getText().toString()) && if (TextUtils.isEmpty(username.getText().toString()) &&
TextUtils.isEmpty(password.getText().toString())){ TextUtils.isEmpty(password.getText().toString())){
...@@ -111,37 +138,73 @@ public class LoginState extends BottomSheetDialogFragment { ...@@ -111,37 +138,73 @@ public class LoginState extends BottomSheetDialogFragment {
}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
*/
// aktifkan progress bar
bar.setVisibility(View.VISIBLE);
// hilangkan tulisan di button
loginButton.setText("");
// nonaktifkan semua form
username.setEnabled(false); username.setEnabled(false);
password.setEnabled(false); password.setEnabled(false);
loginButton.setEnabled(false); loginButton.setEnabled(false);
closeBtn.setEnabled(false); closeBtn.setEnabled(false);
// buat checking login
mainViewModels.checkLogin(new UsersModels(username.getText().toString(), mainViewModels.checkLogin(new UsersModels(username.getText().toString(),
password.getText().toString())).observe((LifecycleOwner) context, new Observer<DataResponse<UsersModels>>() { password.getText().toString()))
.observe((LifecycleOwner) context, new Observer<DataResponse<UsersModels>>() {
@Override @Override
public void onChanged(DataResponse<UsersModels> usersModelsDataResponse) { public void onChanged(DataResponse<UsersModels> usersModelsDataResponse) {
Log.d("Status", usersModelsDataResponse.getMessageData());
if (usersModelsDataResponse != null) { if (usersModelsDataResponse != null) {
/**
* Jika response atau data ada dan cocok
*/
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);
// editor.commit(); // editor.commit();
// redirect ke home
startActivity(new Intent(context, MainActivity.class)); startActivity(new Intent(context, MainActivity.class));
// set progress bar jadi nonaktif
bar.setVisibility(View.GONE);
// munculkan tulisan default di button sign in
loginButton.setText(DEFAULT_LOGIN_NAME);
// ubah sheet dialog jadi tidak bisa di slide atau cancel
sheetDialog.setCancelable(true);
// 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 { } else {
utils.snackBar(v, "Oppss! Wrong Username Or Password!").show(); /**
* Jika response atau data tidak cocok
*/
bar.setVisibility(View.GONE);
loginButton.setText(DEFAULT_LOGIN_NAME);
sheetDialog.setCancelable(true);
utils.snackBar(v, "Oppss! Wrong Username or Password!").show();
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 { } else {
bar.setVisibility(View.VISIBLE);
utils.snackBar(v, "Oppss! ログイン中にエラーが発生しました。しばらくしてからもう一度お試しください").show(); utils.snackBar(v, "Oppss! ログイン中にエラーが発生しました。しばらくしてからもう一度お試しください").show();
} }
......
package com.yono.messeripos;
import android.app.Dialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
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.textfield.TextInputEditText;
import com.yono.messeripos.models.MainViewModels;
import com.yono.messeripos.utils.Utils;
public class RegisterState extends BottomSheetDialogFragment {
private static final String TAG = "RegisterState";
BottomSheetBehavior sheetBehavior2;
BottomSheetDialog sheetDialog2;
RelativeLayout registerLayout;
TextInputEditText username, email, password, repassword;
MaterialButton registerButton;
ImageView closeBtn;
Context context;
MainViewModels mainViewModels;
SharedPreferences sharedPreferences;
Utils utils;
public RegisterState(Context context, MainViewModels mainViewModels) {
this.context = context;
this.mainViewModels = mainViewModels;
}
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
sheetDialog2 = (BottomSheetDialog) super.onCreateDialog(savedInstanceState);
// inflating layout
View view = View.inflate(getContext(), R.layout.register_form, null);
// bindUI
registerLayout = view.findViewById(R.id.RegisterLayout);
username = view.findViewById(R.id.ETUsernameReg);
email = view.findViewById(R.id.ETEmailReg);
password = view.findViewById(R.id.ETPasswordReg);
repassword = view.findViewById(R.id.ETRePasswordReg);
registerButton = view.findViewById(R.id.MBRegister);
closeBtn = view.findViewById(R.id.ivclose);
// create session
sharedPreferences = context.getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
// utils
utils = new Utils();
sheetDialog2.setContentView(view);
sheetBehavior2 = BottomSheetBehavior.from((View) (view.getParent()));
// get Window size
int getHeight = Resources.getSystem().getDisplayMetrics().heightPixels;
int setHeight = getHeight - (getHeight * 5) / 100;
// set max height
sheetBehavior2.setPeekHeight(setHeight);
registerLayout.setMinimumHeight(setHeight);
Log.d(TAG, "onCreateDialog: " + sheetBehavior2.getState());
// loginButton.setOnClickListener(view1 -> {
// if (sheetBehavior.getState() != BottomSheetBehavior.STATE_EXPANDED) loginAuth(view1);
// });
// close btn is clicked
closeBtn.setOnClickListener(view12 -> {
Log.d(TAG, "onCreateDialog: " + sheetBehavior2.getState());
sheetDialog2.dismiss();
});
return sheetDialog2;
}
}
...@@ -11,4 +11,7 @@ import retrofit2.http.POST; ...@@ -11,4 +11,7 @@ import retrofit2.http.POST;
public interface UsersService { public interface UsersService {
@POST(ApiHelper.VERSI_API_1+"login") @POST(ApiHelper.VERSI_API_1+"login")
Call<DataResponse<UsersModels>> checkLogin(@Body UsersModels usersModels); Call<DataResponse<UsersModels>> checkLogin(@Body UsersModels usersModels);
@POST(ApiHelper.VERSI_API_1+"register")
Call<DataResponse<UsersModels>> postRegister(@Body UsersModels usersModels);
} }
...@@ -29,6 +29,8 @@ public class MainViewModels extends ViewModel { ...@@ -29,6 +29,8 @@ public class MainViewModels extends ViewModel {
MutableLiveData<DataResponse<List<ProductModels>>> productByCategory; MutableLiveData<DataResponse<List<ProductModels>>> productByCategory;
MutableLiveData<DataResponse<List<CategoryModels>>> categoryList; MutableLiveData<DataResponse<List<CategoryModels>>> categoryList;
MutableLiveData<DataResponse<UsersModels>> usersLogin; MutableLiveData<DataResponse<UsersModels>> usersLogin;
MutableLiveData<DataResponse<UsersModels>> usersRegister;
MutableLiveData<DataResponse<List<PaymentsModels<String>>>> transactions; MutableLiveData<DataResponse<List<PaymentsModels<String>>>> transactions;
private MainViewModels mainViewModels; private MainViewModels mainViewModels;
...@@ -36,7 +38,7 @@ public class MainViewModels extends ViewModel { ...@@ -36,7 +38,7 @@ public class MainViewModels extends ViewModel {
Client client = new Client(); Client client = new Client();
Utils utils = new Utils(); Utils utils = new Utils();
public MainViewModels(){ public MainViewModels() {
productList = new MutableLiveData<>(); productList = new MutableLiveData<>();
categoryList = new MutableLiveData<>(); categoryList = new MutableLiveData<>();
productByCategory = new MutableLiveData<>(); productByCategory = new MutableLiveData<>();
...@@ -44,26 +46,26 @@ public class MainViewModels extends ViewModel { ...@@ -44,26 +46,26 @@ public class MainViewModels extends ViewModel {
} }
public LiveData<DataResponse<List<ProductModels<CategoryModels>>>> getProduct(){ public LiveData<DataResponse<List<ProductModels<CategoryModels>>>> getProduct() {
getProductList(); getProductList();
return productList; return productList;
} }
public LiveData<DataResponse<List<CategoryModels>>> getCategory(){ public LiveData<DataResponse<List<CategoryModels>>> getCategory() {
getCategoryList(); getCategoryList();
return categoryList; return categoryList;
} }
public void postCategory(CategoryModels categoryModels){ public void postCategory(CategoryModels categoryModels) {
saveCategory(categoryModels); saveCategory(categoryModels);
} }
public LiveData<DataResponse<List<ProductModels>>> getProductByCategory(int id){ public LiveData<DataResponse<List<ProductModels>>> getProductByCategory(int id) {
getDataProductByCategory(id); getDataProductByCategory(id);
return productByCategory; return productByCategory;
} }
public LiveData<DataResponse<List<PaymentsModels<String>>>> getAllTransactions(){ public LiveData<DataResponse<List<PaymentsModels<String>>>> getAllTransactions() {
getDataTransaction(); getDataTransaction();
return transactions; return transactions;
} }
...@@ -74,27 +76,27 @@ public class MainViewModels extends ViewModel { ...@@ -74,27 +76,27 @@ public class MainViewModels extends ViewModel {
categoryServise.addCategory(categoryModels).enqueue(new Callback<DataResponse<CategoryModels>>() { categoryServise.addCategory(categoryModels).enqueue(new Callback<DataResponse<CategoryModels>>() {
@Override @Override
public void onResponse(Call<DataResponse<CategoryModels>> call, Response<DataResponse<CategoryModels>> response) { public void onResponse(Call<DataResponse<CategoryModels>> call, Response<DataResponse<CategoryModels>> response) {
Log.i("Add Categiry", "onResponse: "+utils.convertGson(response.body())); Log.i("Add Categiry", "onResponse: " + utils.convertGson(response.body()));
} }
@Override @Override
public void onFailure(Call<DataResponse<CategoryModels>> call, Throwable t) { public void onFailure(Call<DataResponse<CategoryModels>> call, Throwable t) {
Log.e("error add", "onFailure: ",t ); Log.e("error add", "onFailure: ", t);
} }
}); });
} }
public void deleteProducts(int id){ public void deleteProducts(int id) {
ProductService productService = client.Client(ProductService.class); ProductService productService = client.Client(ProductService.class);
productService.deleteProducts(id).enqueue(new Callback<DataResponse<ProductModels>>() { productService.deleteProducts(id).enqueue(new Callback<DataResponse<ProductModels>>() {
@Override @Override
public void onResponse(Call<DataResponse<ProductModels>> call, Response<DataResponse<ProductModels>> response) { public void onResponse(Call<DataResponse<ProductModels>> call, Response<DataResponse<ProductModels>> response) {
Log.i("Delete", "onResponse: "+utils.convertGson(response.body())); Log.i("Delete", "onResponse: " + utils.convertGson(response.body()));
} }
@Override @Override
public void onFailure(Call<DataResponse<ProductModels>> call, Throwable t) { public void onFailure(Call<DataResponse<ProductModels>> call, Throwable t) {
Log.e("error delete", "onFailure: ",t ); Log.e("error delete", "onFailure: ", t);
} }
}); });
} }
...@@ -106,17 +108,17 @@ public class MainViewModels extends ViewModel { ...@@ -106,17 +108,17 @@ public class MainViewModels extends ViewModel {
@Override @Override
public void onResponse(Call<DataResponse<List<PaymentsModels<String>>>> call, public void onResponse(Call<DataResponse<List<PaymentsModels<String>>>> call,
Response<DataResponse<List<PaymentsModels<String>>>> response) { Response<DataResponse<List<PaymentsModels<String>>>> response) {
Log.i("Get all transaction", "onResponse: "+utils.convertGson(response.body())); Log.i("Get all transaction", "onResponse: " + utils.convertGson(response.body()));
if (response.body() != null){ if (response.body() != null) {
transactions.setValue(response.body()); transactions.setValue(response.body());
}else{ } else {
transactions = null; transactions = null;
} }
} }
@Override @Override
public void onFailure(Call<DataResponse<List<PaymentsModels<String>>>> call, Throwable t) { public void onFailure(Call<DataResponse<List<PaymentsModels<String>>>> call, Throwable t) {
Log.e("Error get transaction", "onFailure: ",t ); Log.e("Error get transaction", "onFailure: ", t);
transactions = null; transactions = null;
} }
}); });
...@@ -130,8 +132,8 @@ public class MainViewModels extends ViewModel { ...@@ -130,8 +132,8 @@ public class MainViewModels extends ViewModel {
public void onResponse(Call<DataResponse<List<ProductModels>>> call, public void onResponse(Call<DataResponse<List<ProductModels>>> call,
Response<DataResponse<List<ProductModels>>> response) { Response<DataResponse<List<ProductModels>>> response) {
String js = new Gson().toJson(response.body()); String js = new Gson().toJson(response.body());
Log.i("Get data by category", "onResponse: "+js); Log.i("Get data by category", "onResponse: " + js);
if (response != null){ if (response != null) {
productByCategory.setValue(response.body()); productByCategory.setValue(response.body());
} }
} }
...@@ -143,28 +145,53 @@ public class MainViewModels extends ViewModel { ...@@ -143,28 +145,53 @@ public class MainViewModels extends ViewModel {
}); });
} }
public MutableLiveData<DataResponse<UsersModels>> checkLogin(UsersModels usersModels){ public MutableLiveData<DataResponse<UsersModels>> checkLogin(UsersModels usersModels) {
usersLogin = new MutableLiveData<>(); usersLogin = new MutableLiveData<>();
PeriksaLogin(usersModels); PeriksaLogin(usersModels);
return usersLogin; return usersLogin;
} }
public MutableLiveData<DataResponse<UsersModels>> checkRegis(UsersModels usersModels){
usersRegister = new MutableLiveData<>();
CreateRegister(usersModels);
return usersRegister;
}
private void PeriksaLogin(UsersModels usersModels) { private void PeriksaLogin(UsersModels usersModels) {
UsersService usersService = client.Client(UsersService.class); UsersService usersService = client.Client(UsersService.class);
//cek login
usersService.checkLogin(usersModels).enqueue(new Callback<DataResponse<UsersModels>>() { usersService.checkLogin(usersModels).enqueue(new Callback<DataResponse<UsersModels>>() {
@Override @Override
public void onResponse(Call<DataResponse<UsersModels>> call, Response<DataResponse<UsersModels>> response) { public void onResponse(Call<DataResponse<UsersModels>> call, Response<DataResponse<UsersModels>> response) {
if (response.body() != null){ if (response.body() != null) {
usersLogin.setValue(response.body()); usersLogin.setValue(response.body());
} }
String js = new Gson().toJson(response.body()); String js = new Gson().toJson(response.body());
Log.d("Periksa login", "Response "+js); Log.d("Periksa login", "Response " + js);
}
@Override
public void onFailure(Call<DataResponse<UsersModels>> call, Throwable t) {
Log.e("Error Login", "Response " + t.getMessage());
}
});
}
private void CreateRegister(UsersModels usersModels){
UsersService usersService = client.Client(UsersService.class);
//post register
usersService.postRegister(usersModels).enqueue(new Callback<DataResponse<UsersModels>>() {
@Override
public void onResponse(Call<DataResponse<UsersModels>> call, Response<DataResponse<UsersModels>> response) {
} }
@Override @Override
public void onFailure(Call<DataResponse<UsersModels>> call, Throwable t) { public void onFailure(Call<DataResponse<UsersModels>> call, Throwable t) {
Log.e("Error Login", "Response "+t.getMessage()); Log.e("Error Register","Response"+t.getMessage());
} }
}); });
} }
...@@ -176,40 +203,40 @@ public class MainViewModels extends ViewModel { ...@@ -176,40 +203,40 @@ public class MainViewModels extends ViewModel {
productService.getProducts().enqueue(new Callback<DataResponse<List<ProductModels<CategoryModels>>>>() { productService.getProducts().enqueue(new Callback<DataResponse<List<ProductModels<CategoryModels>>>>() {
@Override @Override
public void onResponse(Call<DataResponse<List<ProductModels<CategoryModels>>>> call, Response<DataResponse<List<ProductModels<CategoryModels>>>> response) { public void onResponse(Call<DataResponse<List<ProductModels<CategoryModels>>>> call, Response<DataResponse<List<ProductModels<CategoryModels>>>> response) {
Log.i("Get products", "onResponse: "+utils.convertGson(response.body())); Log.i("Get products", "onResponse: " + utils.convertGson(response.body()));
if (response.body() != null){ if (response.body() != null) {
productList.setValue(response.body()); productList.setValue(response.body());
}else{ } else {
productList.setValue(null); productList.setValue(null);
} }
} }
@Override @Override
public void onFailure(Call<DataResponse<List<ProductModels<CategoryModels>>>> call, Throwable t) { public void onFailure(Call<DataResponse<List<ProductModels<CategoryModels>>>> call, Throwable t) {
Log.e("Error get product", "Response "+t.getMessage()); Log.e("Error get product", "Response " + t.getMessage());
} }
}); });
} }
private void getCategoryList(){ private void getCategoryList() {
CategoryServise categoryServise = client.Client(CategoryServise.class); CategoryServise categoryServise = client.Client(CategoryServise.class);
categoryServise.getCategory().enqueue(new Callback<DataResponse<List<CategoryModels>>>() { categoryServise.getCategory().enqueue(new Callback<DataResponse<List<CategoryModels>>>() {
@Override @Override
public void onResponse(Call<DataResponse<List<CategoryModels>>> call, Response<DataResponse<List<CategoryModels>>> response) { public void onResponse(Call<DataResponse<List<CategoryModels>>> call, Response<DataResponse<List<CategoryModels>>> response) {
String js = new Gson().toJson(response.body()); String js = new Gson().toJson(response.body());
Log.d("Get Data Category", "Response "+js); Log.d("Get Data Category", "Response " + js);
if (response.body() != null){ if (response.body() != null) {
categoryList.setValue(response.body()); categoryList.setValue(response.body());
}else { } else {
categoryList.setValue(null); categoryList.setValue(null);
} }
} }
@Override @Override
public void onFailure(Call<DataResponse<List<CategoryModels>>> call, Throwable t) { public void onFailure(Call<DataResponse<List<CategoryModels>>> call, Throwable t) {
Log.e("Error get product", "Response "+t.getMessage()); Log.e("Error get product", "Response " + t.getMessage());
} }
}); });
} }
......
...@@ -6,14 +6,31 @@ public class UsersModels { ...@@ -6,14 +6,31 @@ public class UsersModels {
@SerializedName("username") @SerializedName("username")
private String usernameUsers; private String usernameUsers;
@SerializedName("email")
private String emailUsers;
@SerializedName("password") @SerializedName("password")
private String passwordUsers; private String passwordUsers;
public UsersModels(String usernameUsers, String passwordUsers) { public UsersModels(String usernameUsers,String passwordUsers) {
this.usernameUsers = usernameUsers;
this.passwordUsers = passwordUsers;
}
public UsersModels(String usernameUsers, String emailUsers, String passwordUsers) {
this.usernameUsers = usernameUsers; this.usernameUsers = usernameUsers;
this.emailUsers = emailUsers;
this.passwordUsers = passwordUsers; this.passwordUsers = passwordUsers;
} }
public String getEmailUsers() {
return emailUsers;
}
public void setEmailUsers(String emailUsers) {
this.emailUsers = emailUsers;
}
public String getUsernameUsers() { public String getUsernameUsers() {
return usernameUsers; return usernameUsers;
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--<androidx.coordinatorlayout.widget.CoordinatorLayout android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- xmlns:app="http://schemas.android.com/apk/res-auto"-->
<!-- xmlns:tools="http://schemas.android.com/tools"-->
<!-- android:background="@drawable/gradient"-->
<!-- xmlns:android="http://schemas.android.com/apk/res/android"-->
<!-- tools:context=".LoginActivity">-->
<layout <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" xmlns:app="http://schemas.android.com/apk/res-auto"
...@@ -46,12 +38,11 @@ ...@@ -46,12 +38,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"/>
......
<RelativeLayout android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.github.florent37.expansionpanel.ExpansionHeader
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:id="@+id/sampleHeader"
app:expansion_headerIndicator="@id/headerIndicator"
app:expansion_layout="@id/expansionLayout"
app:expansion_toggleOnClick="true">
<RelativeLayout
android:background="@android:color/white"
android:layout_height="48dp"
android:layout_width="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<TextView
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Trip name"
android:textColor="#3E3E3E" />
<TextView
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_marginLeft="120dp"
android:layout_width="wrap_content"
android:text="Carribean cruise"
android:textColor="#AAA" />
<androidx.appcompat.widget.AppCompatImageView
android:adjustViewBounds="true"
android:id="@+id/headerIndicator"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_width="wrap_content"
app:srcCompat="@drawable/ic_expansion_header_indicator_grey_24dp" />
</RelativeLayout>
</com.github.florent37.expansionpanel.ExpansionHeader>
<com.github.florent37.expansionpanel.ExpansionLayout
android:id="@+id/expansionLayout"
app:expansion_expanded="false"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_marginVertical="2dp">
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvPayment"
android:clickable="true"
android:focusable="true"
android:checkable="true"
android:layout_height="wrap_content"
android:layout_width="match_parent"
app:layout_constraintTop_toTopOf="parent"
app:strokeWidth="1dp"
app:strokeColor="@color/color_stroke">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="15dp">
<ImageView
android:id="@+id/ivLogo"
android:layout_width="120dp"
android:layout_height="0dp"
android:src="@drawable/ic_bni_logo"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<RadioButton
android:id="@+id/rbPayment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:buttonTint="@color/colorPrimary"
android:enabled="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</com.github.florent37.expansionpanel.ExpansionLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!--<androidx.constraintlayout.widget.ConstraintLayout-->
<!-- android:id="@+id/ConstraintLoginLayout"-->
<!-- xmlns:android="http://schemas.android.com/apk/res/android"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- 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">-->
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/LoginLayout" <RelativeLayout
android:padding="20dp" android:id="@+id/LoginLayout"
style="@style/Widget.Rounded.BottomSheet" style="@style/Widget.Rounded.BottomSheet"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:padding="20dp">
<ImageButton <ImageButton
android:id="@+id/closeBtnLogin" android:id="@+id/closeBtnLogin"
android:layout_width="20dp" android:layout_width="20dp"
android:layout_height="20dp" android:layout_height="20dp"
android:src="@drawable/ic_baseline_plus_24" android:layout_alignParentStart="true"
android:scaleType="centerInside" android:layout_alignParentTop="true"
android:adjustViewBounds="true" android:adjustViewBounds="true"
android:padding="20dp"
android:backgroundTint="@android:color/transparent" android:backgroundTint="@android:color/transparent"
android:layout_alignParentTop="true" android:padding="20dp"
android:layout_alignParentStart="true" android:scaleType="centerInside"
/> android:src="@drawable/ic_close" />
<ImageView <ImageView
android:id="@+id/messerLogoInLogin" android:id="@+id/messerLogoInLogin"
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="150dp" android:layout_height="150dp"
android:src="@drawable/ic_messer_primary" android:layout_below="@id/closeBtnLogin"
android:layout_below="@id/closeBtnLogin" android:layout_centerHorizontal="true"
android:layout_centerHorizontal="true" android:layout_marginTop="20dp"
android:layout_marginTop="20dp"/> android:src="@drawable/ic_messer_primary" />
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textview.MaterialTextView
android:id="@+id/formUsernameLogin" android:id="@+id/tvLogin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/messerLogoInLogin"
android:paddingLeft="12dp"
android:text="Login Your Account"
android:textColor="@color/colorPrimary"
android:textFontWeight="600"
android:textSize="16sp" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/formUsernameLogin"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/tvLogin"
android:hint="@string/username">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ETUsernameLogin"
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:imeOptions="actionNext"
android:layout_below="@id/messerLogoInLogin" android:inputType="text" />
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/ETUsernameLogin" <com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent" android:id="@+id/FormPasswordLogin"
android:inputType="text" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:imeOptions="actionNext" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> android:layout_below="@id/formUsernameLogin"
android:layout_marginTop="20dp"
</com.google.android.material.textfield.TextInputLayout> android:hint="@string/password">
<com.google.android.material.textfield.TextInputLayout <com.google.android.material.textfield.TextInputEditText
android:id="@+id/FormPasswordLogin" android:id="@+id/ETPasswordLogin"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="@string/password" android:imeOptions="actionDone|actionGo"
android:layout_below="@id/formUsernameLogin" android:inputType="textPassword" />
android:layout_marginTop="20dp"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"> </com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputEditText <CheckBox
android:id="@+id/ETPasswordLogin" android:id="@+id/CBRememberMe"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:inputType="textPassword" android:layout_height="wrap_content"
android:imeOptions="actionDone|actionGo" android:layout_below="@id/FormPasswordLogin"
android:layout_height="wrap_content" android:layout_marginVertical="10dp"
/> android:text="Remember Me"
android:textColor="@color/colorPrimary"
</com.google.android.material.textfield.TextInputLayout> app:useMaterialThemeColors="true" />
<CheckBox <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/CBRememberMe" android:id="@+id/constraintBtn"
android:layout_width="wrap_content" android:layout_below="@id/CBRememberMe"
android:layout_height="wrap_content" android:layout_width="match_parent"
android:text="Remember Me" android:layout_height="wrap_content">
android:textColor="@color/colorPrimary"
android:layout_below="@id/FormPasswordLogin" <com.google.android.material.button.MaterialButton
android:layout_marginVertical="10dp" android:id="@+id/SignInButtonInLogin"
app:useMaterialThemeColors="true"/> android:layout_width="match_parent"
android:layout_height="wrap_content"
<com.google.android.material.button.MaterialButton android:text="Sign in"
android:id="@+id/SignInButtonInLogin" android:padding="20dp"
android:layout_width="match_parent" app:layout_constraintTop_toTopOf="parent"
android:layout_height="wrap_content" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/CBRememberMe" app:layout_constraintEnd_toEndOf="parent"
android:text="Sign In" app:layout_constraintStart_toStartOf="parent"/>
android:layout_below="@id/CBRememberMe"
android:padding="20dp"/> <ProgressBar
android:id="@+id/progressLogin"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="2dp"
app:layout_constraintBottom_toBottomOf="@id/SignInButtonInLogin"
app:layout_constraintTop_toTopOf="@id/SignInButtonInLogin"
app:layout_constraintStart_toStartOf="@id/SignInButtonInLogin"
app:layout_constraintEnd_toEndOf="@id/SignInButtonInLogin"
/>
<com.google.android.material.textview.MaterialTextView </androidx.constraintlayout.widget.ConstraintLayout>
android:layout_width="wrap_content"
android:layout_height="wrap_content" <com.google.android.material.textview.MaterialTextView
android:text="Forgot Password?" android:id="@+id/forgotPwd"
android:layout_below="@id/SignInButtonInLogin" android:layout_width="wrap_content"
android:layout_marginTop="10dp" android:layout_height="wrap_content"
android:layout_alignParentEnd="true" android:text="Forgot Password?"
android:textColor="@color/colorPrimary"/> android:layout_below="@id/constraintBtn"
android:layout_marginTop="10dp"
android:layout_alignParentEnd="true"
android:textColor="@color/colorPrimary"/>
</RelativeLayout> </RelativeLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:tools="http://schemas.android.com/tools"
android:layout_height="match_parent"
android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_marginVertical="2dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvPayment"
android:clickable="true"
android:focusable="true"
android:checkable="true"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
app:strokeWidth="1dp"
app:strokeColor="@color/color_stroke">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp">
<ImageView
android:id="@+id/ivLogo"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:src="@drawable/cash_logo"
android:layout_alignParentStart="true"/>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
<include
android:id="@+id/bankPayment"
layout="@layout/expansion_header_layout"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_below="@id/cvPayment"/>
<com.google.android.material.card.MaterialCardView
android:id="@+id/cvNFC"
android:clickable="true"
android:focusable="true"
android:checkable="true"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:layout_below="@id/bankPayment"
app:strokeWidth="1dp"
app:strokeColor="@color/color_stroke">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:padding="5dp">
<ImageView
android:id="@+id/nfcLogo"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:src="@drawable/nfc_icon"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="NFC Payment"
android:textSize="20dp"
android:textColor="#F7686868"
android:fontFamily="@font/poppins_medium"
android:layout_toEndOf="@id/nfcLogo"
android:layout_centerVertical="true"/>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout <layout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/ConstraintRegisterLayout" xmlns:app="http://schemas.android.com/apk/res-auto">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_width="match_parent" android:layout_height="match_parent">
android:layout_height="match_parent"
android:fitsSystemWindows="true" <RelativeLayout
android:paddingTop="10dp" android:id="@+id/RegisterLayout"
android:orientation="vertical" android:padding="20dp"
app:behavior_peekHeight="0dp" style="@style/Widget.Rounded.BottomSheet"
app:layout_behavior="com.google.android.material.bottomsheet.BottomSheetBehavior"
style="@style/Widget.Rounded.BottomSheet">
<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"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0">
<ImageButton <ImageButton
android:id="@+id/ivclose" android:id="@+id/ivclose"
...@@ -32,7 +22,7 @@ ...@@ -32,7 +22,7 @@
android:padding="10dp" android:padding="10dp"
android:src="@drawable/ic_close" android:src="@drawable/ic_close"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
tools:ignore="MissingConstraints" /> />
<ImageView <ImageView
...@@ -40,172 +30,118 @@ ...@@ -40,172 +30,118 @@
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="150dp" android:layout_height="150dp"
android:src="@drawable/ic_messer_primary" android:src="@drawable/ic_messer_primary"
app:layout_constraintBottom_toBottomOf="parent" android:layout_below="@+id/ivclose"
app:layout_constraintEnd_toEndOf="parent" android:layout_centerHorizontal="true" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivclose"
app:layout_constraintVertical_bias="0.0" />
<com.google.android.material.textview.MaterialTextView <com.google.android.material.textview.MaterialTextView
android:id="@+id/tvLoginToAcc" android:id="@+id/tvCreate"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Create Your Account" android:text="Create Your Account"
android:textColor="@color/colorPrimary" android:textColor="@color/colorPrimary"
android:textFontWeight="600" android:textFontWeight="600"
android:textSize="16sp" android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent" android:layout_below="@id/ivMeserRegister"
app:layout_constraintEnd_toEndOf="parent" android:paddingLeft="12dp"
app:layout_constraintHorizontal_bias="0.116" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivMeserRegister"
app:layout_constraintVertical_bias="0.039" />
<com.google.android.material.textfield.TextInputLayout
<com.google.android.material.card.MaterialCardView android:id="@+id/formUsernameReg"
android:id="@+id/cvLogin" android:layout_width="match_parent"
android:layout_width="0dp" android:layout_height="wrap_content"
android:layout_height="0dp" android:hint="@string/username"
android:layout_marginHorizontal="30dp" android:layout_below="@id/tvCreate"
android:backgroundTint="@android:color/transparent" style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
app:cardElevation="0dp"
app:layout_constraintBottom_toBottomOf="parent" <com.google.android.material.textfield.TextInputEditText
app:layout_constraintEnd_toEndOf="parent" android:id="@+id/ETUsernameReg"
app:layout_constraintStart_toStartOf="parent" android:layout_width="match_parent"
app:layout_constraintTop_toBottomOf="@id/tvLoginToAcc" android:inputType="text"
app:layout_constraintVertical_bias="0.0"> android:imeOptions="actionNext"
android:layout_height="wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/formEmailReg"
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">
<androidx.constraintlayout.widget.ConstraintLayout <com.google.android.material.textfield.TextInputEditText
android:id="@+id/ETEmailReg"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:inputType="textEmailAddress"
android:imeOptions="actionNext"
<com.google.android.material.textfield.TextInputLayout android:layout_height="wrap_content"
android:id="@+id/tfUsername" />
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent" </com.google.android.material.textfield.TextInputLayout>
android:layout_height="wrap_content"
android:layout_marginVertical="5dp" <com.google.android.material.textfield.TextInputLayout
android:hint="@string/username" android:id="@+id/FormPasswordReg"
app:layout_constraintEnd_toEndOf="parent" android:layout_width="match_parent"
app:layout_constraintStart_toStartOf="parent" android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent" android:hint="@string/password"
app:layout_constraintVertical_bias="0.0"> android:layout_below="@id/formEmailReg"
android:layout_marginTop="5dp"
<com.google.android.material.textfield.TextInputEditText style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
android:id="@+id/tiUsername"
android:layout_width="match_parent" <com.google.android.material.textfield.TextInputEditText
android:layout_height="match_parent" android:id="@+id/ETPasswordReg"
android:imeOptions="actionNext" android:layout_width="match_parent"
android:inputType="text" android:inputType="textPassword"
android:textColor="@color/colorPrimary" /> android:imeOptions="actionDone|actionGo"
</com.google.android.material.textfield.TextInputLayout> android:layout_height="wrap_content"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfEmail" </com.google.android.material.textfield.TextInputLayout>
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent"
android:layout_height="wrap_content" <com.google.android.material.textfield.TextInputLayout
android:layout_marginVertical="5dp" android:id="@+id/FormRePasswordReg"
android:hint="@string/email" android:layout_width="match_parent"
app:layout_constraintBottom_toBottomOf="parent" android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tfUsername" android:hint="@string/password_Confirmation"
app:layout_constraintVertical_bias="0.0"> android:layout_below="@id/FormPasswordReg"
android:layout_marginTop="5dp"
<com.google.android.material.textfield.TextInputEditText style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox">
android:id="@+id/tiEmail"
android:layout_width="match_parent" <com.google.android.material.textfield.TextInputEditText
android:layout_height="match_parent" android:id="@+id/ETRePasswordReg"
android:imeOptions="actionGo" android:layout_width="match_parent"
android:inputType="textEmailAddress" android:inputType="textPassword"
android:textColor="@color/colorPrimary" /> android:imeOptions="actionDone|actionGo"
</com.google.android.material.textfield.TextInputLayout> android:layout_height="wrap_content"
/>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/tfPassword" </com.google.android.material.textfield.TextInputLayout>
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="match_parent" <CheckBox
android:layout_height="wrap_content" android:id="@+id/cbAgree"
android:layout_marginVertical="5dp" android:layout_width="wrap_content"
android:hint="@string/password" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent" android:text="I Agree of terms of use"
app:layout_constraintTop_toBottomOf="@id/tfEmail" android:textColor="@color/colorPrimary"
app:layout_constraintVertical_bias="0.0"> android:layout_below="@id/FormRePasswordReg"
android:layout_marginVertical="10dp"
<com.google.android.material.textfield.TextInputEditText app:useMaterialThemeColors="true"/>
android:id="@+id/tiPassword" <com.google.android.material.button.MaterialButton
android:layout_width="match_parent" android:id="@+id/MBRegister"
android:layout_height="match_parent" android:layout_width="match_parent"
android:imeOptions="actionGo" android:layout_height="wrap_content"
android:inputType="textPassword" app:layout_constraintTop_toBottomOf="@id/cbAgree"
android:textColor="@color/colorPrimary" /> android:text="Create Account"
</com.google.android.material.textfield.TextInputLayout> android:layout_below="@id/cbAgree"
android:padding="20dp"/>
<com.google.android.material.textfield.TextInputLayout </RelativeLayout>
android:id="@+id/tfRePassword"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox" </androidx.coordinatorlayout.widget.CoordinatorLayout>
android:layout_width="match_parent" </layout>
android:layout_height="wrap_content" \ No newline at end of file
android:layout_marginVertical="5dp"
android:hint="@string/password"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/tfPassword"
app:layout_constraintVertical_bias="0.0">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/tiRePassword"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:imeOptions="actionGo"
android:inputType="textPassword"
android:textColor="@color/colorPrimary" />
</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 to terms of use"
android:textColor="@color/colorPrimary"
android:fontFamily="@font/poppins_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tfRePassword"
app:useMaterialThemeColors="true" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnLogin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:backgroundTint="@color/colorPrimary"
android:imeOptions="actionGo"
android:paddingVertical="15dp"
android:text="create"
android:textColor="@color/colorWhite"
android:textFontWeight="600"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbAgree"
app:layout_constraintVertical_bias="0.01999998" />
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:elevation="2dp"
app:layout_constraintBottom_toBottomOf="@id/btnLogin"
app:layout_constraintEnd_toEndOf="@id/btnLogin"
app:layout_constraintStart_toStartOf="@id/btnLogin"
app:layout_constraintTop_toTopOf="@id/btnLogin"
tools:layout_editor_absoluteX="64dp"
tools:layout_editor_absoluteY="337dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
<string name="open_cart">Open Cart</string> <string name="open_cart">Open Cart</string>
<string name="text_new_category">Add New Category</string> <string name="text_new_category">Add New Category</string>
<string name="email">Email</string> <string name="email">Email</string>
<string name="password_Confirmation">Password Confirmation</string>
<string-array name="planets_array"> <string-array name="planets_array">
<item>Mercury</item> <item>Mercury</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment