Merge pull request #1025 from dosiecki/master

Android: Bugfixes
This commit is contained in:
Samuel Clay 2017-06-12 16:54:38 -04:00 committed by GitHub
commit 1924c2b421
4 changed files with 17 additions and 6 deletions

View file

@ -168,6 +168,7 @@ public abstract class ItemsList extends NbActivity implements StoryOrderChangedL
searchQueryInput.requestFocus();
} else {
searchQueryInput.setVisibility(View.GONE);
checkSearchQuery();
}
}

View file

@ -81,7 +81,7 @@ public class StoryItemsAdapter extends SimpleCursorAdapter {
return cursor.getCount();
}
public boolean isStale() {
public synchronized boolean isStale() {
return cursor.isClosed();
}
@ -91,19 +91,28 @@ public class StoryItemsAdapter extends SimpleCursorAdapter {
return super.swapCursor(c);
}
public void setShowNone(boolean showNone) {
public synchronized void setShowNone(boolean showNone) {
this.showNone = showNone;
}
public Story getStory(int position) {
cursor.moveToPosition(position);
return Story.fromCursor(cursor);
public synchronized Story getStory(int position) {
if (cursor == null || cursor.isClosed() || cursor.getColumnCount() == 0 || position >= cursor.getCount() || position < 0) {
return null;
} else {
cursor.moveToPosition(position);
return Story.fromCursor(cursor);
}
}
public void setTextSize(float textSize) {
this.textSize = textSize;
}
@Override
public synchronized long getItemId(int position) {
return super.getItemId(position);
}
@Override
public synchronized void bindView(View v, Context context, Cursor cursor) {
super.bindView(v, context, cursor);

View file

@ -487,6 +487,7 @@ public abstract class ItemListFragment extends NbFragment implements OnScrollLis
}
if (index <= -1) return;
Story story = adapter.getStory(index-1);
if (story == null) return;
switch (action) {
case GEST_ACTION_MARKREAD:
FeedUtils.markStoryAsRead(story, getActivity());;

View file

@ -84,7 +84,7 @@ public class NotificationUtils {
// force a new Reading activity, since if multiple notifications are tapped, any re-use or
// stacking of the activity would almost certainly out-race the sync loop and cause stale
// UI on some devices.
i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
// set the requestCode to the story hashcode to prevent the PI re-using the wrong Intent
PendingIntent pendingIntent = PendingIntent.getActivity(context, story.hashCode(), i, 0);