Commit 1ad956e9 authored by Thomas's avatar Thomas
Browse files

change currentAccount with a getter

parent 1274d83e
Loading
Loading
Loading
Loading
+53 −55

File changed.

Preview size limit exceeded, changes collapsed.

+1 −3
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@ package app.fedilab.android.activities;
 * see <http://www.gnu.org/licenses>. */


import static app.fedilab.android.BaseMainActivity.currentAccount;

import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
@@ -123,7 +121,7 @@ public class AboutActivity extends BaseBarActivity {
                        Intent intent = new Intent(AboutActivity.this, ProfileActivity.class);
                        Bundle args = new Bundle();
                        args.putSerializable(Helper.ARG_ACCOUNT, account);
                        new CachedBundle(AboutActivity.this).insertBundle(args, currentAccount, bundleId -> {
                        new CachedBundle(AboutActivity.this).insertBundle(args, Helper.getCurrentAccount(AboutActivity.this), bundleId -> {
                            Bundle bundle = new Bundle();
                            bundle.putLong(Helper.ARG_INTENT_ID, bundleId);
                            intent.putExtras(bundle);
+1 −3
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@ package app.fedilab.android.mastodon.activities;
 * see <http://www.gnu.org/licenses>. */


import static app.fedilab.android.BaseMainActivity.currentAccount;

import android.app.Activity;
import android.graphics.PorterDuff;
import android.os.Bundle;
@@ -69,7 +67,7 @@ public class AccountReportActivity extends BaseBarActivity {
        Bundle args = getIntent().getExtras();
        if (args != null) {
            long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
            new CachedBundle(AccountReportActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
            new CachedBundle(AccountReportActivity.this).getBundle(bundleId, Helper.getCurrentAccount(AccountReportActivity.this), this::initializeAfterBundle);
        } else {
            initializeAfterBundle(null);
        }
+4 −4
Original line number Diff line number Diff line
@@ -54,12 +54,12 @@ import java.util.List;
import java.util.Locale;

import app.fedilab.android.R;
import app.fedilab.android.activities.MainActivity;
import app.fedilab.android.databinding.ActivityCheckHomeCachetBinding;
import app.fedilab.android.mastodon.client.entities.api.Status;
import app.fedilab.android.mastodon.client.entities.app.StatusCache;
import app.fedilab.android.mastodon.client.entities.app.TimelineCacheLogs;
import app.fedilab.android.mastodon.exception.DBException;
import app.fedilab.android.mastodon.helper.Helper;
import app.fedilab.android.mastodon.helper.ThemeHelper;
import es.dmoral.toasty.Toasty;

@@ -88,7 +88,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
        if (getSupportActionBar() != null) {
            getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        }
        if (MainActivity.currentAccount == null || MainActivity.currentAccount.mastodon_account == null) {
        if (Helper.getCurrentAccount(CheckHomeCacheActivity.this) == null || Helper.getCurrentAccount(CheckHomeCacheActivity.this).mastodon_account == null) {
            finish();
            return;
        }
@@ -107,7 +107,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
            try {
                if (myRange == range.ALL) {
                    if (statuses == null) {
                        statuses = new StatusCache(this).getHome(MainActivity.currentAccount);
                        statuses = new StatusCache(this).getHome(Helper.getCurrentAccount(CheckHomeCacheActivity.this));
                        sortAsc(statuses);
                    }
                } else if (myRange == range.DAY) {
@@ -247,7 +247,7 @@ public class CheckHomeCacheActivity extends BaseBarActivity {
            try {
                if (myRange == range.ALL) {
                    if (timelineCacheLogsList == null) {
                        timelineCacheLogsList = new TimelineCacheLogs(this).getHome(MainActivity.currentAccount);
                        timelineCacheLogsList = new TimelineCacheLogs(this).getHome(Helper.getCurrentAccount(CheckHomeCacheActivity.this));
                    }
                } else if (myRange == range.DAY) {
                    if (timelineCacheLogsDayList == null && timelineCacheLogsList != null) {
+6 −7
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@ package app.fedilab.android.mastodon.activities;
 * see <http://www.gnu.org/licenses>. */


import static app.fedilab.android.BaseMainActivity.currentAccount;
import static app.fedilab.android.BaseMainActivity.currentInstance;
import static app.fedilab.android.BaseMainActivity.emojis;

@@ -123,7 +122,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
            Bundle args = intent.getExtras();
            if (args != null) {
                long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1);
                new CachedBundle(ComposeActivity.this).getBundle(bundleId, currentAccount, bundle -> {
                new CachedBundle(ComposeActivity.this).getBundle(bundleId, Helper.getCurrentAccount(ComposeActivity.this), bundle -> {
                    String imgpath = bundle.getString("imgpath");
                    float focusX = bundle.getFloat("focusX", -2);
                    float focusY = bundle.getFloat("focusY", -2);
@@ -492,7 +491,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
        if (b != null) {
            long bundleId = b.getLong(Helper.ARG_INTENT_ID, -1);
            if (bundleId != -1) {
                new CachedBundle(ComposeActivity.this).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
                new CachedBundle(ComposeActivity.this).getBundle(bundleId, Helper.getCurrentAccount(ComposeActivity.this), this::initializeAfterBundle);
            } else {
                initializeAfterBundle(b);
            }
@@ -513,7 +512,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
                statusMention = (Status) b.getSerializable(Helper.ARG_STATUS_MENTION);
                account = (BaseAccount) b.getSerializable(Helper.ARG_ACCOUNT);
                if (account == null) {
                    account = currentAccount;
                    account = Helper.getCurrentAccount(ComposeActivity.this);
                }
                editMessageId = b.getString(Helper.ARG_EDIT_STATUS_ID, null);
                instance = b.getString(Helper.ARG_INSTANCE, null);
@@ -521,8 +520,8 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
                visibility = b.getString(Helper.ARG_VISIBILITY, null);
                if (visibility == null && statusReply != null) {
                    visibility = getVisibility(account, statusReply.visibility);
                } else if (visibility == null && currentAccount != null && currentAccount.mastodon_account != null && currentAccount.mastodon_account.source != null) {
                    visibility = currentAccount.mastodon_account.source.privacy;
                } else if (visibility == null && Helper.getCurrentAccount(ComposeActivity.this) != null && Helper.getCurrentAccount(ComposeActivity.this).mastodon_account != null && Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.source != null) {
                    visibility = Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.source.privacy;
                }
                mentionBooster = (Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER);
                accountMention = (Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION);
@@ -569,7 +568,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
                    statusDraft.statusDraftList = statuses;
                }
                if (account == null) {
                    account = currentAccount;
                    account = Helper.getCurrentAccount(ComposeActivity.this);
                }
                if (account == null) {
                    Toasty.error(ComposeActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show();
Loading