Fixes for create list dialog

This commit is contained in:
Clayton Wilson 2020-10-08 19:27:16 -04:00
parent d3571cec3d
commit 96c3f2772d
5 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,7 @@ public class CreateListAddDialogFragment extends DialogFragment {
void sendNewListName(String name, int quantity); void sendNewListName(String name, int quantity);
} }
public OnNewListAddListener onNewListListener; public OnNewListAddListener onNewAddListListener;
EditText etNewListName; EditText etNewListName;
EditText etQuantity; EditText etQuantity;
@ -44,7 +44,7 @@ public class CreateListAddDialogFragment extends DialogFragment {
.setPositiveButton("OK", new DialogInterface.OnClickListener() { .setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int id) { public void onClick(DialogInterface dialog, int id) {
onNewListListener.sendNewListName(etNewListName.getText().toString(), Integer.parseInt(etQuantity.getText().toString())); onNewAddListListener.sendNewListName(etNewListName.getText().toString(), Integer.parseInt(etQuantity.getText().toString()));
} }
}) })
.setNegativeButton("cancel", new DialogInterface.OnClickListener() { .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
@ -89,7 +89,7 @@ public class CreateListAddDialogFragment extends DialogFragment {
public void onAttach(@NonNull Context context) { public void onAttach(@NonNull Context context) {
super.onAttach(context); super.onAttach(context);
try { try {
onNewListListener = (OnNewListAddListener) getActivity(); onNewAddListListener = (OnNewListAddListener) getActivity();
} catch (ClassCastException e) { } catch (ClassCastException e) {
Log.e("CreateListAddDialogFragment", "onAttach: ClassCastException: " + e.getMessage()); Log.e("CreateListAddDialogFragment", "onAttach: ClassCastException: " + e.getMessage());
} }

View File

@ -27,7 +27,7 @@ import java.util.Arrays;
import java.util.Properties; import java.util.Properties;
import java.util.Random; import java.util.Random;
public class MainActivity extends AppCompatActivity implements CreateListAddDialogFragment.OnNewListAddListener { public class MainActivity extends AppCompatActivity implements CreateListDialogFragment.OnNewListListener {
private AppBarConfiguration mAppBarConfiguration; private AppBarConfiguration mAppBarConfiguration;
@Override @Override
@ -176,7 +176,7 @@ public class MainActivity extends AppCompatActivity implements CreateListAddDial
} }
@Override @Override
public void sendNewListName(String name, int quantity) { public void sendNewListName(String name) {
AuthManager authManager = new AuthManager(); AuthManager authManager = new AuthManager();
try { try {
authManager.signIn("merzn@purdue.edu", "Password123"); authManager.signIn("merzn@purdue.edu", "Password123");

View File

@ -28,7 +28,7 @@ import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Properties; import java.util.Properties;
public class ListsFragment extends Fragment implements CreateListAddDialogFragment.OnNewListAddListener { public class ListsFragment extends Fragment implements CreateListDialogFragment.OnNewListListener {
ArrayList<List> shoppingLists = new ArrayList<>(); ArrayList<List> shoppingLists = new ArrayList<>();
ListView shoppingListsView; ListView shoppingListsView;
@ -89,7 +89,7 @@ public class ListsFragment extends Fragment implements CreateListAddDialogFragme
} }
@Override @Override
public void sendNewListName(String name, int quantity) { public void sendNewListName(String name) {
AuthManager authManager = new AuthManager(); AuthManager authManager = new AuthManager();
try { try {
authManager.signIn("merzn@purdue.edu", "Password123"); authManager.signIn("merzn@purdue.edu", "Password123");

View File

@ -16,7 +16,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_marginHorizontal="15dp" android:layout_marginHorizontal="15dp"
android:maxLines="1" android:singleLine="true"
android:hint="@string/new_list_name"/> android:hint="@string/new_list_name"/>
</LinearLayout> </LinearLayout>

View File

@ -16,7 +16,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:layout_marginHorizontal="15dp" android:layout_marginHorizontal="15dp"
android:maxLines="1" android:singleLine="true"
android:hint="@string/new_list_name"/> android:hint="@string/new_list_name"/>
<LinearLayout <LinearLayout