mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
Various layout improvements
This commit is contained in:
parent
38aea790d8
commit
c1a8103da8
@ -46,28 +46,26 @@ public class UserDeleter implements CallHandler {
|
||||
awsCognitoIdentityProvider.adminDeleteUser(adminDeleteUserRequest);
|
||||
|
||||
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement(GET_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
System.out.println(statement);
|
||||
ResultSet userLists = statement.executeQuery();
|
||||
while (userLists.next()) {
|
||||
int listID = userLists.getInt("listID");
|
||||
|
||||
statement = connection.prepareStatement(DELETE_LIST_PRODUCT);
|
||||
statement.setInt(1, listID);
|
||||
System.out.println(statement);
|
||||
statement.executeQuery();
|
||||
}
|
||||
PreparedStatement statement = connection.prepareStatement(GET_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
System.out.println(statement);
|
||||
ResultSet userLists = statement.executeQuery();
|
||||
while (userLists.next()) {
|
||||
int listID = userLists.getInt("listID");
|
||||
|
||||
statement = connection.prepareStatement(DELETE_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
statement = connection.prepareStatement(DELETE_LIST_PRODUCT);
|
||||
statement.setInt(1, listID);
|
||||
System.out.println(statement);
|
||||
statement.executeQuery();
|
||||
connection.commit();
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
|
||||
statement = connection.prepareStatement(DELETE_LISTS);
|
||||
statement.setString(1, cognitoID);
|
||||
System.out.println(statement);
|
||||
statement.executeQuery();
|
||||
connection.commit();
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,6 +29,7 @@ public class CreateListDialogFragment extends DialogFragment {
|
||||
@Override
|
||||
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
||||
// Get the layout inflater
|
||||
LayoutInflater inflater = requireActivity().getLayoutInflater();
|
||||
|
||||
@ -59,7 +60,7 @@ public class CreateListDialogFragment extends DialogFragment {
|
||||
public void onAttach(@NonNull Context context) {
|
||||
super.onAttach(context);
|
||||
try {
|
||||
onNewListListener = (OnNewListListener) getActivity();
|
||||
onNewListListener = (OnNewListListener) getTargetFragment();
|
||||
} catch (ClassCastException e) {
|
||||
Log.e("CreateListDialogFragment", "onAttach: ClassCastException: " + e.getMessage());
|
||||
}
|
||||
|
||||
@ -74,11 +74,11 @@ public class ListPickerDialogFragment extends DialogFragment {
|
||||
userListsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
for (int i = 0; i < parent.getChildCount(); i++) {
|
||||
parent.getChildAt(i).setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
// for (int i = 0; i < parent.getChildCount(); i++) {
|
||||
// parent.getChildAt(i).setBackgroundColor(Color.TRANSPARENT);
|
||||
// }
|
||||
|
||||
parent.getChildAt(position).setBackgroundColor(Color.GREEN);
|
||||
// parent.getChildAt(position).setBackgroundColor(Color.GREEN);
|
||||
// view.setBackgroundColor(Color.GREEN);
|
||||
selectedListIndex = position;
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ public class MainActivity extends AppCompatActivity implements CreateListDialogF
|
||||
NavigationView navigationView = findViewById(R.id.nav_view);
|
||||
// Passing each menu ID as a set of Ids because each menu should be considered as top level destinations.
|
||||
mAppBarConfiguration = new AppBarConfiguration.Builder(
|
||||
R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow, R.id.nav_lists)
|
||||
R.id.nav_home, R.id.nav_lists)
|
||||
.setDrawerLayout(drawer)
|
||||
.build();
|
||||
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
|
||||
|
||||
@ -36,6 +36,7 @@ import static com.example.listify.MainActivity.am;
|
||||
|
||||
public class ListsFragment extends Fragment implements CreateListDialogFragment.OnNewListListener {
|
||||
ArrayList<List> shoppingLists = new ArrayList<>();
|
||||
DisplayShoppingListsAdapter displayShoppingListsAdapter;
|
||||
ListView shoppingListsView;
|
||||
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
@ -67,7 +68,7 @@ public class ListsFragment extends Fragment implements CreateListDialogFragment.
|
||||
|
||||
|
||||
// Set adapter and display this users lists
|
||||
DisplayShoppingListsAdapter displayShoppingListsAdapter = new DisplayShoppingListsAdapter(getActivity(), shoppingLists);
|
||||
displayShoppingListsAdapter = new DisplayShoppingListsAdapter(getActivity(), shoppingLists);
|
||||
shoppingListsView.setAdapter(displayShoppingListsAdapter);
|
||||
shoppingListsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||
@Override
|
||||
@ -81,11 +82,13 @@ public class ListsFragment extends Fragment implements CreateListDialogFragment.
|
||||
});
|
||||
|
||||
FloatingActionButton fab = (FloatingActionButton) root.findViewById(R.id.new_list_fab);
|
||||
Fragment thisFragment = this;
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
CreateListDialogFragment createListDialogFragment = new CreateListDialogFragment();
|
||||
createListDialogFragment.show(getActivity().getSupportFragmentManager(), "Create New List");
|
||||
createListDialogFragment.show(getFragmentManager(), "Create New List");
|
||||
createListDialogFragment.setTargetFragment(thisFragment, 0);
|
||||
}
|
||||
});
|
||||
|
||||
@ -108,7 +111,9 @@ public class ListsFragment extends Fragment implements CreateListDialogFragment.
|
||||
|
||||
try {
|
||||
requestor.postObject(newList, idReceiver, idReceiver);
|
||||
System.out.println(idReceiver.await());
|
||||
newList.setItemID(idReceiver.await());
|
||||
shoppingLists.add(newList);
|
||||
displayShoppingListsAdapter.notifyDataSetChanged();
|
||||
Toast.makeText(getContext(), String.format("%s created", name), Toast.LENGTH_LONG).show();
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(getContext(), "An error occurred", Toast.LENGTH_LONG).show();
|
||||
|
||||
@ -18,7 +18,9 @@
|
||||
android:layout_height="300dp"
|
||||
android:divider="@color/list_divider"
|
||||
android:dividerHeight="1dp"
|
||||
android:choiceMode="multipleChoiceModal"/>
|
||||
android:layout_marginHorizontal="50dp"
|
||||
android:choiceMode="singleChoice"
|
||||
android:listSelector="@color/colorAccent"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/nav_header_height"
|
||||
android:layout_height="10dp"
|
||||
android:background="@drawable/side_nav_bar"
|
||||
android:gravity="bottom"
|
||||
android:orientation="vertical"
|
||||
@ -12,24 +12,24 @@
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:contentDescription="@string/nav_header_desc"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
app:srcCompat="@mipmap/ic_launcher_round" />
|
||||
<!-- <ImageView-->
|
||||
<!-- android:id="@+id/imageView"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:contentDescription="@string/nav_header_desc"-->
|
||||
<!-- android:paddingTop="@dimen/nav_header_vertical_spacing"-->
|
||||
<!-- app:srcCompat="@mipmap/ic_launcher_round" />-->
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/nav_header_vertical_spacing"
|
||||
android:text="@string/nav_header_title"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:paddingTop="@dimen/nav_header_vertical_spacing"-->
|
||||
<!-- android:text="@string/nav_header_title"-->
|
||||
<!-- android:textAppearance="@style/TextAppearance.AppCompat.Body1" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/nav_header_subtitle" />
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/textView"-->
|
||||
<!-- android:layout_width="wrap_content"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="@string/nav_header_subtitle" />-->
|
||||
</LinearLayout>
|
||||
@ -8,14 +8,14 @@
|
||||
android:id="@+id/nav_home"
|
||||
android:icon="@drawable/ic_menu_camera"
|
||||
android:title="@string/menu_home" />
|
||||
<item
|
||||
android:id="@+id/nav_gallery"
|
||||
android:icon="@drawable/ic_menu_gallery"
|
||||
android:title="@string/menu_gallery" />
|
||||
<item
|
||||
android:id="@+id/nav_slideshow"
|
||||
android:icon="@drawable/ic_menu_slideshow"
|
||||
android:title="@string/menu_slideshow" />
|
||||
<!-- <item-->
|
||||
<!-- android:id="@+id/nav_gallery"-->
|
||||
<!-- android:icon="@drawable/ic_menu_gallery"-->
|
||||
<!-- android:title="@string/menu_gallery" />-->
|
||||
<!-- <item-->
|
||||
<!-- android:id="@+id/nav_slideshow"-->
|
||||
<!-- android:icon="@drawable/ic_menu_slideshow"-->
|
||||
<!-- android:title="@string/menu_slideshow" />-->
|
||||
<item
|
||||
android:id="@+id/nav_lists"
|
||||
android:icon="@drawable/ic_baseline_list_alt_28"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user