Commit 81cecf07 authored by Nastuzzi Samy's avatar Nastuzzi Samy
Browse files

Merge branch 'release/v0.11.0' into develop

parents 973fb138 14a64220
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fr.utc.simde.jessy"
android:versionCode="32"
android:versionName="0.10.2">
android:versionCode="33"
android:versionName="0.11.0">
<uses-permission android:name="android.permission.NFC" />
<uses-permission android:name="android.permission.INTERNET" />
......
......@@ -676,7 +676,19 @@ public abstract class BaseActivity extends InternetActivity {
}
}
})
.setNegativeButton(R.string.cancel, null);
.setNegativeButton(R.string.cancel, null)
.setNeutralButton(R.string.set_download, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int id) {
if (!haveStoragePermission()) {
updateDialog.stopLoading();
updateDialog.errorDialog(BaseActivity.this, getString(R.string.update), getString(R.string.need_storage_permission));
}
else if (!update(matcher.group(2), true)) {
updateDialog.stopLoading();
updateDialog.errorDialog(BaseActivity.this, getString(R.string.download), getString(R.string.can_not_download));
}
}
});
updateDialog.createDialog(alertDialogBuilder);
}
......@@ -704,7 +716,8 @@ public abstract class BaseActivity extends InternetActivity {
}.start();
}
protected boolean update(final String version) {
protected boolean update(final String version) { return update(version, false); }
protected boolean update(final String version, final boolean downloadOnly) {
final String destination = this.downloadLocation + getString(R.string.app_name) + " " + version + ".apk";
final String url = this.gitUrl + getString(R.string.app_name) + " " + version + ".apk";
final Uri uri = Uri.parse("file://" + destination);
......@@ -721,16 +734,28 @@ public abstract class BaseActivity extends InternetActivity {
final DownloadManager manager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
final long downloadId = manager.enqueue(request);
BroadcastReceiver onComplete = new BroadcastReceiver() {
public void onReceive(Context ctx, Intent intent) {
Intent install = new Intent(Intent.ACTION_VIEW);
install.setDataAndType(uri, "application/vnd.android.package-archive");
install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(install);
BroadcastReceiver onComplete;
if (downloadOnly) {
onComplete = new BroadcastReceiver() {
public void onReceive(Context ctx, Intent intent) {
new Dialog(BaseActivity.this).infoDialog(BaseActivity.this, getString(R.string.download), getString(R.string.download_successful));
unregisterReceiver(this);
}
};
unregisterReceiver(this);
}
};
}
else {
onComplete = new BroadcastReceiver() {
public void onReceive(Context ctx, Intent intent) {
Intent install = new Intent(Intent.ACTION_VIEW);
install.setDataAndType(uri, "application/vnd.android.package-archive");
install.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(install);
unregisterReceiver(this);
}
};
}
registerReceiver(onComplete, new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
......
......@@ -29,7 +29,7 @@ public abstract class NFCActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
NFCAdapter = NfcAdapter.getDefaultAdapter(getApplicationContext());
NFCAdapter = NfcAdapter.getDefaultAdapter(this);
NFCAlertDialog = new AlertDialog.Builder(this);
if (NFCAdapter == null) {
......@@ -65,6 +65,9 @@ public abstract class NFCActivity extends Activity {
if (!NFCAdapter.isEnabled())
enableNFCDialog();
IntentFilter filter = new IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED);
this.registerReceiver(NFCReceiver, filter);
}
}
......@@ -72,15 +75,17 @@ public abstract class NFCActivity extends Activity {
protected void onPause() {
super.onPause();
if (identifierIsAvailable())
NFCAdapter.disableForegroundDispatch(this);
NFCAdapter = NfcAdapter.getDefaultAdapter(this);
NFCAdapter.disableForegroundDispatch(this);
this.unregisterReceiver(NFCReceiver);
}
@Override
protected void onDestroy() {
super.onDestroy();
this.unregisterReceiver(NFCReceiver);
try { this.unregisterReceiver(NFCReceiver); } catch (Exception e) {}
}
protected abstract void onIdentification(final String badgeId);
......
......@@ -67,6 +67,7 @@
<string name="type">Type</string>
<string name="day_s_">jour(s)</string>
<string name="update">Mise à jour</string>
<string name="download">Téléchargement</string>
<string name="qrcode">QR Code</string>
<string name="credit">Crédits</string>
<string name="price">Prix</string>
......@@ -169,10 +170,13 @@
<string name="contribute_admin">Membre d\'honneur (0€)</string>
<string name="contribute_temp">Temporaire</string>
<string name="set_update">Mettre à jour</string>
<string name="set_download">Télécharger</string>
<string name="check_update">Recherche d\'une mise à jour</string>
<string name="available_update">Mise à jour disponible</string>
<string name="can_not_detect_update">Impossible de détecter si une mise à jour disponible</string>
<string name="can_not_update">Impossible de réaliser la mise à jour</string>
<string name="can_not_download">Impossible de télécharger la mise à jour</string>
<string name="download_successful">Téléchagement réussi</string>
<string name="no_update">Aucune mise à jour disponible</string>
<string name="actual_version">Version actuelle</string>
<string name="available_version">Version disponible</string>
......@@ -213,7 +217,6 @@
<string name="article_deleting">Suppression d\'un article</string>
<string name="article_delete_confirmation">Voulez-vous vraiment supprimer cet article:</string>
<string name="print_mode">Mode d\'affichage</string>
<string name="filters">Filtres d\'affichage</string>
<string name="print_cotisant">Afficher le filtre cotisant</string>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment