diff --git a/android/libraries/TweetLanesCore/res/xml/changelog.xml b/android/libraries/TweetLanesCore/res/xml/changelog.xml
index ade311c7..9156bdf7 100644
--- a/android/libraries/TweetLanesCore/res/xml/changelog.xml
+++ b/android/libraries/TweetLanesCore/res/xml/changelog.xml
@@ -24,6 +24,8 @@
Fix - Profile URL is now expanded from a t.co
Fix - Close several leaks dealing with the image loader
Fix - Significantly reduce overdraw in lists containing tweets
+ Fix - Force close when switching accounts
+ Fix - New tweet count on close and re-open
Other - Large codebase tidy-up - hopefully small improvement to performance, size and reliability
diff --git a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java
index 768d75f7..2fbbd9ae 100644
--- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java
+++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/TweetFeedFragment.java
@@ -253,7 +253,7 @@ void fetchNewestTweets(final long sinceStatusId, Long maxStatusId) {
if (mTweetDataRefreshCallback == null) {
if (maxStatusId == null) {
- if(getActivity() != null){
+ if (getActivity() != null) {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
}
mTimesFetchCalled = 0;
@@ -362,6 +362,9 @@ public void onJumpToTop() {
}
private static final String KEY_VISIBLE_STATUS_ID = "visibleStatusId";
+ private static final String KEY_LAST_SEEN_STATUS_ID = "lastSeenStatusId";
+ private static final String KEY_HIDE_LIST_HEADING = "hideListHeading";
+ private static final String KEY_REFRESH_STATUS_ID = "refreshStatusId";
private static final String KEY_STATUSES = "statuses";
/*
@@ -430,6 +433,9 @@ public String getDataToCache() {
JSONObject object = new JSONObject();
try {
object.put(KEY_VISIBLE_STATUS_ID, visibleStatusId);
+ object.put(KEY_LAST_SEEN_STATUS_ID, mLastTwitterStatusIdSeen);
+ object.put(KEY_REFRESH_STATUS_ID, mTwitterStatusIdWhenRefreshed);
+ object.put(KEY_HIDE_LIST_HEADING, mHidingListHeading);
JSONArray statusArray = new JSONArray();
int statusCount = statuses.getStatusCount();
for (int i = 0; i < statusCount; ++i) {
@@ -460,6 +466,16 @@ boolean configureCachedStatuses() {
object = new JSONObject(cachedData);
if (object.has(KEY_VISIBLE_STATUS_ID)) {
mResumeStatusId = object.getLong(KEY_VISIBLE_STATUS_ID);
+ if (object.has(KEY_LAST_SEEN_STATUS_ID)) {
+ mLastTwitterStatusIdSeen = object.getLong(KEY_LAST_SEEN_STATUS_ID);
+ }
+ if (object.has(KEY_HIDE_LIST_HEADING)) {
+ mHidingListHeading = object.getBoolean(KEY_HIDE_LIST_HEADING);
+ }
+ if (object.has(KEY_REFRESH_STATUS_ID)) {
+ mTwitterStatusIdWhenRefreshed = object.getLong(KEY_REFRESH_STATUS_ID);
+ }
+
if (object.has(KEY_STATUSES)) {
String statusesAsString = object.getString(KEY_STATUSES);
if (statusesAsString != null) {
@@ -474,6 +490,10 @@ boolean configureCachedStatuses() {
TwitterManager.get().getFetchStatusesInstance().cacheHashtags(_mCachedStatusFeed);
setStatusFeed(_mCachedStatusFeed, false);
+ if (getStatusFeed() != null) {
+ updateListHeading(getStatusFeed().getStatusIndex(mLastTwitterStatusIdSeen));
+ }
+
return true;
}
}
@@ -749,7 +769,7 @@ void beginListHeadingCount() {
}
/*
- *
+ *
*/ private final OnClickListener mListHeadingHideImageOnClickListener = new OnClickListener() {
@Override
@@ -777,8 +797,7 @@ void updateListHeading(int firstVisibleItem) {
TwitterStatuses twitterStatuses = getStatusFeed();
TwitterStatus status = null;
- if(twitterStatuses!=null)
- {
+ if (twitterStatuses != null) {
status = twitterStatuses.getStatus(firstVisibleItem);
}
@@ -798,7 +817,7 @@ void updateListHeading(int firstVisibleItem) {
R.string.new_posts));
} else {
- if (status != null && status.mId >= mLastTwitterStatusIdSeen) {
+ if (status != null && status.mId >= mLastTwitterStatusIdSeen) {
mLastTwitterStatusIdSeen = status.mId;
}
@@ -808,7 +827,7 @@ void updateListHeading(int firstVisibleItem) {
}
} else {
- if (status != null && status.mId >= mLastTwitterStatusIdSeen) {
+ if (status != null && status.mId >= mLastTwitterStatusIdSeen) {
mLastTwitterStatusIdSeen = status.mId;
}
@@ -921,7 +940,7 @@ private void onRefreshFinished(TwitterStatuses feed) {
}
mTweetDataRefreshCallback = null;
- if(getActivity() != null){
+ if (getActivity() != null) {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}
@@ -1319,9 +1338,9 @@ public void finished(TwitterFetchResult result, TwitterStatus status) {
showToast(getString(R.string.retweeted_marking_un_successful));
}
} else {
- if (result.getErrorMessage() == null){
+ if (result.getErrorMessage() == null) {
showUnsuccessful = true;
- } else if(!result.getErrorMessage().equals("CancelPressed") && !result.getErrorMessage().equals("QutotePressed")){
+ } else if (!result.getErrorMessage().equals("CancelPressed") && !result.getErrorMessage().equals("QutotePressed")) {
showUnsuccessful = true;
}
}
@@ -1329,7 +1348,7 @@ public void finished(TwitterFetchResult result, TwitterStatus status) {
showUnsuccessful = true;
}
- if(showUnsuccessful){
+ if (showUnsuccessful) {
showToast(getString(R.string.retweeted_un_successful));
}
}