Loading app/src/main/java/app/fedilab/android/BaseMainActivity.java +26 −29 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ import static app.fedilab.android.BaseMainActivity.status.DISCONNECTED; import static app.fedilab.android.BaseMainActivity.status.UNKNOWN; import static app.fedilab.android.helper.CacheHelper.deleteDir; import static app.fedilab.android.helper.Helper.PREF_USER_TOKEN; import static app.fedilab.android.helper.Helper.getCurrentAccount; import android.annotation.SuppressLint; import android.content.BroadcastReceiver; Loading Loading @@ -141,13 +140,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt public static boolean filterFetched; public static boolean show_boosts, show_replies, show_art_nsfw; public static String regex_home, regex_local, regex_public; public static BaseAccount currentAccount; Fragment currentFragment; private BaseAccount account; private AppBarConfiguration mAppBarConfiguration; private ActivityMainBinding binding; private Pinned pinned; private BottomMenu bottomMenu; private final BroadcastReceiver broadcast_data = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading @@ -158,7 +156,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt redrawPinned(mastodonLists); } if (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(account, binding.bottomNavView); bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(currentAccount, binding.bottomNavView); if (bottomMenu != null) { //ManageClick on bottom menu items if (binding.bottomNavView.findViewById(R.id.nav_home) != null) { Loading Loading @@ -366,7 +364,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt headerMainBinding.accountProfilePicture.setOnClickListener(v -> { Intent intent = new Intent(BaseMainActivity.this, ProfileActivity.class); Bundle b = new Bundle(); b.putSerializable(Helper.ARG_ACCOUNT, account.mastodon_account); b.putSerializable(Helper.ARG_ACCOUNT, currentAccount.mastodon_account); intent.putExtras(b); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(BaseMainActivity.this, headerMainBinding.instanceInfoContainer, getString(R.string.activity_porfile_pp)); Loading Loading @@ -500,17 +498,17 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt if (itemId == R.id.action_logout_account) { AlertDialog.Builder alt_bld = new AlertDialog.Builder(BaseMainActivity.this, Helper.dialogStyle()); alt_bld.setTitle(R.string.action_logout); if (account.mastodon_account != null && account.mastodon_account.username != null && account.instance != null) { alt_bld.setMessage(getString(R.string.logout_account_confirmation, account.mastodon_account.username, account.instance)); } else if (account.mastodon_account != null && account.mastodon_account.acct != null) { alt_bld.setMessage(getString(R.string.logout_account_confirmation, account.mastodon_account.acct, "")); if (currentAccount.mastodon_account != null && currentAccount.mastodon_account.username != null && currentAccount.instance != null) { alt_bld.setMessage(getString(R.string.logout_account_confirmation, currentAccount.mastodon_account.username, currentAccount.instance)); } else if (currentAccount.mastodon_account != null && currentAccount.mastodon_account.acct != null) { alt_bld.setMessage(getString(R.string.logout_account_confirmation, currentAccount.mastodon_account.acct, "")); } else { alt_bld.setMessage(getString(R.string.logout_account_confirmation, "", "")); } alt_bld.setPositiveButton(R.string.action_logout, (dialog, id) -> { dialog.dismiss(); try { Helper.removeAccount(BaseMainActivity.this, null); Helper.removeAccount(BaseMainActivity.this); } catch (DBException e) { e.printStackTrace(); } Loading @@ -536,28 +534,28 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt }); popup.show(); }); account = null; currentAccount = null; //Update account details new Thread(() -> { try { account = new Account(BaseMainActivity.this).getConnectedAccount(); currentAccount = new Account(BaseMainActivity.this).getConnectedAccount(); } catch (DBException e) { e.printStackTrace(); } Handler mainHandler = new Handler(Looper.getMainLooper()); Runnable myRunnable = () -> { if (account == null) { if (currentAccount == null) { //It is not, the user is redirected to the login page Intent myIntent = new Intent(BaseMainActivity.this, LoginActivity.class); startActivity(myIntent); finish(); return; } bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(account, binding.bottomNavView); if (account.mastodon_account.locked) { bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(currentAccount, binding.bottomNavView); if (currentAccount.mastodon_account.locked) { binding.navView.getMenu().findItem(R.id.nav_follow_requests).setVisible(true); } if (account.admin) { if (currentAccount.admin) { binding.navView.getMenu().findItem(R.id.nav_administration).setVisible(true); } if (bottomMenu != null) { Loading Loading @@ -603,8 +601,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt }); } currentInstance = account.instance; currentUserID = account.user_id; currentInstance = currentAccount.instance; currentUserID = currentAccount.user_id; show_boosts = sharedpreferences.getBoolean(getString(R.string.SET_SHOW_BOOSTS) + currentUserID + currentInstance, true); show_replies = sharedpreferences.getBoolean(getString(R.string.SET_SHOW_REPLIES) + currentUserID + currentInstance, true); regex_home = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_HOME) + currentUserID + currentInstance, null); Loading @@ -612,14 +610,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt regex_public = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_PUBLIC) + currentUserID + currentInstance, null); show_art_nsfw = sharedpreferences.getBoolean(getString(R.string.SET_ART_WITH_NSFW) + currentUserID + currentInstance, false); binding.profilePicture.setOnClickListener(v -> binding.drawerLayout.openDrawer(GravityCompat.START)); Helper.loadPP(binding.profilePicture, account); headerMainBinding.accountAcc.setText(String.format("%s@%s", account.mastodon_account.username, account.instance)); if (account.mastodon_account.display_name.isEmpty()) { account.mastodon_account.display_name = account.mastodon_account.acct; } headerMainBinding.accountName.setText(account.mastodon_account.display_name); Helper.loadPP(headerMainBinding.accountProfilePicture, account); MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, account.mastodon_account, MastodonHelper.MediaAccountType.HEADER); Helper.loadPP(binding.profilePicture, currentAccount); headerMainBinding.accountAcc.setText(String.format("%s@%s", currentAccount.mastodon_account.username, currentAccount.instance)); if (currentAccount.mastodon_account.display_name.isEmpty()) { currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct; } headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name); Helper.loadPP(headerMainBinding.accountProfilePicture, currentAccount); MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER); /* * Some general data are loaded when the app starts such; * - Instance info (for limits) Loading @@ -637,14 +635,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt new ViewModelProvider(BaseMainActivity.this).get(AccountsVM.class).getFilters(currentInstance, currentToken) .observe(BaseMainActivity.this, filters -> mainFilters = filters); new ViewModelProvider(BaseMainActivity.this).get(AccountsVM.class).getConnectedAccount(currentInstance, currentToken) .observe(BaseMainActivity.this, account1 -> { .observe(BaseMainActivity.this, mastodonAccount -> { //Initialize static var getCurrentAccount(BaseMainActivity.this); currentAccount.mastodon_account = mastodonAccount; new Thread(() -> { try { //Update account in db new Account(BaseMainActivity.this).insertOrUpdate(getCurrentAccount(BaseMainActivity.this)); getCurrentAccount(BaseMainActivity.this); new Account(BaseMainActivity.this).insertOrUpdate(currentAccount); } catch (DBException e) { e.printStackTrace(); } Loading app/src/main/java/app/fedilab/android/activities/ComposeActivity.java +4 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package app.fedilab.android.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; import static app.fedilab.android.ui.drawer.ComposeAdapter.prepareDraft; Loading Loading @@ -190,7 +191,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana statusDraft.statusDraftList = statuses; } if (account == null) { account = Helper.getCurrentAccount(ComposeActivity.this); account = currentAccount; } if (account == null) { Toasty.error(ComposeActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); Loading Loading @@ -268,7 +269,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana //We change order for mentions //At first place the account that has been mentioned if it's not our statusDraftList.get(0).mentions = new ArrayList<>(); if (!statusReply.account.acct.equalsIgnoreCase(Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.acct)) { if (!statusReply.account.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) { Mention mention = new Mention(); mention.acct = "@" + statusReply.account.acct; mention.url = statusReply.account.url; Loading @@ -279,7 +280,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana //There are other mentions to if (statusReply.mentions != null && statusReply.mentions.size() > 0) { for (Mention mentionTmp : statusReply.mentions) { if (!mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && !mentionTmp.acct.equalsIgnoreCase(Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.acct)) { if (!mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && !mentionTmp.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) { statusDraftList.get(0).mentions.add(mentionTmp); } } Loading app/src/main/java/app/fedilab/android/activities/ContextActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package app.fedilab.android.activities; * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.BaseMainActivity.currentAccount; import static app.fedilab.android.ui.drawer.StatusAdapter.sendAction; import android.content.SharedPreferences; Loading Loading @@ -84,7 +85,7 @@ public class ContextActivity extends BaseActivity { finish(); return; } MastodonHelper.loadPPMastodon(binding.profilePicture, Helper.getCurrentAccount(ContextActivity.this).mastodon_account); MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account); Bundle bundle = new Bundle(); new Thread(() -> { focusedStatus = SpannableHelper.convertStatus(getApplication().getApplicationContext(), focusedStatus); Loading @@ -107,7 +108,7 @@ public class ContextActivity extends BaseActivity { new Thread(() -> { try { new StatusCache(getApplication()).updateIfExists(statusCache); new QuickLoad(getApplication().getApplicationContext()).updateStatus(Helper.getCurrentAccount(ContextActivity.this), status); new QuickLoad(getApplication().getApplicationContext()).updateStatus(currentAccount, status); Handler mainHandler = new Handler(Looper.getMainLooper()); //Update UI Runnable myRunnable = () -> sendAction(ContextActivity.this, Helper.ARG_STATUS_ACTION, status, null); Loading app/src/main/java/app/fedilab/android/activities/CustomSharingActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.activities; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.BaseMainActivity.currentAccount; import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.net.Uri; Loading Loading @@ -99,7 +101,7 @@ public class CustomSharingActivity extends BaseActivity implements OnCustomShari bundle_thumbnailurl = status.account.avatar; } if (!bundle_creator.contains("@")) { bundle_creator = bundle_creator + "@" + Helper.getCurrentAccount(CustomSharingActivity.this).instance; bundle_creator = bundle_creator + "@" + currentAccount.instance; } binding.setCustomSharingTitle.setEllipsize(TextUtils.TruncateAt.END); Loading app/src/main/java/app/fedilab/android/activities/DraftActivity.java +4 −2 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.activities; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.BaseMainActivity.currentAccount; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -80,7 +82,7 @@ public class DraftActivity extends BaseActivity implements StatusDraftAdapter.Dr getSupportActionBar().setDisplayShowHomeEnabled(true); } timelinesVM = new ViewModelProvider(DraftActivity.this).get(TimelinesVM.class); timelinesVM.getDrafts(Helper.getCurrentAccount(DraftActivity.this)) timelinesVM.getDrafts(currentAccount) .observe(DraftActivity.this, this::initializeDraftView); } Loading Loading @@ -176,7 +178,7 @@ public class DraftActivity extends BaseActivity implements StatusDraftAdapter.Dr super.onResume(); //We need to check if drafts changed (ie when coming back from the compose activity) if (statusDrafts != null && timelinesVM != null) { timelinesVM.getDrafts(Helper.getCurrentAccount(DraftActivity.this)) timelinesVM.getDrafts(currentAccount) .observe(DraftActivity.this, this::updateDrafts); } } Loading Loading
app/src/main/java/app/fedilab/android/BaseMainActivity.java +26 −29 Original line number Diff line number Diff line Loading @@ -18,7 +18,6 @@ import static app.fedilab.android.BaseMainActivity.status.DISCONNECTED; import static app.fedilab.android.BaseMainActivity.status.UNKNOWN; import static app.fedilab.android.helper.CacheHelper.deleteDir; import static app.fedilab.android.helper.Helper.PREF_USER_TOKEN; import static app.fedilab.android.helper.Helper.getCurrentAccount; import android.annotation.SuppressLint; import android.content.BroadcastReceiver; Loading Loading @@ -141,13 +140,12 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt public static boolean filterFetched; public static boolean show_boosts, show_replies, show_art_nsfw; public static String regex_home, regex_local, regex_public; public static BaseAccount currentAccount; Fragment currentFragment; private BaseAccount account; private AppBarConfiguration mAppBarConfiguration; private ActivityMainBinding binding; private Pinned pinned; private BottomMenu bottomMenu; private final BroadcastReceiver broadcast_data = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading @@ -158,7 +156,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt redrawPinned(mastodonLists); } if (b.getBoolean(Helper.RECEIVE_REDRAW_BOTTOM, false)) { bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(account, binding.bottomNavView); bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(currentAccount, binding.bottomNavView); if (bottomMenu != null) { //ManageClick on bottom menu items if (binding.bottomNavView.findViewById(R.id.nav_home) != null) { Loading Loading @@ -366,7 +364,7 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt headerMainBinding.accountProfilePicture.setOnClickListener(v -> { Intent intent = new Intent(BaseMainActivity.this, ProfileActivity.class); Bundle b = new Bundle(); b.putSerializable(Helper.ARG_ACCOUNT, account.mastodon_account); b.putSerializable(Helper.ARG_ACCOUNT, currentAccount.mastodon_account); intent.putExtras(b); ActivityOptionsCompat options = ActivityOptionsCompat .makeSceneTransitionAnimation(BaseMainActivity.this, headerMainBinding.instanceInfoContainer, getString(R.string.activity_porfile_pp)); Loading Loading @@ -500,17 +498,17 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt if (itemId == R.id.action_logout_account) { AlertDialog.Builder alt_bld = new AlertDialog.Builder(BaseMainActivity.this, Helper.dialogStyle()); alt_bld.setTitle(R.string.action_logout); if (account.mastodon_account != null && account.mastodon_account.username != null && account.instance != null) { alt_bld.setMessage(getString(R.string.logout_account_confirmation, account.mastodon_account.username, account.instance)); } else if (account.mastodon_account != null && account.mastodon_account.acct != null) { alt_bld.setMessage(getString(R.string.logout_account_confirmation, account.mastodon_account.acct, "")); if (currentAccount.mastodon_account != null && currentAccount.mastodon_account.username != null && currentAccount.instance != null) { alt_bld.setMessage(getString(R.string.logout_account_confirmation, currentAccount.mastodon_account.username, currentAccount.instance)); } else if (currentAccount.mastodon_account != null && currentAccount.mastodon_account.acct != null) { alt_bld.setMessage(getString(R.string.logout_account_confirmation, currentAccount.mastodon_account.acct, "")); } else { alt_bld.setMessage(getString(R.string.logout_account_confirmation, "", "")); } alt_bld.setPositiveButton(R.string.action_logout, (dialog, id) -> { dialog.dismiss(); try { Helper.removeAccount(BaseMainActivity.this, null); Helper.removeAccount(BaseMainActivity.this); } catch (DBException e) { e.printStackTrace(); } Loading @@ -536,28 +534,28 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt }); popup.show(); }); account = null; currentAccount = null; //Update account details new Thread(() -> { try { account = new Account(BaseMainActivity.this).getConnectedAccount(); currentAccount = new Account(BaseMainActivity.this).getConnectedAccount(); } catch (DBException e) { e.printStackTrace(); } Handler mainHandler = new Handler(Looper.getMainLooper()); Runnable myRunnable = () -> { if (account == null) { if (currentAccount == null) { //It is not, the user is redirected to the login page Intent myIntent = new Intent(BaseMainActivity.this, LoginActivity.class); startActivity(myIntent); finish(); return; } bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(account, binding.bottomNavView); if (account.mastodon_account.locked) { bottomMenu = new BottomMenu(BaseMainActivity.this).hydrate(currentAccount, binding.bottomNavView); if (currentAccount.mastodon_account.locked) { binding.navView.getMenu().findItem(R.id.nav_follow_requests).setVisible(true); } if (account.admin) { if (currentAccount.admin) { binding.navView.getMenu().findItem(R.id.nav_administration).setVisible(true); } if (bottomMenu != null) { Loading Loading @@ -603,8 +601,8 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt }); } currentInstance = account.instance; currentUserID = account.user_id; currentInstance = currentAccount.instance; currentUserID = currentAccount.user_id; show_boosts = sharedpreferences.getBoolean(getString(R.string.SET_SHOW_BOOSTS) + currentUserID + currentInstance, true); show_replies = sharedpreferences.getBoolean(getString(R.string.SET_SHOW_REPLIES) + currentUserID + currentInstance, true); regex_home = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_HOME) + currentUserID + currentInstance, null); Loading @@ -612,14 +610,14 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt regex_public = sharedpreferences.getString(getString(R.string.SET_FILTER_REGEX_PUBLIC) + currentUserID + currentInstance, null); show_art_nsfw = sharedpreferences.getBoolean(getString(R.string.SET_ART_WITH_NSFW) + currentUserID + currentInstance, false); binding.profilePicture.setOnClickListener(v -> binding.drawerLayout.openDrawer(GravityCompat.START)); Helper.loadPP(binding.profilePicture, account); headerMainBinding.accountAcc.setText(String.format("%s@%s", account.mastodon_account.username, account.instance)); if (account.mastodon_account.display_name.isEmpty()) { account.mastodon_account.display_name = account.mastodon_account.acct; } headerMainBinding.accountName.setText(account.mastodon_account.display_name); Helper.loadPP(headerMainBinding.accountProfilePicture, account); MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, account.mastodon_account, MastodonHelper.MediaAccountType.HEADER); Helper.loadPP(binding.profilePicture, currentAccount); headerMainBinding.accountAcc.setText(String.format("%s@%s", currentAccount.mastodon_account.username, currentAccount.instance)); if (currentAccount.mastodon_account.display_name.isEmpty()) { currentAccount.mastodon_account.display_name = currentAccount.mastodon_account.acct; } headerMainBinding.accountName.setText(currentAccount.mastodon_account.display_name); Helper.loadPP(headerMainBinding.accountProfilePicture, currentAccount); MastodonHelper.loadProfileMediaMastodon(headerMainBinding.backgroundImage, currentAccount.mastodon_account, MastodonHelper.MediaAccountType.HEADER); /* * Some general data are loaded when the app starts such; * - Instance info (for limits) Loading @@ -637,14 +635,13 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt new ViewModelProvider(BaseMainActivity.this).get(AccountsVM.class).getFilters(currentInstance, currentToken) .observe(BaseMainActivity.this, filters -> mainFilters = filters); new ViewModelProvider(BaseMainActivity.this).get(AccountsVM.class).getConnectedAccount(currentInstance, currentToken) .observe(BaseMainActivity.this, account1 -> { .observe(BaseMainActivity.this, mastodonAccount -> { //Initialize static var getCurrentAccount(BaseMainActivity.this); currentAccount.mastodon_account = mastodonAccount; new Thread(() -> { try { //Update account in db new Account(BaseMainActivity.this).insertOrUpdate(getCurrentAccount(BaseMainActivity.this)); getCurrentAccount(BaseMainActivity.this); new Account(BaseMainActivity.this).insertOrUpdate(currentAccount); } catch (DBException e) { e.printStackTrace(); } Loading
app/src/main/java/app/fedilab/android/activities/ComposeActivity.java +4 −3 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package app.fedilab.android.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; import static app.fedilab.android.ui.drawer.ComposeAdapter.prepareDraft; Loading Loading @@ -190,7 +191,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana statusDraft.statusDraftList = statuses; } if (account == null) { account = Helper.getCurrentAccount(ComposeActivity.this); account = currentAccount; } if (account == null) { Toasty.error(ComposeActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); Loading Loading @@ -268,7 +269,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana //We change order for mentions //At first place the account that has been mentioned if it's not our statusDraftList.get(0).mentions = new ArrayList<>(); if (!statusReply.account.acct.equalsIgnoreCase(Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.acct)) { if (!statusReply.account.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) { Mention mention = new Mention(); mention.acct = "@" + statusReply.account.acct; mention.url = statusReply.account.url; Loading @@ -279,7 +280,7 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana //There are other mentions to if (statusReply.mentions != null && statusReply.mentions.size() > 0) { for (Mention mentionTmp : statusReply.mentions) { if (!mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && !mentionTmp.acct.equalsIgnoreCase(Helper.getCurrentAccount(ComposeActivity.this).mastodon_account.acct)) { if (!mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && !mentionTmp.acct.equalsIgnoreCase(currentAccount.mastodon_account.acct)) { statusDraftList.get(0).mentions.add(mentionTmp); } } Loading
app/src/main/java/app/fedilab/android/activities/ContextActivity.java +3 −2 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ package app.fedilab.android.activities; * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.BaseMainActivity.currentAccount; import static app.fedilab.android.ui.drawer.StatusAdapter.sendAction; import android.content.SharedPreferences; Loading Loading @@ -84,7 +85,7 @@ public class ContextActivity extends BaseActivity { finish(); return; } MastodonHelper.loadPPMastodon(binding.profilePicture, Helper.getCurrentAccount(ContextActivity.this).mastodon_account); MastodonHelper.loadPPMastodon(binding.profilePicture, currentAccount.mastodon_account); Bundle bundle = new Bundle(); new Thread(() -> { focusedStatus = SpannableHelper.convertStatus(getApplication().getApplicationContext(), focusedStatus); Loading @@ -107,7 +108,7 @@ public class ContextActivity extends BaseActivity { new Thread(() -> { try { new StatusCache(getApplication()).updateIfExists(statusCache); new QuickLoad(getApplication().getApplicationContext()).updateStatus(Helper.getCurrentAccount(ContextActivity.this), status); new QuickLoad(getApplication().getApplicationContext()).updateStatus(currentAccount, status); Handler mainHandler = new Handler(Looper.getMainLooper()); //Update UI Runnable myRunnable = () -> sendAction(ContextActivity.this, Helper.ARG_STATUS_ACTION, status, null); Loading
app/src/main/java/app/fedilab/android/activities/CustomSharingActivity.java +3 −1 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.activities; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.BaseMainActivity.currentAccount; import android.content.SharedPreferences; import android.graphics.drawable.ColorDrawable; import android.net.Uri; Loading Loading @@ -99,7 +101,7 @@ public class CustomSharingActivity extends BaseActivity implements OnCustomShari bundle_thumbnailurl = status.account.avatar; } if (!bundle_creator.contains("@")) { bundle_creator = bundle_creator + "@" + Helper.getCurrentAccount(CustomSharingActivity.this).instance; bundle_creator = bundle_creator + "@" + currentAccount.instance; } binding.setCustomSharingTitle.setEllipsize(TextUtils.TruncateAt.END); Loading
app/src/main/java/app/fedilab/android/activities/DraftActivity.java +4 −2 Original line number Diff line number Diff line Loading @@ -14,6 +14,8 @@ package app.fedilab.android.activities; * You should have received a copy of the GNU General Public License along with Fedilab; if not, * see <http://www.gnu.org/licenses>. */ import static app.fedilab.android.BaseMainActivity.currentAccount; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -80,7 +82,7 @@ public class DraftActivity extends BaseActivity implements StatusDraftAdapter.Dr getSupportActionBar().setDisplayShowHomeEnabled(true); } timelinesVM = new ViewModelProvider(DraftActivity.this).get(TimelinesVM.class); timelinesVM.getDrafts(Helper.getCurrentAccount(DraftActivity.this)) timelinesVM.getDrafts(currentAccount) .observe(DraftActivity.this, this::initializeDraftView); } Loading Loading @@ -176,7 +178,7 @@ public class DraftActivity extends BaseActivity implements StatusDraftAdapter.Dr super.onResume(); //We need to check if drafts changed (ie when coming back from the compose activity) if (statusDrafts != null && timelinesVM != null) { timelinesVM.getDrafts(Helper.getCurrentAccount(DraftActivity.this)) timelinesVM.getDrafts(currentAccount) .observe(DraftActivity.this, this::updateDrafts); } } Loading