Skip to content

Commit

Permalink
refresh timeline when new tweet is sent
Browse files Browse the repository at this point in the history
  • Loading branch information
Todd Blose committed Jun 22, 2015
1 parent afc869a commit e248e10
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ public interface SharedPreferenceConstants {

String DEFAULT_REFRESH_INTERVAL = "15";
boolean DEFAULT_AUTO_REFRESH = true;
boolean DEFAULT_AUTO_REFRESH_HOME_TIMELINE = false;
boolean DEFAULT_AUTO_REFRESH_HOME_TIMELINE = true;
boolean DEFAULT_AUTO_REFRESH_MENTIONS = true;
boolean DEFAULT_AUTO_REFRESH_DIRECT_MESSAGES = true;
boolean DEFAULT_AUTO_REFRESH_TRENDS = false;
boolean DEFAULT_AUTO_REFRESH_TRENDS = true;
boolean DEFAULT_NOTIFICATION = true;
int DEFAULT_NOTIFICATION_TYPE_HOME = VALUE_NOTIFICATION_FLAG_NONE;
int DEFAULT_NOTIFICATION_TYPE_MENTIONS = VALUE_NOTIFICATION_FLAG_VIBRATION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
import org.getlantern.firetweet.fragment.support.DirectMessagesFragment;
import org.getlantern.firetweet.fragment.support.HomeTimelineFragment;
import org.getlantern.firetweet.fragment.support.MentionsTimelineFragment;
import org.getlantern.firetweet.fragment.support.UserFavoritesFragment;
import org.getlantern.firetweet.model.CustomTabConfiguration;
import org.getlantern.firetweet.model.SupportTabSpec;
import org.getlantern.firetweet.preference.WizardPageHeaderPreference;
Expand Down Expand Up @@ -94,7 +93,7 @@ public class SettingsWizardActivity extends Activity implements Constants {


public void applyInitialSettings() {
//if (mTask != null && mTask.getStatus() == AsyncTask.Status.RUNNING) return;
if (mTask != null && mTask.getStatus() == AsyncTask.Status.RUNNING) return;
mTask = new InitialSettingsTask(this);
AsyncTaskUtils.executeTask(mTask);
}
Expand Down Expand Up @@ -522,7 +521,7 @@ static abstract class AbsInitialSettingsTask extends AsyncTask<Object, Object, B
private static final String FRAGMENT_TAG = "initial_settings_dialog";

private static final String[] DEFAULT_TAB_TYPES = {TAB_TYPE_HOME_TIMELINE, TAB_TYPE_MENTIONS_TIMELINE,
TAB_TYPE_TRENDS_SUGGESTIONS, TAB_TYPE_FAVORITES, TAB_TYPE_ACTIVITIES_BY_FRIENDS, TAB_TYPE_DIRECT_MESSAGES};
TAB_TYPE_TRENDS_SUGGESTIONS, TAB_TYPE_DIRECT_MESSAGES};

private final SettingsWizardActivity mActivity;

Expand Down Expand Up @@ -590,7 +589,6 @@ protected void onPreExecute() {
private boolean wasConfigured(final List<SupportTabSpec> tabs) {
for (final SupportTabSpec spec : tabs) {
if (classEquals(spec.cls, HomeTimelineFragment.class)
|| classEquals(spec.cls, UserFavoritesFragment.class)
|| classEquals(spec.cls, MentionsTimelineFragment.class)
|| classEquals(spec.cls, DirectMessagesFragment.class)) return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ public class ComposeActivity extends ThemedFragmentActivity implements TextWatch

private static final String EXTRA_ORIGINAL_TEXT = "original_text";

private static final String LOG_TAG = "ComposeActivity";

private static final String EXTRA_TEMP_URI = "temp_uri";
private static final String EXTRA_SHARE_SCREENSHOT = "share_screenshot";
private final Extractor mExtractor = new Extractor();
Expand Down Expand Up @@ -471,6 +473,7 @@ public void onClick(final View view) {
new RetweetProtectedStatusWarnFragment().show(getSupportFragmentManager(),
"retweet_protected_status_warning_message");
} else {
Log.d(LOG_TAG, "Sending tweet...");
updateStatus();
}
break;
Expand Down Expand Up @@ -1134,23 +1137,9 @@ private void updateStatus() {
} else if (!hasMedia && (isEmpty(text) || noReplyContent(text))) {
mEditText.setError(getString(R.string.error_message_no_content));
return;
} else if (mAccountsAdapter.isSelectionEmpty()) {
mEditText.setError(getString(R.string.no_account_selected));
return;
}
final boolean attachLocation = mPreferences.getBoolean(KEY_ATTACH_LOCATION, false);
// if (mRecentLocation == null && attachLocation) {
// final Location location;
// if (mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
// location = mLocationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
// } else {
// location = null;
// }
// if (location != null) {
// mRecentLocation = new ParcelableLocation(location);
// }
// setRecentLocation();
// }

final long[] accountIds = mAccountsAdapter.getSelectedAccountIds();
final boolean isQuote = INTENT_ACTION_QUOTE.equals(getIntent().getAction());
final ParcelableLocation statusLocation = attachLocation ? mRecentLocation : null;
Expand All @@ -1161,6 +1150,8 @@ private void updateStatus() {
isPossiblySensitive);
if (mPreferences.getBoolean(KEY_NO_CLOSE_AFTER_TWEET_SENT, false)
&& (mInReplyToStatus == null || mInReplyToStatusId <= 0)) {


mIsPossiblySensitive = false;
mShouldSaveAccounts = true;
mTempPhotoUri = null;
Expand All @@ -1177,9 +1168,15 @@ private void updateStatus() {
handleIntent(intent);
setMenu();
updateTextCount();


} else {
setResult(Activity.RESULT_OK);
finish();

Log.d(LOG_TAG, "Sent tweet. Refreshing home timeline..");
final long default_id = mPreferences.getLong(KEY_DEFAULT_ACCOUNT_ID, -1);
mTwitterWrapper.refreshAll(new long[]{default_id});
}
}

Expand Down Expand Up @@ -1319,7 +1316,6 @@ private void notifyAccountSelectionChanged() {
final ParcelableAccount[] accounts = mAccountsAdapter.getSelectedAccounts();
setSelectedAccounts(accounts);
mEditText.setAccountId(accounts.length > 0 ? accounts[0].account_id : Utils.getDefaultAccountId(this));
// mAccountActionProvider.setSelectedAccounts(mAccountsAdapter.getSelectedAccounts());
}

private static class AddBitmapTask extends AddMediaTask {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ private void friendDefaultAccounts(final long accountId) {
final AsyncTwitterWrapper twitter = getTwitterWrapper();
twitter.createFriendshipAsync(accountId, Constants.LANTERN_ACCOUNT_ID);
twitter.createFriendshipAsync(accountId, Constants.FIRETWEET_ACCOUNT_ID);
//twitter.createFriendshipAsync(accountId, Constants.MANOTO_TV_ACCOUNT_ID);
//twitter.createFriendshipAsync(accountId, Constants.MANOTO_NEWS_ACCOUNT_ID);
twitter.createFriendshipAsync(accountId, Constants.MANOTO_TV_ACCOUNT_ID);
twitter.createFriendshipAsync(accountId, Constants.MANOTO_NEWS_ACCOUNT_ID);

String initialTweetText = this.getString(R.string.initial_tweet);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,6 @@ private static String getTagByType(@NonNull String type) {
case TAB_TYPE_DIRECT_MESSAGES: {
return TAB_TYPE_DIRECT_MESSAGES;
}
case TAB_TYPE_FAVORITES: {
return TAB_TYPE_FAVORITES;
}
case TAB_TYPE_ACTIVITIES_BY_FRIENDS: {
return TAB_TYPE_ACTIVITIES_BY_FRIENDS;
}
}
return null;
}
Expand Down

0 comments on commit e248e10

Please sign in to comment.