Fixed the links to the store sites

This commit is contained in:
Aaron Sun 2020-12-03 19:49:30 -08:00
parent c23b980ff2
commit 964864f0fc

View File

@ -56,7 +56,7 @@ public class StoreFragment extends Fragment {
storeURLs.add("https://www.ebay.com/");
listView = root.findViewById(R.id.listOfStores);
myAdapter = new StoreFragment.MyAdapter(this.getContext(), storeLogos, storeNames, storeNames);
myAdapter = new StoreFragment.MyAdapter(this.getContext(), storeLogos, storeNames, storeURLs);
listView.setAdapter(myAdapter);
return root;
@ -64,9 +64,9 @@ public class StoreFragment extends Fragment {
class MyAdapter extends ArrayAdapter<String> {
Context context;
ArrayList<Integer> storeLogos = new ArrayList<>();
ArrayList<String> storeNames = new ArrayList<>();
ArrayList<String> storeURLs = new ArrayList<>();
ArrayList<Integer> storeLogos;
ArrayList<String> storeNames;
ArrayList<String> storeURLs;
MyAdapter (Context c, ArrayList<Integer> logos, ArrayList<String> names, ArrayList<String> urls) {
super(c, R.layout.shopping_list_product_entry, R.id.productView, names);
@ -116,7 +116,8 @@ public class StoreFragment extends Fragment {
name.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoUrl(storeURLs.get(position));
Uri uri = Uri.parse(storeURLs.get(position));
startActivity(new Intent(Intent.ACTION_VIEW, uri));
}
});
}
@ -129,9 +130,4 @@ public class StoreFragment extends Fragment {
return listproduct;
}
}
private void gotoUrl(String url) {
Uri u = Uri.parse(url);
startActivity(new Intent(Intent.ACTION_VIEW, u));
}
}