This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static final String TAG = "NFC"; | |
private NfcAdapter nfcAdapter; | |
private PendingIntent nfcPendingIntent; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
// initialize NFC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onResume() { | |
super.onResume(); | |
Log.d(TAG, "enableForegroundMode"); | |
// foreground mode gives the current active application priority for reading scanned tags | |
IntentFilter tagDetected = new IntentFilter(NfcAdapter.ACTION_TAG_DISCOVERED); // filter for tags | |
IntentFilter[] writeTagFilters = new IntentFilter[] {tagDetected}; | |
nfcAdapter.enableForegroundDispatch(this, nfcPendingIntent, writeTagFilters, null); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onNewIntent(Intent intent) { | |
super.onNewIntent(intent); | |
Log.d(TAG, "onNewIntent"); | |
// check for NFC related actions | |
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) { | |
ImageView lata = (ImageView) findViewById(R.id.lata); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BillFilter { | |
private BillDao dao; | |
@Inject | |
public BillFilter(BillDao dao) { | |
this.dao = dao; | |
} | |
public List<Bill> filter() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Module | |
public class BillModule | |
{ | |
@Provides | |
public BillDao provideBillDao() { | |
return new BillDao(); | |
} | |
} | |
@Component(modules = BillModule.class) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends ActionBarActivity { | |
private List<Bill> filteredBills; | |
private TextView text; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
compile 'com.android.support:appcompat-v7:22.2.0' | |
compile 'com.android.support:design:22.2.0' | |
compile 'com.jakewharton:butterknife:7.0.1' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".MainActivity"> | |
<android.support.design.widget.CoordinatorLayout | |
android:id="@+id/root" | |
android:layout_width="match_parent" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends ActionBarActivity { | |
@Bind(R.id.root) CoordinatorLayout layoutRoot; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
ButterKnife.bind(this); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<set | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:interpolator="@android:anim/linear_interpolator" | |
android:fillAfter="true"> | |
<translate | |
android:fromYDelta="0%p" | |
android:toYDelta="50%p" | |
android:duration="4000" /> |