Show number of available updates in tab heading

This commit is contained in:
Ciaran Gultnieks 2010-12-16 22:44:26 +00:00
parent bec725da56
commit a5d4399e28

View File

@ -383,7 +383,8 @@ public class FDroid extends TabActivity implements OnItemClickListener {
Vector<DB.App> apps = db.getApps(null, null, update);
if (apps.isEmpty()) {
// Don't attempt this more than once - we may have invalid repositories.
// Don't attempt this more than once - we may have invalid
// repositories.
if (triedEmptyUpdate)
return;
// If there are no apps, update from the repos - it must be a
@ -405,6 +406,13 @@ public class FDroid extends TabActivity implements OnItemClickListener {
}
}
// Update the count on the 'Updates' tab to show the number available.
// This is quite unpleasant, but seems to be the only way to do it.
TextView uptext = (TextView) tabHost.getTabWidget().getChildAt(2)
.findViewById(android.R.id.title);
uptext.setText(getString(R.string.tab_updates) + " ("
+ Integer.toString(apps_up.getCount()) + ")");
// Tell the lists that the data behind the adapter has changed, so
// they can refresh...
apps_av.notifyDataSetChanged();