Java tutorial
/* * Copyright (C) 2015 Kyle O'Shaughnessy, Ross Anderson, Michelle Mabuyo, John Slevinsky, Udey Rishi, Quentin Lautischer * Photography equipment trading application for CMPUT 301 at the University of Alberta. * * This file is part of "Trading Post" * * "Trading Post" is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package ca.ualberta.cmput301.t03.inventory; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import ca.ualberta.cmput301.t03.Observable; import ca.ualberta.cmput301.t03.Observer; import ca.ualberta.cmput301.t03.R; /** * Fragment for displaying a single {@link Item}. */ public class ItemTileFragment extends Fragment implements Observer { // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_NAME = "name"; private static final String ARG_CATEGORY = "category"; private Item model; private String mName; private String mCategory; public ItemTileFragment() { } // TODO: Rename and change types and number of parameters public static ItemTileFragment newInstance(String name, String category) { ItemTileFragment fragment = new ItemTileFragment(); Bundle args = new Bundle(); args.putString(ARG_NAME, name); args.putString(ARG_CATEGORY, category); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mName = getArguments().getString(ARG_NAME); mCategory = getArguments().getString(ARG_CATEGORY); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_item_tile, container, false); return v; } @Override public void update(Observable observable) { throw new UnsupportedOperationException(); } }