Show number of available updates in tab heading
This commit is contained in:
parent
bec725da56
commit
a5d4399e28
@ -197,7 +197,7 @@ public class FDroid extends TabActivity implements OnItemClickListener {
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
((FDroidApp) getApplication()).inActivity++;
|
((FDroidApp) getApplication()).inActivity++;
|
||||||
db = new DB(this);
|
db = new DB(this);
|
||||||
triedEmptyUpdate=false;
|
triedEmptyUpdate = false;
|
||||||
populateLists(true);
|
populateLists(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,9 +382,10 @@ public class FDroid extends TabActivity implements OnItemClickListener {
|
|||||||
apps_up.clear();
|
apps_up.clear();
|
||||||
|
|
||||||
Vector<DB.App> apps = db.getApps(null, null, update);
|
Vector<DB.App> apps = db.getApps(null, null, update);
|
||||||
if(apps.isEmpty()) {
|
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
|
||||||
if(triedEmptyUpdate)
|
// repositories.
|
||||||
|
if (triedEmptyUpdate)
|
||||||
return;
|
return;
|
||||||
// If there are no apps, update from the repos - it must be a
|
// If there are no apps, update from the repos - it must be a
|
||||||
// new installation.
|
// new installation.
|
||||||
@ -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
|
// Tell the lists that the data behind the adapter has changed, so
|
||||||
// they can refresh...
|
// they can refresh...
|
||||||
apps_av.notifyDataSetChanged();
|
apps_av.notifyDataSetChanged();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user