mirror of
https://github.com/ClaytonWWilson/Listify.git
synced 2025-12-16 10:48:46 +00:00
Merge pull request #33 from ClaytonWWilson/item-details-page
Item details page
This commit is contained in:
commit
053992f909
@ -1,6 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="com.example.listify">
|
package="com.example.listify">
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
@ -12,22 +13,27 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/AppTheme"
|
android:theme="@style/AppTheme"
|
||||||
android:usesCleartextTraffic="true">
|
android:usesCleartextTraffic="true">
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:theme="@style/AppTheme.NoActionBar">
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ItemDetails"
|
||||||
|
android:label=""
|
||||||
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
|
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".SearchResults"
|
android:name=".SearchResults"
|
||||||
android:label=""
|
android:label=""
|
||||||
android:theme="@style/AppTheme.NoActionBar"
|
android:theme="@style/AppTheme.NoActionBar">
|
||||||
>
|
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity android:name="com.example.listify.ui.SignupPage" />
|
<activity android:name="com.example.listify.ui.SignupPage" />
|
||||||
@ -35,6 +41,7 @@
|
|||||||
<activity android:name="com.example.listify.ui.ForgotPasswordPage" />
|
<activity android:name="com.example.listify.ui.ForgotPasswordPage" />
|
||||||
<activity android:name="com.example.listify.ui.ResetPasswordPage" />
|
<activity android:name="com.example.listify.ui.ResetPasswordPage" />
|
||||||
<activity android:name="com.example.listify.List" />
|
<activity android:name="com.example.listify.List" />
|
||||||
|
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
@ -0,0 +1,68 @@
|
|||||||
|
package com.example.listify;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
|
|
||||||
|
public class CreateListDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
public interface OnNewListListener {
|
||||||
|
void sendNewListName(String name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OnNewListListener onNewListListener;
|
||||||
|
|
||||||
|
EditText etNewListName;
|
||||||
|
|
||||||
|
public CreateListDialogFragment() {}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
// Get the layout inflater
|
||||||
|
LayoutInflater inflater = requireActivity().getLayoutInflater();
|
||||||
|
|
||||||
|
// Inflate and set the layout for the dialog
|
||||||
|
// Pass null as the parent view because its going in the dialog layout
|
||||||
|
View root = inflater.inflate(R.layout.dialog_create_list, null);
|
||||||
|
builder.setView(root)
|
||||||
|
// Add action buttons
|
||||||
|
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
onNewListListener.sendNewListName(etNewListName.getText().toString());
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
CreateListDialogFragment.this.getDialog().cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
etNewListName = (EditText) root.findViewById(R.id.et_new_list_name);
|
||||||
|
|
||||||
|
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required to extend DialogFragment
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
try {
|
||||||
|
onNewListListener = (OnNewListListener) getActivity();
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
Log.e("CreateListDialogFragment", "onAttach: ClassCastException: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,34 +0,0 @@
|
|||||||
package com.example.listify;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
|
||||||
|
|
||||||
public class First2Fragment extends Fragment {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(
|
|
||||||
LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState
|
|
||||||
) {
|
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_first2, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
|
|
||||||
view.findViewById(R.id.button_first).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
NavHostFragment.findNavController(First2Fragment.this)
|
|
||||||
.navigate(R.id.action_First2Fragment_to_Second2Fragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
package com.example.listify;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
|
||||||
|
|
||||||
public class FirstFragment extends Fragment {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(
|
|
||||||
LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState
|
|
||||||
) {
|
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_first, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
|
|
||||||
view.findViewById(R.id.button_first).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
NavHostFragment.findNavController(FirstFragment.this)
|
|
||||||
.navigate(R.id.action_FirstFragment_to_SecondFragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
142
Listify/app/src/main/java/com/example/listify/ItemDetails.java
Normal file
142
Listify/app/src/main/java/com/example/listify/ItemDetails.java
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
package com.example.listify;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import com.bumptech.glide.Glide;
|
||||||
|
import com.example.listify.model.Product;
|
||||||
|
import com.example.listify.model.ShoppingList;
|
||||||
|
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
import androidx.appcompat.widget.Toolbar;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.ImageButton;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
import android.widget.LinearLayout;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class ItemDetails extends AppCompatActivity implements ListPickerDialogFragment.OnListPickListener, CreateListDialogFragment.OnNewListListener {
|
||||||
|
private Product curProduct;
|
||||||
|
private LinearLayout linAddItem;
|
||||||
|
private LinearLayout linCreateList;
|
||||||
|
private TextView tvCreateNew;
|
||||||
|
private TextView tvAddItem;
|
||||||
|
private TextView tvItemName;
|
||||||
|
private TextView tvStoreName;
|
||||||
|
private ImageView itemImage;
|
||||||
|
private TextView tvItemPrice;
|
||||||
|
private TextView tvItemDesc;
|
||||||
|
private ImageButton backToSearchbutton;
|
||||||
|
|
||||||
|
ArrayList<ShoppingList> shoppingLists = new ArrayList<>();
|
||||||
|
|
||||||
|
private boolean isFABOpen = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_item_details);
|
||||||
|
Toolbar toolbar = findViewById(R.id.toolbar);
|
||||||
|
setSupportActionBar(toolbar);
|
||||||
|
|
||||||
|
// Load Product object from search results activity
|
||||||
|
curProduct = (Product) getIntent().getSerializableExtra("SelectedProduct");
|
||||||
|
|
||||||
|
// Set up floating action buttons
|
||||||
|
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||||
|
linAddItem = (LinearLayout) findViewById(R.id.lin_add_item);
|
||||||
|
linCreateList = (LinearLayout) findViewById(R.id.lin_create_list);
|
||||||
|
fab.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View view) {
|
||||||
|
if (!isFABOpen) {
|
||||||
|
showFABMenu();
|
||||||
|
} else {
|
||||||
|
closeFABMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
linAddItem.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
closeFABMenu();
|
||||||
|
|
||||||
|
// Hardcode shopping lists to demonstrate displaying lists
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
shoppingLists.add(new ShoppingList(Integer.toString(i)));
|
||||||
|
}
|
||||||
|
|
||||||
|
ListPickerDialogFragment listPickerDialog = new ListPickerDialogFragment(shoppingLists);
|
||||||
|
listPickerDialog.show(getSupportFragmentManager(), "User Lists");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
linCreateList.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
closeFABMenu();
|
||||||
|
|
||||||
|
CreateListDialogFragment createListDialogFragment = new CreateListDialogFragment();
|
||||||
|
createListDialogFragment.show(getSupportFragmentManager(), "Create New List");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set data
|
||||||
|
tvItemName = (TextView) findViewById(R.id.item_name);
|
||||||
|
tvItemName.setText(curProduct.getItemName());
|
||||||
|
|
||||||
|
itemImage = (ImageView) findViewById(R.id.item_image);
|
||||||
|
Glide.with(this).load(curProduct.getImageUrl()).into(itemImage);
|
||||||
|
|
||||||
|
tvStoreName = (TextView) findViewById(R.id.store_name);
|
||||||
|
tvStoreName.setText(curProduct.getChainName());
|
||||||
|
|
||||||
|
tvItemPrice = (TextView) findViewById(R.id.item_price);
|
||||||
|
tvItemPrice.setText(String.format("$%.2f", curProduct.getPrice()));
|
||||||
|
|
||||||
|
tvItemDesc = (TextView) findViewById(R.id.item_desc);
|
||||||
|
tvItemDesc.setText(curProduct.getDescription());
|
||||||
|
|
||||||
|
tvCreateNew = (TextView) findViewById(R.id.create_new_list);
|
||||||
|
tvCreateNew.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
|
tvAddItem = (TextView) findViewById(R.id.add_item_to_list);
|
||||||
|
tvAddItem.setVisibility(View.INVISIBLE);
|
||||||
|
|
||||||
|
backToSearchbutton = (ImageButton) findViewById(R.id.back_to_search_results_button);
|
||||||
|
backToSearchbutton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showFABMenu(){
|
||||||
|
isFABOpen=true;
|
||||||
|
linAddItem.animate().translationY(-getResources().getDimension(R.dimen.standard_55));
|
||||||
|
linCreateList.animate().translationY(-getResources().getDimension(R.dimen.standard_105));
|
||||||
|
tvAddItem.setVisibility(View.VISIBLE);
|
||||||
|
tvCreateNew.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeFABMenu(){
|
||||||
|
isFABOpen=false;
|
||||||
|
linAddItem.animate().translationY(0);
|
||||||
|
linCreateList.animate().translationY(0);
|
||||||
|
tvAddItem.setVisibility(View.INVISIBLE);
|
||||||
|
tvCreateNew.setVisibility(View.INVISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendListSelection(int selectedListIndex, int quantity) {
|
||||||
|
Toast.makeText(this, String.format("%d of Item added to %s", quantity, shoppingLists.get(selectedListIndex).getName()), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendNewListName(String name) {
|
||||||
|
Toast.makeText(this, String.format("%s created", name), Toast.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,121 @@
|
|||||||
|
package com.example.listify;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.graphics.Color;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.Button;
|
||||||
|
import android.widget.EditText;
|
||||||
|
import android.widget.ListView;
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
import com.example.listify.adapter.DisplayShoppingListsAdapter;
|
||||||
|
import com.example.listify.model.ShoppingList;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
|
||||||
|
public class ListPickerDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
|
public interface OnListPickListener {
|
||||||
|
void sendListSelection(int selectedListIndex, int quantity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OnListPickListener onListPickListener;
|
||||||
|
|
||||||
|
ListView userListsView;
|
||||||
|
DisplayShoppingListsAdapter displayShoppingListsAdapter;
|
||||||
|
Button btnMinus;
|
||||||
|
Button btnPlus;
|
||||||
|
EditText etQuantity;
|
||||||
|
private ArrayList<ShoppingList> userLists;
|
||||||
|
private int selectedListIndex;
|
||||||
|
|
||||||
|
public ListPickerDialogFragment(ArrayList<ShoppingList> userLists) {
|
||||||
|
this.userLists = userLists;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(final Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
// Get the layout inflater
|
||||||
|
LayoutInflater inflater = requireActivity().getLayoutInflater();
|
||||||
|
|
||||||
|
// Inflate and set the layout for the dialog
|
||||||
|
// Pass null as the parent view because its going in the dialog layout
|
||||||
|
View root = inflater.inflate(R.layout.dialog_add_to_list, null);
|
||||||
|
builder.setView(root)
|
||||||
|
// Add action buttons
|
||||||
|
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
onListPickListener.sendListSelection(selectedListIndex, Integer.parseInt(etQuantity.getText().toString()));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
ListPickerDialogFragment.this.getDialog().cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Display user's shopping lists
|
||||||
|
userListsView = (ListView) root.findViewById(R.id.user_lists);
|
||||||
|
displayShoppingListsAdapter = new DisplayShoppingListsAdapter(getActivity(), userLists);
|
||||||
|
userListsView.setAdapter(displayShoppingListsAdapter);
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
view.setBackgroundColor(Color.GREEN);
|
||||||
|
selectedListIndex = position;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set up quantity selection
|
||||||
|
etQuantity = (EditText) root.findViewById(R.id.et_quantity);
|
||||||
|
|
||||||
|
btnMinus = (Button) root.findViewById(R.id.btn_minus);
|
||||||
|
btnMinus.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int curQauntity = Integer.parseInt(etQuantity.getText().toString());
|
||||||
|
if (curQauntity > 0) {
|
||||||
|
curQauntity--;
|
||||||
|
etQuantity.setText(String.format("%d", curQauntity));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btnPlus = (Button) root.findViewById(R.id.btn_plus);
|
||||||
|
btnPlus.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
int curQauntity = Integer.parseInt(etQuantity.getText().toString());
|
||||||
|
curQauntity++;
|
||||||
|
etQuantity.setText(String.format("%d", curQauntity));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Required to extend DialogFragment
|
||||||
|
@Override
|
||||||
|
public void onAttach(@NonNull Context context) {
|
||||||
|
super.onAttach(context);
|
||||||
|
try {
|
||||||
|
onListPickListener = (OnListPickListener) getActivity();
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
Log.e("ListPickerDialogFragment", "onAttach: ClassCastException: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
package com.example.listify;
|
package com.example.listify;
|
||||||
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.appcompat.widget.Toolbar;
|
import androidx.appcompat.widget.Toolbar;
|
||||||
@ -77,7 +78,12 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
|
|||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
Toast.makeText(SearchResults.this, resultsProductListSorted.get(position).getItemName(), Toast.LENGTH_SHORT).show();
|
// Toast.makeText(SearchResults.this, resultsProductListSorted.get(position).getItemName(), Toast.LENGTH_SHORT).show();
|
||||||
|
Intent itemDetailsPage = new Intent(SearchResults.this, ItemDetails.class);
|
||||||
|
|
||||||
|
// Send the selected product
|
||||||
|
itemDetailsPage.putExtra("SelectedProduct", resultsProductListSorted.get(position));
|
||||||
|
startActivity(itemDetailsPage);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -129,6 +135,9 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
|
|||||||
// TODO: Create a new Product Object for each result
|
// TODO: Create a new Product Object for each result
|
||||||
// TODO: Add each result to productList
|
// TODO: Add each result to productList
|
||||||
|
|
||||||
|
// Clear the old search results
|
||||||
|
resultsProductList = new ArrayList<>();
|
||||||
|
|
||||||
// Hardcode some search results...
|
// Hardcode some search results...
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
Product a = new Product("Bottled Water", "0000", "Walmart", "0001", "0123456780", "Bro, it's water...", "Grocery", 13.37, "9/24/2020", "1", "http://3.bp.blogspot.com/-MfroPPQVDKo/UyhUZWqGvkI/AAAAAAAAB-I/DGk622onsvc/s1600/lettuce-b-kool-cat-meme.jpg");
|
Product a = new Product("Bottled Water", "0000", "Walmart", "0001", "0123456780", "Bro, it's water...", "Grocery", 13.37, "9/24/2020", "1", "http://3.bp.blogspot.com/-MfroPPQVDKo/UyhUZWqGvkI/AAAAAAAAB-I/DGk622onsvc/s1600/lettuce-b-kool-cat-meme.jpg");
|
||||||
@ -136,13 +145,23 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
|
|||||||
Product c = new Product("Lettuce", "0002", "Walmart", "0001", "0123456782", "Burger King foot lettuce", "Grocery", 0.60, "9/24/2020", "1", "https://www.cattitudedaily.com/wp-content/uploads/2019/12/white-cat-meme-feature.jpg");
|
Product c = new Product("Lettuce", "0002", "Walmart", "0001", "0123456782", "Burger King foot lettuce", "Grocery", 0.60, "9/24/2020", "1", "https://www.cattitudedaily.com/wp-content/uploads/2019/12/white-cat-meme-feature.jpg");
|
||||||
Product d = new Product("Video Game", "0003", "Walmart", "0001", "0123456783", "Fun Vidya Gaemz", "Electronics", 60.00, "9/24/2020", "1", "https://i1.wp.com/bestlifeonline.com/wp-content/uploads/2018/06/cat-meme-67.jpg?resize=1024%2C1024&ssl=1");
|
Product d = new Product("Video Game", "0003", "Walmart", "0001", "0123456783", "Fun Vidya Gaemz", "Electronics", 60.00, "9/24/2020", "1", "https://i1.wp.com/bestlifeonline.com/wp-content/uploads/2018/06/cat-meme-67.jpg?resize=1024%2C1024&ssl=1");
|
||||||
Product e = new Product("Mountain Dew", "0004", "Walmart", "0001", "0123456784", "Gamer fuel", "Grocery", 5.87, "9/24/2020", "1", "https://memeguy.com/photos/images/gaming-cat-7680.png");
|
Product e = new Product("Mountain Dew", "0004", "Walmart", "0001", "0123456784", "Gamer fuel", "Grocery", 5.87, "9/24/2020", "1", "https://memeguy.com/photos/images/gaming-cat-7680.png");
|
||||||
Product f = new Product("Tire", "0005", "Walmart", "0001", "0123456785", "30 inch rims", "Automotive", 146.97, "9/24/2020", "1", "http://cdn.sheknows.com/articles/2013/05/pet5.jpg");
|
Product f = new Product("Tire", "0005", "Kroger", "0002", "0123456785", "30 inch rims", "Automotive", 146.97, "9/24/2020", "1", "http://cdn.sheknows.com/articles/2013/05/pet5.jpg");
|
||||||
|
Product g = new Product("This is a test for a product that has a very long title to see if the text overflows", "0006", "Target", "0003", "0123456786", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Elit ut aliquam purus sit amet luctus venenatis. Tellus orci ac auctor augue mauris augue neque gravida. Habitant morbi tristique senectus et netus. Dignissim diam quis enim lobortis. Suspendisse sed nisi lacus sed viverra tellus in. Viverra adipiscing at in tellus integer feugiat scelerisque. Volutpat consequat mauris nunc congue nisi vitae suscipit tellus. Habitant morbi tristique senectus et netus et malesuada. Quis enim lobortis scelerisque fermentum dui faucibus in ornare quam. Mattis pellentesque id nibh tortor id aliquet. Volutpat blandit aliquam etiam erat. Vestibulum lorem sed risus ultricies tristique nulla aliquet.\n" +
|
||||||
|
"\n" +
|
||||||
|
"Placerat orci nulla pellentesque dignissim. Quisque non tellus orci ac. Mattis enim ut tellus elementum sagittis vitae et. Interdum velit euismod in pellentesque massa placerat duis ultricies. Id nibh tortor id aliquet lectus. Massa placerat duis ultricies lacus sed. Convallis convallis tellus id interdum velit laoreet id donec. Amet luctus venenatis lectus magna fringilla urna porttitor rhoncus. Sodales ut eu sem integer vitae justo. Viverra ipsum nunc aliquet bibendum enim facilisis.\n" +
|
||||||
|
"\n" +
|
||||||
|
"Eget felis eget nunc lobortis mattis aliquam faucibus purus. Odio morbi quis commodo odio aenean sed adipiscing. Hac habitasse platea dictumst quisque sagittis purus sit. Nam libero justo laoreet sit. Et malesuada fames ac turpis egestas. Erat nam at lectus urna duis convallis convallis. Morbi tincidunt ornare massa eget egestas purus viverra accumsan in. Ut venenatis tellus in metus vulputate eu scelerisque felis imperdiet. At auctor urna nunc id cursus. Sed elementum tempus egestas sed. Lorem dolor sed viverra ipsum nunc aliquet bibendum. Orci eu lobortis elementum nibh tellus molestie. Porttitor leo a diam sollicitudin tempor. Adipiscing bibendum est ultricies integer quis auctor elit sed. Arcu cursus euismod quis viverra nibh. A diam sollicitudin tempor id eu nisl.\n" +
|
||||||
|
"\n" +
|
||||||
|
"Sapien eget mi proin sed libero enim sed faucibus turpis. Pharetra massa massa ultricies mi quis hendrerit dolor magna. Integer enim neque volutpat ac tincidunt vitae semper. Euismod lacinia at quis risus sed vulputate. Ut venenatis tellus in metus vulputate eu scelerisque. Etiam erat velit scelerisque in dictum non consectetur. Viverra nam libero justo laoreet sit amet cursus sit. Arcu non sodales neque sodales. Vivamus arcu felis bibendum ut tristique et egestas quis. Sed adipiscing diam donec adipiscing tristique risus. Sollicitudin tempor id eu nisl nunc mi ipsum faucibus vitae. Velit ut tortor pretium viverra suspendisse potenti nullam ac tortor. Non nisi est sit amet facilisis magna etiam. Tortor at risus viverra adipiscing. Donec ultrices tincidunt arcu non sodales neque sodales. Eget egestas purus viverra accumsan. Enim lobortis scelerisque fermentum dui faucibus in ornare. Porttitor massa id neque aliquam. Ut consequat semper viverra nam. Orci ac auctor augue mauris augue neque gravida.\n" +
|
||||||
|
"\n" +
|
||||||
|
"Lacus sed viverra tellus in hac habitasse platea dictumst. Nec ullamcorper sit amet risus nullam eget felis eget nunc. Semper feugiat nibh sed pulvinar. Consequat nisl vel pretium lectus quam id leo in. Volutpat maecenas volutpat blandit aliquam etiam erat velit scelerisque. Faucibus a pellentesque sit amet porttitor eget. Sed viverra tellus in hac habitasse platea dictumst vestibulum. Placerat vestibulum lectus mauris ultrices eros in cursus turpis. Sed tempus urna et pharetra pharetra massa massa ultricies mi. Ornare arcu odio ut sem. Ornare arcu dui vivamus arcu felis bibendum ut. Feugiat pretium nibh ipsum consequat. Consectetur adipiscing elit ut aliquam purus sit amet luctus venenatis. Felis eget velit aliquet sagittis id consectetur purus ut.", "Automotive", 45.22, "9/24/2020", "1", "http://cdn.sheknows.com/articles/2013/05/pet5.jpg");
|
||||||
resultsProductList.add(a);
|
resultsProductList.add(a);
|
||||||
resultsProductList.add(b);
|
resultsProductList.add(b);
|
||||||
resultsProductList.add(c);
|
resultsProductList.add(c);
|
||||||
resultsProductList.add(d);
|
resultsProductList.add(d);
|
||||||
resultsProductList.add(e);
|
resultsProductList.add(e);
|
||||||
resultsProductList.add(f);
|
resultsProductList.add(f);
|
||||||
|
resultsProductList.add(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
@ -1,34 +0,0 @@
|
|||||||
package com.example.listify;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
|
||||||
|
|
||||||
public class Second2Fragment extends Fragment {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(
|
|
||||||
LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState
|
|
||||||
) {
|
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_second2, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
|
|
||||||
view.findViewById(R.id.button_second).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
NavHostFragment.findNavController(Second2Fragment.this)
|
|
||||||
.navigate(R.id.action_Second2Fragment_to_First2Fragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
package com.example.listify;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
import androidx.navigation.fragment.NavHostFragment;
|
|
||||||
|
|
||||||
public class SecondFragment extends Fragment {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(
|
|
||||||
LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState
|
|
||||||
) {
|
|
||||||
// Inflate the layout for this fragment
|
|
||||||
return inflater.inflate(R.layout.fragment_second, container, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onViewCreated(@NonNull View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
|
|
||||||
view.findViewById(R.id.button_second).setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View view) {
|
|
||||||
NavHostFragment.findNavController(SecondFragment.this)
|
|
||||||
.navigate(R.id.action_SecondFragment_to_FirstFragment);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,55 @@
|
|||||||
|
package com.example.listify.adapter;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.BaseAdapter;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import com.example.listify.R;
|
||||||
|
import com.example.listify.model.ShoppingList;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class DisplayShoppingListsAdapter extends BaseAdapter {
|
||||||
|
private Activity activity;
|
||||||
|
private ArrayList<ShoppingList> lists;
|
||||||
|
private LayoutInflater inflater;
|
||||||
|
|
||||||
|
public DisplayShoppingListsAdapter(Activity activity, ArrayList<ShoppingList> lists){
|
||||||
|
this.activity = activity;
|
||||||
|
this.lists = lists;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getCount() {
|
||||||
|
return lists.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getItem(int position) {
|
||||||
|
return lists.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return position;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public View getView(int position, View convertView, ViewGroup parent) {
|
||||||
|
if (inflater == null) {
|
||||||
|
inflater = (LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
|
}
|
||||||
|
if (convertView == null) {
|
||||||
|
convertView = inflater.inflate(R.layout.display_shopping_lists_item, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
ShoppingList curList = lists.get(position);
|
||||||
|
|
||||||
|
TextView tvListName = (TextView) convertView.findViewById(R.id.shopping_list_name);
|
||||||
|
tvListName.setText(curList.getName());
|
||||||
|
|
||||||
|
return convertView;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -57,7 +57,11 @@ public class SearchResultsListAdapter extends BaseAdapter {
|
|||||||
Product product = productList.get(position);
|
Product product = productList.get(position);
|
||||||
// TODO: If image url is broken, display @drawable/ic_baseline_broken_image_600.xml
|
// TODO: If image url is broken, display @drawable/ic_baseline_broken_image_600.xml
|
||||||
Glide.with(activity).load(product.getImageUrl()).into(productImage);
|
Glide.with(activity).load(product.getImageUrl()).into(productImage);
|
||||||
|
if (product.getItemName().length() >= 35) {
|
||||||
|
itemName.setText(product.getItemName().substring(0, 35) + "...");
|
||||||
|
} else {
|
||||||
itemName.setText(product.getItemName());
|
itemName.setText(product.getItemName());
|
||||||
|
}
|
||||||
price.setText(String.format("$%.2f", product.getPrice()));
|
price.setText(String.format("$%.2f", product.getPrice()));
|
||||||
itemStore.setText(product.getChainName());
|
itemStore.setText(product.getChainName());
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.example.listify.model;
|
package com.example.listify.model;
|
||||||
|
|
||||||
public class Product {
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Product implements Serializable {
|
||||||
private String itemName;
|
private String itemName;
|
||||||
private String itemId;
|
private String itemId;
|
||||||
private String chainName;
|
private String chainName;
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
package com.example.listify.model;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
public class ShoppingList extends ArrayList<Product> {
|
||||||
|
private ArrayList<Product> list;
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public ShoppingList(String name) {
|
||||||
|
list = new ArrayList<Product>();
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Product get(int position) {
|
||||||
|
return this.list.get(position);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return list.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return list.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(@Nullable Object o) {
|
||||||
|
return list.contains(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int indexOf(@Nullable Object o) {
|
||||||
|
return list.indexOf(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean add(Product product) {
|
||||||
|
return list.add(product);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Product remove(int index) {
|
||||||
|
return list.remove(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
list.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean remove(@Nullable Object o) {
|
||||||
|
return list.remove(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addAll(@NonNull Collection<? extends Product> c) {
|
||||||
|
return list.addAll(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
5
Listify/app/src/main/res/drawable/ic_baseline_add_28.xml
Normal file
5
Listify/app/src/main/res/drawable/ic_baseline_add_28.xml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="28dp"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="28dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||||
|
</vector>
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
<vector android:height="28dp"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="28dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M3,17.25V21h3.75L17.81,9.94l-3.75,-3.75L3,17.25zM20.71,7.04c0.39,-0.39 0.39,-1.02 0,-1.41l-2.34,-2.34c-0.39,-0.39 -1.02,-0.39 -1.41,0l-1.83,1.83 3.75,3.75 1.83,-1.83z"/>
|
||||||
|
</vector>
|
||||||
@ -0,0 +1,9 @@
|
|||||||
|
<vector android:height="28dp"
|
||||||
|
android:viewportHeight="24" android:viewportWidth="24"
|
||||||
|
android:width="28dp" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M17,19.22H5V7h7V5H5C3.9,5 3,5.9 3,7v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-7h-2V19.22z"/>
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M19,2h-2v3h-3c0.01,0.01 0,2 0,2h3v2.99c0.01,0.01 2,0 2,0V7h3V5h-3V2z"/>
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M7,9h8v2h-8z"/>
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M7,12l0,2l8,0l0,-2l-3,0z"/>
|
||||||
|
<path android:fillColor="@android:color/white" android:pathData="M7,15h8v2h-8z"/>
|
||||||
|
</vector>
|
||||||
96
Listify/app/src/main/res/layout/activity_item_details.xml
Normal file
96
Listify/app/src/main/res/layout/activity_item_details.xml
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
tools:context=".ItemDetails">
|
||||||
|
|
||||||
|
<com.google.android.material.appbar.AppBarLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:theme="@style/AppTheme.AppBarOverlay">
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.Toolbar
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="?attr/actionBarSize"
|
||||||
|
android:background="?attr/colorPrimary"
|
||||||
|
app:popupTheme="@style/AppTheme.PopupOverlay"
|
||||||
|
>
|
||||||
|
|
||||||
|
<ImageButton
|
||||||
|
android:id="@+id/back_to_search_results_button"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
app:srcCompat="@drawable/abc_vector_test"
|
||||||
|
android:background="@null"
|
||||||
|
android:contentDescription="@string/backButton"/>
|
||||||
|
|
||||||
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
|
||||||
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/content_item_details" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/lin_add_item"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_marginBottom="22dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/add_item_to_list"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/add_to_list"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="5dp"/>
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/fab2"
|
||||||
|
android:layout_width="45dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginEnd="22dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
app:srcCompat="@drawable/ic_baseline_post_add_28" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:id="@+id/lin_create_list"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_marginBottom="22dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/create_new_list"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/create_new_list"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:layout_marginEnd="5dp"/>
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/fab1"
|
||||||
|
android:layout_width="45dp"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginEnd="22dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
app:srcCompat="@drawable/ic_baseline_create_28" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||||
|
android:id="@+id/fab"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|end"
|
||||||
|
android:layout_margin="@dimen/fab_margin"
|
||||||
|
app:srcCompat="@drawable/ic_baseline_add_28" />
|
||||||
|
|
||||||
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||||
77
Listify/app/src/main/res/layout/content_item_details.xml
Normal file
77
Listify/app/src/main/res/layout/content_item_details.xml
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_name"
|
||||||
|
android:layout_width="307dp"
|
||||||
|
android:layout_height="56dp"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:text="@string/default_product_name"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/store_name"
|
||||||
|
android:layout_width="126dp"
|
||||||
|
android:layout_height="28dp"
|
||||||
|
android:layout_marginStart="52dp"
|
||||||
|
android:layout_marginTop="50dp"
|
||||||
|
android:text="@string/default_store"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/item_image"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:layout_constraintVertical_bias="1.0" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/item_image"
|
||||||
|
android:layout_width="307dp"
|
||||||
|
android:layout_height="224dp"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginTop="120dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:background="@color/light_gray"
|
||||||
|
android:textAlignment="center"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintHorizontal_bias="0.75"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
android:contentDescription="@string/product_image_description" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_price"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginTop="16dp"
|
||||||
|
android:layout_marginBottom="25dp"
|
||||||
|
android:text="@string/default__00_00"
|
||||||
|
android:textSize="16sp"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/item_desc"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@+id/item_image" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/item_desc"
|
||||||
|
android:layout_width="309dp"
|
||||||
|
android:layout_height="290dp"
|
||||||
|
android:layout_marginHorizontal="50dp"
|
||||||
|
android:layout_marginStart="50dp"
|
||||||
|
android:layout_marginEnd="50dp"
|
||||||
|
android:layout_marginBottom="7dp"
|
||||||
|
android:text="@string/default_description"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
<!-- app:srcCompat="@drawable/ic_baseline_arrow_downward_50"-->
|
||||||
|
|
||||||
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
50
Listify/app/src/main/res/layout/dialog_add_to_list.xml
Normal file
50
Listify/app/src/main/res/layout/dialog_add_to_list.xml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/add_item_to_list"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginBottom="5dp"/>
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/user_lists"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="300dp"
|
||||||
|
android:divider="@color/list_divider"
|
||||||
|
android:dividerHeight="1dp"
|
||||||
|
android:choiceMode="multipleChoiceModal"/>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_minus"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="@string/minus"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_quantity"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="@string/_1"
|
||||||
|
android:inputType="number"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/btn_plus"
|
||||||
|
android:layout_width="60dp"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:text="@string/plus"/>
|
||||||
|
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
22
Listify/app/src/main/res/layout/dialog_create_list.xml
Normal file
22
Listify/app/src/main/res/layout/dialog_create_list.xml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/create_a_new_list"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:layout_marginTop="5dp"/>
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/et_new_list_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="50dp"
|
||||||
|
android:layout_marginHorizontal="15dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:hint="@string/new_list_name"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/shopping_list_name"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="8dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:layout_marginEnd="8dp"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
</RelativeLayout>
|
||||||
@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".FirstFragment">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textview_first"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/hello_first_fragment"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/button_first"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_first"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/next"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/textview_first" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".First2Fragment">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textview_first"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/hello_first_fragment"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/button_first"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_first"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/next"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/textview_first" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".SecondFragment">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textview_second"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/button_second"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_second"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/previous"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/textview_second" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
tools:context=".Second2Fragment">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/textview_second"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:layout_constraintBottom_toTopOf="@id/button_second"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/button_second"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/previous"
|
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/textview_second" />
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@+id/nav_graph"
|
|
||||||
app:startDestination="@id/FirstFragment">
|
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/FirstFragment"
|
|
||||||
android:name="com.example.listify.FirstFragment"
|
|
||||||
android:label="@string/first_fragment_label"
|
|
||||||
tools:layout="@layout/fragment_first">
|
|
||||||
|
|
||||||
<action
|
|
||||||
android:id="@+id/action_FirstFragment_to_SecondFragment"
|
|
||||||
app:destination="@id/SecondFragment" />
|
|
||||||
</fragment>
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/SecondFragment"
|
|
||||||
android:name="com.example.listify.SecondFragment"
|
|
||||||
android:label="@string/second_fragment_label"
|
|
||||||
tools:layout="@layout/fragment_second">
|
|
||||||
|
|
||||||
<action
|
|
||||||
android:id="@+id/action_SecondFragment_to_FirstFragment"
|
|
||||||
app:destination="@id/FirstFragment" />
|
|
||||||
</fragment>
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/First2Fragment"
|
|
||||||
android:name="com.example.listify.First2Fragment"
|
|
||||||
android:label="@string/first_fragment_label"
|
|
||||||
tools:layout="@layout/fragment_first2">
|
|
||||||
|
|
||||||
<action
|
|
||||||
android:id="@+id/action_First2Fragment_to_Second2Fragment"
|
|
||||||
app:destination="@id/Second2Fragment" />
|
|
||||||
</fragment>
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/Second2Fragment"
|
|
||||||
android:name="com.example.listify.Second2Fragment"
|
|
||||||
android:label="@string/second_fragment_label"
|
|
||||||
tools:layout="@layout/fragment_second2">
|
|
||||||
|
|
||||||
<action
|
|
||||||
android:id="@+id/action_Second2Fragment_to_First2Fragment"
|
|
||||||
app:destination="@id/First2Fragment" />
|
|
||||||
</fragment>
|
|
||||||
</navigation>
|
|
||||||
@ -10,4 +10,5 @@
|
|||||||
<color name="list_row_end_color">#ffffff</color>
|
<color name="list_row_end_color">#ffffff</color>
|
||||||
<color name="list_row_hover_start_color">#ebeef0</color>
|
<color name="list_row_hover_start_color">#ebeef0</color>
|
||||||
<color name="list_row_hover_end_color">#1c9ef4</color>
|
<color name="list_row_hover_end_color">#1c9ef4</color>
|
||||||
|
<color name="light_gray">#e6e6e6</color>
|
||||||
</resources>
|
</resources>
|
||||||
@ -5,4 +5,9 @@
|
|||||||
<dimen name="nav_header_vertical_spacing">8dp</dimen>
|
<dimen name="nav_header_vertical_spacing">8dp</dimen>
|
||||||
<dimen name="nav_header_height">176dp</dimen>
|
<dimen name="nav_header_height">176dp</dimen>
|
||||||
<dimen name="fab_margin">16dp</dimen>
|
<dimen name="fab_margin">16dp</dimen>
|
||||||
|
<dimen name="fab_menu_item_margin">20dp</dimen>
|
||||||
|
|
||||||
|
<dimen name="standard_55">55dp</dimen>
|
||||||
|
<dimen name="standard_105">105dp</dimen>
|
||||||
|
<dimen name="standard_155">155dp</dimen>
|
||||||
</resources>
|
</resources>
|
||||||
@ -29,4 +29,18 @@
|
|||||||
<string name="search_button_desc">Search Button</string>
|
<string name="search_button_desc">Search Button</string>
|
||||||
<string name="title_activity_search_results">SearchResults</string>
|
<string name="title_activity_search_results">SearchResults</string>
|
||||||
<string name="store_selection">Store selection</string>
|
<string name="store_selection">Store selection</string>
|
||||||
|
<string name="title_activity_item_details">ItemDetails</string>
|
||||||
|
<string name="add_to_list">Add to list</string>
|
||||||
|
<string name="create_new_list">Create new list</string>
|
||||||
|
<string name="default_product_name">Product Name</string>
|
||||||
|
<string name="default_store">Store</string>
|
||||||
|
<string name="default__00_00">$00.00</string>
|
||||||
|
<string name="default_description">Description</string>
|
||||||
|
<string name="product_image_description">Product Image</string>
|
||||||
|
<string name="add_item_to_list">Add item to List</string>
|
||||||
|
<string name="minus">-</string>
|
||||||
|
<string name="_1">1</string>
|
||||||
|
<string name="plus">+</string>
|
||||||
|
<string name="create_a_new_list">Create a new list</string>
|
||||||
|
<string name="new_list_name">New list name</string>
|
||||||
</resources>
|
</resources>
|
||||||
Loading…
Reference in New Issue
Block a user