Added Nav Bar and Refactor some activities to fragments

- Added a nav bar to go to customer chat and staff profile
- refactored the activities for pets, suppliers, services and it's detailed activates to make the newly added nav bar to work on all screens.

TODO:
- add functionalities to profile and chat fragments
- change theme of app to stay consistent with desktop app
- change text so it uses String.xml values
This commit is contained in:
Alex
2026-03-06 04:49:15 -07:00
parent 309a209ecd
commit c7a959d4f6
49 changed files with 1249 additions and 768 deletions

View File

@@ -38,6 +38,10 @@ dependencies {
implementation(libs.constraintlayout)
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.viewpager2:viewpager2:1.1.0")
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.camera:camera-camera2:1.3.0")
implementation("androidx.camera:camera-lifecycle:1.3.0")
implementation("androidx.camera:camera-view:1.3.0")
testImplementation(libs.junit)
androidTestImplementation(libs.ext.junit)
androidTestImplementation(libs.espresso.core)

View File

@@ -2,6 +2,16 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
@@ -12,34 +22,20 @@
android:supportsRtl="true"
android:theme="@style/Theme.PetStoreMobile">
<activity
android:name=".activities.InventoryActivity"
android:name=".activities.HomeActivity"
android:windowSoftInputMode="adjustNothing"
android:exported="false" />
<activity
android:name=".activities.AdoptionActivity"
android:name=".activities.listactivities.InventoryActivity"
android:exported="false" />
<activity
android:name=".activities.SupplierActivity"
android:name=".activities.listactivities.AdoptionActivity"
android:exported="false" />
<activity
android:name=".activities.detailactivites.SupplierDetailActivity"
android:name=".activities.listactivities.ProductActivity"
android:exported="false" />
<activity
android:name=".activities.detailactivites.ServiceDetailActivity"
android:exported="false" />
<activity
android:name=".activities.detailactivites.PetDetailActivity"
android:exported="false" />
<activity
android:name=".activities.ProductActivity"
android:exported="false" />
<activity
android:name=".activities.AppointmentActivity"
android:exported="false" />
<activity
android:name=".activities.ServiceActivity"
android:exported="false" />
<activity
android:name=".activities.PetActivity"
android:name=".activities.listactivities.AppointmentActivity"
android:exported="false" />
<activity
android:name=".activities.MainActivity"

View File

@@ -7,6 +7,10 @@ import android.view.MenuItem;
import androidx.appcompat.app.AppCompatActivity;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.listactivities.AdoptionActivity;
import com.example.petstoremobile.activities.listactivities.AppointmentActivity;
import com.example.petstoremobile.activities.listactivities.InventoryActivity;
import com.example.petstoremobile.activities.listactivities.ProductActivity;
public class BaseActivity extends AppCompatActivity {
//Inflate the shared menu
@@ -20,17 +24,13 @@ public class BaseActivity extends AppCompatActivity {
@Override
public boolean onOptionsItemSelected(MenuItem item){
if (item.getItemId() == R.id.menu_pets) {
if (!(this instanceof PetActivity)) {
startActivity(new Intent(this, PetActivity.class));
}
// if (!(this instanceof PetActivity)) {
// startActivity(new Intent(this, PetActivity.class));
// }
} else if (item.getItemId() == R.id.menu_adoption) {
if (!(this instanceof AdoptionActivity)) {
startActivity(new Intent(this, AdoptionActivity.class));
}
} else if (item.getItemId() == R.id.menu_services) {
if (!(this instanceof ServiceActivity)) {
startActivity(new Intent(this, ServiceActivity.class));
}
} else if (item.getItemId() == R.id.menu_appointments) {
if (!(this instanceof AppointmentActivity)) {
startActivity(new Intent(this, AppointmentActivity.class));
@@ -43,10 +43,6 @@ public class BaseActivity extends AppCompatActivity {
if (!(this instanceof ProductActivity)) {
startActivity(new Intent(this, ProductActivity.class));
}
} else if (item.getItemId() == R.id.menu_suppliers) {
if (!(this instanceof SupplierActivity)) {
startActivity(new Intent(this, SupplierActivity.class));
}
}
return super.onOptionsItemSelected(item);
}

View File

@@ -0,0 +1,64 @@
package com.example.petstoremobile.activities;
import android.content.Intent;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.Fragment;
import com.example.petstoremobile.R;
import com.example.petstoremobile.fragments.ChatFragment;
import com.example.petstoremobile.fragments.ListFragment;
import com.example.petstoremobile.fragments.ProfileFragment;
import com.google.android.material.bottomnavigation.BottomNavigationView;
public class HomeActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_home);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
//get the bottom navbar from the layout
BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
// Load ListFragment by default
loadFragment(new ListFragment());
bottomNav.setSelectedItemId(R.id.nav_list);
//when an item in the bar is selected, load the corresponding fragment
bottomNav.setOnItemSelectedListener(item -> {
if (item.getItemId() == R.id.nav_list) {
loadFragment(new ListFragment());
return true;
} else if (item.getItemId() == R.id.nav_chat) {
loadFragment(new ChatFragment());
return true;
} else if (item.getItemId() == R.id.nav_profile) {
loadFragment(new ProfileFragment());
return true;
}
return false;
});
}
//helper function to load a fragment
private void loadFragment(Fragment fragment) {
getSupportFragmentManager()
.beginTransaction()
.replace(R.id.fragment_container, fragment)
.commit();
}
}

View File

@@ -55,9 +55,9 @@ public class MainActivity extends AppCompatActivity {
return;
}
//check if username and password are correct
//check if username and password are correct TODO: Replace with actual login
if (username.equals("admin") && password.equals("admin")) {
Intent intent = new Intent(this, PetActivity.class);
Intent intent = new Intent(this, HomeActivity.class);
startActivity(intent);
Toast.makeText(this, "Login successful", Toast.LENGTH_SHORT).show();
finish();

View File

@@ -1,66 +0,0 @@
package com.example.petstoremobile.activities;
import android.content.Intent;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.detailactivites.PetDetailActivity;
import com.example.petstoremobile.adapters.PetAdapter;
import com.example.petstoremobile.models.Pet;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
public class PetActivity extends BaseActivity {
private List<Pet> petList = new ArrayList<>();
private PetAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_pets);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
loadPetData(); //TODO: Replace this with actual data when backend is working
setupRecyclerView();
// Add button opens the add dialog
FloatingActionButton fabAddPet = findViewById(R.id.fabAddPet);
fabAddPet.setOnClickListener(v -> {
Intent intent = new Intent(this, PetDetailActivity.class);
startActivity(intent);
});
}
// Loads hardcoded sample data for now TODO: REPLACE THIS WITH A METHOD THAT GETS DATA FROM THE DATABASE
private void loadPetData() {
petList.add(new Pet(1, "Buddy", "Dog", "Labrador", 2, "Available", 500.00));
petList.add(new Pet(2, "Milo", "Cat", "Persian", 1, "Available", 300.00));
petList.add(new Pet(3, "Charlie", "Dog", "Golden Retriever", 3, "Available", 550.00));
petList.add(new Pet(4, "Luna", "Cat", "Siamese", 2, "Adopted", 350.00));
petList.add(new Pet(5, "Max", "Dog", "Beagle", 1, "Available", 450.00));
petList.add(new Pet(6, "Bella", "Cat", "Maine Coon", 4, "Available", 400.00));
}
//set up the recyclerview and adapter
private void setupRecyclerView() {
RecyclerView recyclerView = findViewById(R.id.recyclerViewPets);
adapter = new PetAdapter(petList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
}
}

View File

@@ -1,65 +0,0 @@
package com.example.petstoremobile.activities;
import android.content.Intent;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.detailactivites.ServiceDetailActivity;
import com.example.petstoremobile.adapters.ServiceAdapter;
import com.example.petstoremobile.models.Service;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
public class ServiceActivity extends BaseActivity {
private List<Service> serviceList = new ArrayList<>();
private ServiceAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_services);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
loadServiceData();
setupRecyclerView();
// Add button opens the add dialog
FloatingActionButton fabAddService = findViewById(R.id.fabAddService);
fabAddService.setOnClickListener(v -> {
Intent intent = new Intent(this, ServiceDetailActivity.class);
startActivity(intent);
});
}
// Loads hardcoded sample data for now TODO: REPLACE THIS WITH A METHOD THAT GETS DATA FROM THE DATABASE
private void loadServiceData() {
serviceList.add(new Service(1, "Pet Grooming", "Full grooming service", 60, 40.00));
serviceList.add(new Service(2, "Nail Trimming", "Quick nail trim", 15, 10.00));
serviceList.add(new Service(3, "Bath and Brush", "Bathing and brushing service", 45, 30.00));
serviceList.add(new Service(4, "Veterinary Checkup", "Complete health examination", 30, 75.00));
serviceList.add(new Service(5, "Teeth Cleaning", "Professional dental cleaning", 90, 100.00));
}
// Set up the RecyclerView and adapter
private void setupRecyclerView() {
RecyclerView recyclerView = findViewById(R.id.recyclerViewServices);
adapter = new ServiceAdapter(serviceList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
}
}

View File

@@ -1,68 +0,0 @@
package com.example.petstoremobile.activities;
import android.content.Intent;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.detailactivites.SupplierDetailActivity;
import com.example.petstoremobile.adapters.SupplierAdapter;
import com.example.petstoremobile.models.Supplier;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
public class SupplierActivity extends BaseActivity {
private List<Supplier> supplierList = new ArrayList<>();
private SupplierAdapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_supplier);
if (findViewById(R.id.main) != null) {
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
}
loadSupplierData(); //TODO: Replace this with actual data when backend is working
setupRecyclerView();
// Add button opens the add dialog
FloatingActionButton fabAddSupplier = findViewById(R.id.fabAddSupplier);
fabAddSupplier.setOnClickListener(v -> {
Intent intent = new Intent(this, SupplierDetailActivity.class);
startActivity(intent);
});
}
// Loads hardcoded sample data for now TODO: REPLACE THIS WITH A METHOD THAT GETS DATA FROM THE DATABASE
private void loadSupplierData() {
supplierList.add(new Supplier(1, "PetCare Inc.", "John", "Doe", "john@petcare.com", "888-555-0101"));
supplierList.add(new Supplier(2, "Happy Tails", "Jane", "Smith", "jane@happytails.com", "888-555-0102"));
supplierList.add(new Supplier(3, "Animal Supplies Co.", "Mike", "Brown", "mike@animalsupplies.com", "888-555-0103"));
supplierList.add(new Supplier(4, "Groomers Choice", "Sarah", "Wilson", "sarah@groomerschoice.com", "888-555-0104"));
supplierList.add(new Supplier(5, "Healthy Pets", "Robert", "Miller", "robert@healthypets.com", "888-555-0105"));
}
// set up the recyclerview and adapter
private void setupRecyclerView() {
RecyclerView recyclerView = findViewById(R.id.recyclerViewSuppliers);
adapter = new SupplierAdapter(supplierList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
}
}

View File

@@ -1,127 +0,0 @@
package com.example.petstoremobile.activities.detailactivites;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.petstoremobile.R;
public class PetDetailActivity extends AppCompatActivity {
private TextView tvMode, tvPetId;
private EditText etPetName, etPetSpecies, etPetBreed, etPetAge, etPetPrice;
private Spinner spinnerPetStatus;
private Button btnSavePet, btnDeletePet, btnBack;
private int petId;
private boolean isEditing = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_pet_detail);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
//set up spinner and get controls from layout
initViews();
setupSpinner();
handleIntent();
btnBack.setOnClickListener(v -> finish());
btnSavePet.setOnClickListener(v -> savePet());
btnDeletePet.setOnClickListener(v -> deletePet());
}
//get controls from layout
private void initViews() {
tvMode = findViewById(R.id.tvMode);
tvPetId = findViewById(R.id.tvPetId);
etPetName = findViewById(R.id.etPetName);
etPetSpecies = findViewById(R.id.etPetSpecies);
etPetBreed = findViewById(R.id.etPetBreed);
etPetAge = findViewById(R.id.etPetAge);
etPetPrice = findViewById(R.id.etPetPrice);
spinnerPetStatus = findViewById(R.id.spinnerPetStatus);
btnSavePet = findViewById(R.id.btnSavePet);
btnDeletePet = findViewById(R.id.btnDeletePet);
btnBack = findViewById(R.id.btnBack);
}
//set up the spinner menu for pet status
private void setupSpinner() {
ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
android.R.layout.simple_spinner_item,
new String[]{"Available", "Adopted"});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerPetStatus.setAdapter(adapter);
}
//check if pet is being edited or added and show the view accordingly
private void handleIntent() {
// Pet is being edited
if (getIntent().hasExtra("petId")) {
// Get pet data from intent and populate fields
isEditing = true;
petId = getIntent().getIntExtra("petId", -1);
tvMode.setText("Edit Pet");
tvPetId.setText("ID: " + petId);
etPetName.setText(getIntent().getStringExtra("petName"));
etPetSpecies.setText(getIntent().getStringExtra("petSpecies"));
etPetBreed.setText(getIntent().getStringExtra("petBreed"));
etPetAge.setText(String.valueOf(getIntent().getIntExtra("petAge", 0)));
etPetPrice.setText(String.valueOf(getIntent().getDoubleExtra("petPrice", 0.0)));
// Set spinner selection based on pet status
String status = getIntent().getStringExtra("petStatus");
if ("Available".equals(status)) {
spinnerPetStatus.setSelection(0);
} else {
spinnerPetStatus.setSelection(1);
}
//Delete button is visible when editing
btnDeletePet.setVisibility(View.VISIBLE);
} else {
// Pet is being added
// Set default values for add a new pet
isEditing = false;
tvMode.setText("Add Pet");
tvPetId.setVisibility(View.GONE);
btnDeletePet.setVisibility(View.GONE);
btnSavePet.setText("Add");
}
}
//TODO: Method to Update or Add a pet
private void savePet() {
if (isEditing) {
// TODO: Update pet
Toast.makeText(this, "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
} else {
// TODO: Add new pet
Toast.makeText(this, "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
finish();
}
//TODO: Method to Delete a pet
private void deletePet() {
Toast.makeText(this, "Delete functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
finish();
}
}

View File

@@ -1,104 +0,0 @@
package com.example.petstoremobile.activities.detailactivites;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.petstoremobile.R;
public class ServiceDetailActivity extends AppCompatActivity {
private TextView tvMode, tvServiceId;
private EditText etServiceName, etServiceDesc, etServiceDuration, etServicePrice;
private Button btnSaveService, btnDeleteService, btnBack;
private int serviceId;
private boolean isEditing = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_service_detail);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
initViews();
handleIntent();
//Set clicks listener for each button
btnBack.setOnClickListener(v -> finish());
btnSaveService.setOnClickListener(v -> saveService());
btnDeleteService.setOnClickListener(v -> deleteService());
}
//get controls form layout
private void initViews() {
tvMode = findViewById(R.id.tvMode);
tvServiceId = findViewById(R.id.tvServiceId);
etServiceName = findViewById(R.id.etServiceName);
etServiceDesc = findViewById(R.id.etServiceDesc);
etServiceDuration = findViewById(R.id.etServiceDuration);
etServicePrice = findViewById(R.id.etServicePrice);
btnSaveService = findViewById(R.id.btnSaveService);
btnDeleteService = findViewById(R.id.btnDeleteService);
btnBack = findViewById(R.id.btnBack);
}
//check if service is being edited or added and show the view accordingly
private void handleIntent() {
// Service is being edited
if (getIntent().hasExtra("serviceId")) {
// Get service data from intent and populate fields
isEditing = true;
serviceId = getIntent().getIntExtra("serviceId", -1);
tvMode.setText("Edit Service");
tvServiceId.setText("ID: " + serviceId);
etServiceName.setText(getIntent().getStringExtra("serviceName"));
etServiceDesc.setText(getIntent().getStringExtra("serviceDesc"));
etServiceDuration.setText(String.valueOf(getIntent().getIntExtra("serviceDuration", 0)));
etServicePrice.setText(String.valueOf(getIntent().getDoubleExtra("servicePrice", 0.0)));
//Delete button is visible when editing
btnDeleteService.setVisibility(View.VISIBLE);
} else {
// Service is being added
// Set default values for add a new service
isEditing = false;
tvMode.setText("Add Service");
tvServiceId.setVisibility(View.GONE);
btnDeleteService.setVisibility(View.GONE);
btnSaveService.setText("Add");
}
}
//TODO: Method to Update or Add a service
private void saveService() {
if (isEditing) {
// TODO: Update service
Toast.makeText(this, "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
} else {
// TODO: Add new service
Toast.makeText(this, "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
finish();
}
//TODO: Method to Delete a service
private void deleteService() {
Toast.makeText(this, "Delete functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
finish();
}
}

View File

@@ -1,104 +0,0 @@
package com.example.petstoremobile.activities.detailactivites;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.petstoremobile.R;
public class SupplierDetailActivity extends AppCompatActivity {
private TextView tvMode, tvSupId;
private EditText etSupCompany, etSupContactFirstName, etSupContactLastName, etSupEmail, etSupPhone;
private Button btnSaveSupplier, btnDeleteSupplier, btnBack;
private int supId;
private boolean isEditing = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
EdgeToEdge.enable(this);
setContentView(R.layout.activity_supplier_detail);
ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
return insets;
});
initViews();
handleIntent();
//Set clicks listener for each button
btnBack.setOnClickListener(v -> finish());
btnSaveSupplier.setOnClickListener(v -> saveSupplier());
btnDeleteSupplier.setOnClickListener(v -> deleteSupplier());
}
//get controls form layout
private void initViews() {
tvMode = findViewById(R.id.tvMode);
tvSupId = findViewById(R.id.tvSupId);
etSupCompany = findViewById(R.id.etSupCompany);
etSupContactFirstName = findViewById(R.id.etSupContactFirstName);
etSupContactLastName = findViewById(R.id.etSupContactLastName);
etSupEmail = findViewById(R.id.etSupEmail);
etSupPhone = findViewById(R.id.etSupPhone);
btnSaveSupplier = findViewById(R.id.btnSaveSupplier);
btnDeleteSupplier = findViewById(R.id.btnDeleteSupplier);
btnBack = findViewById(R.id.btnBack);
}
//check if supplier is being edited or added and show the view accordingly
private void handleIntent() {
// Supplier is being edited
if (getIntent().hasExtra("supId")) {
// Get supplier data from intent and populate fields
isEditing = true;
supId = getIntent().getIntExtra("supId", -1);
tvMode.setText("Edit Supplier");
tvSupId.setText("ID: " + supId);
etSupCompany.setText(getIntent().getStringExtra("supCompany"));
etSupContactFirstName.setText(getIntent().getStringExtra("supContactFirstName"));
etSupContactLastName.setText(getIntent().getStringExtra("supContactLastName"));
etSupEmail.setText(getIntent().getStringExtra("supEmail"));
etSupPhone.setText(getIntent().getStringExtra("supPhone"));
//Delete button is visible when editing
btnDeleteSupplier.setVisibility(View.VISIBLE);
} else {
// Supplier is being added
// Set default values for add a new supplier
isEditing = false;
tvMode.setText("Add Supplier");
tvSupId.setVisibility(View.GONE);
btnDeleteSupplier.setVisibility(View.GONE);
btnSaveSupplier.setText("Add");
}
}
//TODO: Method to Update or Add a supplier
private void saveSupplier() {
if (isEditing) {
// TODO: Update supplier
Toast.makeText(this, "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
} else {
// TODO: Add new supplier
Toast.makeText(this, "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
finish();
}
//TODO: Method to Delete a supplier
private void deleteSupplier() {
Toast.makeText(this, "Delete functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
finish();
}
}

View File

@@ -1,14 +1,14 @@
package com.example.petstoremobile.activities;
package com.example.petstoremobile.activities.listactivities;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.BaseActivity;
public class AdoptionActivity extends BaseActivity {

View File

@@ -1,4 +1,4 @@
package com.example.petstoremobile.activities;
package com.example.petstoremobile.activities.listactivities;
import android.os.Bundle;
@@ -8,6 +8,7 @@ import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.BaseActivity;
public class AppointmentActivity extends BaseActivity {

View File

@@ -1,14 +1,14 @@
package com.example.petstoremobile.activities;
package com.example.petstoremobile.activities.listactivities;
import android.os.Bundle;
import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.BaseActivity;
public class InventoryActivity extends BaseActivity {

View File

@@ -1,4 +1,4 @@
package com.example.petstoremobile.activities;
package com.example.petstoremobile.activities.listactivities;
import android.os.Bundle;
@@ -8,6 +8,7 @@ import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.BaseActivity;
public class ProductActivity extends BaseActivity {

View File

@@ -1,7 +1,5 @@
package com.example.petstoremobile.adapters;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
@@ -10,19 +8,23 @@ import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.detailactivites.PetDetailActivity;
import com.example.petstoremobile.models.Pet;
import java.util.List;
public class PetAdapter extends RecyclerView.Adapter<PetAdapter.PetViewHolder> {
private List<Pet> petList;
private Context context;
private OnPetClickListener petClickListener;
// Interface for pet click on recycler view
public interface OnPetClickListener {
void onPetClick(int position);
}
//Constructor
public PetAdapter(List<Pet> petList, Context context) {
this.petList = petList;
this.context = context;
public PetAdapter(List<Pet> petList, OnPetClickListener petClickListener) {
this.petList = petList;
this.petClickListener = petClickListener;
}
// Get the controls of each row in recycler view
@@ -31,11 +33,11 @@ public class PetAdapter extends RecyclerView.Adapter<PetAdapter.PetViewHolder> {
public PetViewHolder(@NonNull View v) {
super(v);
tvPetName = v.findViewById(R.id.tvPetName);
tvPetName = v.findViewById(R.id.tvPetName);
tvPetSpeciesBreed = v.findViewById(R.id.tvPetSpeciesBreed);
tvPetAge = v.findViewById(R.id.tvPetAge);
tvPetPrice = v.findViewById(R.id.tvPetPrice);
tvPetStatus = v.findViewById(R.id.tvPetStatus);
tvPetAge = v.findViewById(R.id.tvPetAge);
tvPetPrice = v.findViewById(R.id.tvPetPrice);
tvPetStatus = v.findViewById(R.id.tvPetStatus);
}
}
@@ -43,7 +45,7 @@ public class PetAdapter extends RecyclerView.Adapter<PetAdapter.PetViewHolder> {
@NonNull
@Override
public PetViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context).inflate(R.layout.item_pet, parent, false);
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_pet, parent, false);
return new PetViewHolder(v);
}
@@ -65,18 +67,8 @@ public class PetAdapter extends RecyclerView.Adapter<PetAdapter.PetViewHolder> {
holder.tvPetStatus.setBackgroundColor(Color.parseColor("#F44336"));
}
//Set click listener for each row
holder.itemView.setOnClickListener(v -> {
Intent intent = new Intent(context, PetDetailActivity.class);
intent.putExtra("petId", pet.getPetId());
intent.putExtra("petName", pet.getPetName());
intent.putExtra("petSpecies", pet.getPetSpecies());
intent.putExtra("petBreed", pet.getPetBreed());
intent.putExtra("petAge", pet.getPetAge());
intent.putExtra("petPrice", pet.getPetPrice());
intent.putExtra("petStatus", pet.getPetStatus());
context.startActivity(intent);
});
//when a row is clicked, open the detail view
holder.itemView.setOnClickListener(v -> petClickListener.onPetClick(position));
}
@Override

View File

@@ -1,53 +1,53 @@
package com.example.petstoremobile.adapters;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.detailactivites.ServiceDetailActivity;
import com.example.petstoremobile.models.Service;
import java.util.List;
public class ServiceAdapter extends RecyclerView.Adapter<ServiceAdapter.ServiceViewHolder> {
private List<Service> serviceList;
private Context context;
//Constructor
public ServiceAdapter(List<Service> serviceList, Context context) {
this.serviceList = serviceList;
this.context = context;
private List<Service> serviceList;
private OnServiceClickListener serviceClickListener;
// Interface for service click on recycler view
public interface OnServiceClickListener {
void onServiceClick(int position);
}
//Get controls of each row in recycler view
//Constructor
public ServiceAdapter(List<Service> serviceList, OnServiceClickListener serviceClickListener) {
this.serviceList = serviceList;
this.serviceClickListener = serviceClickListener;
}
// Get the controls of each row in recycler view
public static class ServiceViewHolder extends RecyclerView.ViewHolder {
TextView tvServiceName, tvServiceDesc, tvServiceDuration, tvServicePrice;
public ServiceViewHolder(@NonNull View v) {
super(v);
tvServiceName = v.findViewById(R.id.tvServiceName);
tvServiceDesc = v.findViewById(R.id.tvServiceDesc);
tvServiceName = v.findViewById(R.id.tvServiceName);
tvServiceDesc = v.findViewById(R.id.tvServiceDesc);
tvServiceDuration = v.findViewById(R.id.tvServiceDuration);
tvServicePrice = v.findViewById(R.id.tvServicePrice);
tvServicePrice = v.findViewById(R.id.tvServicePrice);
}
}
//Create a new row view
// Create a new row view
@NonNull
@Override
public ServiceViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context).inflate(R.layout.item_service, parent, false);
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_service, parent, false);
return new ServiceViewHolder(v);
}
//Populate the row with service data
//populate the row with service data
@Override
public void onBindViewHolder(@NonNull ServiceViewHolder holder, int position) {
Service service = serviceList.get(position);
@@ -57,21 +57,12 @@ public class ServiceAdapter extends RecyclerView.Adapter<ServiceAdapter.ServiceV
holder.tvServiceDuration.setText("Duration: " + service.getServiceDuration() + " min");
holder.tvServicePrice.setText("$" + String.format("%.2f", service.getServicePrice()));
//Set click listener for each row
holder.itemView.setOnClickListener(v -> {
Intent intent = new Intent(context, ServiceDetailActivity.class);
intent.putExtra("serviceId", service.getServiceId());
intent.putExtra("serviceName", service.getServiceName());
intent.putExtra("serviceDesc", service.getServiceDesc());
intent.putExtra("serviceDuration", service.getServiceDuration());
intent.putExtra("servicePrice", service.getServicePrice());
context.startActivity(intent);
});
//when a row is clicked, open the detail view
holder.itemView.setOnClickListener(v -> serviceClickListener.onServiceClick(position));
}
@Override
public int getItemCount() {
return serviceList.size();
}
}
}

View File

@@ -1,32 +1,32 @@
package com.example.petstoremobile.adapters;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.example.petstoremobile.R;
import com.example.petstoremobile.activities.detailactivites.SupplierDetailActivity;
import com.example.petstoremobile.models.Supplier;
import java.util.List;
public class SupplierAdapter extends RecyclerView.Adapter<SupplierAdapter.SupplierViewHolder> {
private List<Supplier> supplierList;
private Context context;
//Constructor
public SupplierAdapter(List<Supplier> supplierList, Context context) {
this.supplierList = supplierList;
this.context = context;
private List<Supplier> supplierList;
private OnSupplierClickListener supplierClickListener;
// Interface for supplier click on recycler view
public interface OnSupplierClickListener {
void onSupplierClick(int position);
}
//Get controls of each row in recycler view
//Constructor
public SupplierAdapter(List<Supplier> supplierList, OnSupplierClickListener supplierClickListener) {
this.supplierList = supplierList;
this.supplierClickListener = supplierClickListener;
}
// Get the controls of each row in recycler view
public static class SupplierViewHolder extends RecyclerView.ViewHolder {
TextView tvSupCompany, tvSupContactName, tvSupEmail, tvSupPhone;
@@ -39,15 +39,15 @@ public class SupplierAdapter extends RecyclerView.Adapter<SupplierAdapter.Suppli
}
}
//Create a new row view
// Create a new row view
@NonNull
@Override
public SupplierViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(context).inflate(R.layout.item_supplier, parent, false);
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_supplier, parent, false);
return new SupplierViewHolder(v);
}
//Populate the row with supplier data
//populate the row with supplier data
@Override
public void onBindViewHolder(@NonNull SupplierViewHolder holder, int position) {
Supplier supplier = supplierList.get(position);
@@ -57,22 +57,12 @@ public class SupplierAdapter extends RecyclerView.Adapter<SupplierAdapter.Suppli
holder.tvSupEmail.setText(supplier.getSupEmail());
holder.tvSupPhone.setText(supplier.getSupPhone());
//Set click listener for each row
holder.itemView.setOnClickListener(v -> {
Intent intent = new Intent(context, SupplierDetailActivity.class);
intent.putExtra("supId", supplier.getSupId());
intent.putExtra("supCompany", supplier.getSupCompany());
intent.putExtra("supContactFirstName", supplier.getSupContactFirstName());
intent.putExtra("supContactLastName", supplier.getSupContactLastName());
intent.putExtra("supEmail", supplier.getSupEmail());
intent.putExtra("supPhone", supplier.getSupPhone());
context.startActivity(intent);
});
//when a row is clicked, open the detail view
holder.itemView.setOnClickListener(v -> supplierClickListener.onSupplierClick(position));
}
@Override
public int getItemCount() {
return supplierList.size();
}
}
}

View File

@@ -0,0 +1,36 @@
package com.example.petstoremobile.fragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ScrollView;
import android.widget.TextView;
import com.example.petstoremobile.R;
public class ChatFragment extends Fragment {
private LinearLayout chatContainer;
private EditText etMessage;
private ScrollView scrollView;
private Button btnSend;
//TODO: Add functionality for sending messages
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_chat, container, false);
return view;
}
}

View File

@@ -0,0 +1,76 @@
package com.example.petstoremobile.fragments;
import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.core.view.MenuProvider;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import androidx.lifecycle.Lifecycle;
import com.example.petstoremobile.R;
import com.example.petstoremobile.fragments.listfragments.PetFragment;
import com.example.petstoremobile.fragments.listfragments.ServiceFragment;
import com.example.petstoremobile.fragments.listfragments.SupplierFragment;
//The Fragment for the displaying the list of entities to be viewed
public class ListFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_list, container, false);
//Display pets fragment by default
if (savedInstanceState == null) {
loadFragment(new PetFragment());
}
//create a menu for the user to select what entity to view
requireActivity().addMenuProvider(new MenuProvider() {
//inflate the menu
@Override
public void onCreateMenu(@NonNull Menu menu, @NonNull MenuInflater menuInflater) {
menuInflater.inflate(R.menu.menu_main, menu);
}
//handle menu clicks
@Override
public boolean onMenuItemSelected(@NonNull MenuItem menuItem) {
//check what menu item is selected and load the corresponding fragment
if (menuItem.getItemId() == R.id.menu_pets) {
loadFragment(new PetFragment());
return true;
} else if (menuItem.getItemId() == R.id.menu_services) {
loadFragment(new ServiceFragment());
return true;
} else if (menuItem.getItemId() == R.id.menu_suppliers) {
loadFragment(new SupplierFragment());
return true;
}
return false;
}
}, getViewLifecycleOwner(), Lifecycle.State.RESUMED);
return view;
}
// helper function to load the fragment into the display
public void loadFragment(Fragment fragment) {
getChildFragmentManager()
.beginTransaction()
.replace(R.id.inner_fragment_container, fragment)
.addToBackStack(null)
.commit();
}
}

View File

@@ -0,0 +1,24 @@
package com.example.petstoremobile.fragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.petstoremobile.R;
public class ProfileFragment extends Fragment {
//TODO: Create functionality for profile fragment
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_profile, container, false);
return view;
}
}

View File

@@ -0,0 +1,116 @@
package com.example.petstoremobile.fragments.listfragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.petstoremobile.R;
import com.example.petstoremobile.adapters.PetAdapter;
import com.example.petstoremobile.fragments.ListFragment;
import com.example.petstoremobile.fragments.listfragments.detailfragments.PetDetailFragment;
import com.example.petstoremobile.models.Pet;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
public class PetFragment extends Fragment implements PetAdapter.OnPetClickListener {
private List<Pet> petList = new ArrayList<>();
private PetAdapter adapter;
//load pet view
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_pet, container, false);
loadPetData(); //TODO: Replace this with actual data when backend is working
setupRecyclerView(view);
//Add button to opens the add dialog
FloatingActionButton fabAddPet = view.findViewById(R.id.fabAddPet);
fabAddPet.setOnClickListener(v -> openPetDetails(-1));
return view;
}
//Open the pet detail view depending on the mode
private void openPetDetails(int position) {
PetDetailFragment detailFragment = new PetDetailFragment();
//Make a bundle to pass data to the detail fragment
Bundle args = new Bundle();
args.putInt("position", position);
//if editing a pet, add the pet data to the bundle
if (position != -1) {
Pet pet = petList.get(position);
args.putInt("petId", pet.getPetId());
args.putString("petName", pet.getPetName());
args.putString("petSpecies", pet.getPetSpecies());
args.putString("petBreed", pet.getPetBreed());
args.putInt("petAge", pet.getPetAge());
args.putString("petStatus", pet.getPetStatus());
args.putDouble("petPrice", pet.getPetPrice());
}
//send the bundle to the detail fragment to display
detailFragment.setArguments(args);
//set the pet fragment to the parent so we refer back to pet view when save or delete is done
detailFragment.setPetFragment(this);
//get ListFragment to load the the detail view
ListFragment listFragment = (ListFragment) getParentFragment();
if (listFragment != null) {
listFragment.loadFragment(detailFragment);
}
}
// Called by PetDetailFragment when save or delete is done
public void onPetSaved(int position, Pet pet) {
if (position == -1) {
petList.add(pet);
adapter.notifyItemInserted(petList.size() - 1);
} else {
petList.set(position, pet);
adapter.notifyItemChanged(position);
}
}
public void onPetDeleted(int position) {
petList.remove(position);
adapter.notifyItemRemoved(position);
}
// Called by PetAdapter when a row is clicked to open the details view
@Override
public void onPetClick(int position) {
openPetDetails(position);
}
// Helper function to get a list of all pets (Loads hardcoded sample data for now) TODO: REPLACE THIS WITH A METHOD THAT GETS DATA FROM THE DATABASE
private void loadPetData() {
petList.clear();
petList.add(new Pet(1, "Buddy","Dog", "Labrador",2, "Available", 500.00));
petList.add(new Pet(2, "Milo", "Cat", "Persian",1, "Available", 300.00));
petList.add(new Pet(3, "Charlie","Dog", "Golden Retriever", 3, "Available", 550.00));
petList.add(new Pet(4, "Luna", "Cat", "Siamese",2, "Adopted", 350.00));
petList.add(new Pet(5, "Max", "Dog", "Beagle",1, "Available", 450.00));
petList.add(new Pet(6, "Bella", "Cat", "Maine Coon",4, "Available", 400.00));
}
//set up the recyclerview and adapter
private void setupRecyclerView(View view) {
RecyclerView recyclerView = view.findViewById(R.id.recyclerViewPets);
adapter = new PetAdapter(petList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter);
}
}

View File

@@ -0,0 +1,113 @@
package com.example.petstoremobile.fragments.listfragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.petstoremobile.R;
import com.example.petstoremobile.adapters.ServiceAdapter;
import com.example.petstoremobile.fragments.ListFragment;
import com.example.petstoremobile.fragments.listfragments.detailfragments.ServiceDetailFragment;
import com.example.petstoremobile.models.Service;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
public class ServiceFragment extends Fragment implements ServiceAdapter.OnServiceClickListener {
private List<Service> serviceList = new ArrayList<>();
private ServiceAdapter adapter;
//load service view
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_service, container, false);
loadServiceData(); //TODO: Replace this with actual data when backend is working
setupRecyclerView(view);
//Add button to opens the add dialog
FloatingActionButton fabAddService = view.findViewById(R.id.fabAddService);
fabAddService.setOnClickListener(v -> openServiceDetails(-1));
return view;
}
//Open the service detail view depending on the mode
private void openServiceDetails(int position) {
ServiceDetailFragment detailFragment = new ServiceDetailFragment();
//Make a bundle to pass data to the detail fragment
Bundle args = new Bundle();
args.putInt("position", position);
//if editing a service, add the service data to the bundle
if (position != -1) {
Service service = serviceList.get(position);
args.putInt("serviceId", service.getServiceId());
args.putString("serviceName", service.getServiceName());
args.putString("serviceDesc", service.getServiceDesc());
args.putInt("serviceDuration", service.getServiceDuration());
args.putDouble("servicePrice", service.getServicePrice());
}
//send the bundle to the detail fragment to display
detailFragment.setArguments(args);
//set the service fragment to the parent so we refer back to service view when save or delete is done
detailFragment.setServiceFragment(this);
//get ListFragment to load the the detail view
ListFragment listFragment = (ListFragment) getParentFragment();
if (listFragment != null) {
listFragment.loadFragment(detailFragment);
}
}
// Called by ServiceDetailFragment when save or delete is done
public void onServiceSaved(int position, Service service) {
if (position == -1) {
serviceList.add(service);
adapter.notifyItemInserted(serviceList.size() - 1);
} else {
serviceList.set(position, service);
adapter.notifyItemChanged(position);
}
}
public void onServiceDeleted(int position) {
serviceList.remove(position);
adapter.notifyItemRemoved(position);
}
// Called by ServiceAdapter when a row is clicked to open the details view
@Override
public void onServiceClick(int position) {
openServiceDetails(position);
}
// Helper function to get a list of all services (Loads hardcoded sample data for now) TODO: REPLACE THIS WITH A METHOD THAT GETS DATA FROM THE DATABASE
private void loadServiceData() {
serviceList.clear();
serviceList.add(new Service(1, "Grooming", "Full grooming for your pet", 60, 50.00));
serviceList.add(new Service(2, "Vaccination", "Standard vaccinations", 30, 75.00));
serviceList.add(new Service(3, "Health Checkup", "Comprehensive health exam", 45, 100.00));
serviceList.add(new Service(4, "Pet Sitting", "Overnight stay for your pet", 1440, 40.00));
serviceList.add(new Service(5, "Training", "Basic obedience training session", 60, 60.00));
}
//set up the recyclerview and adapter
private void setupRecyclerView(View view) {
RecyclerView recyclerView = view.findViewById(R.id.recyclerViewServices);
adapter = new ServiceAdapter(serviceList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter);
}
}

View File

@@ -0,0 +1,114 @@
package com.example.petstoremobile.fragments.listfragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.petstoremobile.R;
import com.example.petstoremobile.adapters.SupplierAdapter;
import com.example.petstoremobile.fragments.ListFragment;
import com.example.petstoremobile.fragments.listfragments.detailfragments.SupplierDetailFragment;
import com.example.petstoremobile.models.Supplier;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.List;
public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupplierClickListener {
private List<Supplier> supplierList = new ArrayList<>();
private SupplierAdapter adapter;
//load supplier view
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_supplier, container, false);
loadSupplierData(); //TODO: Replace this with actual data when backend is working
setupRecyclerView(view);
//Add button to opens the add dialog
FloatingActionButton fabAddSupplier = view.findViewById(R.id.fabAddSupplier);
fabAddSupplier.setOnClickListener(v -> openSupplierDetails(-1));
return view;
}
//Open the supplier detail view depending on the mode
private void openSupplierDetails(int position) {
SupplierDetailFragment detailFragment = new SupplierDetailFragment();
//Make a bundle to pass data to the detail fragment
Bundle args = new Bundle();
args.putInt("position", position);
//if editing a supplier, add the supplier data to the bundle
if (position != -1) {
Supplier supplier = supplierList.get(position);
args.putInt("supId", supplier.getSupId());
args.putString("supCompany", supplier.getSupCompany());
args.putString("supContactFirstName", supplier.getSupContactFirstName());
args.putString("supContactLastName", supplier.getSupContactLastName());
args.putString("supEmail", supplier.getSupEmail());
args.putString("supPhone", supplier.getSupPhone());
}
//send the bundle to the detail fragment to display
detailFragment.setArguments(args);
//set the supplier fragment to the parent so we refer back to supplier view when save or delete is done
detailFragment.setSupplierFragment(this);
//get ListFragment to load the the detail view
ListFragment listFragment = (ListFragment) getParentFragment();
if (listFragment != null) {
listFragment.loadFragment(detailFragment);
}
}
// Called by SupplierDetailFragment when save or delete is done
public void onSupplierSaved(int position, Supplier supplier) {
if (position == -1) {
supplierList.add(supplier);
adapter.notifyItemInserted(supplierList.size() - 1);
} else {
supplierList.set(position, supplier);
adapter.notifyItemChanged(position);
}
}
public void onSupplierDeleted(int position) {
supplierList.remove(position);
adapter.notifyItemRemoved(position);
}
// Called by SupplierAdapter when a row is clicked to open the details view
@Override
public void onSupplierClick(int position) {
openSupplierDetails(position);
}
// Helper function to get a list of all suppliers (Loads hardcoded sample data for now) TODO: REPLACE THIS WITH A METHOD THAT GETS DATA FROM THE DATABASE
private void loadSupplierData() {
supplierList.clear();
supplierList.add(new Supplier(1, "Pet Food Co.", "John", "Doe", "john@petfood.com", "123-456-7890"));
supplierList.add(new Supplier(2, "Toy Kingdom", "Jane", "Smith", "jane@toykingdom.com", "987-654-3210"));
supplierList.add(new Supplier(3, "HealthPet", "Robert", "Brown", "robert@healthpet.com", "555-0199-234"));
supplierList.add(new Supplier(4, "Groomers Choice", "Emily", "Davis", "emily@groomers.com", "444-555-6666"));
supplierList.add(new Supplier(5, "Birdy Haven", "Michael", "Wilson", "michael@birdyhaven.com", "111-222-3333"));
}
//set up the recyclerview and adapter
private void setupRecyclerView(View view) {
RecyclerView recyclerView = view.findViewById(R.id.recyclerViewSuppliers);
adapter = new SupplierAdapter(supplierList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter);
}
}

View File

@@ -0,0 +1,132 @@
package com.example.petstoremobile.fragments.listfragments.detailfragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import com.example.petstoremobile.R;
import com.example.petstoremobile.fragments.ListFragment;
import com.example.petstoremobile.fragments.listfragments.PetFragment;
public class PetDetailFragment extends Fragment {
private TextView tvMode, tvPetId;
private EditText etPetName, etPetSpecies, etPetBreed, etPetAge, etPetPrice;
private Spinner spinnerPetStatus;
private Button btnSavePet, btnDeletePet, btnBack;
private int petId;
private boolean isEditing = false;
private PetFragment petFragment;
//set the pet fragment to the parent so we refer back to pet view when save or delete is done
public void setPetFragment(PetFragment fragment) {
this.petFragment = fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_pet_detail, container, false);
//set up spinner and get controls from layout and display the view depending on the mode
initViews(view);
setupSpinner();
handleArguments();
//set button click listeners
btnBack.setOnClickListener(v -> {
//get the list fragment and pop the back stack to return to the previous view (PetFragment)
ListFragment listFragment = (ListFragment) getParentFragment();
if (listFragment != null) {
listFragment.getChildFragmentManager().popBackStack();
}
});
btnSavePet.setOnClickListener(v -> savePet());
btnDeletePet.setOnClickListener(v -> deletePet());
return view;
}
//TODO: Method to Update or Add a pet
private void savePet() {
if (isEditing) {
// TODO: Update pet
Toast.makeText(getContext(), "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
} else {
// TODO: Add new pet
Toast.makeText(getContext(), "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
}
//TODO: Method to Delete a pet
private void deletePet() {
Toast.makeText(getContext(), "Delete functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
//helper function to check if pet is being edited or added and show the view accordingly
private void handleArguments() {
// Pet is being edited if the bundle contains a petId
if (getArguments() != null && getArguments().containsKey("petId")) {
// Get pet data from arguments and populate fields
isEditing = true;
petId = getArguments().getInt("petId");
tvMode.setText("Edit Pet");
tvPetId.setText("ID: " + petId);
etPetName.setText(getArguments().getString("petName"));
etPetSpecies.setText(getArguments().getString("petSpecies"));
etPetBreed.setText(getArguments().getString("petBreed"));
etPetAge.setText(String.valueOf(getArguments().getInt("petAge")));
etPetPrice.setText(String.valueOf(getArguments().getDouble("petPrice")));
String status = getArguments().getString("petStatus");
if ("Available".equals(status)) {
spinnerPetStatus.setSelection(0);
} else {
spinnerPetStatus.setSelection(1);
}
btnDeletePet.setVisibility(View.VISIBLE);
} else {
// Pet is being added
// Set default values for add a new pet
isEditing = false;
tvMode.setText("Add Pet");
tvPetId.setVisibility(View.GONE);
btnDeletePet.setVisibility(View.GONE);
btnSavePet.setText("Add");
}
}
//helper function to get controls from layout
private void initViews(View view) {
tvMode = view.findViewById(R.id.tvMode);
tvPetId = view.findViewById(R.id.tvPetId);
etPetName = view.findViewById(R.id.etPetName);
etPetSpecies = view.findViewById(R.id.etPetSpecies);
etPetBreed = view.findViewById(R.id.etPetBreed);
etPetAge = view.findViewById(R.id.etPetAge);
etPetPrice = view.findViewById(R.id.etPetPrice);
spinnerPetStatus = view.findViewById(R.id.spinnerPetStatus);
btnSavePet = view.findViewById(R.id.btnSavePet);
btnDeletePet = view.findViewById(R.id.btnDeletePet);
btnBack = view.findViewById(R.id.btnBack);
}
//helper function to set up the spinner menu for pet status
private void setupSpinner() {
ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(),
android.R.layout.simple_spinner_item,
new String[]{"Available", "Adopted"});
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerPetStatus.setAdapter(adapter);
}
}

View File

@@ -0,0 +1,109 @@
package com.example.petstoremobile.fragments.listfragments.detailfragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.petstoremobile.R;
import com.example.petstoremobile.fragments.ListFragment;
import com.example.petstoremobile.fragments.listfragments.ServiceFragment;
public class ServiceDetailFragment extends Fragment {
private TextView tvMode, tvServiceId;
private EditText etServiceName, etServiceDesc, etServiceDuration, etServicePrice;
private Button btnSaveService, btnDeleteService, btnBack;
private int serviceId;
private boolean isEditing = false;
private ServiceFragment serviceFragment;
//set the service fragment to the parent so we refer back to service view when save or delete is done
public void setServiceFragment(ServiceFragment fragment) {
this.serviceFragment = fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_service_detail, container, false);
//get controls from layout and display the view depending on the mode
initViews(view);
handleArguments();
//set button click listeners
btnBack.setOnClickListener(v -> {
//get the list fragment and pop the back stack to return to the previous view (ServiceFragment)
ListFragment listFragment = (ListFragment) getParentFragment();
if (listFragment != null) {
listFragment.getChildFragmentManager().popBackStack();
}
});
btnSaveService.setOnClickListener(v -> saveService());
btnDeleteService.setOnClickListener(v -> deleteService());
return view;
}
//TODO: Method to Update or Add a service
private void saveService() {
if (isEditing) {
// TODO: Update service
Toast.makeText(getContext(), "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
} else {
// TODO: Add new service
Toast.makeText(getContext(), "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
}
//TODO: Method to Delete a service
private void deleteService() {
Toast.makeText(getContext(), "Delete functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
//helper function to check if service is being edited or added and show the view accordingly
private void handleArguments() {
// Service is being edited if the bundle contains a serviceId
if (getArguments() != null && getArguments().containsKey("serviceId")) {
// Get service data from arguments and populate fields
isEditing = true;
serviceId = getArguments().getInt("serviceId");
tvMode.setText("Edit Service");
tvServiceId.setText("ID: " + serviceId);
etServiceName.setText(getArguments().getString("serviceName"));
etServiceDesc.setText(getArguments().getString("serviceDesc"));
etServiceDuration.setText(String.valueOf(getArguments().getInt("serviceDuration")));
etServicePrice.setText(String.valueOf(getArguments().getDouble("servicePrice")));
btnDeleteService.setVisibility(View.VISIBLE);
} else {
// Service is being added
// Set default values for add a new service
isEditing = false;
tvMode.setText("Add Service");
tvServiceId.setVisibility(View.GONE);
btnDeleteService.setVisibility(View.GONE);
btnSaveService.setText("Add");
}
}
//helper function to get controls from layout
private void initViews(View view) {
tvMode = view.findViewById(R.id.tvMode);
tvServiceId = view.findViewById(R.id.tvServiceId);
etServiceName = view.findViewById(R.id.etServiceName);
etServiceDesc = view.findViewById(R.id.etServiceDesc);
etServiceDuration = view.findViewById(R.id.etServiceDuration);
etServicePrice = view.findViewById(R.id.etServicePrice);
btnSaveService = view.findViewById(R.id.btnSaveService);
btnDeleteService = view.findViewById(R.id.btnDeleteService);
btnBack = view.findViewById(R.id.btnBack);
}
}

View File

@@ -0,0 +1,111 @@
package com.example.petstoremobile.fragments.listfragments.detailfragments;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.example.petstoremobile.R;
import com.example.petstoremobile.fragments.ListFragment;
import com.example.petstoremobile.fragments.listfragments.SupplierFragment;
public class SupplierDetailFragment extends Fragment {
private TextView tvMode, tvSupId;
private EditText etSupCompany, etSupContactFirstName, etSupContactLastName, etSupEmail, etSupPhone;
private Button btnSaveSupplier, btnDeleteSupplier, btnBack;
private int supId;
private boolean isEditing = false;
private SupplierFragment supplierFragment;
//set the supplier fragment to the parent so we refer back to supplier view when save or delete is done
public void setSupplierFragment(SupplierFragment fragment) {
this.supplierFragment = fragment;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_supplier_detail, container, false);
//get controls from layout and display the view depending on the mode
initViews(view);
handleArguments();
//set button click listeners
btnBack.setOnClickListener(v -> {
//get the list fragment and pop the back stack to return to the previous view (SupplierFragment)
ListFragment listFragment = (ListFragment) getParentFragment();
if (listFragment != null) {
listFragment.getChildFragmentManager().popBackStack();
}
});
btnSaveSupplier.setOnClickListener(v -> saveSupplier());
btnDeleteSupplier.setOnClickListener(v -> deleteSupplier());
return view;
}
//TODO: Method to Update or Add a supplier
private void saveSupplier() {
if (isEditing) {
// TODO: Update supplier
Toast.makeText(getContext(), "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
} else {
// TODO: Add new supplier
Toast.makeText(getContext(), "Save functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
}
//TODO: Method to Delete a supplier
private void deleteSupplier() {
Toast.makeText(getContext(), "Delete functionality not yet implemented with DB", Toast.LENGTH_SHORT).show();
}
//helper function to check if supplier is being edited or added and show the view accordingly
private void handleArguments() {
// Supplier is being edited if the bundle contains a supId
if (getArguments() != null && getArguments().containsKey("supId")) {
// Get supplier data from arguments and populate fields
isEditing = true;
supId = getArguments().getInt("supId");
tvMode.setText("Edit Supplier");
tvSupId.setText("ID: " + supId);
etSupCompany.setText(getArguments().getString("supCompany"));
etSupContactFirstName.setText(getArguments().getString("supContactFirstName"));
etSupContactLastName.setText(getArguments().getString("supContactLastName"));
etSupEmail.setText(getArguments().getString("supEmail"));
etSupPhone.setText(getArguments().getString("supPhone"));
btnDeleteSupplier.setVisibility(View.VISIBLE);
} else {
// Supplier is being added
// Set default values for add a new supplier
isEditing = false;
tvMode.setText("Add Supplier");
tvSupId.setVisibility(View.GONE);
btnDeleteSupplier.setVisibility(View.GONE);
btnSaveSupplier.setText("Add");
}
}
//helper function to get controls from layout
private void initViews(View view) {
tvMode = view.findViewById(R.id.tvMode);
tvSupId = view.findViewById(R.id.tvSupId);
etSupCompany = view.findViewById(R.id.etSupCompany);
etSupContactFirstName = view.findViewById(R.id.etSupContactFirstName);
etSupContactLastName = view.findViewById(R.id.etSupContactLastName);
etSupEmail = view.findViewById(R.id.etSupEmail);
etSupPhone = view.findViewById(R.id.etSupPhone);
btnSaveSupplier = view.findViewById(R.id.btnSaveSupplier);
btnDeleteSupplier = view.findViewById(R.id.btnDeleteSupplier);
btnBack = view.findViewById(R.id.btnBack);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

View File

@@ -5,7 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.AdoptionActivity">
tools:context=".activities.listactivities.AdoptionActivity">
<TextView
android:id="@+id/textView4"

View File

@@ -5,7 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.AppointmentActivity">
tools:context=".activities.listactivities.AppointmentActivity">
<TextView
android:id="@+id/textView3"

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<FrameLayout
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorSurface"
app:menu="@menu/bottom_nav_menu" />
</LinearLayout>

View File

@@ -5,7 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.InventoryActivity">
tools:context=".activities.listactivities.InventoryActivity">
<TextView
android:id="@+id/textView"

View File

@@ -12,9 +12,10 @@
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:src="@tools:sample/avatars" />
android:layout_width="184dp"
android:layout_height="173dp"
android:src="@drawable/petstore_logo"
android:scaleType="fitCenter" />
<TextView
android:layout_width="wrap_content"

View File

@@ -5,7 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".activities.ProductActivity">
tools:context=".activities.listactivities.ProductActivity">
<TextView
android:id="@+id/textView2"

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#F5F5F5"
android:fitsSystemWindows="true">
<ScrollView
android:id="@+id/scrollView"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:padding="8dp"
android:fitsSystemWindows="true">
<LinearLayout
android:id="@+id/chatContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="8dp"/>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="8dp"
android:background="@android:color/white">
<EditText
android:id="@+id/etMessage"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:hint="Type a message..."
android:inputType="text"
android:layout_marginEnd="8dp"/>
<Button
android:id="@+id/btnSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Send"/>
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/inner_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragments.ListFragment"/>

View File

@@ -7,14 +7,11 @@
android:layout_height="match_parent"
android:background="#F5F5F5">
<!-- The list of pets -->
<!-- Floating add button in the bottom right corner -->
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewPets"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp" />
android:padding="8dp"/>
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabAddPet"

View File

@@ -6,18 +6,19 @@
android:background="#F5F5F5"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="24dp">
android:paddingLeft="20dp"
android:paddingRight="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tvMode"
android:layout_width="143dp"
android:layout_width="245dp"
android:layout_height="48dp"
android:fontFamily="sans-serif-black"
android:text="Add Pet"
@@ -37,17 +38,17 @@
android:id="@+id/tvPetId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="10dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="30dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="20dp"
android:text="ID: 0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Pet Name"
android:textColor="@color/black"
@@ -57,8 +58,8 @@
android:id="@+id/etPetName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="16dp"
android:hint="Enter pet name"
android:inputType="text" />
@@ -66,8 +67,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Species"
android:textColor="@color/black"
@@ -77,8 +78,8 @@
android:id="@+id/etPetSpecies"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="16dp"
android:hint="e.g. Dog, Cat, Bird"
android:inputType="text" />
@@ -86,8 +87,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Breed"
android:textColor="@color/black"
@@ -97,8 +98,8 @@
android:id="@+id/etPetBreed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="16dp"
android:hint="Enter breed"
android:inputType="text" />
@@ -106,8 +107,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Age"
android:textColor="@color/black"
@@ -117,8 +118,8 @@
android:id="@+id/etPetAge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="16dp"
android:hint="Enter age"
android:inputType="number" />
@@ -126,8 +127,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Price"
android:textColor="@color/black"
@@ -137,8 +138,8 @@
android:id="@+id/etPetPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="16dp"
android:hint="Enter price"
android:inputType="numberDecimal" />
@@ -146,8 +147,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Status"
android:textColor="@color/black"
@@ -157,16 +158,15 @@
android:id="@+id/spinnerPetStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="32dp" />
<!-- Save button always visible -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:orientation="horizontal">
<Button
@@ -189,6 +189,4 @@
</LinearLayout>
<!-- Delete button only visible when editing -->
</LinearLayout>

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
android:background="#F5F5F5"
android:gravity="center"
android:orientation="vertical"
android:padding="24dp">
<ImageView
android:id="@+id/imgProfile"
android:layout_width="189dp"
android:layout_height="162dp"
android:layout_marginBottom="20dp"
android:src="@drawable/placeholder" />
<Button
android:id="@+id/btnChangePhoto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change Photo"
android:layout_marginBottom="24dp"/>
<TextView
android:id="@+id/tvProfileName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Name"
android:textColor="#000000"
android:textSize="26sp"
android:textStyle="bold" />
<TextView
android:id="@+id/tvProfileRole"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="24dp"
android:text="Staff Role"
android:textColor="#2196F3"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Email"
android:textColor="#888888"
android:textSize="12sp" />
<TextView
android:id="@+id/tvProfileEmail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:text="Example@example.com"
android:textColor="#000000"
android:textSize="16sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Phone"
android:textColor="#888888"
android:textSize="12sp" />
<TextView
android:id="@+id/tvProfilePhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:text="123-123-1234"
android:textColor="#000000"
android:textSize="16sp" />
<Button
android:id="@+id/btnLogout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:backgroundTint="#F44336"
android:text="Log Out"
android:textColor="#FFFFFF" />
</LinearLayout>

View File

@@ -6,18 +6,19 @@
android:background="#F5F5F5"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="24dp">
android:paddingLeft="20dp"
android:paddingRight="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tvMode"
android:layout_width="162dp"
android:layout_width="245dp"
android:layout_height="48dp"
android:fontFamily="sans-serif-black"
android:text="Add Service"
@@ -38,17 +39,17 @@
android:id="@+id/tvServiceId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginLeft="0dp"
android:layout_marginTop="10dp"
android:layout_marginRight="50dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="30dp"
android:text="ID: 0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Service Name"
android:textColor="@color/black"
@@ -58,8 +59,8 @@
android:id="@+id/etServiceName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="16dp"
android:hint="Enter service name"
android:inputType="text" />
@@ -67,8 +68,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Description"
android:textColor="@color/black"
@@ -78,8 +79,8 @@
android:id="@+id/etServiceDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="16dp"
android:hint="Enter description"
android:inputType="textMultiLine"
@@ -88,8 +89,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Duration (minutes)"
android:textColor="@color/black"
@@ -99,8 +100,8 @@
android:id="@+id/etServiceDuration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="16dp"
android:hint="Enter duration in minutes"
android:inputType="number" />
@@ -108,8 +109,8 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="4dp"
android:text="Price"
android:textColor="@color/black"
@@ -119,8 +120,8 @@
android:id="@+id/etServicePrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:layout_marginBottom="32dp"
android:hint="Enter price"
android:inputType="numberDecimal" />
@@ -128,8 +129,8 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="0dp"
android:orientation="horizontal">
<Button

View File

@@ -6,19 +6,19 @@
android:background="#F5F5F5"
android:gravity="center_vertical"
android:orientation="vertical"
android:padding="24dp">
android:paddingLeft="20dp"
android:paddingRight="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tvMode"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:width="245dp"
android:fontFamily="sans-serif-black"
android:text="Add Supplier"
android:textColor="@color/black"
@@ -38,17 +38,13 @@
android:id="@+id/tvSupId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginTop="10dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="30dp"
android:text="ID: 0" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="4dp"
android:text="Company Name"
android:textColor="@color/black"
@@ -58,8 +54,6 @@
android:id="@+id/etSupCompany"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="16dp"
android:hint="Enter company name"
android:inputType="text" />
@@ -67,8 +61,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="4dp"
android:text="Contact First Name"
android:textColor="@color/black"
@@ -78,8 +70,6 @@
android:id="@+id/etSupContactFirstName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="16dp"
android:hint="Enter first name"
android:inputType="text" />
@@ -87,8 +77,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="4dp"
android:text="Contact Last Name"
android:textColor="@color/black"
@@ -98,8 +86,6 @@
android:id="@+id/etSupContactLastName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="16dp"
android:hint="Enter last name"
android:inputType="text" />
@@ -107,8 +93,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="4dp"
android:text="Email"
android:textColor="@color/black"
@@ -118,8 +102,6 @@
android:id="@+id/etSupEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="16dp"
android:hint="Enter email"
android:inputType="textEmailAddress" />
@@ -127,8 +109,6 @@
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="4dp"
android:text="Phone"
android:textColor="@color/black"
@@ -138,8 +118,6 @@
android:id="@+id/etSupPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="32dp"
android:hint="Enter phone number"
android:inputType="phone" />
@@ -147,8 +125,6 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:orientation="horizontal">
<Button

View File

@@ -6,7 +6,6 @@
android:padding="16dp"
android:background="@android:color/white">
<!-- Pet name and status on the same row -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -37,7 +36,6 @@
</LinearLayout>
<!-- Species and breed -->
<TextView
android:id="@+id/tvPetSpeciesBreed"
android:layout_width="wrap_content"
@@ -47,7 +45,6 @@
android:textColor="#666666"
android:textSize="14sp" />
<!-- Age and price on the same row -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -74,7 +71,6 @@
</LinearLayout>
<!-- Divider line between items -->
<View
android:layout_width="match_parent"
android:layout_height="1dp"

View File

@@ -6,7 +6,6 @@
android:padding="16dp"
android:background="@android:color/white">
<!-- Service name -->
<TextView
android:id="@+id/tvServiceName"
android:layout_width="match_parent"
@@ -16,7 +15,6 @@
android:textSize="18sp"
android:textStyle="bold" />
<!-- Service description -->
<TextView
android:id="@+id/tvServiceDesc"
android:layout_width="match_parent"
@@ -26,7 +24,6 @@
android:textColor="#666666"
android:textSize="14sp" />
<!-- Duration and price on the same row -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -53,7 +50,6 @@
</LinearLayout>
<!-- Divider -->
<View
android:layout_width="match_parent"
android:layout_height="1dp"

View File

@@ -6,7 +6,6 @@
android:padding="16dp"
android:background="@android:color/white">
<!-- Company name -->
<TextView
android:id="@+id/tvSupCompany"
android:layout_width="match_parent"
@@ -16,7 +15,6 @@
android:textSize="18sp"
android:textStyle="bold" />
<!-- Contact name -->
<TextView
android:id="@+id/tvSupContactName"
android:layout_width="match_parent"
@@ -26,7 +24,6 @@
android:textColor="#666666"
android:textSize="14sp" />
<!-- Email and phone on the same row -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -52,7 +49,6 @@
</LinearLayout>
<!-- Divider -->
<View
android:layout_width="match_parent"
android:layout_height="1dp"

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_list"
android:title="List"
android:icon="@android:drawable/ic_menu_sort_by_size"/>
<item
android:id="@+id/nav_chat"
android:title="Chat"
android:icon="@android:drawable/ic_menu_send"/>
<item
android:id="@+id/nav_profile"
android:title="Profile"
android:icon="@android:drawable/ic_menu_myplaces"/>
</menu>

View File

@@ -1,3 +1,5 @@
<resources>
<string name="app_name">Leons Pet Store</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>