Commit bf527c11 authored by Muhammad Suryono's avatar Muhammad Suryono

update main

parent c6c27f3b
......@@ -116,11 +116,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;
}
......
......@@ -12,12 +12,13 @@ import androidx.sqlite.db.SupportSQLiteOpenHelper;
import com.yono.messeripos.daos.CartDaos;
import com.yono.messeripos.daos.PaymentPendingDaos;
import com.yono.messeripos.models.PaymentPending;
import com.yono.messeripos.models.ProductCartModels;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Database(entities = {ProductCartModels.class}, version = 1, exportSchema = false)
@Database(entities = {ProductCartModels.class, PaymentPending.class}, version = 1, exportSchema = false)
public abstract class LocalDatabase extends RoomDatabase {
public abstract CartDaos cartDaos();
......
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