inform with subtitles about where we search at the moment

This commit is contained in:
ligi 2014-03-29 04:11:18 +05:30
parent e6b0c76d28
commit 20fcf1a365
2 changed files with 19 additions and 1 deletions

View file

@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.support.v4.app.ActionBarDrawerToggle;
@ -312,7 +313,7 @@ public class TicketListActivity extends ActionBarActivity {
}
}
class ScanForPassesTask extends AsyncTask<Void, Void, Void> {
class ScanForPassesTask extends AsyncTask<Void, String, Void> {
private long start_time;
private HashSet<String> processedAtTopLevelSet;
@ -321,6 +322,19 @@ public class TicketListActivity extends ActionBarActivity {
processedAtTopLevelSet = new HashSet<>();
}
@Override
protected void onProgressUpdate(String... values) {
super.onProgressUpdate(values);
if (Build.VERSION.SDK_INT > 10) {
if (values != null) {
getActionBar().setSubtitle(String.format(getString(R.string.searching_in), values[0]));
} else {
getActionBar().setSubtitle(null);
}
}
}
/**
* recursive traversion from path on to find files named .pkpass
*
@ -328,6 +342,7 @@ public class TicketListActivity extends ActionBarActivity {
*/
private void search_in(String path) {
publishProgress(path);
if (path == null) {
Log.w("trying to search in null path");
@ -401,6 +416,8 @@ public class TicketListActivity extends ActionBarActivity {
// | /data
search_in(Environment.getDataDirectory().toString());
publishProgress(null);
return null;
}
}

View file

@ -89,5 +89,6 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
<string name="pass_directions">Navigate</string>
<string name="pass_to_calendar">to Calendar</string>
<string name="invalid_passbook_title">Invalid Passbook</string>
<string name="searching_in">searching in %s</string>
</resources>