Skip to content

Commit

Permalink
Merge remote-tracking branch 'Upstream/develop' into Upstream_release
Browse files Browse the repository at this point in the history
  • Loading branch information
BlythMeister committed Sep 24, 2013
2 parents 1d30e2c + d9162f8 commit 6968431
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 45 deletions.
2 changes: 1 addition & 1 deletion android/clientbeta/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tweetlanes.android.beta"
android:versionCode="51"
android:versionName="1.2.1_b6">
android:versionName="1.2.1_b7">



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void clearCallbacks() {
}

/*
*
*
*/
public interface FetchUsersWorkerCallbacks {

Expand Down Expand Up @@ -734,12 +734,13 @@ protected FetchUsersTaskOutput doInBackground(
while (check) {
//Establish ids for this batch
for (int i = start; i < finish; i++) {
fetchIds.add(ids[i]);

if (ids.length - 1 == i) {
check = false;
break;
}

fetchIds.add(ids[i]);
}

//Mark where to start and end next time round
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,12 @@ public TwitterStatus(AdnPost post) {
mInReplyToStatusId = post.mInReplyTo;

mSource = post.mSource;
mUserId = post.mUser.mId;
mUserName = post.mUser.mName;
mUserScreenName = post.mUser.mUserName;
if(post.mUser != null)
{
mUserId = post.mUser.mId;
mUserName = post.mUser.mName;
mUserScreenName = post.mUser.mUserName;
}
mIsFavorited = post.mIsFavorited;
mIsRetweetedByMe = post.mIsRetweetedByMe;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1239,14 +1239,29 @@ void configureActionBarSearchView(Menu menu) {
public void onFocusChange(View v, boolean hasFocus) {

mCurrentComposeFragment.setIgnoreFocusChange(true);

if (mComposeTweetView != null) {
mComposeTweetView.setVisibility(hasFocus ? View.GONE
: View.VISIBLE);
mComposeTweetView.setVisibility(View.GONE);
}
if (mComposeDirectMessageView != null) {
mComposeDirectMessageView
.setVisibility(hasFocus ? View.GONE : View.VISIBLE);
mComposeDirectMessageView.setVisibility(View.GONE);
}

if(!hasFocus)
{
if (mCurrentComposeFragment == mComposeDirectMessageFragment) {
if (mComposeDirectMessageView != null) {
mComposeDirectMessageView.setVisibility(View.VISIBLE);
}
}
else
{
if (mComposeTweetView != null) {
mComposeTweetView.setVisibility(View.VISIBLE);
}
}
}

mCurrentComposeFragment.setIgnoreFocusChange(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,10 @@ private void showAccount(AccountDescriptor selectedAccount, Constant.LaneType la
clearFragmentsCache();

app.setCurrentAccount(selectedAccount.getId());
mHomeLaneAdapter.notifyDataSetChanged();
if(mHomeLaneAdapter != null)
{
mHomeLaneAdapter.notifyDataSetChanged();
}

// From http://stackoverflow.com/a/3419987/328679
Intent intent = getIntent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
if (outState != null) {
if (outState != null && mLayoutResourceId != null) {
outState.putInt(KEY_RESOURCE_ID, mLayoutResourceId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.content.LocalBroadcastManager;
Expand Down Expand Up @@ -243,6 +244,25 @@ public void fetchNewestTweets() {
}
}

private void lockScreenRotation() {
if (getActivity() != null) {
switch (getActivity().getResources().getConfiguration().orientation) {
case Configuration.ORIENTATION_PORTRAIT:
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
break;
case Configuration.ORIENTATION_LANDSCAPE:
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
break;
}
}
}

private void resetScreenRotation() {
if (getActivity() != null) {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
}
}

/*
*
*/
Expand All @@ -253,9 +273,7 @@ void fetchNewestTweets(final long sinceStatusId, Long maxStatusId) {
if (mTweetDataRefreshCallback == null) {

if (maxStatusId == null) {
if (getActivity() != null) {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
}
lockScreenRotation();
mTimesFetchCalled = 0;
TwitterStatus visibleStatus = getVisibleStatus();
if (visibleStatus != null && mLastTwitterStatusIdSeen < visibleStatus.mId) {
Expand Down Expand Up @@ -492,7 +510,7 @@ boolean configureCachedStatuses() {
setStatusFeed(_mCachedStatusFeed, false);
if (getStatusFeed() != null && mLastTwitterStatusIdSeen != null) {
Integer index = getStatusFeed().getStatusIndex(mLastTwitterStatusIdSeen);
if(index != null){
if (index != null) {
updateListHeading(index);
}
}
Expand Down Expand Up @@ -783,7 +801,7 @@ public void onClick(View v) {
};

/*
*
*
*/
void setListHeadingVisiblilty(int value) {
mListHeadingTextView.setVisibility(value);
Expand Down Expand Up @@ -928,24 +946,33 @@ private void onRefreshFinished(TwitterStatuses feed) {
}

if (statusIndex != null) {
mTweetFeedListView.getRefreshableView()
.setSelectionFromTop(statusIndex.intValue() + 1, mScrollTracker.getFirstVisibleYOffset());
int newIndex = statusIndex.intValue() + 1;

if (mNewStatuses == 1 && getStatusFeed() != null) {
TwitterStatus firstStatus = getStatusFeed().getStatus(0);
if (firstStatus != null && firstStatus.getAuthorScreenName().equals(getApp().getCurrentAccount().getScreenName())) {
newIndex = statusIndex.intValue();
}
}

mTweetFeedListView.getRefreshableView().setSelectionFromTop(newIndex, mScrollTracker.getFirstVisibleYOffset());

if (visibleStatus != null && mLastTwitterStatusIdSeen < visibleStatus.mId) {
mLastTwitterStatusIdSeen = visibleStatus.mId;
}

if (!mDetached) {
updateListHeading(statusIndex.intValue() + 1);
updateListHeading(newIndex);
}
} else {
showToast(getString(R.string.lost_position));
}

mTweetDataRefreshCallback = null;
if (getActivity() != null) {
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
if (mNewStatuses == 0) {
mTweetFeedListView.getRefreshableView().setSelectionFromTop(0, mScrollTracker.getFirstVisibleYOffset());
}
mTweetDataRefreshCallback = null;
resetScreenRotation();
}

/*
Expand Down Expand Up @@ -1335,10 +1362,14 @@ public void finished(TwitterFetchResult result, TwitterStatus status) {
TwitterStatus cachedStatus = cachedStatuses.findByStatusId(status.mOriginalRetweetId);
if (cachedStatus != null) {
cachedStatus.setRetweet(true);
showToast(getString(R.string.retweeted_successfully));
if (!mDetached) {
showToast(getString(R.string.retweeted_successfully));
}
setIsRetweet(true);
} else {
showToast(getString(R.string.retweeted_marking_un_successful));
if (!mDetached) {
showToast(getString(R.string.retweeted_marking_un_successful));
}
}
} else {
if (result.getErrorMessage() == null) {
Expand All @@ -1351,7 +1382,7 @@ public void finished(TwitterFetchResult result, TwitterStatus status) {
showUnsuccessful = true;
}

if (showUnsuccessful) {
if (showUnsuccessful && !mDetached) {
showToast(getString(R.string.retweeted_un_successful));
}
}
Expand Down Expand Up @@ -1390,14 +1421,18 @@ public void finished(boolean successful, TwitterStatuses statuses, Integer value
}
}

showToast(getString(settingFavorited ? R.string.favorited_successfully : R.string
.unfavorited_successfully));
if (!mDetached) {
showToast(getString(settingFavorited ? R.string.favorited_successfully : R.string
.unfavorited_successfully));
}

setIsFavorited(settingFavorited);
} else {
boolean newState = getSelectedFavoriteState() != ItemSelectedState.ALL;
showToast(getString(newState ? R.string.favorited_un_successfully : R.string
.unfavorited_un_successfully));
if (!mDetached) {
showToast(getString(newState ? R.string.favorited_un_successfully : R.string
.unfavorited_un_successfully));
}
}
}

Expand Down Expand Up @@ -1429,7 +1464,9 @@ public void finished(boolean successful, TwitterStatuses statuses, Integer value
_mCachedStatusFeed.remove(selectedStatuses);
}
} else {
showToast(getString(R.string.deleted_un_successfully));
if (!mDetached) {
showToast(getString(R.string.deleted_un_successfully));
}
}
}
};
Expand Down Expand Up @@ -1470,23 +1507,25 @@ public void finished(TwitterFetchResult result, TwitterUsers users) {
if (result.isSuccessful() && users != null && users.getUserCount() > 0) {
int userCount = users.getUserCount();
String notice;
if (itemId == R.id.action_report_for_spam) {
if (userCount == 1) {
notice = "Reported @" + users.getUser(0).getScreenName() +
" for Spam.";
if (!mDetached) {
if (itemId == R.id.action_report_for_spam) {
if (userCount == 1) {
notice = "Reported @" + users.getUser(0).getScreenName() +
" for Spam.";
} else {
notice = "Reported " + userCount + " users for Spam.";
}
} else {
notice = "Reported " + userCount + " users for Spam.";
if (userCount == 1) {
notice = "Blocked @" + users.getUser(0).getScreenName() + ".";
} else {
notice = "Blocked " + userCount + " users.";
}
}
} else {
if (userCount == 1) {
notice = "Blocked @" + users.getUser(0).getScreenName() + ".";
} else {
notice = "Blocked " + userCount + " users.";
if (notice != null) {
showToast(notice);
}
}
if (notice != null) {
showToast(notice);
}
}
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ public void finished(TwitterFetchResult result,
};

mStatus = status;
TwitterManager.get().getStatus(mStatus.mOriginalRetweetId, mGetStatusCallback);
if(mStatus != null)
{
TwitterManager.get().getStatus(mStatus.mOriginalRetweetId, mGetStatusCallback);
}
} else {
onStatusRefresh(status);
}
Expand Down

0 comments on commit 6968431

Please sign in to comment.