diff options
30 files changed, 896 insertions, 613 deletions
diff --git a/app/src/main/java/app/fedilab/android/BaseMainActivity.java b/app/src/main/java/app/fedilab/android/BaseMainActivity.java index 850de4dec..ff07e4b1e 100644 --- a/app/src/main/java/app/fedilab/android/BaseMainActivity.java +++ b/app/src/main/java/app/fedilab/android/BaseMainActivity.java @@ -163,6 +163,7 @@ import app.fedilab.android.mastodon.client.entities.api.Tag; import app.fedilab.android.mastodon.client.entities.app.Account; import app.fedilab.android.mastodon.client.entities.app.BaseAccount; import app.fedilab.android.mastodon.client.entities.app.BottomMenu; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.client.entities.app.MutedAccounts; import app.fedilab.android.mastodon.client.entities.app.Pinned; import app.fedilab.android.mastodon.client.entities.app.PinnedTimeline; @@ -659,16 +660,26 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt Status status = (Status) bundle.getSerializable(Helper.INTENT_TARGETED_STATUS); if (account != null) { Intent intentAccount = new Intent(activity, ProfileActivity.class); - Bundle b = new Bundle(); - b.putSerializable(Helper.ARG_ACCOUNT, account); - intentAccount.putExtras(b); - intentAccount.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - activity.startActivity(intentAccount); + Bundle args = new Bundle(); + args.putSerializable(Helper.ARG_ACCOUNT, account); + new CachedBundle(activity).insertBundle(args, bundleId -> { + Bundle bundleCached = new Bundle(); + bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId); + intentAccount.putExtras(bundleCached); + intentAccount.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + activity.startActivity(intentAccount); + }); } else if (status != null) { Intent intentContext = new Intent(activity, ContextActivity.class); - intentContext.putExtra(Helper.ARG_STATUS, status); - intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - activity.startActivity(intentContext); + Bundle args = new Bundle(); + args.putSerializable(Helper.ARG_STATUS, status); + new CachedBundle(activity).insertBundle(args, bundleId -> { + Bundle bundleCached = new Bundle(); + bundleCached.putLong(Helper.ARG_INTENT_ID, bundleId); + intentContext.putExtras(bundleCached); + intentContext.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + activity.startActivity(intentContext); + }); } } final Handler handler = new Handler(); @@ -1035,11 +1046,15 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt public void federatedAccount(app.fedilab.android.mastodon.client.entities.api.Account account) { if (account != null) { Intent intent = new Intent(activity, ProfileActivity.class); - Bundle b = new Bundle(); - b.putSerializable(Helper.ARG_ACCOUNT, account); - intent.putExtras(b); - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - activity.startActivity(intent); + Bundle args = new Bundle(); + args.putSerializable(Helper.ARG_ACCOUNT, account); + new CachedBundle(activity).insertBundle(args, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intent.putExtras(bundle); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + activity.startActivity(intent); + }); } else { Toasty.error(activity, activity.getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); } @@ -1418,10 +1433,15 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt headerMainBinding.instanceInfo.setOnClickListener(v -> (new InstanceHealthActivity()).show(getSupportFragmentManager(), null)); headerMainBinding.accountProfilePicture.setOnClickListener(v -> { Intent intent = new Intent(BaseMainActivity.this, ProfileActivity.class); - Bundle b = new Bundle(); - b.putSerializable(Helper.ARG_ACCOUNT, currentAccount.mastodon_account); - intent.putExtras(b); - startActivity(intent); + Bundle args = new Bundle(); + args.putSerializable(Helper.ARG_ACCOUNT, currentAccount.mastodon_account); + new CachedBundle(BaseMainActivity.this).insertBundle(args, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intent.putExtras(bundle); + startActivity(intent); + }); + }); headerMainBinding.accountAcc.setOnClickListener(v -> headerMainBinding.changeAccount.callOnClick()); diff --git a/app/src/main/java/app/fedilab/android/activities/AboutActivity.java b/app/src/main/java/app/fedilab/android/activities/AboutActivity.java index 209351fc8..ee6862df3 100644 --- a/app/src/main/java/app/fedilab/android/activities/AboutActivity.java +++ b/app/src/main/java/app/fedilab/android/activities/AboutActivity.java @@ -40,6 +40,7 @@ import app.fedilab.android.mastodon.activities.BaseBarActivity; import app.fedilab.android.mastodon.activities.ProfileActivity; import app.fedilab.android.mastodon.client.entities.api.Account; import app.fedilab.android.mastodon.client.entities.api.Status; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.helper.CrossActionHelper; import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.MastodonHelper; @@ -119,10 +120,14 @@ public class AboutActivity extends BaseBarActivity { binding.accountUn.setText(account.acct); binding.accountPp.setOnClickListener(v -> { Intent intent = new Intent(AboutActivity.this, ProfileActivity.class); - Bundle b = new Bundle(); - b.putSerializable(Helper.ARG_ACCOUNT, account); - intent.putExtras(b); - startActivity(intent); + Bundle args = new Bundle(); + args.putSerializable(Helper.ARG_ACCOUNT, account); + new CachedBundle(AboutActivity.this).insertBundle(args, bundleId -> { + Bundle bundle = new Bundle(); + bundle.putLong(Helper.ARG_INTENT_ID, bundleId); + intent.putExtras(bundle); + startActivity(intent); + }); }); AccountsVM accountsVM = new ViewModelProvider(AboutActivity.this).get(AccountsVM.class); List<String> ids = new ArrayList<>(); diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/AccountReportActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/AccountReportActivity.java index 8a1b2b083..46c3e9d3a 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/AccountReportActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/AccountReportActivity.java @@ -35,6 +35,7 @@ import app.fedilab.android.databinding.ActivityAdminReportBinding; import app.fedilab.android.mastodon.client.entities.api.Status; import app.fedilab.android.mastodon.client.entities.api.admin.AdminAccount; import app.fedilab.android.mastodon.client.entities.api.admin.AdminReport; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.helper.Helper; import app.fedilab.android.mastodon.helper.ThemeHelper; import app.fedilab.android.mastodon.ui.drawer.StatusReportAdapter; @@ -48,7 +49,7 @@ public class AccountReportActivity extends BaseBarActivity { private AdminReport report; private ActivityAdminReportBinding binding; private AdminVM adminVM; - + private AdminAccount targeted_account; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -61,12 +62,21 @@ public class AccountReportActivity extends BaseBarActivity { } report = null; - AdminAccount targeted_account = null; - Bundle b = getIntent().getExtras(); - if (b != null) { - account_id = b.getString(Helper.ARG_ACCOUNT_ID, null); - targeted_account = (AdminAccount) b.getSerializable(Helper.ARG_ACCOUNT); - report = (AdminReport) b.getSerializable(Helper.ARG_REPORT); + targeted_account = null; + Bundle args = getIntent().getExtras(); + if (args != null) { + long bundleId = args.getLong(Helper.ARG_INTENT_ID, -1); + new CachedBundle(AccountReportActivity.this).getBundle(bundleId, this::initializeAfterBundle); + } else { + initializeAfterBundle(null); + } + } + private void initializeAfterBundle(Bundle bundle) { + + if(bundle != null) { + account_id = bundle.getString(Helper.ARG_ACCOUNT_ID, null); + targeted_account = (AdminAccount) bundle.getSerializable(Helper.ARG_ACCOUNT); + report = (AdminReport) bundle.getSerializable(Helper.ARG_REPORT); } binding.allow.getBackground().setColorFilter(ThemeHelper.getAttColor(this, R.attr.colorPrimary), PorterDuff.Mode.MULTIPLY); @@ -103,7 +113,6 @@ public class AccountReportActivity extends BaseBarActivity { account_id = targeted_account.username; } - } private void fillReport(AdminAccount accountAdmin, actionType type) { diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/ActionActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/ActionActivity.java index a943e6dd8..d3c89017e 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/ActionActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/ActionActivity.java @@ -100,24 +100,12 @@ public class ActionActivity extends BaseBarActivity { } switch (type) { - case MUTED_TIMELINE: - setTitle(R.string.muted_menu); - break; - case FAVOURITE_TIMELINE: - setTitle(R.string.favourite); - break; - case BLOCKED_TIMELINE: - setTitle(R.string.blocked_menu); - break; - case BOOKMARK_TIMELINE: - setTitle(R.string.bookmarks); - break; - case BLOCKED_DOMAIN_TIMELINE: - setTitle(R.string.blocked_domains); - break; - case MUTED_TIMELINE_HOME: - setTitle(R.string.muted_menu_home); - break; + case MUTED_TIMELINE -> setTitle(R.string.muted_menu); + case FAVOURITE_TIMELINE -> setTitle(R.string.favourite); + case BLOCKED_TIMELINE -> setTitle(R.string.blocked_menu); + case BOOKMARK_TIMELINE -> setTitle(R.string.bookmarks); + case BLOCKED_DOMAIN_TIMELINE -> setTitle(R.string.blocked_domains); + case MUTED_TIMELINE_HOME -> setTitle(R.string.muted_menu_home); } } diff --git a/app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java b/app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java index 6d9c24d59..36b9082e3 100644 --- a/app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java +++ b/app/src/main/java/app/fedilab/android/mastodon/activities/ComposeActivity.java @@ -88,6 +88,7 @@ import app.fedilab.android.mastodon.client.entities.api.Mention; import app.fedilab.android.mastodon.client.entities.api.ScheduledStatus; import app.fedilab.android.mastodon.client.entities.api.Status; import app.fedilab.android.mastodon.client.entities.app.BaseAccount; +import app.fedilab.android.mastodon.client.entities.app.CachedBundle; import app.fedilab.android.mastodon.client.entities.app.StatusDraft; import app.fedilab.android.mastodon.exception.DBException; import app.fedilab.android.mastodon.helper.DividerDecorationSimple; @@ -484,260 +485,274 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana binding.title.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18 * 1.1f / scale); statusList = new ArrayList<>(); Bundle b = getIntent().getExtras(); - if (b != null) { - statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY); - statusQuoted = (Status) b.getSerializable(Helper.ARG_QUOTED_MESSAGE); - statusDraft = (StatusDraft) b.getSerializable(Helper.ARG_STATUS_DRAFT); - scheduledStatus = (ScheduledStatus) b.getSerializable(Helper.ARG_STATUS_SCHEDULED); - statusReplyId = b.getString(Helper.ARG_STATUS_REPLY_ID); - statusMention = (Status) b.getSerializable(Helper.ARG_STATUS_MENTION); - account = (BaseAccount) b.getSerializable(Helper.ARG_ACCOUNT); - if (account == null) { - account = currentAccount; - } - editMessageId = b.getString(Helper.ARG_EDIT_STATUS_ID, null); - instance = b.getString(Helper.ARG_INSTANCE, null); - token = b.getString(Helper.ARG_TOKEN, null); - 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; + if(b != null) { + long bundleId = b.getLong(Helper.ARG_INTENT_ID, -1); + if(bundleId != -1 ) { + new CachedBundle(ComposeActivity.this).getBundle(bundleId, this::initializeAfterBundle); + } else { + initializeAfterBundle(b); } - mentionBooster = (Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER); - accountMention = (Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION); - //Shared elements - sharedAttachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ATTACHMENTS); - sharedUrlMedia = b.getString(Helper.ARG_SHARE_URL_MEDIA); - sharedSubject = b.getString(Helper.ARG_SHARE_SUBJECT, null); - sharedContent = b.getString(Helper.ARG_SHARE_CONTENT, null); - sharedTitle = b.getString(Helper.ARG_SHARE_TITLE, null); - sharedDescription = b.getString(Helper.ARG_SHARE_DESCRIPTION, null); - shareURL = b.getString(Helper.ARG_SHARE_URL, null); } + } - if (sharedContent != null && shareURL != null && sharedContent.compareTo(shareURL) == 0) { - sharedContent = ""; - } - if (sharedTitle != null && sharedSubject != null && sharedSubject.length() > sharedTitle.length()) { - sharedTitle = sharedSubject; - } - //Edit a scheduled status from server - if (scheduledStatus != null) { - statusDraft = new StatusDraft(); - List<Status> statuses = new ArrayList<>(); - Status status = new Status(); - status.id = Helper.generateIdString(); - status.text = scheduledStatus.params.text; - status.in_reply_to_id = scheduledStatus.params.in_reply_to_id; - status.poll = scheduledStatus.params.poll; - - if (scheduledStatus.params.media_ids != null && scheduledStatus.params.media_ids.size() > 0) { - status.media_attachments = new ArrayList<>(); - new Thread(() -> { - StatusesVM statusesVM = new ViewModelProvider(ComposeActivity.this).get(StatusesVM.class); - for (String attachmentId : scheduledStatus.params.media_ids) { - statusesVM.getAttachment(instance, token, attachmentId) - .observe(ComposeActivity.this, attachment -> status.media_attachments.add(attachment)); - } - }).start(); - } - status.sensitive = scheduledStatus.params.sensitive; - status.spoiler_text = scheduledStatus.params.spoiler_text; - status.visibility = scheduledStatus.params.visibility; - statusDraft.statusDraftList = statuses; - } - if (account == null) { - account = currentAccount; - } - if (account == null) { - Toasty.error(ComposeActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); - finish(); - return; - } - if (instance == null) { - instance = account.instance; - } - if (token == null) { - token = account.token; - } - if (emojis == null || !emojis.containsKey(instance)) { - new Thread(() -> { - try { - emojis.put(instance, new EmojiInstance(ComposeActivity.this).getEmojiList(instance)); - } catch (DBException e) { - e.printStackTrace(); + private void initializeAfterBundle(Bundle b) { + SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(this); + new Thread(()->{ + if (b != null) { + statusReply = (Status) b.getSerializable(Helper.ARG_STATUS_REPLY); + statusQuoted = (Status) b.getSerializable(Helper.ARG_QUOTED_MESSAGE); + statusDraft = (StatusDraft) b.getSerializable(Helper.ARG_STATUS_DRAFT); + scheduledStatus = (ScheduledStatus) b.getSerializable(Helper.ARG_STATUS_SCHEDULED); + statusReplyId = b.getString(Helper.ARG_STATUS_REPLY_ID); + statusMention = (Status) b.getSerializable(Helper.ARG_STATUS_MENTION); + account = (BaseAccount) b.getSerializable(Helper.ARG_ACCOUNT); + if (account == null) { + account = currentAccount; } - }).start(); - } - if (MainActivity.instanceInfo == null) { - String instanceInfo = sharedpreferences.getString(getString(R.string.INSTANCE_INFO) + instance, null); - if (instanceInfo != null) { - MainActivity.instanceInfo = Instance.restore(instanceInfo); - } - } - - StatusesVM statusesVM = new ViewModelProvider(ComposeActivity.this).get(StatusesVM.class); - //Empty compose - List<Status> statusDraftList = new ArrayList<>(); - Status status = new Status(); - status.id = Helper.generateIdString(); - if (statusQuoted != null) { - status.quote_id = statusQuoted.id; - } - statusDraftList.add(status); - - if (statusReplyId != null && statusDraft != null) {//Delete and redraft - statusesVM.getStatus(currentInstance, BaseMainActivity.currentToken, statusReplyId) - .observe(ComposeActivity.this, status1 -> { - if (status1 != null) { - statusesVM.getContext(currentInstance, BaseMainActivity.currentToken, statusReplyId) - .observe(ComposeActivity.this, statusContext -> { - if (statusContext != null) { - initializeContextRedraftView(statusContext, status1); - } else { - Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error)); - } - }); - } else { - Helper.sendToastMessage(getApplication(), Helper.RECEIVE_TOAST_TYPE_ERROR, getString(R.string.toast_error)); - } - }); - } else if (statusDraft != null) {//Restore a draft with all messages - restoredDraft = true; - if (statusDraft.statusReplyList != null) { - statusList.addAll(statusDraft.statusReplyList); - binding.recyclerView.addItemDecoration(new DividerDecorationSimple(ComposeActivity.this, statusList)); - } - int statusCount = statusList.size(); - statusList.addAll(statusDraft.statusDraftList); - composeAdapter = new ComposeAdapter(statusList, statusCount, account, accountMention, visibility, editMessageId); - composeAdapter.mediaDescriptionCallBack = this; - composeAdapter.manageDrafts = this; - composeAdapter.promptDraftListener = this; - LinearLayoutManager mLayoutManager = new LinearLayoutManager(ComposeActivity.this); - binding.recyclerView.setLayoutManager(mLayoutManager); - binding.recyclerView.setAdapter(composeAdapter); - binding.recyclerView.scrollToPosition(composeAdapter.getItemCount() - 1); - - } else if (statusReply != null) { - statusList.add(statusReply); - int statusCount = statusList.size(); - statusDraftList.get(0).in_reply_to_id = statusReply.id; - //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 != null && account.mastodon_account != null && !statusReply.account.acct.equalsIgnoreCase(account.mastodon_account.acct)) { - Mention mention = new Mention(); - mention.acct = "@" + statusReply.account.acct; - mention.url = statusReply.account.url; - mention.username = statusReply.account.username; - statusDraftList.get(0).mentions.add(mention); - } - - - //There are other mentions to - if (statusReply.mentions != null && statusReply.mentions.size() > 0) { - for (Mention mentionTmp : statusReply.mentions) { - if (statusReply.account.acct != null && !mentionTmp.acct.equalsIgnoreCase(statusReply.account.acct) && account.mastodon_account != null && !mentionTmp.acct.equalsIgnoreCase(account.mastodon_account.acct)) { - statusDraftList.get(0).mentions.add(mentionTmp); - } + editMessageId = b.getString(Helper.ARG_EDIT_STATUS_ID, null); + instance = b.getString(Helper.ARG_INSTANCE, null); + token = b.getString(Helper.ARG_TOKEN, null); + 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; } + mentionBooster = (Account) b.getSerializable(Helper.ARG_MENTION_BOOSTER); + accountMention = (Account) b.getSerializable(Helper.ARG_ACCOUNT_MENTION); + //Shared elements + sharedAttachments = (ArrayList<Attachment>) b.getSerializable(Helper.ARG_MEDIA_ATTACHMENTS); + sharedUrlMedia = b.getString(Helper.ARG_SHARE_URL_MEDIA); + sharedSubject = b.getString(Helper.ARG_SHARE_SUBJECT, null); + sharedContent = b.getString(Helper.ARG_SHARE_CONTENT, null); + sharedTitle = b.getString(Helper.ARG_SHARE_TITLE, null); + sharedDescription = b.getString(Helper.ARG_SHARE_DESCRIPTION, null); + shareURL = b.getString(Helper.ARG_SHARE_URL, null); } - if (mentionBooster != null) { - Mention mention = new Mention(); - mention.acct = mentionBooster.acct; - mention.url = mentionBooster.url; - mention.username = mentionBooster.username; - boolean present = false; - for (Mention mentionTmp : statusDraftList.get(0).mentions) { - if (mentionTmp.acct.equalsIgnoreCase(mentionBooster.acct)) { - present = true; - break; + Handler mainHandler = new Handler(Looper.getMainLooper()); + Runnable myRunnable = () -> { + if (sharedContent != null && shareURL != null && sharedContent.compareTo(shareURL) == 0) { + sharedContent = ""; + } + if (sharedTitle != null && sharedSubject != null && sharedSubject.length() > sharedTitle.length()) { + sharedTitle = sharedSubject; + } + //Edit a scheduled status from server + if (scheduledStatus != null) { + statusDraft = new StatusDraft(); + List<Status> statuses = new ArrayList<>(); + Status status = new Status(); + status.id = Helper.generateIdString(); + status.text = scheduledStatus.params.text; + status.in_reply_to_id = scheduledStatus.params.in_reply_to_id; + status.poll = scheduledStatus.params.poll; + + if (scheduledStatus.params.media_ids != null && scheduledStatus.params.media_ids.size() > 0) { + status.media_attachments = new ArrayList<>(); + new Thread(() -> { + StatusesVM statusesVM = new ViewModelProvider(ComposeActivity.this).get(StatusesVM.class); + for (String attachmentId : scheduledStatus.params.media_ids) { + statusesVM.getAttachment(instance, token, attachmentId) + .observe(ComposeActivity.this, attachment -> status.media_attachments.add(attachment)); + } + }).start(); } + status.sensitive = scheduledStatus.params.sensitive; + status.spoiler_text = scheduledStatus.params.spoiler_text; + status.visibility = scheduledStatus.params.visibility; + statusDraft.statusDraftList = statuses; } - if (!present) { - statusDraftList.get(0).mentions.add(mention); + if (account == null) { + account = currentAccount; } - } - if (statusReply.spoiler_text != null) { - statusDraftList.get(0).spoiler_text = statusReply.spoiler_text; - if (statusReply.spoiler_text.trim().length() > 0) { - statusDraftList.get(0).spoilerChecked = true; + if (account == null) { + Toasty.error(ComposeActivity.this, getString(R.string.toast_error), Toasty.LENGTH_SHORT).show(); + finish(); + return; } - } - if (statusReply.language != null && !statusReply.language.isEmpty()) { - Set<String> storedLanguages = sharedpreferences.getStringSet(getString(R.string.SET_SELECTED_LANGUAGE), null); - if (storedLanguages == null || storedLanguages.size() == 0) { - statusDraftList.get(0).language = statusReply.language; - } else { - if (storedLanguages.contains(statusReply.language)) { - statusDraftList.get(0).language = statusReply.language; - } else { - String currentCode = sharedpreferences.getString(getString(R.string.SET_COMPOSE_LANGUAGE) + account.user_id + account.instance, Locale.getDefault().getLanguage()); - if (currentCode.isEmpty()) { - currentCode = "EN"; + if (instance == null) { + instance = account.instance; + } + if (token == null) { + token = account.token; + } + if (emojis == null || !emojis.containsKey(instance)) { + new Thread(() -> { + try { + emojis.put(instance, new EmojiInstance(ComposeActivity.this).getEmojiList(instance)); + } catch (DBException e) { + e.printStackTrace(); } - statusDraftList.get(0).language = currentCode; + }).start(); + } + if (MainActivity.instanceInfo == null) { + String instanceInfo = sharedprefe |