This commit is contained in:
David Development 2015-04-11 14:05:25 +02:00
parent 3c078290bc
commit a871712216
2 changed files with 8 additions and 14 deletions

View file

@ -228,7 +228,8 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
}
if(keyCode == KeyEvent.KEYCODE_BACK)
{
NewsDetailFragment ndf = (NewsDetailFragment) getSupportFragmentManager().findFragmentByTag("android:switcher:" + R.id.pager + ":" + currentPosition);
NewsDetailFragment ndf = getNewsDetailFragmentAtPosition(currentPosition);//(NewsDetailFragment) getSupportFragmentManager().findFragmentByTag("android:switcher:" + R.id.pager + ":" + currentPosition);
if(ndf != null && ndf.mWebView != null)
{
if(ndf.mWebView.canGoBack())
@ -538,19 +539,9 @@ public class NewsDetailActivity extends PodcastFragmentActivity {
@Override
public Fragment getItem(int position) {
NewsDetailFragment fragment = null;
int key;
for(int i = 0; i < items.size(); i++) {
key = items.keyAt(i);
WeakReference<NewsDetailFragment> wr = items.get(key);
if(wr.get() != null) {
if ((wr.get()).getSectionNumber() == position){
fragment = wr.get();
break;
}
} else {
items.remove(key);//Remove null pointer --> Should never happen
i--; //One key removed (at position i -> so reduce i by one)
}
if(items.get(position) != null) {
fragment = items.get(position).get();
}
if(fragment == null) {

View file

@ -358,6 +358,9 @@ public class NewsReaderDetailFragment extends ListFragment implements IOnStayUnr
dbConn.insertIntoRssCurrentViewTable(sqlSelectStatement);
}
}
setUpdateListViewOnStartUp(false);//Always reset this variable here. Otherwise the list will be cleared when the activity is restarted
return dbConn.getCurrentRssItemView(sortDirection);
}