3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 package de.dhbwloe.campusapp.fragments;
17 import android.content.Context;
18 import android.net.Uri;
19 import android.os.Bundle;
20 import android.support.v4.app.Fragment;
21 import android.view.LayoutInflater;
22 import android.view.View;
23 import android.view.ViewGroup;
24 import android.widget.TextView;
26 import java.text.DecimalFormat;
28 import de.dhbwloe.campusapp.CampusAppFragment;
29 import de.dhbwloe.campusapp.R;
30 import de.dhbwloe.campusapp.search.SearchIndices;
33 * A simple {@link Fragment} subclass.
34 * Activities that contain this fragment must implement the
35 * {@link MensaCard.OnFragmentInteractionListener} interface
36 * to handle interaction events.
37 * Use the {@link MensaCard#newInstance} factory method to
38 * create an instance of this fragment.
40 public class MensaCard extends CampusAppFragment {
44 public View onCreateView(LayoutInflater inflater, ViewGroup container,
45 Bundle savedInstanceState) {
46 view = inflater.inflate(R.layout.fragment_mensa_card, container, false);
47 AppContext.setTitle(AppContext.getResString(R.string.mensacard_title));
49 Bundle args = getArguments();
50 if(args != null && args.containsKey("balance")) {
51 showNfcCardData(args);
57 public void showNfcCardData(Bundle bundle) {
58 TextView cardDataView = (TextView)view.findViewById(R.id.balanceTxt);
59 double balance = bundle.getDouble("balance");
60 DecimalFormat df = new DecimalFormat(AppContext.getResString(R.string.mensaformat_price));
61 cardDataView.setText(df.format(balance));