Commit 308655a7 authored by fauzi's avatar fauzi

Merge branch 'dev' into cart

parents d18e8230 bf527c11
......@@ -115,11 +115,13 @@ public class LoginState extends BottomSheetDialogFragment {
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())){
}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{
}else
{
/**
* Jika tombol sign in ditekan
*
......
......@@ -8,6 +8,7 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.service.controls.actions.ModeAction;
import android.text.Editable;
import android.text.TextWatcher;
......@@ -18,6 +19,8 @@ import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Toast;
import androidx.annotation.NonNull;
......@@ -68,7 +71,7 @@ public class MainActivity extends AppCompatActivity {
CategoryAdapter categoryAdapter;
ProductAdapter productAdapter;
Utils utils = new Utils();
SharedPreferences sharedPreferences;
SharedPreferences sharedPreferences, sharedPreferencesLogin;
public static Boolean status_update = false;
MainViewModelsCart mainViewModelsCart;
public static Boolean cartIsEmpty;
......@@ -108,6 +111,7 @@ public class MainActivity extends AppCompatActivity {
productAdapter = new ProductAdapter();
mainViewModelsCart = new ViewModelProvider(MainActivity.this).get(MainViewModelsCart.class);
sharedPreferences = getSharedPreferences(MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
sharedPreferencesLogin = getSharedPreferences(SplashScreen.MY_SHARED_PREFERENCES, Context.MODE_PRIVATE);
checkout = sharedPreferences.getBoolean(CHECKOUT,false);
orderId = sharedPreferences.getString(ORDER_ID,"");
progressDialog = new ProgressDialog(MainActivity.this);
......@@ -178,6 +182,19 @@ public class MainActivity extends AppCompatActivity {
startActivity(new Intent(getApplicationContext(), FormProductActivity.class));
}else if (id == R.id.allTransaction){
startActivity(new Intent(getApplicationContext(), TransactionActivity.class));
}else if (id == R.id.logout){
progressDialog.show();
SharedPreferences.Editor editor = sharedPreferencesLogin.edit();
editor.putBoolean(SplashScreen.SESSION, false);
if(editor.commit()){
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(MainActivity.this, LoginActivity.class));
finish();
}
}, 700);
}
}
return true;
}
......
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