Commit be985098e3ea9fb4dab0f02fa7209432e98cfa4a
1 parent
dd839264
Abstract class NFC
Showing
4 changed files
with
23 additions
and
9 deletions
Show diff stats
app/src/main/java/net/plil/clubinfo/etunicorn/app/Crediter.java
@@ -25,11 +25,9 @@ import net.plil.clubinfo.etunicorn.R; | @@ -25,11 +25,9 @@ import net.plil.clubinfo.etunicorn.R; | ||
25 | * Use the {@link Crediter#newInstance} factory method to | 25 | * Use the {@link Crediter#newInstance} factory method to |
26 | * create an instance of this fragment. | 26 | * create an instance of this fragment. |
27 | */ | 27 | */ |
28 | -public class Crediter extends Fragment { | 28 | +public class Crediter extends FragmentNFC { |
29 | NfcAdapter mNfcAdapter; | 29 | NfcAdapter mNfcAdapter; |
30 | 30 | ||
31 | - | ||
32 | - | ||
33 | private OnFragmentInteractionListener mListener; | 31 | private OnFragmentInteractionListener mListener; |
34 | 32 | ||
35 | public Crediter() { | 33 | public Crediter() { |
@@ -86,8 +84,9 @@ public class Crediter extends Fragment { | @@ -86,8 +84,9 @@ public class Crediter extends Fragment { | ||
86 | mListener = null; | 84 | mListener = null; |
87 | } | 85 | } |
88 | 86 | ||
89 | - public void processNFC(){ | ||
90 | - Toast.makeText(getContext(), "HELLO NFC", Toast.LENGTH_LONG).show(); | 87 | + @Override |
88 | + public void processNFC() { | ||
89 | + | ||
91 | } | 90 | } |
92 | 91 | ||
93 | 92 |
app/src/main/java/net/plil/clubinfo/etunicorn/app/Debiter.java
@@ -18,7 +18,7 @@ import net.plil.clubinfo.etunicorn.R; | @@ -18,7 +18,7 @@ import net.plil.clubinfo.etunicorn.R; | ||
18 | * Use the {@link Debiter#newInstance} factory method to | 18 | * Use the {@link Debiter#newInstance} factory method to |
19 | * create an instance of this fragment. | 19 | * create an instance of this fragment. |
20 | */ | 20 | */ |
21 | -public class Debiter extends Fragment { | 21 | +public class Debiter extends FragmentNFC { |
22 | // TODO: Rename parameter arguments, choose names that match | 22 | // TODO: Rename parameter arguments, choose names that match |
23 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER | 23 | // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER |
24 | private static final String ARG_PARAM1 = "param1"; | 24 | private static final String ARG_PARAM1 = "param1"; |
@@ -92,6 +92,11 @@ public class Debiter extends Fragment { | @@ -92,6 +92,11 @@ public class Debiter extends Fragment { | ||
92 | mListener = null; | 92 | mListener = null; |
93 | } | 93 | } |
94 | 94 | ||
95 | + @Override | ||
96 | + public void processNFC() { | ||
97 | + | ||
98 | + } | ||
99 | + | ||
95 | /** | 100 | /** |
96 | * This interface must be implemented by activities that contain this | 101 | * This interface must be implemented by activities that contain this |
97 | * fragment to allow an interaction in this fragment to be communicated | 102 | * fragment to allow an interaction in this fragment to be communicated |
app/src/main/java/net/plil/clubinfo/etunicorn/app/FragmentNFC.java
0 → 100644
app/src/main/java/net/plil/clubinfo/etunicorn/app/MainActivity.java
@@ -106,9 +106,8 @@ public class MainActivity extends AppCompatActivity { | @@ -106,9 +106,8 @@ public class MainActivity extends AppCompatActivity { | ||
106 | @Override | 106 | @Override |
107 | protected void onNewIntent(Intent intent) { | 107 | protected void onNewIntent(Intent intent) { |
108 | super.onNewIntent(intent); | 108 | super.onNewIntent(intent); |
109 | - Toast.makeText(getBaseContext(), mViewPager.getCurrentItem()+" NFC WORKING", Toast.LENGTH_LONG).show(); | ||
110 | - Toast.makeText(getBaseContext(), intent.getParcelableExtra(NfcAdapter.EXTRA_TAG) + "", Toast.LENGTH_LONG).show(); | ||
111 | - | 109 | + ((FragmentNFC)mSectionsPagerAdapter.getItem(mViewPager.getCurrentItem())).processNFC(); |
110 | + Toast.makeText(getBaseContext(),"NFC WORKING", Toast.LENGTH_LONG).show(); | ||
112 | } | 111 | } |
113 | 112 | ||
114 | @Override | 113 | @Override |