diff --git a/app/build.gradle b/app/build.gradle index c56980d..6991af9 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,29 +1,32 @@ apply plugin: 'com.android.application' android { compileSdkVersion 26 defaultConfig { applicationId "org.dslul.ticketreader" minSdkVersion 15 targetSdkVersion 26 - versionCode 2 - versionName "1.1" + versionCode 5 + versionName "1.4" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + vectorDrawables.useSupportLibrary = true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'com.android.support:appcompat-v7:26.1.0' implementation 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support:design:26.1.0' testImplementation 'junit:junit:4.12' androidTestImplementation 'com.android.support.test:runner:1.0.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1' + compile 'com.google.android.gms:play-services-ads:11.8.0' + compile 'com.android.support:cardview-v7:26.1.0' } diff --git a/app/release/app-release.apk b/app/release/app-release.apk index 9ec8757..4824b04 100644 Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ diff --git a/app/release/output.json b/app/release/output.json index 15e4575..bc7bb51 100644 --- a/app/release/output.json +++ b/app/release/output.json @@ -1 +1 @@ -[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":2},"path":"app-release.apk","properties":{"packageId":"org.dslul.ticketreader","split":"","minSdkVersion":"15"}}] \ No newline at end of file +[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":5},"path":"app-release.apk","properties":{"packageId":"org.dslul.ticketreader","split":"","minSdkVersion":"15"}}] \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7f0191a..54f14d3 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,26 +1,32 @@ - + + android:theme="@style/AppTheme.NoActionBar" + android:configChanges="orientation" + android:screenOrientation="portrait"> + - + \ No newline at end of file diff --git a/app/src/main/java/org/dslul/ticketreader/MainActivity.java b/app/src/main/java/org/dslul/ticketreader/MainActivity.java index 45d5b00..024579f 100644 --- a/app/src/main/java/org/dslul/ticketreader/MainActivity.java +++ b/app/src/main/java/org/dslul/ticketreader/MainActivity.java @@ -1,216 +1,304 @@ package org.dslul.ticketreader; import android.os.Bundle; +import android.os.CountDownTimer; import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.CardView; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; +import android.widget.ImageView; +import android.widget.RelativeLayout; +import android.widget.TableLayout; import android.widget.TextView; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; import java.util.concurrent.TimeUnit; import android.content.ClipboardManager; import android.content.ClipData; import android.content.Context; import android.nfc.NfcAdapter; import android.nfc.tech.NfcA; import android.widget.Toast; import android.content.Intent; import android.content.IntentFilter; import android.app.PendingIntent; import android.os.Handler; import android.os.Message; import android.app.AlertDialog; import android.content.DialogInterface; +import com.google.android.gms.ads.AdRequest; +import com.google.android.gms.ads.AdView; +import com.google.android.gms.ads.MobileAds; public class MainActivity extends AppCompatActivity { private NfcAdapter mNfcAdapter; private IntentFilter tech; private IntentFilter[] intentFiltersArray; private PendingIntent pendingIntent; private Intent intent; private AlertDialog alertDialog; + private Toast currentToast; + private String pages = "ERROR"; - private TextView dataout; + private AdView adview; + private ImageView imageNfc; + private CardView ticketCard; + private CardView statusCard; + private ImageView statusImg; + private TextView statoBiglietto; + private TextView infoLabel; + private TableLayout infoTable; + private TextView dataObliterazione; + private TextView corseRimanenti; + + private CountDownTimer timer; private static final int ACTION_NONE = 0; private static final int ACTION_READ = 1; private int scanAction; // list of NFC technologies detected: private final String[][] techListsArray = new String[][] { new String[] { //MifareUltralight.class.getName(), NfcA.class.getName() } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); + adview = (AdView) findViewById(R.id.adView); + imageNfc = (ImageView) findViewById(R.id.imagenfcView); + ticketCard = (CardView) findViewById(R.id.ticketCardView); + statusCard = (CardView) findViewById(R.id.statusCardView); + statusImg = (ImageView) findViewById(R.id.statusImg); + statoBiglietto = (TextView) findViewById(R.id.stato_biglietto); + infoLabel = (TextView) findViewById(R.id.infolabel); + infoTable = (TableLayout) findViewById(R.id.info_table); + dataObliterazione = (TextView) findViewById(R.id.data_obliterazione); + corseRimanenti = (TextView) findViewById(R.id.corse_rimaste); + + MobileAds.initialize(this, ""); + AdRequest adRequest = new AdRequest.Builder().build(); + adview.loadAd(adRequest); + mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null) { - // Stop here, we definitely need NFC Toast.makeText(this, "Questo dispositivo non supporta la tecnologia NFC.", Toast.LENGTH_LONG).show(); finish(); return; } if (!mNfcAdapter.isEnabled()) { - Toast.makeText(this, "NFC disabilitato. Attiva l'NFC e torna indietro.", Toast.LENGTH_LONG).show(); + Toast.makeText(this, "NFC disabilitato. Attiva l'NFC e premi il tasto indietro.", Toast.LENGTH_LONG).show(); startActivity(new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS)); } tech = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED); intentFiltersArray = new IntentFilter[] {tech}; intent = new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP); //FLAG_ACTIVITY_REORDER_TO_FRONT FLAG_RECEIVER_REPLACE_PENDING pendingIntent = PendingIntent.getActivity(this, 0, intent, 0); scanAction = ACTION_READ; - dataout = new TextView(this); + onNewIntent(getIntent()); + } @Override protected void onResume() { super.onResume(); mNfcAdapter.enableForegroundDispatch(this, pendingIntent, intentFiltersArray, this.techListsArray); } @Override protected void onPause() { // disabling foreground dispatch: //NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(this); mNfcAdapter.disableForegroundDispatch(this); super.onPause(); } @Override protected void onNewIntent(Intent intent) { - if (intent.getAction().equals(NfcAdapter.ACTION_TECH_DISCOVERED)) { + if (intent.getAction().equals(NfcAdapter.ACTION_TECH_DISCOVERED)) { - String mTextBufferText = "aa"; + String mTextBufferText = "aa"; - NfcThread nfcThread = new NfcThread(intent, scanAction, mTextBufferText, mTextBufferHandler, mToastShortHandler, mToastLongHandler, mShowInfoDialogHandler); - nfcThread.start(); + NfcThread nfcThread = new NfcThread(intent, scanAction, mTextBufferText, mTextBufferHandler, mToastShortHandler, mToastLongHandler, mShowInfoDialogHandler); + nfcThread.start(); - scanAction = ACTION_READ; - } + scanAction = ACTION_READ; + } } private Handler mTextBufferHandler = new Handler() { public void handleMessage(Message msg) { pages = (String)msg.obj; + if(timer != null) + timer.cancel(); if(pages != "ERROR") { - dataout = (TextView) findViewById(R.id.outdata); Parser parser = new Parser(pages); - dataout.setText("Data obliterazione: " + parser.getDate() - + System.getProperty("line.separator") - + "Minuti rimanenti: " + parser.getRemainingMinutes() - + System.getProperty("line.separator") - + "Corse residue: " + parser.getRemainingRides()); - } + dataObliterazione.setText(parser.getDate()); + corseRimanenti.setText(Integer.toString(parser.getRemainingRides())); + + if(parser.getRemainingMinutes() != 0) { + statoBiglietto.setText(R.string.in_corso); + statusImg.setImageResource(R.drawable.ic_restore_grey_800_36dp); + statusCard.setCardBackgroundColor(0xFF90CAF9); + Calendar calendar = Calendar.getInstance(); + int sec = calendar.get(Calendar.SECOND); + timer = new CountDownTimer((parser.getRemainingMinutes()*60 - sec)*1000, 1000) { + + public void onTick(long millis) { + statoBiglietto.setText(String.format(getResources().getString(R.string.in_corso), + TimeUnit.MILLISECONDS.toMinutes(millis), + TimeUnit.MILLISECONDS.toSeconds(millis) - + TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(millis)))); + } + + public void onFinish() { + statoBiglietto.setText(R.string.corse_esaurite); + statusImg.setImageResource(R.drawable.ic_error_grey_800_36dp); + statusCard.setCardBackgroundColor(0xFFEF9A9A); + timer.cancel(); + } + + }.start(); + } else if(parser.getRemainingRides() == 0 && parser.getRemainingMinutes() == 0) { + statoBiglietto.setText(R.string.corse_esaurite); + statusImg.setImageResource(R.drawable.ic_error_grey_800_36dp); + statusCard.setCardBackgroundColor(0xFFEF9A9A); + } else if(parser.getRemainingRides() != 0 && parser.getRemainingMinutes() == 0) { + statoBiglietto.setText(String.format(getResources().getString(R.string.corse_disponibili), parser.getRemainingRides())); + statusImg.setImageResource(R.drawable.ic_check_circle_grey_800_36dp); + statusCard.setCardBackgroundColor(0xFFA5D6A7); + } + + statusCard.setVisibility(View.VISIBLE); + ticketCard.setVisibility(View.VISIBLE); + infoLabel.setText(R.string.read_another_ticket); + imageNfc.setVisibility(View.GONE); + + + } else { + statusCard.setVisibility(View.GONE); + ticketCard.setVisibility(View.GONE); + infoLabel.setText(R.string.info_instructions); + imageNfc.setVisibility(View.VISIBLE); + } } }; private Handler mToastShortHandler = new Handler() { public void handleMessage(Message msg) { String text = (String)msg.obj; - Toast.makeText(MainActivity.this, text, Toast.LENGTH_SHORT).show(); + if(currentToast != null) + currentToast.cancel(); + currentToast = Toast.makeText(MainActivity.this, text, Toast.LENGTH_SHORT); + currentToast.show(); } }; private Handler mToastLongHandler = new Handler() { public void handleMessage(Message msg) { String text = (String)msg.obj; - Toast.makeText(MainActivity.this, text, Toast.LENGTH_LONG).show(); + if(currentToast != null) + currentToast.cancel(); + currentToast = Toast.makeText(MainActivity.this, text, Toast.LENGTH_LONG); + currentToast.show(); } }; private Handler mShowInfoDialogHandler = new Handler() { public void handleMessage(Message msg) { String text = (String)msg.obj; //infoDialog = showInfoDialog(text); //infoDialog.show(); } }; @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_info) { alertDialog = showAlertDialog("Semplice applicazione opensource per visualizzare le " + - "corse rimanenti nei biglietti GTT. \nhttps://github.com/dslul/ticketreader"); + "corse rimanenti nei biglietti GTT. \n\nhttps://github.com/dslul/ticketreader\n\n" + + "Icone: Card Paypass by Viktor Vorobyev from the Noun Project;\n" + + "samsung galaxy by Setyo Ari Wibowo from the Noun Project"); alertDialog.show(); return true; } return super.onOptionsItemSelected(item); } private AlertDialog showAlertDialog(String message) { DialogInterface.OnClickListener dialogInterfaceListener = new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { alertDialog.cancel(); scanAction = ACTION_READ; } }; alertDialog = new AlertDialog.Builder(this) .setTitle("Informazioni") .setIcon(android.R.drawable.ic_dialog_info) .setMessage(message) .setPositiveButton("Chiudi", null) .create(); alertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() { public void onCancel(DialogInterface dialog) { scanAction = ACTION_READ; } }); return alertDialog; } } diff --git a/app/src/main/java/org/dslul/ticketreader/Parser.java b/app/src/main/java/org/dslul/ticketreader/Parser.java index dfeb2e7..9ea323e 100644 --- a/app/src/main/java/org/dslul/ticketreader/Parser.java +++ b/app/src/main/java/org/dslul/ticketreader/Parser.java @@ -1,99 +1,99 @@ package org.dslul.ticketreader; import android.util.Log; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.concurrent.TimeUnit; public class Parser { private String pages; private String date; private int remainingMins; public Parser(String data) { //if(data == null) this.pages = data; this.date = this.pages.substring(90, 96); } public String getDate() { String startingDate = "05/01/01 00:00:00"; SimpleDateFormat format = new SimpleDateFormat("yy/MM/dd HH:mm:ss"); Date date = null; try { date = format.parse(startingDate); } catch (ParseException e) { e.printStackTrace(); } Date finalDate = addMinutesToDate(Long.parseLong(this.date, 16), date); //calcola minuti rimanenti Calendar c = Calendar.getInstance(); long diff = (c.getTime().getTime() - finalDate.getTime()) / 60000; if(diff >= 90) { remainingMins = 0; } else { remainingMins = (int)(90 - diff); } - return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT) + return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.SHORT) .format(finalDate); } //TODO: corse in metropolitana (forse bit piĆ¹ significativo pag. 3) public int getRemainingRides() { int tickettype = (int)getBytesFromPage(5, 0, 1); int tickets; if(tickettype == 3) { //extraurbano tickets = (int) (~getBytesFromPage(3, 0, 4)); } else { tickets = (int)(~getBytesFromPage(3, 2, 2)) & 0xFFFF; } return Integer.bitCount(tickets); } public int getRemainingMinutes() { return remainingMins; } private long getBytesFromPage(int page, int offset, int bytesnum) { return Long.parseLong( pages.substring(9 * page + offset * 2, 9 * page + offset * 2 + bytesnum * 2), 16); } private static Date addMinutesToDate(long minutes, Date beforeTime){ final long ONE_MINUTE_IN_MILLIS = 60000; long curTimeInMs = beforeTime.getTime(); Date afterAddingMins = new Date(curTimeInMs + (minutes * ONE_MINUTE_IN_MILLIS)); return afterAddingMins; } private static byte[] hexStringToByteArray(String s) { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i+1), 16)); } return data; } } diff --git a/app/src/main/res/drawable-hdpi/ic_check_circle_grey_800_24dp.png b/app/src/main/res/drawable-hdpi/ic_check_circle_grey_800_24dp.png new file mode 100644 index 0000000..b74b8b5 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_check_circle_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_check_circle_grey_800_36dp.png b/app/src/main/res/drawable-hdpi/ic_check_circle_grey_800_36dp.png new file mode 100644 index 0000000..dfb91aa Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_check_circle_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_error_grey_800_24dp.png b/app/src/main/res/drawable-hdpi/ic_error_grey_800_24dp.png new file mode 100644 index 0000000..b68ba22 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_error_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_error_grey_800_36dp.png b/app/src/main/res/drawable-hdpi/ic_error_grey_800_36dp.png new file mode 100644 index 0000000..38b0b53 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_error_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_restore_grey_800_24dp.png b/app/src/main/res/drawable-hdpi/ic_restore_grey_800_24dp.png new file mode 100644 index 0000000..060e695 Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_restore_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-hdpi/ic_restore_grey_800_36dp.png b/app/src/main/res/drawable-hdpi/ic_restore_grey_800_36dp.png new file mode 100644 index 0000000..d1edc2b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/ic_restore_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_check_circle_grey_800_24dp.png b/app/src/main/res/drawable-mdpi/ic_check_circle_grey_800_24dp.png new file mode 100644 index 0000000..6354661 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_check_circle_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_check_circle_grey_800_36dp.png b/app/src/main/res/drawable-mdpi/ic_check_circle_grey_800_36dp.png new file mode 100644 index 0000000..b74b8b5 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_check_circle_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_error_grey_800_24dp.png b/app/src/main/res/drawable-mdpi/ic_error_grey_800_24dp.png new file mode 100644 index 0000000..0f54c3c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_error_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_error_grey_800_36dp.png b/app/src/main/res/drawable-mdpi/ic_error_grey_800_36dp.png new file mode 100644 index 0000000..b68ba22 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_error_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_restore_grey_800_24dp.png b/app/src/main/res/drawable-mdpi/ic_restore_grey_800_24dp.png new file mode 100644 index 0000000..c84f83c Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_restore_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-mdpi/ic_restore_grey_800_36dp.png b/app/src/main/res/drawable-mdpi/ic_restore_grey_800_36dp.png new file mode 100644 index 0000000..060e695 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/ic_restore_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_check_circle_grey_800_24dp.png b/app/src/main/res/drawable-xhdpi/ic_check_circle_grey_800_24dp.png new file mode 100644 index 0000000..ad79ec3 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_check_circle_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_check_circle_grey_800_36dp.png b/app/src/main/res/drawable-xhdpi/ic_check_circle_grey_800_36dp.png new file mode 100644 index 0000000..33e3b93 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_check_circle_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_error_grey_800_24dp.png b/app/src/main/res/drawable-xhdpi/ic_error_grey_800_24dp.png new file mode 100644 index 0000000..a16a35c Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_error_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_error_grey_800_36dp.png b/app/src/main/res/drawable-xhdpi/ic_error_grey_800_36dp.png new file mode 100644 index 0000000..22f995d Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_error_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_restore_grey_800_24dp.png b/app/src/main/res/drawable-xhdpi/ic_restore_grey_800_24dp.png new file mode 100644 index 0000000..0d84d6b Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_restore_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xhdpi/ic_restore_grey_800_36dp.png b/app/src/main/res/drawable-xhdpi/ic_restore_grey_800_36dp.png new file mode 100644 index 0000000..b4cd6a3 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/ic_restore_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_check_circle_grey_800_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_check_circle_grey_800_24dp.png new file mode 100644 index 0000000..33e3b93 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_check_circle_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_check_circle_grey_800_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_check_circle_grey_800_36dp.png new file mode 100644 index 0000000..177d687 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_check_circle_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_error_grey_800_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_error_grey_800_24dp.png new file mode 100644 index 0000000..22f995d Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_error_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_error_grey_800_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_error_grey_800_36dp.png new file mode 100644 index 0000000..efd3ee2 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_error_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_restore_grey_800_24dp.png b/app/src/main/res/drawable-xxhdpi/ic_restore_grey_800_24dp.png new file mode 100644 index 0000000..b4cd6a3 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_restore_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xxhdpi/ic_restore_grey_800_36dp.png b/app/src/main/res/drawable-xxhdpi/ic_restore_grey_800_36dp.png new file mode 100644 index 0000000..9f61f35 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ic_restore_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_check_circle_grey_800_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_check_circle_grey_800_24dp.png new file mode 100644 index 0000000..b020c75 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_check_circle_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_check_circle_grey_800_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_check_circle_grey_800_36dp.png new file mode 100644 index 0000000..bbcbd8f Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_check_circle_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_error_grey_800_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_error_grey_800_24dp.png new file mode 100644 index 0000000..9cf0ba0 Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_error_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_error_grey_800_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_error_grey_800_36dp.png new file mode 100644 index 0000000..5d913eb Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_error_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_restore_grey_800_24dp.png b/app/src/main/res/drawable-xxxhdpi/ic_restore_grey_800_24dp.png new file mode 100644 index 0000000..5b2707f Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_restore_grey_800_24dp.png differ diff --git a/app/src/main/res/drawable-xxxhdpi/ic_restore_grey_800_36dp.png b/app/src/main/res/drawable-xxxhdpi/ic_restore_grey_800_36dp.png new file mode 100644 index 0000000..0bf95aa Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/ic_restore_grey_800_36dp.png differ diff --git a/app/src/main/res/drawable/ic_nfc.xml b/app/src/main/res/drawable/ic_nfc.xml new file mode 100644 index 0000000..1db1c22 --- /dev/null +++ b/app/src/main/res/drawable/ic_nfc.xml @@ -0,0 +1,5 @@ + + + + diff --git a/app/src/main/res/layout/content_main.xml b/app/src/main/res/layout/content_main.xml index 15e0c26..9952cda 100644 --- a/app/src/main/res/layout/content_main.xml +++ b/app/src/main/res/layout/content_main.xml @@ -1,33 +1,200 @@ - + tools:showIn="@layout/activity_main" + android:orientation="vertical"> - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + card_view:cardCornerRadius="3dp" + android:visibility="gone" + android:layout_above="@id/adView" + card_view:cardElevation="4dp" + card_view:cardBackgroundColor="@android:color/white" + card_view:cardUseCompatPadding="true"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png index 5d1d91d..f069077 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png index a828c1e..0c3990c 100644 Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-hdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png index ba08dcb..d71091e 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png index baa3201..8cc45cd 100644 Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-mdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 0896c5f..cc6ad8a 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png index fbf04c7..1f3f0fa 100644 Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index 499676e..011cfa3 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png index b9369c5..b885843 100644 Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index dd0a681..f406d8b 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png index 419ce9c..29de391 100644 Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and b/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 3ab3e9c..9fd135c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,6 +1,6 @@ - #3F51B5 - #303F9F + #00529f + #00529f #FF4081 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 1dd513b..39f8a3f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,14 @@ GTT Ticket Reader Info + Data obliterazione: + Minuti rimanenti: + Corse rimaste: + Avvicina un biglietto alla parte posteriore del dispositivo per effettuare la scansione + Immagine biglietto nfc + Per leggere un altro biglietto, avvicinalo nuovamente al sensore NFC + %d corse disponibili + In corso %d:%d + Corse esaurite + Dettagli biglietto diff --git a/app/src/main/res/xml/filter_nfc.xml b/app/src/main/res/xml/filter_nfc.xml new file mode 100644 index 0000000..d3260d6 --- /dev/null +++ b/app/src/main/res/xml/filter_nfc.xml @@ -0,0 +1,6 @@ + + + android.nfc.tech.NfcA + + + diff --git a/banner.xcf b/banner.xcf new file mode 100644 index 0000000..158cd5a Binary files /dev/null and b/banner.xcf differ diff --git a/build.gradle b/build.gradle index e6b32bc..dc11641 100644 --- a/build.gradle +++ b/build.gradle @@ -1,27 +1,30 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.1' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { google() jcenter() + maven { + url "https://maven.google.com" + } } } task clean(type: Delete) { delete rootProject.buildDir } diff --git a/nfc.svg b/nfc.svg new file mode 100644 index 0000000..6956474 --- /dev/null +++ b/nfc.svg @@ -0,0 +1,60 @@ + +image/svg+xml \ No newline at end of file diff --git a/web_hi_res_512.png b/web_hi_res_512.png index d402c33..fbf7dc7 100644 Binary files a/web_hi_res_512.png and b/web_hi_res_512.png differ