improve dependency injection (#723)

This commit is contained in:
Konrad Pozniak 2018-07-23 21:59:10 +02:00 committed by GitHub
commit 7f648b1acd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 28 additions and 27 deletions

View file

@ -70,12 +70,13 @@ public abstract class SFragment extends BaseFragment {
@Inject
public MastodonApi mastodonApi;
@Inject
public AccountManager accountManager;
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
AccountEntity activeAccount = TuskyApplication.getInstance(getContext()).getServiceLocator()
.get(AccountManager.class).getActiveAccount();
AccountEntity activeAccount = accountManager.getActiveAccount();
if (activeAccount != null) {
loggedInAccountId = activeAccount.getAccountId();
loggedInUsername = activeAccount.getUsername();