Fixes issue #95 - Content not refreshed when an account is added

This commit is contained in:
stom79 2017-12-08 07:22:42 +01:00
parent 33f55accd9
commit 68262542c8
3 changed files with 5 additions and 1 deletions

View File

@ -98,6 +98,7 @@ import fr.gouv.etalab.mastodon.fragments.DisplayStatusFragment;
import fr.gouv.etalab.mastodon.fragments.TabLayoutSettingsFragment;
import fr.gouv.etalab.mastodon.sqlite.AccountDAO;
import static fr.gouv.etalab.mastodon.helper.Helper.ADD_USER_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_THEME_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.CHANGE_USER_INTENT;
import static fr.gouv.etalab.mastodon.helper.Helper.HOME_TIMELINE_INTENT;
@ -1022,6 +1023,8 @@ public abstract class BaseMainActivity extends AppCompatActivity
if( !toolbar_search.isIconified() ) {
toolbar_search.setIconified(true);
}
}else if (extras.getInt(INTENT_ACTION) == ADD_USER_INTENT){
this.recreate();
}
}else if( Intent.ACTION_SEND.equals(action) && type != null ) {
if ("text/plain".equals(type)) {

View File

@ -76,7 +76,7 @@ public class UpdateAccountInfoAsyncTask extends AsyncTask<Void, Void, Void> {
protected void onPostExecute(Void result) {
Intent mainActivity = new Intent(this.contextReference.get(), MainActivity.class);
mainActivity.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mainActivity.putExtra(Helper.INTENT_ACTION, Helper.ADD_USER_INTENT);
this.contextReference.get().startActivity(mainActivity);
((Activity) this.contextReference.get()).finish();

View File

@ -190,6 +190,7 @@ public class Helper {
public static final int HOME_TIMELINE_INTENT = 2;
public static final int CHANGE_THEME_INTENT = 3;
public static final int CHANGE_USER_INTENT = 4;
public static final int ADD_USER_INTENT = 5;
//Settings
public static final String SET_TOOTS_PER_PAGE = "set_toots_per_page";
public static final String SET_ACCOUNTS_PER_PAGE = "set_accounts_per_page";