Added URL links to stores' official sites

This commit is contained in:
Aaron Sun 2020-11-25 12:37:24 -08:00
parent 95251d7115
commit ef527aef42

View File

@ -1,5 +1,8 @@
package com.example.listify.ui.store;
import android.content.Intent;
import android.net.Uri;
import android.widget.TextView;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
@ -13,7 +16,36 @@ import com.example.listify.R;
public class StoreFragment extends Fragment {
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_stores, container, false);
TextView krogerText = (TextView) root.findViewById(R.id.textView11);
krogerText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoUrl("https://www.kroger.com/");
}
});
TextView kohlsText = (TextView) root.findViewById(R.id.textView12);
krogerText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoUrl("https://www.kohls.com/");
}
});
TextView ebayText = (TextView) root.findViewById(R.id.textView13);
krogerText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
gotoUrl("https://www.ebay.com/");
}
});
return root;
}
private void gotoUrl(String url) {
Uri u = Uri.parse(url);
startActivity(new Intent(Intent.ACTION_VIEW, u));
}
}