diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml
index e600d133..679f4190 100644
--- a/android/src/main/AndroidManifest.xml
+++ b/android/src/main/AndroidManifest.xml
@@ -1804,6 +1804,7 @@
+
diff --git a/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.kt b/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.kt
index aba8a55b..ec84c30f 100644
--- a/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.kt
+++ b/android/src/main/java/org/ligi/passandroid/ui/PassListActivity.kt
@@ -3,9 +3,7 @@ package org.ligi.passandroid.ui
import android.Manifest
import android.annotation.TargetApi
import android.app.Activity
-import android.app.ProgressDialog
import android.content.ActivityNotFoundException
-import android.content.DialogInterface
import android.content.Intent
import android.content.res.Configuration
import android.os.Build
@@ -22,13 +20,10 @@ import com.google.android.material.snackbar.Snackbar
import kotlinx.android.synthetic.main.pass_list.*
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
-import org.ligi.kaxt.setButton
import org.ligi.kaxt.startActivityFromClass
import org.ligi.kaxt.startActivityFromURL
import org.ligi.passandroid.R
import org.ligi.passandroid.events.PassStoreChangeEvent
-import org.ligi.passandroid.events.ScanFinishedEvent
-import org.ligi.passandroid.events.ScanProgressEvent
import org.ligi.passandroid.functions.createAndAddEmptyPass
import org.ligi.passandroid.model.PassStoreProjection
import org.ligi.passandroid.model.State
@@ -51,25 +46,7 @@ class PassListActivity : PassAndroidActivity() {
private val drawerToggle by lazy { ActionBarDrawerToggle(this, drawer_layout, R.string.drawer_open, R.string.drawer_close) }
private val adapter by lazy { PassTopicFragmentPagerAdapter(passStore.classifier, supportFragmentManager) }
- private val pd by lazy { ProgressDialog(this) }
- @Subscribe(threadMode = ThreadMode.MAIN)
- fun onScanProgress(event: ScanProgressEvent) {
- if (pd.isShowing) {
- pd.setMessage(event.message)
- }
- }
-
- @Subscribe(threadMode = ThreadMode.MAIN)
- fun onScanFinished(event: ScanFinishedEvent) {
-
- if (pd.isShowing) {
- val message = getString(R.string.scan_finished_dialog_text, event.foundPasses.size)
- pd.dismiss()
- AlertDialog.Builder(this@PassListActivity).setTitle(R.string.scan_finished_dialog_title).setMessage(message).setPositiveButton(android.R.string.ok, null).show()
- }
-
- }
@TargetApi(16)
@OnPermissionDenied(Manifest.permission.READ_EXTERNAL_STORAGE)
@@ -80,22 +57,7 @@ class PassListActivity : PassAndroidActivity() {
@TargetApi(16)
@NeedsPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
- fun scan() {
- val intent = Intent(this, SearchPassesIntentService::class.java)
- startService(intent)
-
- pd.setTitle(R.string.scan_progressdialog_title)
- pd.setMessage(getString(R.string.scan_progressdialog_message))
- pd.setCancelable(false)
- pd.isIndeterminate = true
- pd.setButton(DialogInterface.BUTTON_NEUTRAL, R.string.scan_dialog_send_background_button) {
- this@PassListActivity.finish()
- }
- pd.setButton(DialogInterface.BUTTON_POSITIVE, android.R.string.cancel) {
- stopService(intent)
- }
- pd.show()
- }
+ fun scan() = startActivity(Intent(this, PassScanActivity::class.java))
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array, grantResults: IntArray) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
@@ -227,7 +189,7 @@ class PassListActivity : PassAndroidActivity() {
for (pass in passStoreProjection.passList) {
passStore.deletePassWithId(pass.id)
}
- }.setNegativeButton(android.R.string.cancel, null).show()
+ }.setNegativeButton(android.R.string.cancel, null).show()
true
}
else -> drawerToggle.onOptionsItemSelected(item) || super.onOptionsItemSelected(item)
diff --git a/android/src/main/java/org/ligi/passandroid/ui/PassScanActivity.kt b/android/src/main/java/org/ligi/passandroid/ui/PassScanActivity.kt
new file mode 100644
index 00000000..61a42ea8
--- /dev/null
+++ b/android/src/main/java/org/ligi/passandroid/ui/PassScanActivity.kt
@@ -0,0 +1,67 @@
+package org.ligi.passandroid.ui
+
+import android.app.AlertDialog
+import android.content.Intent
+import android.os.Bundle
+import android.view.MenuItem
+import android.view.View.GONE
+import kotlinx.android.synthetic.main.activity_scan.*
+import org.greenrobot.eventbus.Subscribe
+import org.greenrobot.eventbus.ThreadMode
+import org.ligi.passandroid.R
+import org.ligi.passandroid.events.ScanFinishedEvent
+import org.ligi.passandroid.events.ScanProgressEvent
+
+class PassScanActivity : PassAndroidActivity() {
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ fun onScanProgress(event: ScanProgressEvent) {
+ progress_text.text = event.message
+ }
+
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ fun onScanFinished(event: ScanFinishedEvent) {
+ progress_container.visibility = GONE
+ val message = getString(R.string.scan_finished_dialog_text, event.foundPasses.size)
+ AlertDialog.Builder(this)
+ .setTitle(R.string.scan_finished_dialog_title)
+ .setMessage(message)
+ .setPositiveButton(android.R.string.ok) { _, _ ->
+ finish()
+ }
+ .show()
+ }
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ setContentView(R.layout.activity_scan)
+
+ supportActionBar?.setDisplayHomeAsUpEnabled(true)
+
+
+ val intent = Intent(this, SearchPassesIntentService::class.java)
+ startService(intent)
+ }
+
+ override fun onResume() {
+ super.onResume()
+
+ bus.register(this)
+
+ }
+
+ override fun onPause() {
+ bus.unregister(this)
+ super.onPause()
+ }
+
+ override fun onOptionsItemSelected(item: MenuItem) = when (item.itemId) {
+ android.R.id.home -> {
+ finish()
+ true
+ }
+
+ else -> super.onOptionsItemSelected(item)
+ }
+}
\ No newline at end of file
diff --git a/android/src/main/java/org/ligi/passandroid/ui/SearchPassesIntentService.kt b/android/src/main/java/org/ligi/passandroid/ui/SearchPassesIntentService.kt
index 71d6ec3f..cca8eae2 100644
--- a/android/src/main/java/org/ligi/passandroid/ui/SearchPassesIntentService.kt
+++ b/android/src/main/java/org/ligi/passandroid/ui/SearchPassesIntentService.kt
@@ -103,7 +103,6 @@ class SearchPassesIntentService : IntentService("SearchPassesIntentService") {
* recursive voyage starting at path to find files named .pkpass
*/
private fun searchIn(path: File, recursive: Boolean) {
-
if (System.currentTimeMillis() - lastProgressUpdate > 1000) {
lastProgressUpdate = System.currentTimeMillis()
val msg = path.toString()
diff --git a/android/src/main/res/layout/activity_scan.xml b/android/src/main/res/layout/activity_scan.xml
new file mode 100644
index 00000000..52c0a372
--- /dev/null
+++ b/android/src/main/res/layout/activity_scan.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/src/main/res/values-de/strings.xml b/android/src/main/res/values-de/strings.xml
index eedc7759..afc25235 100644
--- a/android/src/main/res/values-de/strings.xml
+++ b/android/src/main/res/values-de/strings.xml
@@ -119,9 +119,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
Und %d mehr
Suche abgeschlossen
%d Pässe gefunden
- Suche…
- Bitte warten
- Hintergrund
Leere Papierkorb
Alternative Nachricht
Zufällig
diff --git a/android/src/main/res/values-es/strings.xml b/android/src/main/res/values-es/strings.xml
index 6500afa5..124c9d8c 100644
--- a/android/src/main/res/values-es/strings.xml
+++ b/android/src/main/res/values-es/strings.xml
@@ -114,9 +114,6 @@ ESTE SOFTWARE SE OFRECE \"TAL CUAL\" Y CUALQUIER GARANTÍA EXPRESA O IMPLÍCITA,
Y %d más
Búsqueda terminada
encontrados %d Passbooks
- Buscando…
- Por favor, espere
- fondo
Vaciar papelera
mensaje alternativo
aleatorio
diff --git a/android/src/main/res/values-eu/strings.xml b/android/src/main/res/values-eu/strings.xml
index 5146e1bc..659d971f 100644
--- a/android/src/main/res/values-eu/strings.xml
+++ b/android/src/main/res/values-eu/strings.xml
@@ -65,9 +65,6 @@
Eta %d gehiago
Eskaneatzen amaitu da.
%d pase aurkitu dira
- Bilatzen…
- Mesedez itxaron.
- atzealdea
hustu zakarrontzia
Mezu alternatiboa
ausazkoa
diff --git a/android/src/main/res/values-fr/strings.xml b/android/src/main/res/values-fr/strings.xml
index 0864b51c..707cab0f 100644
--- a/android/src/main/res/values-fr/strings.xml
+++ b/android/src/main/res/values-fr/strings.xml
@@ -112,9 +112,6 @@ THIS SOFTWARE IS PROVIDED \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLU
Et %d plus
Recherche terminée
%d passes trouvés
- Recherche…
- Veuillez patienter.
- arrière-plan
corbeille vide
message alternatif
aléatoire
diff --git a/android/src/main/res/values-gl/strings.xml b/android/src/main/res/values-gl/strings.xml
index 80cab786..2e36ce46 100644
--- a/android/src/main/res/values-gl/strings.xml
+++ b/android/src/main/res/values-gl/strings.xml
@@ -117,9 +117,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
e %d máis
Busca finalizada.
atopou %d passes
- Buscando…
- Por favor agarde.
- fondo
lixo baldeiro
Mensaxe alternativa
ao chou
diff --git a/android/src/main/res/values-it/strings.xml b/android/src/main/res/values-it/strings.xml
index f106e5a2..be349ba8 100644
--- a/android/src/main/res/values-it/strings.xml
+++ b/android/src/main/res/values-it/strings.xml
@@ -107,9 +107,6 @@ IL SOFTWARE VIENE FORNITO \"COSÌ COM\'È\", SENZA GARANZIE, ESPRESSE O IMPLICIT
E altri %d
Scansione finita.
trovato %d Pass
- Sto cercando…
- Aspetta.
- background
svuota cestino
Messaggio alternativo
casuale
diff --git a/android/src/main/res/values-ja/strings.xml b/android/src/main/res/values-ja/strings.xml
index 50c2b48e..4080a84a 100644
--- a/android/src/main/res/values-ja/strings.xml
+++ b/android/src/main/res/values-ja/strings.xml
@@ -122,9 +122,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
および %d 以上
スキャンが終了しました。
%d チケットが見つかりました
- 検索中…
- しばらくお待ちください。
- バックグラウンド
ゴミ箱を空にする
代りのメッセージ
ランダム
diff --git a/android/src/main/res/values-nl/strings.xml b/android/src/main/res/values-nl/strings.xml
index b4bd36ca..506246c1 100644
--- a/android/src/main/res/values-nl/strings.xml
+++ b/android/src/main/res/values-nl/strings.xml
@@ -128,9 +128,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
En %d meer
Zoekactie afgewerkt.
%d passen gevonden
- Zoeken…
- Even geduld.
- achtergrond
Prullenbak leegmaken
alternatieve boodschap
willekeurig
diff --git a/android/src/main/res/values-ru/strings.xml b/android/src/main/res/values-ru/strings.xml
index f17ee61c..a6ae981b 100644
--- a/android/src/main/res/values-ru/strings.xml
+++ b/android/src/main/res/values-ru/strings.xml
@@ -110,9 +110,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
Еще %d
Поиск завершен.
найдено %d карточек
- Поиск…
- Пожалуйста подождите.
- в фоне
очистить корзину
альтернативное Сообщение
случайный
diff --git a/android/src/main/res/values/strings.xml b/android/src/main/res/values/strings.xml
index 5c8e5d13..af6f5e53 100644
--- a/android/src/main/res/values/strings.xml
+++ b/android/src/main/res/values/strings.xml
@@ -132,9 +132,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
And %d more
Scan finished.
found %d passes
- Searching…
- Please wait.
- background
empty trash
alternative Message
random
@@ -219,6 +216,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
Need permission to import pass
Permission Error
+ Scanning for passes. Please wait.