diff --git a/android/clientbeta/AndroidManifest.xml b/android/clientbeta/AndroidManifest.xml index 337cf3dc..e48ec606 100644 --- a/android/clientbeta/AndroidManifest.xml +++ b/android/clientbeta/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="51" + android:versionName="1.2.1_b4"> 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/HomeActivity.java b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/HomeActivity.java index 38a71a50..e451f40b 100644 --- a/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/HomeActivity.java +++ b/android/libraries/TweetLanesCore/src/com/tweetlanes/android/core/view/HomeActivity.java @@ -545,6 +545,7 @@ private void showAccount(AccountDescriptor selectedAccount, Constant.LaneType la clearFragmentsCache(); app.setCurrentAccount(selectedAccount.getId()); + mHomeLaneAdapter.notifyDataSetChanged(); // From http://stackoverflow.com/a/3419987/328679 Intent intent = getIntent(); 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 0d2c8d8b..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,9 @@ void fetchNewestTweets(final long sinceStatusId, Long maxStatusId) { if (mTweetDataRefreshCallback == null) { if (maxStatusId == null) { - getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); + if (getActivity() != null) { + getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); + } mTimesFetchCalled = 0; TwitterStatus visibleStatus = getVisibleStatus(); if (visibleStatus != null && mLastTwitterStatusIdSeen < visibleStatus.mId) { @@ -360,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"; /* @@ -428,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) { @@ -458,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) { @@ -472,6 +490,10 @@ boolean configureCachedStatuses() { TwitterManager.get().getFetchStatusesInstance().cacheHashtags(_mCachedStatusFeed); setStatusFeed(_mCachedStatusFeed, false); + if (getStatusFeed() != null) { + updateListHeading(getStatusFeed().getStatusIndex(mLastTwitterStatusIdSeen)); + } + return true; } } @@ -747,7 +769,7 @@ void beginListHeadingCount() { } /* - * + * */ private final OnClickListener mListHeadingHideImageOnClickListener = new OnClickListener() { @Override @@ -775,8 +797,7 @@ void updateListHeading(int firstVisibleItem) { TwitterStatuses twitterStatuses = getStatusFeed(); TwitterStatus status = null; - if(twitterStatuses!=null) - { + if (twitterStatuses != null) { status = twitterStatuses.getStatus(firstVisibleItem); } @@ -796,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; } @@ -806,7 +827,7 @@ void updateListHeading(int firstVisibleItem) { } } else { - if (status != null && status.mId >= mLastTwitterStatusIdSeen) { + if (status != null && status.mId >= mLastTwitterStatusIdSeen) { mLastTwitterStatusIdSeen = status.mId; } @@ -919,7 +940,9 @@ private void onRefreshFinished(TwitterStatuses feed) { } mTweetDataRefreshCallback = null; - getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); + if (getActivity() != null) { + getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); + } } /* @@ -1315,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; } } @@ -1325,7 +1348,7 @@ public void finished(TwitterFetchResult result, TwitterStatus status) { showUnsuccessful = true; } - if(showUnsuccessful){ + if (showUnsuccessful) { showToast(getString(R.string.retweeted_un_successful)); } }