Merge pull request #69 from ClaytonWWilson/async-loading

Async loading
This commit is contained in:
Clayton Wilson 2020-10-31 20:11:36 -04:00 committed by GitHub
commit 19fdd96b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 389 additions and 116 deletions

View File

@ -1,5 +1,8 @@
package com.example.listify;
import android.app.Dialog;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import com.amplifyframework.auth.AuthException;
@ -11,6 +14,8 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
@ -71,6 +76,8 @@ public class ItemDetails extends AppCompatActivity implements ListPickerDialogFr
@Override
public void onClick(View v) {
closeFABMenu();
LoadingCircleDialog loadingDialog = new LoadingCircleDialog(ItemDetails.this);
loadingDialog.show();
Properties configs = new Properties();
try {
@ -81,23 +88,59 @@ public class ItemDetails extends AppCompatActivity implements ListPickerDialogFr
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
SynchronousReceiver<Integer[]> listIdsReceiver = new SynchronousReceiver<>();
SynchronousReceiver<List> listReceiver = new SynchronousReceiver<>();
requestor.getListOfIds(List.class, listIdsReceiver, listIdsReceiver);
Thread t = new Thread(new Runnable() {
@Override
public void run() {
Integer[] listIds = null;
try {
Integer[] listIds = listIdsReceiver.await();
for (int i = 0; i < listIds.length; i++) {
requestor.getObject(Integer.toString(listIds[i]), List.class, listReceiver, listReceiver);
shoppingLists.add(listReceiver.await());
}
listIds = listIdsReceiver.await();
} catch (Exception e) {
e.printStackTrace();
}
// Create threads and add them to a list
Thread[] threads = new Thread[listIds.length];
List[] results = new List[listIds.length];
for (int i = 0; i < listIds.length; i++) {
SynchronousReceiver<List> listReceiver = new SynchronousReceiver<>();
requestor.getObject(Integer.toString(listIds[i]), List.class, listReceiver, listReceiver);
final int finalI = i;
Thread l = new Thread(new Runnable() {
@Override
public void run() {
try {
results[finalI] = listReceiver.await();
} catch (Exception e) {
e.printStackTrace();
}
}
});
threads[i] = l;
l.start();
}
shoppingLists.clear();
// Wait for each thread to finish and add results to shoppingLists
for (int i = 0; i < threads.length; i++) {
try {
threads[i].join();
} catch (InterruptedException e) {
e.printStackTrace();
}
shoppingLists.add(results[i]);
}
loadingDialog.cancel();
ListPickerDialogFragment listPickerDialog = new ListPickerDialogFragment(shoppingLists);
listPickerDialog.show(getSupportFragmentManager(), "User Lists");
}
});
t.start();
}
});
linCreateList.setOnClickListener(new View.OnClickListener() {
@Override
@ -157,7 +200,7 @@ public class ItemDetails extends AppCompatActivity implements ListPickerDialogFr
}
// Add the viewed item to the selected list
// Add the selected item to the selected list
@Override
public void sendListSelection(int selectedListIndex, int quantity) {
@ -184,6 +227,8 @@ public class ItemDetails extends AppCompatActivity implements ListPickerDialogFr
// Create a new list and add the item to it
@Override
public void sendNewListName(String name, int quantity) {
LoadingCircleDialog loadingDialog = new LoadingCircleDialog(this);
loadingDialog.show();
Properties configs = new Properties();
try {
@ -196,16 +241,34 @@ public class ItemDetails extends AppCompatActivity implements ListPickerDialogFr
com.example.listify.data.List newList = new List(-1, name, "user filled by lambda", Instant.now().toEpochMilli());
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
requestor.postObject(newList, idReceiver, idReceiver);
int newListId = idReceiver.await();
ListEntry entry = new ListEntry(newListId, curProduct.getItemId(), quantity, Instant.now().toEpochMilli(),false);
requestor.postObject(entry);
Toast.makeText(this, String.format("%s created and item added", name), Toast.LENGTH_LONG).show();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(ItemDetails.this, String.format("%s created and item added", name), Toast.LENGTH_LONG).show();
loadingDialog.cancel();
}
});
} catch (Exception e) {
Toast.makeText(this, "An error occurred", Toast.LENGTH_LONG).show();
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(ItemDetails.this, "An error occurred", Toast.LENGTH_LONG).show();
loadingDialog.cancel();
e.printStackTrace();
}
});
}
}
});
t.start();
}
}

View File

@ -28,7 +28,7 @@ import org.json.JSONException;
import static com.example.listify.MainActivity.am;
public class ListPage extends AppCompatActivity {
public class ListPage extends AppCompatActivity implements Requestor.Receiver {
ListView listView;
MyAdapter myAdapter;
Requestor requestor;
@ -36,6 +36,7 @@ public class ListPage extends AppCompatActivity {
Button incrQuan;
Button decrQuan;
Button removeItem;
ProgressBar loadingListItems;
ArrayList<String> pNames = new ArrayList<>();
ArrayList<String> pStores = new ArrayList<>();
@ -50,11 +51,23 @@ public class ListPage extends AppCompatActivity {
DecimalFormat df = new DecimalFormat("0.00");
// TODO: Display a message if their list is empty
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
// Read list ID from caller
final int listID = (int) getIntent().getSerializableExtra("listID");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
listView = findViewById(R.id.listView);
myAdapter = new MyAdapter(this, pNames, pStores, pPrices, pQuantity, pImages);
listView.setAdapter(myAdapter);
loadingListItems = findViewById(R.id.progress_loading_list_items);
loadingListItems.setVisibility(View.VISIBLE);
pNames.add("Total Price");
pStores.add("");
pPrices.add("0.00");
@ -62,6 +75,7 @@ public class ListPage extends AppCompatActivity {
pImages.add("-1");
pListItemPair.add(null);
Properties configs = new Properties();
try {
configs = AuthManager.loadProperties(this, "android.resource://" + getPackageName() + "/raw/auths.json");
@ -69,18 +83,32 @@ public class ListPage extends AppCompatActivity {
e.printStackTrace();
}
requestor = new Requestor(am, configs.getProperty("apiKey"));
SynchronousReceiver<List> lr = new SynchronousReceiver<>();
requestor.getObject(Integer.toString(listID), List.class, lr);
List list;
requestor.getObject(Integer.toString(listID), List.class, this);
try {
list = lr.await();
}
catch (Exception e) {
list = null;
/*pNames.add("Half-gallon organic whole milk");
pStores.add("Kroger");
pPrices.add("$5.00");
pQuantity.add("1");
pImages.add(R.drawable.milk);
pNames.add("5-bunch medium bananas");
pStores.add("Kroger");
pPrices.add("$3.00");
pQuantity.add("1");
pImages.add(R.drawable.bananas);
pNames.add("JIF 40-oz creamy peanut butter");
pStores.add("Kroger");
pPrices.add("$7.00");
pQuantity.add("1");
pImages.add(R.drawable.peanutbutter);*/
}
@Override
public void acceptDelivery(Object delivered) {
List list = (List) delivered;
if(list != null) {
for (ListEntry entry : list.getEntries()) {
int product = entry.getProductID();
@ -123,7 +151,6 @@ public class ListPage extends AppCompatActivity {
double newTotal = Double.parseDouble(pPrices.get(0)) + (item.getPrice().doubleValue() * entry.getQuantity());
pPrices.set(0, df.format(newTotal));
index++;
pNames.add(index, item.getDescription());
@ -141,15 +168,15 @@ public class ListPage extends AppCompatActivity {
}
}
}
runOnUiThread(new Runnable() {
@Override
public void run() {
loadingListItems.setVisibility(View.GONE);
myAdapter.notifyDataSetChanged();
}
});
}
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_list);
listView = findViewById(R.id.listView);
myAdapter = new MyAdapter(this, pNames, pStores, pPrices, pQuantity, pImages);
listView.setAdapter(myAdapter);
}
class MyAdapter extends ArrayAdapter<String> {

View File

@ -0,0 +1,36 @@
package com.example.listify;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.view.Window;
import android.view.WindowManager;
public class LoadingCircleDialog {
Dialog loadingDialog;
public LoadingCircleDialog(Context context) {
loadingDialog = new Dialog(context);
// Create and show a loading dialog
loadingDialog.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
loadingDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
// layout to display
loadingDialog.setContentView(R.layout.dialog_loading);
// set color transpartent
loadingDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
loadingDialog.setCancelable(false);
loadingDialog.setCanceledOnTouchOutside(false);
}
public void show() {
loadingDialog.show();
}
public void cancel() {
loadingDialog.cancel();
}
}

View File

@ -9,6 +9,7 @@ import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.SearchView;
import com.example.listify.adapter.SearchResultsListAdapter;
import com.example.listify.data.ItemSearch;
@ -22,8 +23,8 @@ import java.util.Properties;
import static com.example.listify.MainActivity.am;
public class SearchResults extends AppCompatActivity implements SortDialogFragment.OnSortingListener {
private ListView listView;
public class SearchResults extends AppCompatActivity implements SortDialogFragment.OnSortingListener, Requestor.Receiver {
private ProgressBar loadingSearch;
private SearchResultsListAdapter searchResultsListAdapter;
private List<Product> resultsProductList = new ArrayList<>();
private List<Product> resultsProductListSorted = new ArrayList<>();
@ -47,6 +48,8 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
loadingSearch = (ProgressBar) findViewById(R.id.progress_loading_search);
// Back button closes this activity and returns to previous activity (MainActivity)
ImageButton backButton = (ImageButton) findViewById(R.id.backToHomeButton);
backButton.setOnClickListener(new View.OnClickListener() {
@ -77,7 +80,7 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
}
});
listView = (ListView) findViewById(R.id.search_results_list);
ListView listView = (ListView) findViewById(R.id.search_results_list);
searchResultsListAdapter = new SearchResultsListAdapter(this, resultsProductListSorted);
listView.setAdapter(searchResultsListAdapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@ -96,6 +99,15 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
// Show progress bar
loadingSearch.setVisibility(View.VISIBLE);
// Clear the old search results
resultsProductList.clear();
// Clear old search results from the view
resultsProductListSorted.clear();
searchResultsListAdapter.notifyDataSetChanged();
doSearch(query);
return false;
}
@ -122,12 +134,8 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
sortDialog.show(getSupportFragmentManager(), "Sort");
}
});
}
// Override default phone back button to add animation
@Override
public void onBackPressed() {
@ -136,10 +144,6 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
}
private void doSearch(String query) {
// Clear the old search results
resultsProductList.clear();
Properties configs = new Properties();
try {
configs = AuthManager.loadProperties(this, "android.resource://" + getPackageName() + "/raw/auths.json");
@ -148,32 +152,7 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
}
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
SynchronousReceiver<ItemSearch> itemReceiver = new SynchronousReceiver<>();
requestor.getObject(query, ItemSearch.class, itemReceiver, itemReceiver);
ItemSearch results;
try {
results = itemReceiver.await();
for (int i = 0; i < results.getResults().size(); i++) {
// TODO: Change to dynamically grab chain name by id
resultsProductList.add(new Product(results.getResults().get(i).getDescription(), results.getResults().get(i).getProductID(), "Kroger", results.getResults().get(i).getChainID(), results.getResults().get(i).getUpc(), results.getResults().get(i).getDescription(), results.getResults().get(i).getPrice(), results.getResults().get(i).getImageURL(), results.getResults().get(i).getDepartment()));
}
} catch (Exception e) {
e.printStackTrace();
}
// Create a list of all stores in the results so the user can filter by store name
for (int i = 0; i < resultsProductList.size(); i++) {
if (!stores.contains(resultsProductList.get(i).getChainName())) {
stores.add(resultsProductList.get(i).getChainName());
}
}
// Add all results to the sorted list
resultsProductListSorted.addAll(resultsProductList);
// Apply selected sorting to the list
sortResults();
requestor.getObject(query, ItemSearch.class, this);
}
// Sorts the search results
@ -203,7 +182,6 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
});
break;
// TODO: May need to change this depending on if price is stored as a string or a double
case 2:
resultsProductListSorted.sort(new Comparator<Product>() {
@Override
@ -257,7 +235,57 @@ public class SearchResults extends AppCompatActivity implements SortDialogFragme
resultsProductListSorted.clear();
resultsProductListSorted.addAll(temp);
}
}
// This is called after the search results come back from the server
// TODO: Display a "no results" message if nothing is found when searching
@Override
public void acceptDelivery(Object delivered) {
ItemSearch results = (ItemSearch) delivered;
try {
for (int i = 0; i < results.getResults().size(); i++) {
// TODO: Change to dynamically grab chain name by id
resultsProductList.add(new Product(
results.getResults().get(i).getDescription(),
results.getResults().get(i).getProductID(),
"Kroger",
results.getResults().get(i).getChainID(),
results.getResults().get(i).getUpc(),
results.getResults().get(i).getDescription(),
results.getResults().get(i).getPrice(),
results.getResults().get(i).getImageURL(),
results.getResults().get(i).getDepartment()
));
}
} catch (Exception e) {
e.printStackTrace();
}
// Create a list of all stores in the results so the user can filter by store name
for (int i = 0; i < resultsProductList.size(); i++) {
if (!stores.contains(resultsProductList.get(i).getChainName())) {
stores.add(resultsProductList.get(i).getChainName());
}
}
// Add all results to the sorted list
resultsProductListSorted.addAll(resultsProductList);
// Apply selected sorting to the list
sortResults();
// Updates the list of search results. Runs on the main UI thread since other threads are
// not allowed to change UI elements
runOnUiThread(new Runnable() {
@Override
public void run() {
searchResultsListAdapter.notifyDataSetChanged();
// Hide progress bar
loadingSearch.setVisibility(View.GONE);
}
});
}
}

View File

@ -1,15 +1,22 @@
package com.example.listify.ui.lists;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.LayoutInflater;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.ListFragment;
import com.amplifyframework.auth.AuthException;
import com.example.listify.AuthManager;
@ -17,6 +24,7 @@ import com.example.listify.CreateListAddDialogFragment;
import com.example.listify.CreateListDialogFragment;
import com.example.listify.ItemDetails;
import com.example.listify.ListPage;
import com.example.listify.LoadingCircleDialog;
import com.example.listify.R;
import com.example.listify.Requestor;
import com.example.listify.SearchResults;
@ -34,16 +42,20 @@ import java.util.Properties;
import static com.example.listify.MainActivity.am;
public class ListsFragment extends Fragment implements CreateListDialogFragment.OnNewListListener {
public class ListsFragment extends Fragment implements CreateListDialogFragment.OnNewListListener, Requestor.Receiver {
ArrayList<List> shoppingLists = new ArrayList<>();
DisplayShoppingListsAdapter displayShoppingListsAdapter;
Requestor requestor;
ListView shoppingListsView;
ProgressBar loadingLists;
int resultsIndex;
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_lists, container, false);
shoppingListsView = root.findViewById(R.id.shopping_lists);
loadingLists = (ProgressBar) root.findViewById(R.id.progress_loading_lists);
loadingLists.setVisibility(View.VISIBLE);
// TODO: Switch this to async
Properties configs = new Properties();
try {
configs = AuthManager.loadProperties(getContext(), "android.resource://" + getActivity().getPackageName() + "/raw/auths.json");
@ -51,36 +63,13 @@ public class ListsFragment extends Fragment implements CreateListDialogFragment.
e.printStackTrace();
}
Requestor requestor = new Requestor(am, configs.getProperty("apiKey"));
requestor = new Requestor(am, configs.getProperty("apiKey"));
SynchronousReceiver<Integer[]> listIdsReceiver = new SynchronousReceiver<>();
SynchronousReceiver<List> listReceiver = new SynchronousReceiver<>();
requestor.getListOfIds(List.class, listIdsReceiver, listIdsReceiver);
try {
Integer[] listIds = listIdsReceiver.await();
for (int i = 0; i < listIds.length; i++) {
requestor.getObject(Integer.toString(listIds[i]), List.class, listReceiver, listReceiver);
shoppingLists.add(listReceiver.await());
}
} catch (Exception e) {
e.printStackTrace();
}
final Requestor.Receiver<Integer[]> recv = this;
requestor.getListOfIds(List.class, recv, null);
// Set adapter and display this users lists
displayShoppingListsAdapter = new DisplayShoppingListsAdapter(getActivity(), shoppingLists);
shoppingListsView.setAdapter(displayShoppingListsAdapter);
shoppingListsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent listPage = new Intent(getContext(), ListPage.class);
// Send the list ID
listPage.putExtra("listID", shoppingLists.get(position).getItemID());
startActivity(listPage);
}
});
FloatingActionButton fab = (FloatingActionButton) root.findViewById(R.id.new_list_fab);
Fragment thisFragment = this;
fab.setOnClickListener(new View.OnClickListener() {
@ -97,6 +86,8 @@ public class ListsFragment extends Fragment implements CreateListDialogFragment.
@Override
public void sendNewListName(String name) {
LoadingCircleDialog loadingDialog = new LoadingCircleDialog(getActivity());
loadingDialog.show();
Properties configs = new Properties();
try {
@ -111,13 +102,95 @@ public class ListsFragment extends Fragment implements CreateListDialogFragment.
try {
requestor.postObject(newList, idReceiver, idReceiver);
newList.setItemID(idReceiver.await());
shoppingLists.add(newList);
displayShoppingListsAdapter.notifyDataSetChanged();
Toast.makeText(getContext(), String.format("%s created", name), Toast.LENGTH_LONG).show();
} catch (Exception e) {
Toast.makeText(getContext(), "An error occurred", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
newList.setItemID(idReceiver.await());
} catch (Exception e) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getContext(), "An error occurred", Toast.LENGTH_LONG).show();
loadingDialog.cancel();
}
});
e.printStackTrace();
}
shoppingLists.add(newList);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
displayShoppingListsAdapter.notifyDataSetChanged();
loadingDialog.cancel();
Toast.makeText(getContext(), String.format("%s created", name), Toast.LENGTH_LONG).show();
}
});
}
});
t.start();
}
@Override
public void acceptDelivery(Object delivered) {
Integer[] listIds = (Integer[]) delivered;
// Create threads and add them to a list
Thread[] threads = new Thread[listIds.length];
List[] results = new List[listIds.length];
for (int i = 0; i < listIds.length; i++) {
SynchronousReceiver<List> listReceiver = new SynchronousReceiver<>();
requestor.getObject(Integer.toString(listIds[i]), List.class, listReceiver, listReceiver);
final int finalI = i;
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
results[finalI] = listReceiver.await();
} catch (Exception e) {
e.printStackTrace();
}
}
});
threads[i] = t;
t.start();
}
// Wait for each thread to finish and add results to shoppingLists
for (int i = 0; i < threads.length; i++) {
try {
threads[i].join();
} catch (InterruptedException e) {
e.printStackTrace();
}
shoppingLists.add(results[i]);
}
// Set adapter and display this users lists
displayShoppingListsAdapter = new DisplayShoppingListsAdapter(getActivity(), shoppingLists);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
shoppingListsView.setAdapter(displayShoppingListsAdapter);
shoppingListsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent listPage = new Intent(getContext(), ListPage.class);
// Send the list ID
listPage.putExtra("listID", shoppingLists.get(position).getItemID());
startActivity(listPage);
}
});
loadingLists.setVisibility(View.GONE);
}
});
}
}

View File

@ -1,9 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/progress_loading_list_items"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminate="true"
android:visibility="gone"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -11,4 +21,4 @@
</ListView>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>

View File

@ -12,6 +12,16 @@
tools:context=".SearchResults"
tools:showIn="@layout/activity_search_results">
<ProgressBar
android:id="@+id/progress_loading_search"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminate="true"
android:visibility="gone"/>
<ListView
android:id="@+id/search_results_list"
android:layout_width="fill_parent"

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null">
<ProgressBar
android:id="@+id/progress_loading_lists"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminate="true"
android:visibility="visible"/>
</RelativeLayout>

View File

@ -12,6 +12,16 @@
tools:context=".ui.lists.ListsFragment"
tools:showIn="@layout/fragment_lists">
<ProgressBar
android:id="@+id/progress_loading_lists"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:indeterminate="true"
android:visibility="gone"/>
<ListView
android:id="@+id/shopping_lists"
android:layout_width="fill_parent"