Skip to content

Commit

Permalink
- Version changed 1.01 -> 2.00
Browse files Browse the repository at this point in the history
- README updated
- Build configuration changed.
  It allow to make 3 version of android package (release, betta and alfa) with differnt package name from one source tree
- Low level calls to NFC changed from MifareUltralight to NfcA. It allow to read JSC Micron made tickets.
  • Loading branch information
Mikhail Basov (aka mvb) committed Nov 24, 2015
1 parent 2e121ce commit 6e57140
Show file tree
Hide file tree
Showing 18 changed files with 109 additions and 40 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ gradlew.bat
# built application files
*.apk
*.ap_
!app/Ticket-Info.*b.apk
!app/old_versions/Ticket-Info.*b.apk

# files for the dex VM
*.dex
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Date: Tue Nov 24 19:28:57 2015 +0300, commit 2e121ceec8cd278ec4497b920971678bada56378

- Project converted to modern Android Studio (v1.5)

15 changes: 0 additions & 15 deletions README

This file was deleted.

38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
This is Android application to see what inside Moscow trasportation system tickets.

Tis project is update to actual state of another [old project](https://github.com/ValleZ/Ticket-Info.git)

This project has no value as Android application because several projects with better functionality exist in Android Market now.
This project interesting as open source example of working with NFC and for understanding "How things made" (about Moscow transportation system tickets)

source files encoding is utf-8

Author of original project said:
> I live in california now, so I can not update the app.
I doing my best to make this project actual.

Some restrictions exist:

* Work only with "paper" tickets (Mifare Ultralight and modern Micron JSC). It because new android phones use NFC chip with reduced functionality. Modern Broadcom NFC chip can't read Mifare Classic 1K (Troika ticket based on it)
* All information for this project gathered by reverce engeneering and information may be not correct. I don't know official source of information about tickets format and used chips.

### Version numbering:

* 2.00 - alfa version, very unstable, experimental
* 2.00b - betta version, based on alfa version with the same number, more stable
* 2.00r - stable release

I will never create release version for this application. This projech has no value as application (see below)

### Last changes:

- Version changed 1.01 -> 2.00
- README updated
- Build configuration changed.
It allow to make 3 version of android package (release, betta and alfa) with differnt package name from one source tree
- Low level calls to NFC changed from MifareUltralight to NfcA. It allow to read JSC Micron made tickets.

You can see [full change log](CHANHELOG.md)


Binary file added app/Ticket-Info.2.00b.apk
Binary file not shown.
44 changes: 41 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,57 @@
apply plugin: 'com.android.application'

android {
applicationVariants.all { variant ->
variant.outputs.each { output ->
def outputFile = output.outputFile
if (outputFile != null && outputFile.name.endsWith('.apk')) {
def fileName = "Ticket-Info." + versionName + ".apk"
output.outputFile = new File(outputFile.parent, fileName)
}
}
}
signingConfigs {
release {
keyAlias 'mvb_key'
storeFile file('../../.keys/mvb-release.keystore')
}
debug {
storeFile file('../../.keys/mvb-debug.keystore')
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
}
compileSdkVersion 15
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "ru.valle.tickets"
minSdkVersion 10
targetSdkVersion 10
versionCode 200
versionName '2.00'
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
zipAlignEnabled true
applicationIdSuffix '.r'
versionNameSuffix 'r'
signingConfig signingConfigs.release
}
betta {
applicationIdSuffix '.b'
versionNameSuffix 'b'
debuggable true
signingConfig signingConfigs.debug
}
debug {
signingConfig signingConfigs.debug
}
}
productFlavors {
}
}

dependencies {
}
Binary file added app/old_versions/Ticket-Info.2.00b.apk
Binary file not shown.
15 changes: 9 additions & 6 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="101"
android:versionName="1.01" package="ru.valle.tickets">
<supports-screens
android:versionCode="200"
android:versionName="2.00"
package="ru.valle.tickets">

<supports-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true" />

<application android:label="@string/app_name"
android:debuggable="false" android:icon="@drawable/app_icon">
android:icon="@drawable/app_icon">

<activity android:name=".ui.MainActivity"
android:label="@string/app_name"
android:configChanges="orientation|keyboard|keyboardHidden"
android:launchMode="singleTop"
>
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
Expand Down
28 changes: 12 additions & 16 deletions app/src/main/java/ru/valle/tickets/ui/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ of this software and associated documentation files (the "Software"), to deal
import android.content.IntentFilter.MalformedMimeTypeException;
import android.nfc.NfcAdapter;
import android.nfc.Tag;
import android.nfc.tech.MifareUltralight;
import android.nfc.tech.NfcA;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.widget.TextView;
import java.text.DateFormat;
Expand Down Expand Up @@ -70,12 +69,7 @@ public void onCreate(Bundle savedInstanceState) {
Log.e(TAG, "fail", e);
}
filters = new IntentFilter[]{filter};
techLists = new String[][]{new String[]{MifareUltralight.class.getName()}};





techLists = new String[][]{new String[]{NfcA.class.getName()}};
}

@Override
Expand All @@ -97,17 +91,19 @@ public void onNewIntent(Intent intent) {
try {
Bundle extras = intent.getExtras();
Tag tag = (Tag) extras.get(NfcAdapter.EXTRA_TAG);
final MifareUltralight ultralight = MifareUltralight.get(tag);
final NfcA nfca = NfcA.get(tag);
text.setText(getString(R.string.ticket_is_reading));
new AsyncTask<MifareUltralight, Void, String>() {
new AsyncTask<NfcA, Void, String>() {

@Override
protected String doInBackground(MifareUltralight... paramss) {
protected String doInBackground(NfcA... paramss) {
try {
ultralight.connect();
byte[] pages3bytes = ultralight.readPages(3);
byte[] pages8bytes = ultralight.readPages(8);
ultralight.close();
nfca.connect();
byte[] cmd3 = { 0x30, (byte) 3};
byte[] pages3bytes = nfca.transceive(cmd3);
byte[] cmd8 = { 0x30, (byte) 8};
byte[] pages8bytes = nfca.transceive(cmd8);
nfca.close();
return decodeUltralight(toIntPages(pages3bytes), toIntPages(pages8bytes));
} catch (Throwable th) {
return getString(R.string.ticket_read_error);
Expand All @@ -118,7 +114,7 @@ protected String doInBackground(MifareUltralight... paramss) {
protected void onPostExecute(String result) {
text.setText(result);
}
}.execute(ultralight);
}.execute(nfca);

} catch (Throwable th) {
text.setText(getString(R.string.ticket_read_error));
Expand Down
Binary file added app/src/main/res/drawable-hdpi/app_icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/app_icon_a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable-hdpi/app_icon_b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/app_icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/app_icon_a.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/app_icon_b.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
3 changes: 3 additions & 0 deletions app/src/main/res/xml/nfc_tech_filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
<tech-list>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
</tech-list>
</resources>

0 comments on commit 6e57140

Please sign in to comment.