Merge branch 'master' into ClientLambdas

This commit is contained in:
NMerz 2020-10-03 23:05:26 -04:00
commit 1907dc6ce5
12 changed files with 255 additions and 185 deletions

View File

@ -34,7 +34,7 @@
<activity android:name="com.example.listify.ui.LoginPage" />
<activity android:name="com.example.listify.ui.ForgotPasswordPage" />
<activity android:name="com.example.listify.ui.ResetPasswordPage" />
<activity android:name="com.example.listify.ui.CodePage" />
<activity android:name="com.example.listify.List" />
</application>
</manifest>

View File

@ -0,0 +1,76 @@
package com.example.listify;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
public class List extends AppCompatActivity {
ListView listView;
String listName = "Sample List";
String[] pNames = {"Half-gallon organic whole milk"};
String[] pStores = {"Kroger"};
String[] pPrices = {"$5.00"};
int[] pImages = {R.drawable.milk};
//List(String name) {
// listName = name;
//}
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
listView = findViewById(R.id.listView);
MyAdapter myAdapter = new MyAdapter(this, pNames, pStores, pPrices, pImages);
listView.setAdapter(myAdapter);
}
class MyAdapter extends ArrayAdapter<String> {
Context context;
String[] pNames;
String[] pStores;
String[] pPrices;
int[] pImages;
MyAdapter (Context c, String[] names, String[] stores, String[] prices, int[] images) {
super(c, R.layout.listproduct, R.id.productView, names);
context = c;
pNames = names;
pStores = stores;
pPrices = prices;
pImages = images;
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
LayoutInflater layoutInflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View listproduct = layoutInflater.inflate(R.layout.listproduct, parent,false);
ImageView image = listproduct.findViewById(R.id.imageView);
TextView name = listproduct.findViewById(R.id.productView);
TextView store = listproduct.findViewById(R.id.storeView);
TextView price = listproduct.findViewById(R.id.priceView);
image.setImageResource(pImages[position]);
name.setText(pNames[position]);
store.setText(pStores[position]);
price.setText(pPrices[position]);
return listproduct;
}
}
}

View File

@ -59,8 +59,10 @@ public class MainActivity extends AppCompatActivity {
//------------------------------------------------------------------------------------------//
boolean testAPI = true;
boolean testAPI = false;
//----------------------------------API Testing---------------------------------------------//
if (testAPI) {
AuthManager authManager = new AuthManager();
try {
@ -109,18 +111,16 @@ public class MainActivity extends AppCompatActivity {
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// FloatingActionButton fab = findViewById(R.id.fab);
// fab.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View view) {
// Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
// .setAction("Action", null).show();
// }
// });
/*FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});*/
DrawerLayout drawer = findViewById(R.id.drawer_layout);
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.
// 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)
.setDrawerLayout(drawer)
@ -128,14 +128,12 @@ public class MainActivity extends AppCompatActivity {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController);
// Handle search button click
ImageButton searchButton = (ImageButton) findViewById(R.id.searchButton);
searchButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, SearchResults.class);
// Send user to SearchResults activity
startActivity(intent);
overridePendingTransition(R.anim.enter_from_left, R.anim.exit_from_left);
@ -144,13 +142,12 @@ public class MainActivity extends AppCompatActivity {
});
}
// @Override
// public boolean onCreateOptionsMenu(Menu menu) {
// // Inflate the menu; this adds items to the action bar if it is present.
// getMenuInflater().inflate(R.menu.main, menu);
// return true;
// }
/*@Override
public boolean onCreateOptionsMenu(Menu menu) {
//Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}*/
@Override
public boolean onSupportNavigateUp() {

View File

@ -55,8 +55,8 @@ public class LoginPage extends AppCompatActivity {
try {
authManager.signIn(email, password);
//Intent intent = new Intent(LoginPage.this, LoginPage.class);
//startActivity(intent);
Intent intent = new Intent(LoginPage.this, MainActivity.class);
startActivity(intent);
}
catch(Exception ex) {
//Display "Incorrect email or password" message

View File

@ -68,8 +68,8 @@ public class SignupPage extends AppCompatActivity implements CodePage.CodeDialog
else {
try {
authManager.confirmSignUp(code);
//Intent intent = new Intent(SignupPage.this, MainActivity.class);
//startActivity(intent);
Intent intent = new Intent(SignupPage.this, MainActivity.class);
startActivity(intent);
}
catch (Exception e) {
//Remove user from database

View File

@ -14,17 +14,29 @@ import com.example.listify.R;
public class HomeFragment extends Fragment {
private Button toLoginPage;
private Button toListPage;
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_home, container, false);
toLoginPage = (Button) root.findViewById(R.id.button1);
toLoginPage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.ui.SignupPage.class);
Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.ui.LoginPage.class);
startActivity(intent);
}
});
toListPage = (Button) root.findViewById(R.id.button2);
toListPage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(HomeFragment.this.getActivity(), com.example.listify.List.class);
startActivity(intent);
}
});
return root;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/listView">
</ListView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -1,142 +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">
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="28dp"
android:text="List Name"
android:textSize="20sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.cardview.widget.CardView
android:id="@+id/cardView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="85dp"
app:cardElevation="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="400px"
android:padding="10dp">
<ImageView
android:id="@+id/imageView1"
android:layout_width="400px"
android:layout_height="wrap_content"
android:src="@drawable/lisitfy_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/productView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="30dp"
android:layout_marginBottom="100dp"
android:text="Product Name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView1"
android:textSize="20sp"/>
<TextView
android:id="@+id/priceView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="30dp"
android:layout_marginBottom="90dp"
android:text="Price"
app:layout_constraintTop_toBottomOf="@+id/productView1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView1"
android:textSize="15sp"/>
<TextView
android:id="@+id/storeView1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="30dp"
android:layout_marginBottom="80dp"
android:text="Store Address"
app:layout_constraintTop_toBottomOf="@+id/priceView1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView1"
android:textSize="15sp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cardView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
app:cardElevation="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/cardView1">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
android:layout_height="400px"
android:padding="10dp">
<ImageView
android:id="@+id/imageView2"
android:layout_width="400px"
android:layout_height="wrap_content"
android:src="@drawable/lisitfy_logo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<TextView
android:id="@+id/productView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="30dp"
android:layout_marginBottom="100dp"
android:text="Product Name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView2"
android:textSize="20sp"/>
<TextView
android:id="@+id/priceView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="30dp"
android:layout_marginBottom="90dp"
android:text="Price"
app:layout_constraintTop_toBottomOf="@+id/productView2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView2"
android:textSize="15sp"/>
<TextView
android:id="@+id/storeView2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="30dp"
android:layout_marginBottom="80dp"
android:text="Store Address"
app:layout_constraintTop_toBottomOf="@+id/priceView2"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView2"
android:textSize="15sp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -10,32 +10,39 @@
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="1dp"
android:layout_marginRight="1dp"
android:layout_marginTop="29dp"
android:text="Button"
app:layout_constraintEnd_toEndOf="@+id/switch2"
app:layout_constraintTop_toBottomOf="@+id/switch2" />
android:layout_marginBottom="25dp"
android:layout_marginStart="1dp"
android:text="Log in"
app:layout_constraintBottom_toTopOf="@+id/button2"
app:layout_constraintStart_toStartOf="@+id/button2" />
<Switch
android:id="@+id/switch2"
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="19dp"
android:layout_marginRight="19dp"
android:layout_marginTop="31dp"
android:text="Target"
app:layout_constraintEnd_toEndOf="@+id/textView4"
app:layout_constraintTop_toBottomOf="@+id/textView4" />
android:layout_marginBottom="148dp"
android:text="List"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Switch
android:id="@+id/switch1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="29dp"
android:text="Kroger"
app:layout_constraintBottom_toTopOf="@+id/button1"
app:layout_constraintStart_toStartOf="@+id/button1" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="31dp"
android:text="Search these stores:"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toTopOf="@+id/switch1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -0,0 +1,106 @@
<?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">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/constraintLayout"
android:layout_width="wrap_content"
android:layout_height="400px"
android:padding="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<Button
android:id="@+id/buttonIncr"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="25dp"
android:text="+"
android:textSize="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toBottomOf="@+id/storeView" />
<Button
android:id="@+id/buttonDecr"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="75dp"
android:text="-"
android:textSize="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toBottomOf="@+id/storeView" />
<Button
android:id="@+id/buttonDel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="150dp"
android:text="Remove"
android:textSize="10dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toBottomOf="@+id/storeView" />
<ImageView
android:id="@+id/imageView"
android:layout_width="400px"
android:layout_height="wrap_content"
android:src="@drawable/placeholder"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/productView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="100dp"
android:padding="30dp"
android:text="Product Name"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/storeView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="90dp"
android:padding="30dp"
android:text="Store"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toBottomOf="@+id/productView" />
<TextView
android:id="@+id/priceView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="80dp"
android:padding="30dp"
android:text="Price"
android:textSize="15sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/imageView"
app:layout_constraintTop_toBottomOf="@+id/storeView" />
<TextView
android:id="@+id/textViewQuantity"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/buttonDecr"
app:layout_constraintStart_toEndOf="@+id/buttonIncr"
app:layout_constraintTop_toBottomOf="@+id/storeView" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>