mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
commit
530d23de3e
@ -8,10 +8,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class TestListDelete {
|
public class TestListDelete {
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testListDeleterValid() {
|
|
||||||
testListDeleterCore(false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testListDeleterWOAccess() {
|
public void testListDeleterWOAccess() {
|
||||||
|
|||||||
@ -69,6 +69,12 @@ public class AuthManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void nullify() {
|
public void nullify() {
|
||||||
|
authSession = null;
|
||||||
|
authSignUpResult = null;
|
||||||
|
authSignInResult = null;
|
||||||
|
authResetPasswordResult = null;
|
||||||
|
authError = null;
|
||||||
|
email = null;
|
||||||
email = null;
|
email = null;
|
||||||
password = null;
|
password = null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -346,6 +346,7 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
totalPriceByStore.put(storeName, totalPriceByStore.get(storeName) - (Double.parseDouble(pPrices.get(position)) * Integer.parseInt(pQuantity.get(position))));
|
totalPriceByStore.put(storeName, totalPriceByStore.get(storeName) - (Double.parseDouble(pPrices.get(position)) * Integer.parseInt(pQuantity.get(position))));
|
||||||
pPrices.set(storeHeaderIndex.get(storeName), df.format(totalPriceByStore.get(storeName)));
|
pPrices.set(storeHeaderIndex.get(storeName), df.format(totalPriceByStore.get(storeName)));
|
||||||
|
|
||||||
|
|
||||||
totalPrice -= (Double.parseDouble(pPrices.get(position)) * Double.parseDouble(pQuantity.get(position)));
|
totalPrice -= (Double.parseDouble(pPrices.get(position)) * Double.parseDouble(pQuantity.get(position)));
|
||||||
tvTotalPrice.setText(String.format("$%.2f", totalPrice));
|
tvTotalPrice.setText(String.format("$%.2f", totalPrice));
|
||||||
|
|
||||||
@ -369,7 +370,11 @@ public class ListPage extends AppCompatActivity implements Requestor.Receiver {
|
|||||||
if(!pNames.isEmpty()) {
|
if(!pNames.isEmpty()) {
|
||||||
name.setText(pNames.get(position));
|
name.setText(pNames.get(position));
|
||||||
store.setText(pStores.get(position));
|
store.setText(pStores.get(position));
|
||||||
price.setText("$" + pPrices.get(position));
|
if (Double.parseDouble(pPrices.get(position)) * Double.parseDouble(pQuantity.get(position)) <= 0) {
|
||||||
|
price.setText(String.format("$%s", pPrices.get(position)));
|
||||||
|
} else {
|
||||||
|
price.setText(String.format("$%s ($%.2f)", pPrices.get(position), Double.parseDouble(pPrices.get(position)) * Double.parseDouble(pQuantity.get(position))));
|
||||||
|
}
|
||||||
|
|
||||||
if(pQuantity.get(position).equals("-1")) {
|
if(pQuantity.get(position).equals("-1")) {
|
||||||
quantity.setVisibility(View.GONE);
|
quantity.setVisibility(View.GONE);
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import androidx.navigation.NavController;
|
|||||||
import androidx.navigation.Navigation;
|
import androidx.navigation.Navigation;
|
||||||
import androidx.navigation.ui.AppBarConfiguration;
|
import androidx.navigation.ui.AppBarConfiguration;
|
||||||
import androidx.navigation.ui.NavigationUI;
|
import androidx.navigation.ui.NavigationUI;
|
||||||
|
|
||||||
import com.amplifyframework.auth.AuthException;
|
import com.amplifyframework.auth.AuthException;
|
||||||
import com.example.listify.data.Item;
|
import com.example.listify.data.Item;
|
||||||
import com.example.listify.data.ItemSearch;
|
import com.example.listify.data.ItemSearch;
|
||||||
@ -23,15 +22,16 @@ import com.example.listify.data.List;
|
|||||||
import com.example.listify.data.ListEntry;
|
import com.example.listify.data.ListEntry;
|
||||||
import com.example.listify.ui.LoginPage;
|
import com.example.listify.ui.LoginPage;
|
||||||
import com.google.android.material.navigation.NavigationView;
|
import com.google.android.material.navigation.NavigationView;
|
||||||
import static com.example.listify.SplashActivity.showSplash;
|
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static com.example.listify.SplashActivity.showSplash;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements CreateListDialogFragment.OnNewListListener {
|
public class MainActivity extends AppCompatActivity implements CreateListDialogFragment.OnNewListListener {
|
||||||
private AppBarConfiguration mAppBarConfiguration;
|
private AppBarConfiguration mAppBarConfiguration;
|
||||||
public static AuthManager am = new AuthManager();
|
public static AuthManager am = new AuthManager();
|
||||||
@ -61,7 +61,8 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
|||||||
}, 1);
|
}, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(am.getEmail() == null) {
|
if(am.getUserToken().equals("")) {
|
||||||
|
am.nullify();
|
||||||
Intent intent = new Intent(MainActivity.this, LoginPage.class);
|
Intent intent = new Intent(MainActivity.this, LoginPage.class);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -352,6 +352,7 @@ public class SearchResults extends AppCompatActivity implements FilterDialogFrag
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create a list of all stores in the results so the user can filter by store name
|
// Create a list of all stores in the results so the user can filter by store name
|
||||||
|
stores.clear();
|
||||||
for (int i = 0; i < resultsProductList.size(); i++) {
|
for (int i = 0; i < resultsProductList.size(); i++) {
|
||||||
if (!stores.contains(resultsProductList.get(i).getChainName())) {
|
if (!stores.contains(resultsProductList.get(i).getChainName())) {
|
||||||
stores.add(resultsProductList.get(i).getChainName());
|
stores.add(resultsProductList.get(i).getChainName());
|
||||||
@ -377,6 +378,17 @@ public class SearchResults extends AppCompatActivity implements FilterDialogFrag
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Reset price filter
|
||||||
|
double max = 0;
|
||||||
|
for (int i = 0; i < resultsProductListSorted.size(); i++){
|
||||||
|
if (resultsProductListSorted.get(i).getPrice().doubleValue() > max) {
|
||||||
|
max = resultsProductListSorted.get(i).getPrice().doubleValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.minPrice = 0;
|
||||||
|
this.maxPrice = max;
|
||||||
|
|
||||||
// Apply selected sorting to the list
|
// Apply selected sorting to the list
|
||||||
sortResults();
|
sortResults();
|
||||||
|
|
||||||
|
|||||||
@ -55,19 +55,30 @@ public class CheckBoxListViewAdapter extends BaseAdapter {
|
|||||||
holder = new ViewHolder();
|
holder = new ViewHolder();
|
||||||
holder.label = (TextView) convertView.findViewById(R.id.store_name);
|
holder.label = (TextView) convertView.findViewById(R.id.store_name);
|
||||||
holder.checkBox = (CheckBox)convertView.findViewById(R.id.store_check_box);
|
holder.checkBox = (CheckBox)convertView.findViewById(R.id.store_check_box);
|
||||||
|
holder.checkBox.setOnClickListener(new View.OnClickListener() {
|
||||||
holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onClick(View v) {
|
||||||
int getPosition = (Integer) buttonView.getTag();
|
int getPosition = (Integer) ((CompoundButton)(v)).getTag();
|
||||||
|
|
||||||
if (isChecked) {
|
if (((CompoundButton) v).isChecked()) {
|
||||||
checkedList.add(list.get(getPosition));
|
checkedList.add(list.get(getPosition));
|
||||||
} else {
|
} else {
|
||||||
checkedList.remove(list.get(getPosition));
|
checkedList.remove(list.get(getPosition));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// holder.checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
// @Override
|
||||||
|
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
|
// int getPosition = (Integer) buttonView.getTag();
|
||||||
|
//
|
||||||
|
// if (isChecked) {
|
||||||
|
// checkedList.add(list.get(getPosition));
|
||||||
|
// } else {
|
||||||
|
// checkedList.remove(list.get(getPosition));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
|
||||||
convertView.setOnClickListener(new View.OnClickListener() {
|
convertView.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -90,7 +90,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Descending"
|
android:text="Ascending"
|
||||||
android:textSize="16sp"
|
android:textSize="16sp"
|
||||||
android:textColor="@android:color/black"
|
android:textColor="@android:color/black"
|
||||||
android:paddingStart="16dp"/>
|
android:paddingStart="16dp"/>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user