Edited the views so application looks consistant

-edited appointment, adoption, product, inventory xmls to look consistant
- added search feature to Pets, services, and suppliers
- made it so the application will resume where you left off when the application is switched to the background and back
This commit is contained in:
Alex
2026-03-14 03:02:18 -06:00
parent cf0329e0a5
commit 025e749ce3
33 changed files with 1386 additions and 700 deletions

View File

@@ -14,6 +14,7 @@
android:required="false" /> android:required="false" />
<application <application
android:name=".PetStoreApplication"
android:networkSecurityConfig="@xml/network_security_config" android:networkSecurityConfig="@xml/network_security_config"
android:allowBackup="true" android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules" android:dataExtractionRules="@xml/data_extraction_rules"

View File

@@ -0,0 +1,13 @@
package com.example.petstoremobile;
import android.app.Application;
import com.example.petstoremobile.api.Auth.TokenManager;
public class PetStoreApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Clear login data on app so when the application closes, the user is logged out and have to re-login
TokenManager.getInstance(this).clearLoginData();
}
}

View File

@@ -36,9 +36,11 @@ public class HomeActivity extends AppCompatActivity {
//get the bottom navbar from the layout //get the bottom navbar from the layout
BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation); BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
// Load ListFragment by default // Load ListFragment by default only if this is a fresh start
loadFragment(new ListFragment()); if (savedInstanceState == null) {
bottomNav.setSelectedItemId(R.id.nav_list); loadFragment(new ListFragment());
bottomNav.setSelectedItemId(R.id.nav_list);
}
//when an item in the bar is selected, load the corresponding fragment //when an item in the bar is selected, load the corresponding fragment
bottomNav.setOnItemSelectedListener(item -> { bottomNav.setOnItemSelectedListener(item -> {

View File

@@ -36,6 +36,15 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
// Check if user is already logged in
if (TokenManager.getInstance(this).isLoggedIn()) {
Intent intent = new Intent(this, HomeActivity.class);
startActivity(intent);
finish();
return;
}
EdgeToEdge.enable(this); EdgeToEdge.enable(this);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
@@ -53,9 +62,6 @@ public class MainActivity extends AppCompatActivity {
//clear login status //clear login status
tvLoginStatus.setText(""); tvLoginStatus.setText("");
// Clear old login data before logging in
TokenManager.getInstance(this).clearLoginData();
//Set click listener for login button //Set click listener for login button
btnLogin.setOnClickListener(v -> { btnLogin.setOnClickListener(v -> {
//Get user name and password from text fields //Get user name and password from text fields

View File

@@ -14,7 +14,6 @@ public class RetrofitClient {
//base URL //base URL
public static final String BASE_URL = "http://10.0.2.2:8080/api/"; //for emulator testing change to computer ip if using hardware to test public static final String BASE_URL = "http://10.0.2.2:8080/api/"; //for emulator testing change to computer ip if using hardware to test
private static Retrofit retrofit = null; private static Retrofit retrofit = null;
public static Retrofit getClient(Context context) { public static Retrofit getClient(Context context) {

View File

@@ -14,6 +14,8 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import com.example.petstoremobile.R; import com.example.petstoremobile.R;
import com.example.petstoremobile.adapters.AdoptionAdapter; import com.example.petstoremobile.adapters.AdoptionAdapter;
import com.example.petstoremobile.fragments.ListFragment; import com.example.petstoremobile.fragments.ListFragment;
@@ -30,12 +32,15 @@ public class AdoptionFragment extends Fragment implements AdoptionAdapter.OnAdop
private AdoptionAdapter adapter; private AdoptionAdapter adapter;
private SwipeRefreshLayout swipeRefreshLayout; private SwipeRefreshLayout swipeRefreshLayout;
private EditText etSearch; private EditText etSearch;
private ImageButton hamburger;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_adoption, container, false); View view = inflater.inflate(R.layout.fragment_adoption, container, false);
hamburger = view.findViewById(R.id.btnHamburger);
loadAdoptionData(); loadAdoptionData();
// Replace with actual API call when backend is ready // Replace with actual API call when backend is ready
setupRecyclerView(view); setupRecyclerView(view);
@@ -45,6 +50,15 @@ public class AdoptionFragment extends Fragment implements AdoptionAdapter.OnAdop
FloatingActionButton fabAddAdoption = view.findViewById(R.id.fabAddAdoption); FloatingActionButton fabAddAdoption = view.findViewById(R.id.fabAddAdoption);
fabAddAdoption.setOnClickListener(v -> openAdoptionDetails(-1)); fabAddAdoption.setOnClickListener(v -> openAdoptionDetails(-1));
//Make the hamburger button open the drawer from listFragment
hamburger.setOnClickListener(v -> {
ListFragment listFragment = (ListFragment) getParentFragment();
//if list fragment is found then use its helper function to open the drawer
if (listFragment != null) {
listFragment.openDrawer();
}
});
return view; return view;
} }

View File

@@ -14,6 +14,8 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import com.example.petstoremobile.R; import com.example.petstoremobile.R;
import com.example.petstoremobile.adapters.AppointmentAdapter; import com.example.petstoremobile.adapters.AppointmentAdapter;
import com.example.petstoremobile.fragments.ListFragment; import com.example.petstoremobile.fragments.ListFragment;
@@ -30,12 +32,15 @@ public class AppointmentFragment extends Fragment implements AppointmentAdapter.
private AppointmentAdapter adapter; private AppointmentAdapter adapter;
private SwipeRefreshLayout swipeRefreshLayout; private SwipeRefreshLayout swipeRefreshLayout;
private EditText etSearch; private EditText etSearch;
private ImageButton hamburger;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_appointment, container, false); View view = inflater.inflate(R.layout.fragment_appointment, container, false);
hamburger = view.findViewById(R.id.btnHamburger);
loadAppointmentData(); // TODO: Replace with actual API call when backend is ready loadAppointmentData(); // TODO: Replace with actual API call when backend is ready
setupRecyclerView(view); setupRecyclerView(view);
setupSearch(view); setupSearch(view);
@@ -44,6 +49,15 @@ public class AppointmentFragment extends Fragment implements AppointmentAdapter.
FloatingActionButton fabAddAppointment = view.findViewById(R.id.fabAddAppointment); FloatingActionButton fabAddAppointment = view.findViewById(R.id.fabAddAppointment);
fabAddAppointment.setOnClickListener(v -> openAppointmentDetails(-1)); fabAddAppointment.setOnClickListener(v -> openAppointmentDetails(-1));
//Make the hamburger button open the drawer from listFragment
hamburger.setOnClickListener(v -> {
ListFragment listFragment = (ListFragment) getParentFragment();
//if list fragment is found then use its helper function to open the drawer
if (listFragment != null) {
listFragment.openDrawer();
}
});
return view; return view;
} }

View File

@@ -14,6 +14,8 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import com.example.petstoremobile.R; import com.example.petstoremobile.R;
import com.example.petstoremobile.adapters.InventoryAdapter; import com.example.petstoremobile.adapters.InventoryAdapter;
import com.example.petstoremobile.fragments.ListFragment; import com.example.petstoremobile.fragments.ListFragment;
@@ -30,12 +32,15 @@ public class InventoryFragment extends Fragment implements InventoryAdapter.OnIn
private InventoryAdapter adapter; private InventoryAdapter adapter;
private SwipeRefreshLayout swipeRefreshLayout; private SwipeRefreshLayout swipeRefreshLayout;
private EditText etSearch; private EditText etSearch;
private ImageButton hamburger;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_inventory, container, false); View view = inflater.inflate(R.layout.fragment_inventory, container, false);
hamburger = view.findViewById(R.id.btnHamburger);
loadInventoryData(); // TODO: Replace with actual API call when backend is ready loadInventoryData(); // TODO: Replace with actual API call when backend is ready
setupRecyclerView(view); setupRecyclerView(view);
setupSearch(view); setupSearch(view);
@@ -44,6 +49,15 @@ public class InventoryFragment extends Fragment implements InventoryAdapter.OnIn
FloatingActionButton fabAddInventory = view.findViewById(R.id.fabAddInventory); FloatingActionButton fabAddInventory = view.findViewById(R.id.fabAddInventory);
fabAddInventory.setOnClickListener(v -> openInventoryDetails(-1)); fabAddInventory.setOnClickListener(v -> openInventoryDetails(-1));
//Make the hamburger button open the drawer from listFragment
hamburger.setOnClickListener(v -> {
ListFragment listFragment = (ListFragment) getParentFragment();
//if list fragment is found then use its helper function to open the drawer
if (listFragment != null) {
listFragment.openDrawer();
}
});
return view; return view;
} }

View File

@@ -5,11 +5,15 @@ import android.os.Bundle;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.Toast; import android.widget.Toast;
@@ -34,9 +38,12 @@ import retrofit2.Response;
public class PetFragment extends Fragment implements PetAdapter.OnPetClickListener { public class PetFragment extends Fragment implements PetAdapter.OnPetClickListener {
private List<Pet> petList = new ArrayList<>(); private List<Pet> petList = new ArrayList<>();
private List<Pet> filteredList = new ArrayList<>();
private ImageButton hamburger; private ImageButton hamburger;
private PetAdapter adapter; private PetAdapter adapter;
private PetApi api; private PetApi api;
private SwipeRefreshLayout swipeRefreshLayout;
private EditText etSearch;
//load pet view //load pet view
@Override @Override
@@ -50,7 +57,9 @@ public class PetFragment extends Fragment implements PetAdapter.OnPetClickListen
hamburger = view.findViewById(R.id.btnHamburger); hamburger = view.findViewById(R.id.btnHamburger);
setupRecyclerView(view); setupRecyclerView(view);
loadPetData(); //TODO: Replace this with actual data when backend is working setupSearch(view);
setupSwipeRefresh(view);
loadPetData();
//Add button to opens the add dialog //Add button to opens the add dialog
@@ -69,13 +78,48 @@ public class PetFragment extends Fragment implements PetAdapter.OnPetClickListen
return view; return view;
} }
private void setupSearch(View view) {
etSearch = view.findViewById(R.id.etSearchPet);
etSearch.addTextChangedListener(new TextWatcher() {
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
filterPets(s.toString());
}
@Override public void afterTextChanged(Editable s) {}
});
}
private void filterPets(String query) {
filteredList.clear();
if (query.isEmpty()) {
filteredList.addAll(petList);
} else {
String lower = query.toLowerCase();
for (Pet p : petList) {
if (p.getPetName().toLowerCase().contains(lower)
|| p.getPetSpecies().toLowerCase().contains(lower)
|| p.getPetBreed().toLowerCase().contains(lower)) {
filteredList.add(p);
}
}
}
adapter.notifyDataSetChanged();
}
private void setupSwipeRefresh(View view) {
swipeRefreshLayout = view.findViewById(R.id.swipeRefreshPet);
swipeRefreshLayout.setOnRefreshListener(() -> {
loadPetData();
});
}
//Open pet profile //Open pet profile
private void openPetProfile(int position) { private void openPetProfile(int position) {
PetProfileFragment profileFragment = new PetProfileFragment(); PetProfileFragment profileFragment = new PetProfileFragment();
//Make a bundle to pass data to the profile fragment //Make a bundle to pass data to the profile fragment
Bundle args = new Bundle(); Bundle args = new Bundle();
Pet pet = petList.get(position); Pet pet = filteredList.get(position);
args.putInt("petId", pet.getPetId()); args.putInt("petId", pet.getPetId());
args.putString("petName", pet.getPetName()); args.putString("petName", pet.getPetName());
args.putString("petSpecies", pet.getPetSpecies()); args.putString("petSpecies", pet.getPetSpecies());
@@ -89,7 +133,7 @@ public class PetFragment extends Fragment implements PetAdapter.OnPetClickListen
//get ListFragment to load the the pet profile view //get ListFragment to load the the pet profile view
ListFragment listFragment = (ListFragment) getParentFragment(); ListFragment listFragment = (ListFragment) getParentFragment();
if (profileFragment != null) { if (listFragment != null) {
listFragment.loadFragment(profileFragment); listFragment.loadFragment(profileFragment);
} }
} }
@@ -105,23 +149,6 @@ public class PetFragment extends Fragment implements PetAdapter.OnPetClickListen
} }
} }
// Called by PetDetailFragment when save or delete is done
//TODO: REPLACE THIS WITH JUST RELOADING THE LIST BY FETCHING FROM THE BACKEND
// 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 // Called by PetAdapter when a row is clicked to open the details view
@Override @Override
public void onPetClick(int position) { public void onPetClick(int position) {
@@ -130,9 +157,15 @@ public class PetFragment extends Fragment implements PetAdapter.OnPetClickListen
// Helper function to get a list of all pets from the backend // Helper function to get a list of all pets from the backend
private void loadPetData() { private void loadPetData() {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(true);
}
api.getAllPets(0, 100).enqueue(new Callback<PageResponse<PetDTO>>() { api.getAllPets(0, 100).enqueue(new Callback<PageResponse<PetDTO>>() {
@Override @Override
public void onResponse(Call<PageResponse<PetDTO>> call, Response<PageResponse<PetDTO>> response) { public void onResponse(Call<PageResponse<PetDTO>> call, Response<PageResponse<PetDTO>> response) {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
}
if (response.isSuccessful() && response.body() != null) { if (response.isSuccessful() && response.body() != null) {
petList.clear(); petList.clear();
@@ -143,7 +176,7 @@ public class PetFragment extends Fragment implements PetAdapter.OnPetClickListen
.collect(java.util.stream.Collectors.toList()); .collect(java.util.stream.Collectors.toList());
petList.addAll(pets); petList.addAll(pets);
adapter.notifyDataSetChanged(); filterPets(etSearch.getText().toString());
} else { } else {
Log.e("onResponse: ", response.message()); Log.e("onResponse: ", response.message());
@@ -151,7 +184,10 @@ public class PetFragment extends Fragment implements PetAdapter.OnPetClickListen
} }
@Override @Override
public void onFailure(Call<PageResponse<PetDTO>> call, Throwable t) { // 4. here public void onFailure(Call<PageResponse<PetDTO>> call, Throwable t) {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
}
Toast.makeText(getContext(), Toast.makeText(getContext(),
"Failed to load pets", Toast.LENGTH_SHORT).show(); "Failed to load pets", Toast.LENGTH_SHORT).show();
Log.e("onFailure: ", t.getMessage()); Log.e("onFailure: ", t.getMessage());
@@ -162,7 +198,7 @@ public class PetFragment extends Fragment implements PetAdapter.OnPetClickListen
//set up the recyclerview and adapter //set up the recyclerview and adapter
private void setupRecyclerView(View view) { private void setupRecyclerView(View view) {
RecyclerView recyclerView = view.findViewById(R.id.recyclerViewPets); RecyclerView recyclerView = view.findViewById(R.id.recyclerViewPets);
adapter = new PetAdapter(petList, this); adapter = new PetAdapter(filteredList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
} }

View File

@@ -14,6 +14,8 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton;
import com.example.petstoremobile.R; import com.example.petstoremobile.R;
import com.example.petstoremobile.adapters.ProductAdapter; import com.example.petstoremobile.adapters.ProductAdapter;
import com.example.petstoremobile.fragments.ListFragment; import com.example.petstoremobile.fragments.ListFragment;
@@ -30,12 +32,15 @@ public class ProductFragment extends Fragment implements ProductAdapter.OnProduc
private ProductAdapter adapter; private ProductAdapter adapter;
private SwipeRefreshLayout swipeRefreshLayout; private SwipeRefreshLayout swipeRefreshLayout;
private EditText etSearch; private EditText etSearch;
private ImageButton hamburger;
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_product, container, false); View view = inflater.inflate(R.layout.fragment_product, container, false);
hamburger = view.findViewById(R.id.btnHamburger);
loadProductData(); // TODO: Replace with actual API call when backend is ready loadProductData(); // TODO: Replace with actual API call when backend is ready
setupRecyclerView(view); setupRecyclerView(view);
setupSearch(view); setupSearch(view);
@@ -44,6 +49,15 @@ public class ProductFragment extends Fragment implements ProductAdapter.OnProduc
FloatingActionButton fabAddProduct = view.findViewById(R.id.fabAddProduct); FloatingActionButton fabAddProduct = view.findViewById(R.id.fabAddProduct);
fabAddProduct.setOnClickListener(v -> openProductDetails(-1)); fabAddProduct.setOnClickListener(v -> openProductDetails(-1));
//Make the hamburger button open the drawer from listFragment
hamburger.setOnClickListener(v -> {
ListFragment listFragment = (ListFragment) getParentFragment();
//if list fragment is found then use its helper function to open the drawer
if (listFragment != null) {
listFragment.openDrawer();
}
});
return view; return view;
} }

View File

@@ -5,11 +5,15 @@ import android.os.Bundle;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.Toast; import android.widget.Toast;
@@ -34,9 +38,12 @@ import retrofit2.Response;
public class ServiceFragment extends Fragment implements ServiceAdapter.OnServiceClickListener { public class ServiceFragment extends Fragment implements ServiceAdapter.OnServiceClickListener {
private List<Service> serviceList = new ArrayList<>(); private List<Service> serviceList = new ArrayList<>();
private List<Service> filteredList = new ArrayList<>();
private ServiceAdapter adapter; private ServiceAdapter adapter;
private ImageButton hamburger; private ImageButton hamburger;
private ServiceApi api; private ServiceApi api;
private SwipeRefreshLayout swipeRefreshLayout;
private EditText etSearch;
//load service view //load service view
@Override @Override
@@ -48,6 +55,8 @@ public class ServiceFragment extends Fragment implements ServiceAdapter.OnServic
hamburger = view.findViewById(R.id.btnHamburger); hamburger = view.findViewById(R.id.btnHamburger);
setupRecyclerView(view); setupRecyclerView(view);
setupSearch(view);
setupSwipeRefresh(view);
loadServiceData(); loadServiceData();
//Add button to opens the add dialog //Add button to opens the add dialog
@@ -66,6 +75,40 @@ public class ServiceFragment extends Fragment implements ServiceAdapter.OnServic
return view; return view;
} }
private void setupSearch(View view) {
etSearch = view.findViewById(R.id.etSearchService);
etSearch.addTextChangedListener(new TextWatcher() {
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
filterServices(s.toString());
}
@Override public void afterTextChanged(Editable s) {}
});
}
private void filterServices(String query) {
filteredList.clear();
if (query.isEmpty()) {
filteredList.addAll(serviceList);
} else {
String lower = query.toLowerCase();
for (Service s : serviceList) {
if (s.getServiceName().toLowerCase().contains(lower)
|| s.getServiceDesc().toLowerCase().contains(lower)) {
filteredList.add(s);
}
}
}
adapter.notifyDataSetChanged();
}
private void setupSwipeRefresh(View view) {
swipeRefreshLayout = view.findViewById(R.id.swipeRefreshService);
swipeRefreshLayout.setOnRefreshListener(() -> {
loadServiceData();
});
}
//Open the service detail view depending on the mode //Open the service detail view depending on the mode
private void openServiceDetails(int position) { private void openServiceDetails(int position) {
ServiceDetailFragment detailFragment = new ServiceDetailFragment(); ServiceDetailFragment detailFragment = new ServiceDetailFragment();
@@ -76,7 +119,7 @@ public class ServiceFragment extends Fragment implements ServiceAdapter.OnServic
//if editing a service, add the service data to the bundle //if editing a service, add the service data to the bundle
if (position != -1) { if (position != -1) {
Service service = serviceList.get(position); Service service = filteredList.get(position);
args.putInt("serviceId", service.getServiceId()); args.putInt("serviceId", service.getServiceId());
args.putString("serviceName", service.getServiceName()); args.putString("serviceName", service.getServiceName());
args.putString("serviceDesc", service.getServiceDesc()); args.putString("serviceDesc", service.getServiceDesc());
@@ -96,22 +139,6 @@ public class ServiceFragment extends Fragment implements ServiceAdapter.OnServic
} }
} }
// 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 // Called by ServiceAdapter when a row is clicked to open the details view
@Override @Override
public void onServiceClick(int position) { public void onServiceClick(int position) {
@@ -120,9 +147,15 @@ public class ServiceFragment extends Fragment implements ServiceAdapter.OnServic
// Helper function to get a list of all services from the backend // Helper function to get a list of all services from the backend
private void loadServiceData() { private void loadServiceData() {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(true);
}
api.getAllServices(0, 100).enqueue(new Callback<PageResponse<ServiceDTO>>() { api.getAllServices(0, 100).enqueue(new Callback<PageResponse<ServiceDTO>>() {
@Override @Override
public void onResponse(Call<PageResponse<ServiceDTO>> call, Response<PageResponse<ServiceDTO>> response) { public void onResponse(Call<PageResponse<ServiceDTO>> call, Response<PageResponse<ServiceDTO>> response) {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
}
if (response.isSuccessful() && response.body() != null) { if (response.isSuccessful() && response.body() != null) {
serviceList.clear(); serviceList.clear();
@@ -133,7 +166,7 @@ public class ServiceFragment extends Fragment implements ServiceAdapter.OnServic
.collect(java.util.stream.Collectors.toList()); .collect(java.util.stream.Collectors.toList());
serviceList.addAll(services); serviceList.addAll(services);
adapter.notifyDataSetChanged(); filterServices(etSearch.getText().toString());
} else { } else {
Log.e("onResponse: ", response.message()); Log.e("onResponse: ", response.message());
@@ -142,6 +175,9 @@ public class ServiceFragment extends Fragment implements ServiceAdapter.OnServic
@Override @Override
public void onFailure(Call<PageResponse<ServiceDTO>> call, Throwable t) { public void onFailure(Call<PageResponse<ServiceDTO>> call, Throwable t) {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
}
if (getContext() != null) { if (getContext() != null) {
Toast.makeText(getContext(), Toast.makeText(getContext(),
"Failed to load services", Toast.LENGTH_SHORT).show(); "Failed to load services", Toast.LENGTH_SHORT).show();
@@ -154,7 +190,7 @@ public class ServiceFragment extends Fragment implements ServiceAdapter.OnServic
//set up the recyclerview and adapter //set up the recyclerview and adapter
private void setupRecyclerView(View view) { private void setupRecyclerView(View view) {
RecyclerView recyclerView = view.findViewById(R.id.recyclerViewServices); RecyclerView recyclerView = view.findViewById(R.id.recyclerViewServices);
adapter = new ServiceAdapter(serviceList, this); adapter = new ServiceAdapter(filteredList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
} }

View File

@@ -5,11 +5,15 @@ import android.os.Bundle;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;
import android.widget.Toast; import android.widget.Toast;
@@ -34,9 +38,12 @@ import retrofit2.Response;
public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupplierClickListener { public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupplierClickListener {
private List<Supplier> supplierList = new ArrayList<>(); private List<Supplier> supplierList = new ArrayList<>();
private List<Supplier> filteredList = new ArrayList<>();
private SupplierAdapter adapter; private SupplierAdapter adapter;
private ImageButton hamburger; private ImageButton hamburger;
private SupplierApi api; private SupplierApi api;
private SwipeRefreshLayout swipeRefreshLayout;
private EditText etSearch;
//load supplier view //load supplier view
@Override @Override
@@ -48,6 +55,8 @@ public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupp
hamburger = view.findViewById(R.id.btnHamburger); hamburger = view.findViewById(R.id.btnHamburger);
setupRecyclerView(view); setupRecyclerView(view);
setupSearch(view);
setupSwipeRefresh(view);
loadSupplierData(); loadSupplierData();
//Add button to opens the add dialog //Add button to opens the add dialog
@@ -66,6 +75,41 @@ public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupp
return view; return view;
} }
private void setupSearch(View view) {
etSearch = view.findViewById(R.id.etSearchSupplier);
etSearch.addTextChangedListener(new TextWatcher() {
@Override public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override public void onTextChanged(CharSequence s, int start, int before, int count) {
filterSuppliers(s.toString());
}
@Override public void afterTextChanged(Editable s) {}
});
}
private void filterSuppliers(String query) {
filteredList.clear();
if (query.isEmpty()) {
filteredList.addAll(supplierList);
} else {
String lower = query.toLowerCase();
for (Supplier s : supplierList) {
if (s.getSupCompany().toLowerCase().contains(lower)
|| s.getSupContactFirstName().toLowerCase().contains(lower)
|| s.getSupContactLastName().toLowerCase().contains(lower)) {
filteredList.add(s);
}
}
}
adapter.notifyDataSetChanged();
}
private void setupSwipeRefresh(View view) {
swipeRefreshLayout = view.findViewById(R.id.swipeRefreshSupplier);
swipeRefreshLayout.setOnRefreshListener(() -> {
loadSupplierData();
});
}
//Open the supplier detail view depending on the mode //Open the supplier detail view depending on the mode
private void openSupplierDetails(int position) { private void openSupplierDetails(int position) {
SupplierDetailFragment detailFragment = new SupplierDetailFragment(); SupplierDetailFragment detailFragment = new SupplierDetailFragment();
@@ -76,7 +120,7 @@ public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupp
//if editing a supplier, add the supplier data to the bundle //if editing a supplier, add the supplier data to the bundle
if (position != -1) { if (position != -1) {
Supplier supplier = supplierList.get(position); Supplier supplier = filteredList.get(position);
args.putInt("supId", supplier.getSupId()); args.putInt("supId", supplier.getSupId());
args.putString("supCompany", supplier.getSupCompany()); args.putString("supCompany", supplier.getSupCompany());
args.putString("supContactFirstName", supplier.getSupContactFirstName()); args.putString("supContactFirstName", supplier.getSupContactFirstName());
@@ -97,21 +141,6 @@ public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupp
} }
} }
// 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 // Called by SupplierAdapter when a row is clicked to open the details view
@Override @Override
@@ -121,9 +150,15 @@ public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupp
// Helper function to get a list of all suppliers from the backend // Helper function to get a list of all suppliers from the backend
private void loadSupplierData() { private void loadSupplierData() {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(true);
}
api.getAllSuppliers(0, 100).enqueue(new Callback<PageResponse<SupplierDTO>>() { api.getAllSuppliers(0, 100).enqueue(new Callback<PageResponse<SupplierDTO>>() {
@Override @Override
public void onResponse(Call<PageResponse<SupplierDTO>> call, Response<PageResponse<SupplierDTO>> response) { public void onResponse(Call<PageResponse<SupplierDTO>> call, Response<PageResponse<SupplierDTO>> response) {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
}
if (response.isSuccessful() && response.body() != null) { if (response.isSuccessful() && response.body() != null) {
supplierList.clear(); supplierList.clear();
@@ -134,7 +169,7 @@ public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupp
.collect(java.util.stream.Collectors.toList()); .collect(java.util.stream.Collectors.toList());
supplierList.addAll(suppliers); supplierList.addAll(suppliers);
adapter.notifyDataSetChanged(); filterSuppliers(etSearch.getText().toString());
} else { } else {
Log.e("onResponse: ", response.message()); Log.e("onResponse: ", response.message());
@@ -143,6 +178,9 @@ public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupp
@Override @Override
public void onFailure(Call<PageResponse<SupplierDTO>> call, Throwable t) { public void onFailure(Call<PageResponse<SupplierDTO>> call, Throwable t) {
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
}
if (getContext() != null) { if (getContext() != null) {
Toast.makeText(getContext(), Toast.makeText(getContext(),
"Failed to load suppliers", Toast.LENGTH_SHORT).show(); "Failed to load suppliers", Toast.LENGTH_SHORT).show();
@@ -155,7 +193,7 @@ public class SupplierFragment extends Fragment implements SupplierAdapter.OnSupp
//set up the recyclerview and adapter //set up the recyclerview and adapter
private void setupRecyclerView(View view) { private void setupRecyclerView(View view) {
RecyclerView recyclerView = view.findViewById(R.id.recyclerViewSuppliers); RecyclerView recyclerView = view.findViewById(R.id.recyclerViewSuppliers);
adapter = new SupplierAdapter(supplierList, this); adapter = new SupplierAdapter(filteredList, this);
recyclerView.setLayoutManager(new LinearLayoutManager(getContext())); recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter); recyclerView.setAdapter(adapter);
} }

View File

@@ -4,6 +4,10 @@ package com.example.petstoremobile.fragments.listfragments.detailfragments;
// Uses InputValidator for detailed field validation and ActivityLogger to log all changes. // Uses InputValidator for detailed field validation and ActivityLogger to log all changes.
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -149,9 +153,19 @@ public class AdoptionDetailFragment extends Fragment {
} }
private void setupSpinner() { private void setupSpinner() {
ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(), ArrayAdapter<String> adapter = new ArrayAdapter<String>(requireContext(),
android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_item,
new String[]{"Approved", "Pending", "Rejected"}); new String[]{"Approved", "Pending", "Rejected"}) {
//Override the getView method for the spinner to make the text color darker for more readability
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View view = super.getView(position, convertView, parent);
((TextView) view).setTextColor(ContextCompat.getColor(requireContext(), R.color.text_dark));
return view;
}
};
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerAdoptionStatus.setAdapter(adapter); spinnerAdoptionStatus.setAdapter(adapter);
} }

View File

@@ -3,7 +3,12 @@ package com.example.petstoremobile.fragments.listfragments.detailfragments;
// Uses InputValidator for detailed field validation and ActivityLogger to log all changes. // Uses InputValidator for detailed field validation and ActivityLogger to log all changes.
import android.content.res.Configuration;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -154,9 +159,19 @@ public class AppointmentDetailFragment extends Fragment {
} }
private void setupSpinner() { private void setupSpinner() {
ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(), ArrayAdapter<String> adapter = new ArrayAdapter<String>(requireContext(),
android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_item,
new String[]{"Confirmed", "Pending", "Cancelled"}); new String[]{"Confirmed", "Pending", "Cancelled"}) {
//Override the getView method for the spinner to make the text color darker for more readability
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View view = super.getView(position, convertView, parent);
((TextView) view).setTextColor(ContextCompat.getColor(requireContext(), R.color.text_dark));
return view;
}
};
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerStatus.setAdapter(adapter); spinnerStatus.setAdapter(adapter);
} }

View File

@@ -2,6 +2,9 @@ package com.example.petstoremobile.fragments.listfragments.detailfragments;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -51,6 +54,7 @@ public class PetDetailFragment extends Fragment {
listFragment.getChildFragmentManager().popBackStack(); listFragment.getChildFragmentManager().popBackStack();
} }
}); });
//set save and delete button to run the appropriate method
btnSavePet.setOnClickListener(v -> savePet()); btnSavePet.setOnClickListener(v -> savePet());
btnDeletePet.setOnClickListener(v -> deletePet()); btnDeletePet.setOnClickListener(v -> deletePet());
@@ -122,11 +126,21 @@ public class PetDetailFragment extends Fragment {
//helper function to set up the spinner menu for pet status //helper function to set up the spinner menu for pet status
private void setupSpinner() { private void setupSpinner() {
ArrayAdapter<String> adapter = new ArrayAdapter<>(requireContext(), ArrayAdapter<String> adapter = new ArrayAdapter<String>(requireContext(),
android.R.layout.simple_spinner_item, android.R.layout.simple_spinner_item,
new String[]{"Available", "Adopted"}); new String[]{"Available", "Adopted"}) {
//Override the getView method for the spinner to make the text color darker for more readability
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
View view = super.getView(position, convertView, parent);
((TextView) view).setTextColor(ContextCompat.getColor(requireContext(), R.color.text_dark));
return view;
}
};
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerPetStatus.setAdapter(adapter); spinnerPetStatus.setAdapter(adapter);
} }
} }

View File

@@ -79,7 +79,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter username" android:hint="Enter username"
android:inputType="text" android:inputType="text"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -95,7 +96,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter password" android:hint="Enter password"
android:inputType="textPassword" android:inputType="textPassword"
android:layout_marginBottom="24dp"/> android:layout_marginBottom="24dp"
android:textColor="@color/text_dark"/>
<Button <Button
android:id="@+id/btnLogin" android:id="@+id/btnLogin"

View File

@@ -1,18 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Updated: added search bar and SwipeRefreshLayout for pull-to-refresh -->
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F5F5F5"> android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Adoptions"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<EditText <EditText
android:id="@+id/etSearchAdoption" android:id="@+id/etSearchAdoption"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -23,7 +48,8 @@
android:drawableStart="@android:drawable/ic_menu_search" android:drawableStart="@android:drawable/ic_menu_search"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:background="@android:color/white" android:background="@android:color/white"
android:padding="12dp"/> android:padding="12dp"
android:textColor="@color/text_dark"/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshAdoption" android:id="@+id/swipeRefreshAdoption"
@@ -46,7 +72,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:backgroundTint="@color/accent_coral"
android:contentDescription="Add Adoption" android:contentDescription="Add Adoption"
app:srcCompat="@android:drawable/ic_input_add"/> app:srcCompat="@android:drawable/ic_input_add"
app:tint="@color/white"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,100 +1,201 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F5F5F5"> android:orientation="vertical"
android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="56dp"
android:orientation="vertical" android:background="@color/primary_dark"
android:paddingLeft="20dp" android:gravity="center_vertical"
android:paddingRight="20dp" android:paddingStart="16dp"
android:paddingTop="20dp" android:paddingEnd="16dp"
android:paddingBottom="20dp"> android:orientation="horizontal">
<TextView
android:id="@+id/tvAdoptionMode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Add Adoption"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btnDeleteAdoption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:backgroundTint="@color/accent_coral"
android:text="Delete"
android:textColor="@color/white" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="vertical"
android:padding="24dp">
<TextView <LinearLayout
android:id="@+id/tvAdoptionMode" android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:fontFamily="sans-serif-black"
android:text="Add Adoption"
android:textColor="@color/text_dark"
android:textSize="25sp" />
<Button
android:id="@+id/btnDeleteAdoption"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Delete" /> android:orientation="vertical"
android:background="@drawable/rounded_card"
android:padding="16dp"
android:layout_marginBottom="16dp">
<TextView
android:id="@+id/tvAdoptionId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID: #0"
android:textColor="@color/text_light"
android:textSize="11sp"
android:textStyle="italic"
android:layout_gravity="end"
android:layout_marginBottom="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adopter Name"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etAdopterName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter adopter name"
android:inputType="text"
android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adopter Email"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etAdopterEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter email address"
android:inputType="textEmailAddress"
android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adopter Phone"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etAdopterPhone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter phone number"
android:inputType="phone"
android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pet Name"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etAdoptionPetName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter pet name"
android:inputType="text"
android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Adoption Date"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etAdoptionDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="YYYY-MM-DD"
android:inputType="text"
android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Status"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<Spinner
android:id="@+id/spinnerAdoptionStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<TextView </ScrollView>
android:id="@+id/tvAdoptionId"
android:layout_width="wrap_content" <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/white"
android:padding="16dp">
<Button
android:id="@+id/btnAdoptionBack"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="20dp" android:layout_weight="1"
android:text="ID: 0" /> android:layout_marginEnd="8dp"
android:text="Back"
android:backgroundTint="@color/primary_medium"
android:textColor="@color/white"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" <Button
android:text="Adopter Name" android:textColor="@color/text_dark" android:textSize="12sp" android:id="@+id/btnSaveAdoption"
android:layout_marginBottom="4dp"/> android:layout_width="0dp"
<EditText android:id="@+id/etAdopterName" android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:hint="Enter adopter name" android:layout_weight="1"
android:inputType="text" android:layout_marginBottom="16dp"/> android:layout_marginStart="8dp"
android:text="Save"
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:backgroundTint="@color/accent_coral"
android:text="Adopter Email" android:textColor="@color/text_dark" android:textSize="12sp" android:textColor="@color/white"/>
android:layout_marginBottom="4dp"/>
<EditText android:id="@+id/etAdopterEmail" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="Enter email address"
android:inputType="textEmailAddress" android:layout_marginBottom="16dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Adopter Phone" android:textColor="@color/text_dark" android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText android:id="@+id/etAdopterPhone" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="Enter phone number"
android:inputType="phone" android:layout_marginBottom="16dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Pet Name" android:textColor="@color/text_dark" android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText android:id="@+id/etAdoptionPetName" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="Enter pet name"
android:inputType="text" android:layout_marginBottom="16dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Adoption Date" android:textColor="@color/text_dark" android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText android:id="@+id/etAdoptionDate" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="YYYY-MM-DD"
android:inputType="text" android:layout_marginBottom="16dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Status" android:textColor="@color/text_dark" android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<Spinner android:id="@+id/spinnerAdoptionStatus" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_marginBottom="32dp"/>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btnAdoptionBack" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_marginRight="10dp" android:text="Back"/>
<Button android:id="@+id/btnSaveAdoption" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_marginLeft="10dp" android:text="Save"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -1,18 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Updated: added search bar and SwipeRefreshLayout for pull-to-refresh -->
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F5F5F5"> android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Appointments"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<EditText <EditText
android:id="@+id/etSearchAppointment" android:id="@+id/etSearchAppointment"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -23,7 +48,8 @@
android:drawableStart="@android:drawable/ic_menu_search" android:drawableStart="@android:drawable/ic_menu_search"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:background="@android:color/white" android:background="@android:color/white"
android:padding="12dp"/> android:padding="12dp"
android:textColor="@color/text_dark"/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshAppointment" android:id="@+id/swipeRefreshAppointment"
@@ -46,7 +72,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:backgroundTint="@color/accent_coral"
android:contentDescription="Add Appointment" android:contentDescription="Add Appointment"
app:srcCompat="@android:drawable/ic_input_add"/> app:srcCompat="@android:drawable/ic_input_add"
app:tint="@color/white"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout> </androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,101 +1,197 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F5F5F5"> android:orientation="vertical"
android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="56dp"
android:orientation="vertical" android:background="@color/primary_dark"
android:paddingLeft="20dp" android:gravity="center_vertical"
android:paddingRight="20dp" android:paddingStart="16dp"
android:paddingTop="20dp" android:paddingEnd="16dp"
android:paddingBottom="20dp"> android:orientation="horizontal">
<TextView
android:id="@+id/tvApptMode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Add Appointment"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btnDeleteAppointment"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:backgroundTint="@color/accent_coral"
android:text="Delete"
android:textColor="@color/white" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="vertical"
android:padding="24dp">
<TextView <LinearLayout
android:id="@+id/tvApptMode" android:layout_width="match_parent"
android:layout_width="0dp"
android:layout_height="48dp"
android:layout_weight="1"
android:fontFamily="sans-serif-black"
android:text="Add Appointment"
android:textColor="@color/text_dark"
android:textSize="25sp" />
<Button
android:id="@+id/btnDeleteAppointment"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Delete" /> android:orientation="vertical"
android:background="@drawable/rounded_card"
android:padding="16dp"
android:layout_marginBottom="16dp">
<TextView
android:id="@+id/tvAppointmentId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID: #0"
android:textColor="@color/text_light"
android:textSize="11sp"
android:textStyle="italic"
android:layout_gravity="end"
android:layout_marginBottom="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Customer Name"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etCustomerName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter customer name"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pet Name"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etApptPetName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter pet name"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Service Type"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etServiceType"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="e.g. Grooming, Vet Checkup"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Appointment Date"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etAppointmentDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="YYYY-MM-DD"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Appointment Time"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etAppointmentTime"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="e.g. 10:00 AM"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Status"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<Spinner
android:id="@+id/spinnerAppointmentStatus"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
<TextView </ScrollView>
android:id="@+id/tvAppointmentId"
android:layout_width="wrap_content" <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/white"
android:padding="16dp">
<Button
android:id="@+id/btnApptBack"
android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="20dp" android:layout_weight="1"
android:text="ID: 0" /> android:layout_marginEnd="8dp"
android:text="Back"
android:backgroundTint="@color/primary_medium"
android:textColor="@color/white"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" <Button
android:text="Customer Name" android:textColor="@color/text_dark" android:textSize="12sp" android:id="@+id/btnSaveAppointment"
android:layout_marginBottom="4dp"/> android:layout_width="0dp"
<EditText android:id="@+id/etCustomerName" android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:hint="Enter customer name" android:layout_weight="1"
android:inputType="text" android:layout_marginBottom="16dp"/> android:layout_marginStart="8dp"
android:text="Save"
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:backgroundTint="@color/accent_coral"
android:text="Pet Name" android:textColor="@color/text_dark" android:textSize="12sp" android:textColor="@color/white"/>
android:layout_marginBottom="4dp"/>
<EditText android:id="@+id/etApptPetName" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="Enter pet name"
android:inputType="text" android:layout_marginBottom="16dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Service Type" android:textColor="@color/text_dark" android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText android:id="@+id/etServiceType" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="e.g. Grooming, Vet Checkup"
android:inputType="text" android:layout_marginBottom="16dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Appointment Date" android:textColor="@color/text_dark" android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText android:id="@+id/etAppointmentDate" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="YYYY-MM-DD"
android:inputType="text" android:layout_marginBottom="16dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Appointment Time" android:textColor="@color/text_dark" android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText android:id="@+id/etAppointmentTime" android:layout_width="match_parent"
android:layout_height="wrap_content" android:hint="e.g. 10:00 AM"
android:inputType="text" android:layout_marginBottom="16dp"/>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Status" android:textColor="@color/text_dark" android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<Spinner android:id="@+id/spinnerAppointmentStatus" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_marginBottom="32dp"/>
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:orientation="horizontal">
<Button android:id="@+id/btnApptBack" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_marginRight="10dp" android:text="Back"/>
<Button android:id="@+id/btnSaveAppointment" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_marginLeft="10dp" android:text="Save"/>
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
</LinearLayout>

View File

@@ -53,7 +53,8 @@
android:layout_weight="1" android:layout_weight="1"
android:hint="Type a message..." android:hint="Type a message..."
android:inputType="text" android:inputType="text"
android:layout_marginEnd="8dp"/> android:layout_marginEnd="8dp"
android:textColor="@color/text_dark"/>
<Button <Button
android:id="@+id/btnSend" android:id="@+id/btnSend"

View File

@@ -1,18 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Updated: added search bar and SwipeRefreshLayout for pull-to-refresh -->
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F5F5F5"> android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Inventory"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<EditText <EditText
android:id="@+id/etSearchInventory" android:id="@+id/etSearchInventory"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -23,7 +48,8 @@
android:drawableStart="@android:drawable/ic_menu_search" android:drawableStart="@android:drawable/ic_menu_search"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:background="@android:color/white" android:background="@android:color/white"
android:padding="12dp"/> android:padding="12dp"
android:textColor="@color/text_dark"/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshInventory" android:id="@+id/swipeRefreshInventory"
@@ -46,8 +72,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:backgroundTint="@color/accent_coral"
android:contentDescription="Add Inventory Item" android:contentDescription="Add Inventory Item"
app:srcCompat="@android:drawable/ic_input_add"/> app:srcCompat="@android:drawable/ic_input_add"
app:tint="@color/white"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,153 +1,182 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F5F5F5"> android:orientation="vertical"
android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="56dp"
android:orientation="vertical" android:background="@color/primary_dark"
android:paddingLeft="20dp" android:gravity="center_vertical"
android:paddingRight="20dp" android:paddingStart="16dp"
android:paddingTop="20dp" android:paddingEnd="16dp"
android:paddingBottom="20dp"> android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tvInventoryMode"
android:layout_width="245dp"
android:layout_height="48dp"
android:fontFamily="sans-serif-black"
android:text="Add Inventory Item"
android:textColor="@color/text_dark"
android:textSize="22sp" />
<Button
android:id="@+id/btnDeleteInventory"
android:layout_width="121dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:text="Delete" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tvInventoryId" android:id="@+id/tvInventoryMode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Add Inventory Item"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btnDeleteInventory"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="20dp" android:layout_marginStart="8dp"
android:text="ID: 0" /> android:backgroundTint="@color/accent_coral"
android:text="Delete"
<TextView android:textColor="@color/white" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Item Name"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etItemName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Enter item name"
android:inputType="text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Category"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etInventoryCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="e.g. Food, Toys, Medicine"
android:inputType="text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Quantity"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etQuantity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Enter quantity"
android:inputType="number" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Unit Price"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etUnitPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Enter unit price"
android:inputType="numberDecimal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Supplier"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etInventorySupplier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:hint="Enter supplier name"
android:inputType="text" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnInventoryBack"
android:layout_width="121dp"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:text="Back" />
<Button
android:id="@+id/btnSaveInventory"
android:layout_width="121dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:text="Save" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="24dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/rounded_card"
android:padding="16dp"
android:layout_marginBottom="16dp">
<TextView
android:id="@+id/tvInventoryId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID: #0"
android:textColor="@color/text_light"
android:textSize="11sp"
android:textStyle="italic"
android:layout_gravity="end"
android:layout_marginBottom="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Item Name"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etItemName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter item name"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Category"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etInventoryCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="e.g. Food, Toys, Medicine"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Quantity"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etQuantity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter quantity"
android:inputType="number"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Unit Price"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etUnitPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter unit price"
android:inputType="numberDecimal"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Supplier"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etInventorySupplier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter supplier name"
android:inputType="text"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/white"
android:padding="16dp">
<Button
android:id="@+id/btnInventoryBack"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="8dp"
android:text="Back"
android:backgroundTint="@color/primary_medium"
android:textColor="@color/white"/>
<Button
android:id="@+id/btnSaveInventory"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:text="Save"
android:backgroundTint="@color/accent_coral"
android:textColor="@color/white"/>
</LinearLayout>
</LinearLayout>

View File

@@ -7,39 +7,64 @@
android:background="@color/background_grey"> android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"
android:tint="@color/white"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Pets"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewPets"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="56dp" android:orientation="vertical">
android:padding="8dp"/>
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Pets"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<EditText
android:id="@+id/etSearchPet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="Search by name, species or breed..."
android:inputType="text"
android:drawableStart="@android:drawable/ic_menu_search"
android:drawablePadding="8dp"
android:background="@android:color/white"
android:padding="12dp"
android:textColor="@color/text_dark"/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshPet"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewPets"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabAddPet" android:id="@+id/fabAddPet"

View File

@@ -16,10 +16,9 @@
<TextView <TextView
android:id="@+id/tvMode" android:id="@+id/tvMode"
android:layout_width="185dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:width="10dp"
android:text="Add Pet" android:text="Add Pet"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="20sp" android:textSize="20sp"
@@ -27,25 +26,15 @@
<Button <Button
android:id="@+id/btnDeletePet" android:id="@+id/btnDeletePet"
android:layout_width="4dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_weight="1"
android:backgroundTint="@color/accent_coral" android:backgroundTint="@color/accent_coral"
android:text="Delete" android:text="Delete"
android:textColor="@color/white" /> android:textColor="@color/white" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/tvPetId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="10dp"
android:layout_marginRight="24dp"
android:text="ID: 0" />
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
@@ -65,6 +54,17 @@
android:padding="16dp" android:padding="16dp"
android:layout_marginBottom="16dp"> android:layout_marginBottom="16dp">
<TextView
android:id="@+id/tvPetId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Pet ID: #0"
android:textColor="@color/text_light"
android:textSize="11sp"
android:textStyle="italic"
android:layout_gravity="end"
android:layout_marginBottom="8dp"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -79,7 +79,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter pet name" android:hint="Enter pet name"
android:inputType="text" android:inputType="text"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -95,7 +96,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="e.g. Dog, Cat, Bird" android:hint="e.g. Dog, Cat, Bird"
android:inputType="text" android:inputType="text"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -111,7 +113,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter breed" android:hint="Enter breed"
android:inputType="text" android:inputType="text"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -127,7 +130,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter age" android:hint="Enter age"
android:inputType="number" android:inputType="number"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -143,7 +147,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter price" android:hint="Enter price"
android:inputType="numberDecimal" android:inputType="numberDecimal"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -193,4 +198,4 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View File

@@ -1,18 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Updated: added search bar and SwipeRefreshLayout for pull-to-refresh -->
<androidx.coordinatorlayout.widget.CoordinatorLayout <androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F5F5F5"> android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Products"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<EditText <EditText
android:id="@+id/etSearchProduct" android:id="@+id/etSearchProduct"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -23,7 +48,8 @@
android:drawableStart="@android:drawable/ic_menu_search" android:drawableStart="@android:drawable/ic_menu_search"
android:drawablePadding="8dp" android:drawablePadding="8dp"
android:background="@android:color/white" android:background="@android:color/white"
android:padding="12dp"/> android:padding="12dp"
android:textColor="@color/text_dark"/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshProduct" android:id="@+id/swipeRefreshProduct"
@@ -46,8 +72,9 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom|end" android:layout_gravity="bottom|end"
android:layout_margin="16dp" android:layout_margin="16dp"
android:backgroundTint="@color/accent_coral"
android:contentDescription="Add Product" android:contentDescription="Add Product"
app:srcCompat="@android:drawable/ic_input_add"/> app:srcCompat="@android:drawable/ic_input_add"
app:tint="@color/white"/>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@@ -1,154 +1,183 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="#F5F5F5"> android:orientation="vertical"
android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:id="@+id/main"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="56dp"
android:orientation="vertical" android:background="@color/primary_dark"
android:paddingLeft="20dp" android:gravity="center_vertical"
android:paddingRight="20dp" android:paddingStart="16dp"
android:paddingTop="20dp" android:paddingEnd="16dp"
android:paddingBottom="20dp"> android:orientation="horizontal">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/tvProductMode"
android:layout_width="245dp"
android:layout_height="48dp"
android:fontFamily="sans-serif-black"
android:text="Add Product"
android:textColor="@color/text_dark"
android:textSize="25sp" />
<Button
android:id="@+id/btnDeleteProduct"
android:layout_width="121dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:text="Delete" />
</LinearLayout>
<TextView <TextView
android:id="@+id/tvProductId" android:id="@+id/tvProductMode"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Add Product"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
<Button
android:id="@+id/btnDeleteProduct"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="20dp" android:layout_marginStart="8dp"
android:text="ID: 0" /> android:backgroundTint="@color/accent_coral"
android:text="Delete"
<TextView android:textColor="@color/white" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Product Name"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etProductName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Enter product name"
android:inputType="text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Description"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etProductDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Enter product description"
android:inputType="textMultiLine"
android:lines="3" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Category"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etProductCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="e.g. Food, Toys, Grooming"
android:inputType="text" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Price"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etProductPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Enter price"
android:inputType="numberDecimal" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Stock Quantity"
android:textColor="@color/text_dark"
android:textSize="12sp" />
<EditText
android:id="@+id/etStockQuantity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="32dp"
android:hint="Enter stock quantity"
android:inputType="number" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<Button
android:id="@+id/btnProductBack"
android:layout_width="121dp"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:text="Back" />
<Button
android:id="@+id/btnSaveProduct"
android:layout_width="121dp"
android:layout_height="wrap_content"
android:layout_marginLeft="20dp"
android:layout_marginBottom="8dp"
android:layout_weight="1"
android:text="Save" />
</LinearLayout>
</LinearLayout> </LinearLayout>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="24dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/rounded_card"
android:padding="16dp"
android:layout_marginBottom="16dp">
<TextView
android:id="@+id/tvProductId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID: #0"
android:textColor="@color/text_light"
android:textSize="11sp"
android:textStyle="italic"
android:layout_gravity="end"
android:layout_marginBottom="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Product Name"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etProductName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter product name"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Description"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etProductDesc"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Enter product description"
android:inputType="textMultiLine"
android:minLines="1" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Category"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etProductCategory"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="e.g. Food, Toys, Grooming"
android:inputType="text"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Price"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etProductPrice"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter price"
android:inputType="numberDecimal"
android:layout_marginBottom="16dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Stock Quantity"
android:textColor="@color/text_dark"
android:textSize="12sp"
android:layout_marginBottom="4dp"/>
<EditText
android:id="@+id/etStockQuantity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter stock quantity"
android:inputType="number"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/white"
android:padding="16dp">
<Button
android:id="@+id/btnProductBack"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginEnd="8dp"
android:text="Back"
android:backgroundTint="@color/primary_medium"
android:textColor="@color/white"/>
<Button
android:id="@+id/btnSaveProduct"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginStart="8dp"
android:text="Save"
android:backgroundTint="@color/accent_coral"
android:textColor="@color/white"/>
</LinearLayout>
</LinearLayout>

View File

@@ -7,39 +7,64 @@
android:background="@color/background_grey"> android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"
android:tint="@color/white"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Services"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewServices"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="56dp" android:orientation="vertical">
android:padding="8dp"/>
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Services"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<EditText
android:id="@+id/etSearchService"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="Search by service name or description..."
android:inputType="text"
android:drawableStart="@android:drawable/ic_menu_search"
android:drawablePadding="8dp"
android:background="@android:color/white"
android:padding="12dp"
android:textColor="@color/text_dark"/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshService"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewServices"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabAddService" android:id="@+id/fabAddService"

View File

@@ -16,7 +16,7 @@
<TextView <TextView
android:id="@+id/tvMode" android:id="@+id/tvMode"
android:layout_width="185dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="Add Service" android:text="Add Service"
@@ -26,25 +26,15 @@
<Button <Button
android:id="@+id/btnDeleteService" android:id="@+id/btnDeleteService"
android:layout_width="4dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_weight="1"
android:backgroundTint="@color/accent_coral" android:backgroundTint="@color/accent_coral"
android:text="Delete" android:text="Delete"
android:textColor="@color/white" /> android:textColor="@color/white" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/tvServiceId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="10dp"
android:layout_marginRight="24dp"
android:text="ID: 0" />
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
@@ -56,15 +46,6 @@
android:orientation="vertical" android:orientation="vertical"
android:padding="24dp"> android:padding="24dp">
<TextView
android:id="@+id/tvServiceId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/text_light"
android:textSize="12sp"
android:layout_marginBottom="16dp"
android:visibility="gone"/>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -73,6 +54,17 @@
android:padding="16dp" android:padding="16dp"
android:layout_marginBottom="16dp"> android:layout_marginBottom="16dp">
<TextView
android:id="@+id/tvServiceId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID: #0"
android:textColor="@color/text_light"
android:textSize="11sp"
android:textStyle="italic"
android:layout_gravity="end"
android:layout_marginBottom="8dp"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -87,7 +79,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter service name" android:hint="Enter service name"
android:inputType="text" android:inputType="text"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -101,10 +94,11 @@
android:id="@+id/etServiceDesc" android:id="@+id/etServiceDesc"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:hint="Enter description" android:hint="Enter description"
android:inputType="textMultiLine" android:inputType="textMultiLine"
android:minLines="2" android:minLines="1"
android:layout_marginBottom="16dp"/> android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -120,7 +114,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter duration in minutes" android:hint="Enter duration in minutes"
android:inputType="number" android:inputType="number"
android:layout_marginBottom="16dp"/> android:layout_marginBottom="16dp"
android:textColor="@color/text_dark"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
@@ -135,7 +130,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:hint="Enter price" android:hint="Enter price"
android:inputType="numberDecimal"/> android:inputType="numberDecimal"
android:textColor="@color/text_dark"/>
</LinearLayout> </LinearLayout>

View File

@@ -7,39 +7,64 @@
android:background="@color/background_grey"> android:background="@color/background_grey">
<LinearLayout <LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"
android:tint="@color/white"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Suppliers"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewSuppliers"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="56dp" android:orientation="vertical">
android:padding="8dp"/>
<LinearLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/primary_dark"
android:gravity="center_vertical"
android:paddingStart="16dp"
android:paddingEnd="16dp">
<ImageButton
android:id="@+id/btnHamburger"
android:layout_width="48dp"
android:layout_height="48dp"
android:src="@drawable/baseline_menu_36"
android:background="?attr/selectableItemBackgroundBorderless"
android:contentDescription="Open menu"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Suppliers"
android:textColor="@color/white"
android:textSize="20sp"
android:textStyle="bold"/>
</LinearLayout>
<EditText
android:id="@+id/etSearchSupplier"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
android:hint="Search by company or contact name..."
android:inputType="text"
android:drawableStart="@android:drawable/ic_menu_search"
android:drawablePadding="8dp"
android:background="@android:color/white"
android:padding="12dp"
android:textColor="@color/text_dark"/>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshSupplier"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerViewSuppliers"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="8dp"/>
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<com.google.android.material.floatingactionbutton.FloatingActionButton <com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabAddSupplier" android:id="@+id/fabAddSupplier"

View File

@@ -16,7 +16,7 @@
<TextView <TextView
android:id="@+id/tvMode" android:id="@+id/tvMode"
android:layout_width="185dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
android:text="Add Supplier" android:text="Add Supplier"
@@ -26,25 +26,15 @@
<Button <Button
android:id="@+id/btnDeleteSupplier" android:id="@+id/btnDeleteSupplier"
android:layout_width="4dp" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="8dp" android:layout_marginStart="8dp"
android:layout_weight="1"
android:backgroundTint="@color/accent_coral" android:backgroundTint="@color/accent_coral"
android:text="Delete" android:text="Delete"
android:textColor="@color/white" /> android:textColor="@color/white" />
</LinearLayout> </LinearLayout>
<TextView
android:id="@+id/tvSupId"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginTop="10dp"
android:layout_marginRight="24dp"
android:text="ID: 0" />
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp" android:layout_height="0dp"
@@ -64,6 +54,17 @@
android:padding="16dp" android:padding="16dp"
android:layout_marginBottom="16dp"> android:layout_marginBottom="16dp">
<TextView
android:id="@+id/tvSupId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ID: #0"
android:textColor="@color/text_light"
android:textSize="11sp"
android:textStyle="italic"
android:layout_gravity="end"
android:layout_marginBottom="8dp"/>
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -5,5 +5,7 @@
<item name="colorPrimaryVariant">@color/primary_medium</item> <item name="colorPrimaryVariant">@color/primary_medium</item>
<item name="colorAccent">@color/accent_coral</item> <item name="colorAccent">@color/accent_coral</item>
<item name="android:windowBackground">@color/background_grey</item> <item name="android:windowBackground">@color/background_grey</item>
<item name="editTextStyle">@style/Widget.App.EditText</item>
<item name="spinnerStyle">@style/Widget.App.Spinner</item>
</style> </style>
</resources> </resources>

View File

@@ -5,7 +5,16 @@
<item name="colorPrimaryVariant">@color/primary_medium</item> <item name="colorPrimaryVariant">@color/primary_medium</item>
<item name="colorAccent">@color/accent_coral</item> <item name="colorAccent">@color/accent_coral</item>
<item name="android:windowBackground">@color/background_grey</item> <item name="android:windowBackground">@color/background_grey</item>
<item name="editTextStyle">@style/Widget.App.EditText</item>
<item name="spinnerStyle">@style/Widget.App.Spinner</item>
<item name="android:statusBarColor">@color/primary_dark</item>
<item name="android:windowLightStatusBar">false</item>
</style>
<style name="Widget.App.EditText" parent="Widget.AppCompat.EditText">
<item name="android:textColor">@color/text_dark</item>
</style>
<style name="Widget.App.Spinner" parent="Widget.AppCompat.Spinner">
<item name="android:textColor">@color/text_dark</item>
</style> </style>
<style name="Theme.PetStoreMobile" parent="Base.Theme.PetStoreMobile" /> <style name="Theme.PetStoreMobile" parent="Base.Theme.PetStoreMobile" />
</resources> </resources>