diff --git a/WarpDrinkApp/app/src/main/java/ms/warpzone/warppay/manager/MainManager.java b/WarpDrinkApp/app/src/main/java/ms/warpzone/warppay/manager/MainManager.java index f812cf18f0c2d00283159b229ad07c925f391e1c..f991f7055130eebe09d3f16b302ef34cbda9bb8e 100644 --- a/WarpDrinkApp/app/src/main/java/ms/warpzone/warppay/manager/MainManager.java +++ b/WarpDrinkApp/app/src/main/java/ms/warpzone/warppay/manager/MainManager.java @@ -6,23 +6,18 @@ import android.content.Context; import android.content.DialogInterface; import android.os.Handler; import android.util.Log; -import android.widget.Toast; import com.squareup.okhttp.Interceptor; import com.squareup.okhttp.OkHttpClient; import com.squareup.okhttp.Request; -import org.mindrot.jbcrypt.BCrypt; - import java.io.IOException; -import java.io.InputStream; -import java.security.Certificate; + import java.security.KeyManagementException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; import java.util.ArrayList; import java.util.List; import java.util.Timer; @@ -35,7 +30,6 @@ import ms.warpzone.warppay.MainActivity; import ms.warpzone.warppay.R; import ms.warpzone.warppay.data.SQLiteService; import ms.warpzone.warppay.data.models.local.Category; -import ms.warpzone.warppay.data.models.local.Product; import ms.warpzone.warppay.data.models.local.User; import ms.warpzone.warppay.data.RestService; import ms.warpzone.warppay.data.models.rest.RestCategory; @@ -62,7 +56,6 @@ public class MainManager { private boolean barcodeLearning=false; private Timer timer; private Timer screenSaverTimer; - public AlertDialog alertAmount; private ProgressDialog pdRefresh = null; private NotificationDialog ndRefreshError = null; private Timer tmrRefresh; @@ -134,11 +127,11 @@ public class MainManager { this.refreshData(); } - public void refreshData() { + void refreshData() { this.refreshData(false); } - public void refreshData(boolean disableDialog) { + private void refreshData(boolean disableDialog) { if(this.ndRefreshError != null) this.ndRefreshError.dismiss(); this.ndRefreshError = null; @@ -209,7 +202,7 @@ public class MainManager { ndRefreshError.getBuilder().setNeutralButton("Refresh", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { - MainManager.getInstance().refreshData(); + MainManager.this.refreshData(); } }); @@ -219,7 +212,7 @@ public class MainManager { final Runnable runnable = new Runnable() { @Override public void run() { - MainManager.getInstance().refreshData(); + MainManager.this.refreshData(); } }; @@ -234,7 +227,7 @@ public class MainManager { } } - public void setCurrentUser(User user) { + void setCurrentUser(User user) { this.setCurrentUser(user,false); } @@ -286,7 +279,7 @@ public class MainManager { this.timer.schedule(t, 60000); } - public void startRefreshTimer() { + private void startRefreshTimer() { this.tmrRefresh = new Timer(); TimerTask t = new TimerTask() { @Override @@ -305,7 +298,7 @@ public class MainManager { this.tmrRefresh.schedule(t, 60000,60000); } - public void stopRefreshTimer() { + private void stopRefreshTimer() { if (this.tmrRefresh != null) { this.tmrRefresh.cancel(); this.tmrRefresh.purge(); @@ -331,7 +324,7 @@ public class MainManager { this.screenSaverTimer.schedule(t, 4000); } - public void stopScreenSaverTimer() { + private void stopScreenSaverTimer() { if (this.screenSaverTimer != null) { this.screenSaverTimer.cancel(); this.screenSaverTimer.purge(); @@ -341,7 +334,7 @@ public class MainManager { return this.dataManager.getCurrentUser(); } - public void clearCurrentUser() { + void clearCurrentUser() { DataManager.getInstance().setLastCardId(""); this.dataManager.clearCurrentUser(); this.uiManager.clearCurrentUser(); @@ -368,7 +361,7 @@ public class MainManager { t.setAmount(amount); t.setTrans_type(1); t.setCash_paid(true); - ArrayList transactions = new ArrayList<>(); + ArrayList<RestTransaction> transactions = new ArrayList<>(); transactions.add(t); MainManager.getInstance().getRestService().saveTransaction(currentUser.getUserid(), transactions).enqueue(new Callback<Void>() {