static int sActiveTabIndex = -1;
- static void updateButtonBar(Activity a, int highlight) {
+ static boolean updateButtonBar(Activity a, int highlight) {
final TabWidget ll = (TabWidget) a.findViewById(R.id.buttonbar);
boolean withtabs = false;
Intent intent = a.getIntent();
if (highlight == 0 || !withtabs) {
ll.setVisibility(View.GONE);
- return;
+ return withtabs;
} else if (withtabs) {
ll.setVisibility(View.VISIBLE);
}
processTabClick((Activity)ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId());
}});
}
+ return withtabs;
}
static void processTabClick(Activity a, View v, int current) {
private long mSelectedId;
private static int mLastListPosCourse = -1;
private static int mLastListPosFine = -1;
+ private boolean mUseLastListPos = false;
public TrackBrowserActivity()
{
};
setContentView(R.layout.media_picker_activity);
- MusicUtils.updateButtonBar(this, R.id.songtab);
+ mUseLastListPos = MusicUtils.updateButtonBar(this, R.id.songtab);
mTrackList = getListView();
mTrackList.setOnCreateContextMenuListener(this);
if (mEditMode) {
@Override
public void onDestroy() {
ListView lv = getListView();
- if (lv != null) {
+ if (lv != null && mUseLastListPos) {
mLastListPosCourse = lv.getFirstVisiblePosition();
View cv = lv.getChildAt(0);
if (cv != null) {
return;
}
+ MusicUtils.hideDatabaseError(this);
+ mUseLastListPos = MusicUtils.updateButtonBar(this, R.id.songtab);
+ setTitle();
+
// Restore previous position
- if (mLastListPosCourse >= 0) {
+ if (mLastListPosCourse >= 0 && mUseLastListPos) {
ListView lv = getListView();
// this hack is needed because otherwise the position doesn't change
// for the 2nd (non-limited) cursor
}
}
- MusicUtils.hideDatabaseError(this);
- MusicUtils.updateButtonBar(this, R.id.songtab);
- setTitle();
-
// When showing the queue, position the selection on the currently playing track
// Otherwise, position the selection on the first matching artist, if any
IntentFilter f = new IntentFilter();