diff --git a/app/src/main/java/pizza/olin/consamables/AdminPageActivity.java b/app/src/main/java/pizza/olin/consamables/AdminPageActivity.java index f57da71..e6c4991 100644 --- a/app/src/main/java/pizza/olin/consamables/AdminPageActivity.java +++ b/app/src/main/java/pizza/olin/consamables/AdminPageActivity.java @@ -26,6 +26,7 @@ import java.util.ArrayList; import java.util.Date; +import java.util.Locale; import pizza.olin.consamables.data.FirebaseHandler; import pizza.olin.consamables.types.GroupOrder; @@ -58,6 +59,7 @@ protected void onCreate(Bundle savedInstanceState) { @Override public void onClick(View view) { boolean isActiveOrder = false; + // ^This variable is not used if (maybeNewestOrder.isPresent()) { if (maybeNewestOrder.get().isClosed) { // cool @@ -137,10 +139,10 @@ private void updateTimer() { countDownTimer = new CountDownTimer(timeLeftInOrder, UPDATE_TIMER_MS) { public void onTick(long millisUntilFinished) { - timeLeft.setText(String.format( - "%02d:%02d", - millisUntilFinished / 1000 / 60, - millisUntilFinished / 1000 % 60)); + // To make your code more readable, do this: + long minutes = (millisUntilFinished / 1000) / 60; + long seconds = (millisUntilFinished / 1000) % 60; + timeLeft.setText(String.format(Locale.getDefault(), "%02d:%02d", minutes, seconds)); } public void onFinish() { @@ -152,6 +154,7 @@ public void onFinish() { countDownTimer.cancel(); } + // "Time's up" needs to be in strings.xml timeLeft.setText("Time's up!"); } } diff --git a/app/src/main/java/pizza/olin/consamables/OrderListFragment.java b/app/src/main/java/pizza/olin/consamables/OrderListFragment.java index 936820f..4344efb 100644 --- a/app/src/main/java/pizza/olin/consamables/OrderListFragment.java +++ b/app/src/main/java/pizza/olin/consamables/OrderListFragment.java @@ -34,6 +34,7 @@ public void onCreate(Bundle savedInstanceState) { orderId = getArguments().getString(ARG_ORDER_ID); } + // What is this? if (orderId != null) { } @@ -49,6 +50,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, } public void onButtonPressed(Uri uri) { + // What is this? if (mListener != null) { } } diff --git a/app/src/main/java/pizza/olin/consamables/WizardActivity.java b/app/src/main/java/pizza/olin/consamables/WizardActivity.java index d7de8a4..b0f5f8c 100644 --- a/app/src/main/java/pizza/olin/consamables/WizardActivity.java +++ b/app/src/main/java/pizza/olin/consamables/WizardActivity.java @@ -46,7 +46,8 @@ public class WizardActivity extends AppCompatActivity implements HalfOrWholePage.PizzaTypeListener, ToppingSelectPage.ToppingSelectListener, BeverageSelectPage.BeverageTypeListener, OrderConfirmationPage.OrderConfirmationListener, FinishedOrderPage.FinishedOrderListener { - private static final String TAG = "WizardActivity"; + // This is fine, but consider using WizardActivity.class.getName(); + private static final String TAG = WizardActivity.class.getName(); private static final String ANONYMOUS = "anonymous"; private static final int RC_SIGN_IN = 47; private FirebaseAuth mFirebaseAuth; @@ -60,6 +61,8 @@ public class WizardActivity extends AppCompatActivity @Override protected void onCreate(Bundle savedInstanceState) { + // This onCreate is huge. Consider refactoring into separate methods like getWizardSteps(), + // and handleEmailVerification() super.onCreate(savedInstanceState); setContentView(R.layout.activity_wizard); diff --git a/app/src/main/java/pizza/olin/consamables/data/SharedPrefsHandler.java b/app/src/main/java/pizza/olin/consamables/data/SharedPrefsHandler.java index 0c2f5fa..b469dff 100644 --- a/app/src/main/java/pizza/olin/consamables/data/SharedPrefsHandler.java +++ b/app/src/main/java/pizza/olin/consamables/data/SharedPrefsHandler.java @@ -45,6 +45,7 @@ public ArrayList getToppings() { return allToppings; } + // This method doesn't seem to be used public GroupOrder getCurrentOrder() { String serializedOrder = prefs.getString("Current Order", ""); GroupOrder order = gson.fromJson(serializedOrder, GroupOrder.class); diff --git a/app/src/main/java/pizza/olin/consamables/pages/BeverageSelectPage.java b/app/src/main/java/pizza/olin/consamables/pages/BeverageSelectPage.java index 02fcf95..c2d6148 100644 --- a/app/src/main/java/pizza/olin/consamables/pages/BeverageSelectPage.java +++ b/app/src/main/java/pizza/olin/consamables/pages/BeverageSelectPage.java @@ -1,7 +1,10 @@ package pizza.olin.consamables.pages; import android.content.Context; + +// Unused import! import android.net.Uri; + import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; diff --git a/app/src/main/java/pizza/olin/consamables/pages/FinishedOrderPage.java b/app/src/main/java/pizza/olin/consamables/pages/FinishedOrderPage.java index 89b9ab7..b84f7b6 100644 --- a/app/src/main/java/pizza/olin/consamables/pages/FinishedOrderPage.java +++ b/app/src/main/java/pizza/olin/consamables/pages/FinishedOrderPage.java @@ -20,6 +20,8 @@ public class FinishedOrderPage extends Fragment { private FinishedOrderListener mListener; + + // This isn't used private SharedPrefsHandler prefsHandler; public FinishedOrderPage() { diff --git a/app/src/main/java/pizza/olin/consamables/pages/OrderConfirmationPage.java b/app/src/main/java/pizza/olin/consamables/pages/OrderConfirmationPage.java index d045467..e55867d 100644 --- a/app/src/main/java/pizza/olin/consamables/pages/OrderConfirmationPage.java +++ b/app/src/main/java/pizza/olin/consamables/pages/OrderConfirmationPage.java @@ -52,6 +52,7 @@ public void setUserVisibleHint(boolean isVisible) { if (thisOrder.getBeverage() != null) { beverage.setText(thisOrder.getBeverage().getName()); } else { + // This needs to be in strings.xml beverage.setText("None"); } } diff --git a/app/src/main/java/pizza/olin/consamables/pages/ToppingSelectPage.java b/app/src/main/java/pizza/olin/consamables/pages/ToppingSelectPage.java index fc03bf4..7d31df2 100644 --- a/app/src/main/java/pizza/olin/consamables/pages/ToppingSelectPage.java +++ b/app/src/main/java/pizza/olin/consamables/pages/ToppingSelectPage.java @@ -67,7 +67,10 @@ public void setUserVisibleHint(boolean isVisible) { if (isVisible) { PizzaOrderType pizzaType = mListener.getPizzaType(); ViewGroup parent = (ViewGroup) getView(); + + // does parent always have at least 1 child? View currentView = parent.getChildAt(0); + int currentViewId = currentView.getId(); int targetViewId = viewOptions.get(pizzaType); int layoutId; diff --git a/app/src/main/java/pizza/olin/consamables/types/HalfPizza.java b/app/src/main/java/pizza/olin/consamables/types/HalfPizza.java index 3d97c4b..13ebf71 100644 --- a/app/src/main/java/pizza/olin/consamables/types/HalfPizza.java +++ b/app/src/main/java/pizza/olin/consamables/types/HalfPizza.java @@ -60,6 +60,7 @@ public String getDisplayName() { @Override public String getDisplayDetails() { + // Beautiful return Stream.of(toppings) .reduce("", new BiFunction() { @Override diff --git a/app/src/main/java/pizza/olin/consamables/types/WholePizza.java b/app/src/main/java/pizza/olin/consamables/types/WholePizza.java index 2e7a41c..62a0469 100644 --- a/app/src/main/java/pizza/olin/consamables/types/WholePizza.java +++ b/app/src/main/java/pizza/olin/consamables/types/WholePizza.java @@ -51,6 +51,7 @@ public String getDisplayName() { @Override public String getDisplayDetails() { + // None of these are used ArrayList leftToppings = leftHalf.getToppings(); ArrayList rightToppings = rightHalf.getToppings(); int leftMaxLength = getLeftMaxToppingLength();