Working pagers

This commit is contained in:
Thomas 2024-01-11 12:02:22 +01:00
parent 08c1ba943b
commit b052547cc4
6 changed files with 121 additions and 182 deletions

View file

@ -23,7 +23,6 @@ import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.os.Parcel; import android.os.Parcel;
import android.util.Base64; import android.util.Base64;
import android.util.Log;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
@ -83,12 +82,10 @@ public class CachedBundle {
values.put(Sqlite.COL_BUNDLE, serializeBundle(bundle)); values.put(Sqlite.COL_BUNDLE, serializeBundle(bundle));
values.put(Sqlite.COL_CREATED_AT, Helper.dateToString(new Date())); values.put(Sqlite.COL_CREATED_AT, Helper.dateToString(new Date()));
values.put(Sqlite.COL_TYPE, CacheType.ARGS.getValue()); values.put(Sqlite.COL_TYPE, CacheType.ARGS.getValue());
Log.v(Helper.TAG, "insertIntent --> " + currentUser);
if (bundle.containsKey(Helper.ARG_ACCOUNT) && currentUser != null) { if (bundle.containsKey(Helper.ARG_ACCOUNT) && currentUser != null) {
ContentValues valuesAccount = new ContentValues(); ContentValues valuesAccount = new ContentValues();
Bundle bundleAccount = new Bundle(); Bundle bundleAccount = new Bundle();
Account account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT); Account account = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
Log.v(Helper.TAG, "account --> " + account);
if (account != null) { if (account != null) {
bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account); bundleAccount.putSerializable(Helper.ARG_ACCOUNT, account);
valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount)); valuesAccount.put(Sqlite.COL_BUNDLE, serializeBundle(bundleAccount));
@ -130,12 +127,8 @@ public class CachedBundle {
Bundle bundle = null; Bundle bundle = null;
try { try {
CachedBundle cachedBundle = getCachedBundle(String.valueOf(id)); CachedBundle cachedBundle = getCachedBundle(String.valueOf(id));
Log.v(Helper.TAG, "cachedBundle --> " + cachedBundle);
if (cachedBundle != null) { if (cachedBundle != null) {
bundle = cachedBundle.bundle; bundle = cachedBundle.bundle;
if (bundle != null) {
Log.v(Helper.TAG, "bundle.containsKey(Helper.ARG_CACHED_ACCOUNT_ID) --> " + bundle.containsKey(Helper.ARG_CACHED_ACCOUNT_ID));
}
if (bundle != null && bundle.containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) { if (bundle != null && bundle.containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
Account cachedAccount = getCachedAccount(Account, bundle.getString(Helper.ARG_CACHED_ACCOUNT_ID)); Account cachedAccount = getCachedAccount(Account, bundle.getString(Helper.ARG_CACHED_ACCOUNT_ID));
if (cachedAccount != null) { if (cachedAccount != null) {
@ -183,7 +176,6 @@ public class CachedBundle {
if (db == null) { if (db == null) {
throw new DBException("db is null. Wrong initialization."); throw new DBException("db is null. Wrong initialization.");
} }
Log.v(Helper.TAG, "getCachedAccount --> " + account + " -> " + target_id);
if (account == null || target_id == null) { if (account == null || target_id == null) {
return null; return null;
} }
@ -193,9 +185,6 @@ public class CachedBundle {
+ Sqlite.COL_TYPE + " = '" + CacheType.ACCOUNT.getValue() + "' AND " + Sqlite.COL_TYPE + " = '" + CacheType.ACCOUNT.getValue() + "' AND "
+ Sqlite.COL_TARGET_ID + " = '" + target_id + "'", null, null, null, null, "1"); + Sqlite.COL_TARGET_ID + " = '" + target_id + "'", null, null, null, null, "1");
CachedBundle cachedBundle = cursorToCachedBundle(c); CachedBundle cachedBundle = cursorToCachedBundle(c);
if (cachedBundle != null) {
Log.v(Helper.TAG, "cachedBundle.bundle --> " + cachedBundle.bundle);
}
if (cachedBundle != null && cachedBundle.bundle.containsKey(Helper.ARG_ACCOUNT)) { if (cachedBundle != null && cachedBundle.bundle.containsKey(Helper.ARG_ACCOUNT)) {
return (Account) cachedBundle.bundle.getSerializable(Helper.ARG_ACCOUNT); return (Account) cachedBundle.bundle.getSerializable(Helper.ARG_ACCOUNT);
} }

View file

@ -18,8 +18,6 @@ import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -81,21 +79,14 @@ public class FragmentMediaProfile extends Fragment {
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle); new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else { } else {
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) { if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
new Thread(() -> { try {
try { accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID)); } catch (DBException e) {
} catch (DBException e) { e.printStackTrace();
throw new RuntimeException(e); }
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
initializeAfterBundle(getArguments());
};
mainHandler.post(myRunnable);
}).start();
} else {
initializeAfterBundle(getArguments());
} }
initializeAfterBundle(getArguments());
} }
} else { } else {
initializeAfterBundle(null); initializeAfterBundle(null);

View file

@ -22,8 +22,6 @@ import static app.fedilab.android.mastodon.helper.MastodonHelper.ACCOUNTS_PER_CA
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -90,21 +88,14 @@ public class FragmentMastodonAccount extends Fragment {
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle); new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else { } else {
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) { if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
new Thread(() -> { try {
try { accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID)); } catch (DBException e) {
} catch (DBException e) { e.printStackTrace();
throw new RuntimeException(e); }
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
initializeAfterBundle(getArguments());
};
mainHandler.post(myRunnable);
}).start();
} else {
initializeAfterBundle(getArguments());
} }
initializeAfterBundle(getArguments());
} }
} else { } else {
initializeAfterBundle(null); initializeAfterBundle(null);

View file

@ -27,7 +27,6 @@ import android.content.SharedPreferences;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Looper; import android.os.Looper;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -180,7 +179,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
} }
} }
}; };
private boolean bundleInitialized;
private boolean retry_for_home_done; private boolean retry_for_home_done;
private String lemmy_post_id; private String lemmy_post_id;
private boolean checkRemotely; private boolean checkRemotely;
@ -233,10 +231,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
Log.v(Helper.TAG, "onResume bundleInitialized: " + bundleInitialized);
if (!bundleInitialized) {
return;
}
if (!isViewInitialized) { if (!isViewInitialized) {
isViewInitialized = true; isViewInitialized = true;
if (initialStatuses != null) { if (initialStatuses != null) {
@ -370,141 +364,125 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
bundleInitialized = false; timelineType = Timeline.TimeLineEnum.HOME;
binding = FragmentPaginationBinding.inflate(inflater, container, false); binding = FragmentPaginationBinding.inflate(inflater, container, false);
if (getArguments() != null) { if (getArguments() != null) {
long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1); long bundleId = getArguments().getLong(Helper.ARG_INTENT_ID, -1);
Log.v(Helper.TAG, "onCreateView bundleId: " + bundleId);
if (bundleId != -1) { if (bundleId != -1) {
new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle); new CachedBundle(requireActivity()).getBundle(bundleId, currentAccount, this::initializeAfterBundle);
} else { } else {
if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) { if (getArguments().containsKey(Helper.ARG_CACHED_ACCOUNT_ID)) {
new Thread(() -> { try {
try { accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID));
accountTimeline = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID)); } catch (DBException e) {
} catch (DBException e) { e.printStackTrace();
throw new RuntimeException(e); }
}
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = () -> {
initializeAfterBundle(getArguments());
};
mainHandler.post(myRunnable);
}).start();
} else {
initializeAfterBundle(getArguments());
} }
initializeAfterBundle(getArguments());
} }
} }
return binding.getRoot(); return binding.getRoot();
} }
private void initializeAfterBundle(Bundle bundle) { private void initializeAfterBundle(Bundle bundle) {
Log.v(Helper.TAG, "initializeAfterBundle: " + bundle); if (bundle != null) {
new Thread(() -> { timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE);
if (bundle != null) { lemmy_post_id = bundle.getString(Helper.ARG_LEMMY_POST_ID, null);
timelineType = (Timeline.TimeLineEnum) bundle.get(Helper.ARG_TIMELINE_TYPE); list_id = bundle.getString(Helper.ARG_LIST_ID, null);
lemmy_post_id = bundle.getString(Helper.ARG_LEMMY_POST_ID, null); search = bundle.getString(Helper.ARG_SEARCH_KEYWORD, null);
list_id = bundle.getString(Helper.ARG_LIST_ID, null); searchCache = bundle.getString(Helper.ARG_SEARCH_KEYWORD_CACHE, null);
search = bundle.getString(Helper.ARG_SEARCH_KEYWORD, null); pinnedTimeline = (PinnedTimeline) bundle.getSerializable(Helper.ARG_REMOTE_INSTANCE);
searchCache = bundle.getString(Helper.ARG_SEARCH_KEYWORD_CACHE, null);
pinnedTimeline = (PinnedTimeline) bundle.getSerializable(Helper.ARG_REMOTE_INSTANCE);
if (pinnedTimeline != null && pinnedTimeline.remoteInstance != null) { if (pinnedTimeline != null && pinnedTimeline.remoteInstance != null) {
if (pinnedTimeline.remoteInstance.type != RemoteInstance.InstanceType.NITTER) { if (pinnedTimeline.remoteInstance.type != RemoteInstance.InstanceType.NITTER) {
remoteInstance = pinnedTimeline.remoteInstance.host; remoteInstance = pinnedTimeline.remoteInstance.host;
} else { } else {
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
remoteInstance = sharedpreferences.getString(getString(R.string.SET_NITTER_HOST), getString(R.string.DEFAULT_NITTER_HOST)).toLowerCase(); remoteInstance = sharedpreferences.getString(getString(R.string.SET_NITTER_HOST), getString(R.string.DEFAULT_NITTER_HOST)).toLowerCase();
canBeFederated = false;
}
}
if (timelineType == Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC) {
canBeFederated = false; canBeFederated = false;
} }
publicTrendsDomain = bundle.getString(Helper.ARG_REMOTE_INSTANCE_STRING, null);
isViewInitialized = bundle.getBoolean(Helper.ARG_INITIALIZE_VIEW, true);
isNotPinnedTimeline = isViewInitialized;
tagTimeline = (TagTimeline) bundle.getSerializable(Helper.ARG_TAG_TIMELINE);
bubbleTimeline = (BubbleTimeline) bundle.getSerializable(Helper.ARG_BUBBLE_TIMELINE);
if (bundle.containsKey(Helper.ARG_ACCOUNT)) {
accountTimeline = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
}
exclude_replies = !bundle.getBoolean(Helper.ARG_SHOW_REPLIES, true);
checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
show_pinned = bundle.getBoolean(Helper.ARG_SHOW_PINNED, false);
exclude_reblogs = !bundle.getBoolean(Helper.ARG_SHOW_REBLOGS, true);
media_only = bundle.getBoolean(Helper.ARG_SHOW_MEDIA_ONY, false);
viewModelKey = bundle.getString(Helper.ARG_VIEW_MODEL_KEY, "");
minified = bundle.getBoolean(Helper.ARG_MINIFIED, false);
statusReport = (Status) bundle.getSerializable(Helper.ARG_STATUS_REPORT);
initialStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS);
Log.v(Helper.TAG, "accountTimeline: " + accountTimeline);
} }
bundleInitialized = true; if (timelineType == Timeline.TimeLineEnum.TREND_MESSAGE_PUBLIC) {
Handler mainHandler = new Handler(Looper.getMainLooper()); canBeFederated = false;
Runnable myRunnable = () -> { }
timelinesVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, TimelinesVM.class); publicTrendsDomain = bundle.getString(Helper.ARG_REMOTE_INSTANCE_STRING, null);
accountsVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, AccountsVM.class); isViewInitialized = bundle.getBoolean(Helper.ARG_INITIALIZE_VIEW, true);
initialStatuses = null; isNotPinnedTimeline = isViewInitialized;
lockForResumeCall = 0; tagTimeline = (TagTimeline) bundle.getSerializable(Helper.ARG_TAG_TIMELINE);
timelineType = Timeline.TimeLineEnum.HOME; bubbleTimeline = (BubbleTimeline) bundle.getSerializable(Helper.ARG_BUBBLE_TIMELINE);
canBeFederated = true; if (bundle.containsKey(Helper.ARG_ACCOUNT)) {
retry_for_home_done = false; accountTimeline = (Account) bundle.getSerializable(Helper.ARG_ACCOUNT);
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity()); }
boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false); exclude_replies = !bundle.getBoolean(Helper.ARG_SHOW_REPLIES, true);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar); checkRemotely = bundle.getBoolean(Helper.ARG_CHECK_REMOTELY, false);
max_id = statusReport != null ? statusReport.id : null; show_pinned = bundle.getBoolean(Helper.ARG_SHOW_PINNED, false);
offset = 0; exclude_reblogs = !bundle.getBoolean(Helper.ARG_SHOW_REBLOGS, true);
rememberPosition = sharedpreferences.getBoolean(getString(R.string.SET_REMEMBER_POSITION), true); media_only = bundle.getBoolean(Helper.ARG_SHOW_MEDIA_ONY, false);
//Inner marker are only for pinned timelines and main timelines, they have isViewInitialized set to false viewModelKey = bundle.getString(Helper.ARG_VIEW_MODEL_KEY, "");
if (max_id == null && !isViewInitialized && rememberPosition) { minified = bundle.getBoolean(Helper.ARG_MINIFIED, false);
max_id = sharedpreferences.getString(getString(R.string.SET_INNER_MARKER) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance + slug, null); statusReport = (Status) bundle.getSerializable(Helper.ARG_STATUS_REPORT);
} initialStatus = (Status) bundle.getSerializable(Helper.ARG_STATUS);
//Only fragment in main view pager should not have the view initialized }
//AND Only the first fragment will initialize its view
flagLoading = false;
//When visiting a profile without being authenticated timelinesVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, TimelinesVM.class);
if (checkRemotely) { accountsVM = new ViewModelProvider(FragmentMastodonTimeline.this).get(viewModelKey, AccountsVM.class);
String[] acctArray = accountTimeline.acct.split("@"); initialStatuses = null;
if (acctArray.length > 1) { lockForResumeCall = 0;
remoteInstance = acctArray[1];
}
if (remoteInstance != null && remoteInstance.equalsIgnoreCase(currentInstance)) {
checkRemotely = false;
} else if (remoteInstance == null) {
checkRemotely = false;
}
}
if (tagTimeline != null) {
ident = "@T@" + tagTimeline.name;
if (tagTimeline.isART) {
timelineType = Timeline.TimeLineEnum.ART;
}
} else if (bubbleTimeline != null) {
ident = "@B@Bubble";
} else if (list_id != null) {
ident = "@l@" + list_id;
} else if (remoteInstance != null && !checkRemotely) {
if (pinnedTimeline.remoteInstance.type == RemoteInstance.InstanceType.NITTER) {
ident = "@R@" + pinnedTimeline.remoteInstance.host;
} else {
ident = "@R@" + remoteInstance;
}
} else if (search != null) {
ident = "@S@" + search;
} else {
ident = null;
}
if (timelineType != null) {
slug = timelineType != Timeline.TimeLineEnum.ART ? timelineType.getValue() + (ident != null ? "|" + ident : "") : Timeline.TimeLineEnum.TAG.getValue() + (ident != null ? "|" + ident : "");
}
ContextCompat.registerReceiver(requireActivity(), receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION), ContextCompat.RECEIVER_NOT_EXPORTED); canBeFederated = true;
}; retry_for_home_done = false;
mainHandler.post(myRunnable); SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(requireActivity());
}).start(); boolean displayScrollBar = sharedpreferences.getBoolean(getString(R.string.SET_TIMELINE_SCROLLBAR), false);
binding.recyclerView.setVerticalScrollBarEnabled(displayScrollBar);
max_id = statusReport != null ? statusReport.id : null;
offset = 0;
rememberPosition = sharedpreferences.getBoolean(getString(R.string.SET_REMEMBER_POSITION), true);
//Inner marker are only for pinned timelines and main timelines, they have isViewInitialized set to false
if (max_id == null && !isViewInitialized && rememberPosition) {
max_id = sharedpreferences.getString(getString(R.string.SET_INNER_MARKER) + BaseMainActivity.currentUserID + BaseMainActivity.currentInstance + slug, null);
}
//Only fragment in main view pager should not have the view initialized
//AND Only the first fragment will initialize its view
flagLoading = false;
//When visiting a profile without being authenticated
if (checkRemotely) {
String[] acctArray = accountTimeline.acct.split("@");
if (acctArray.length > 1) {
remoteInstance = acctArray[1];
}
if (remoteInstance != null && remoteInstance.equalsIgnoreCase(currentInstance)) {
checkRemotely = false;
} else if (remoteInstance == null) {
checkRemotely = false;
}
}
if (tagTimeline != null) {
ident = "@T@" + tagTimeline.name;
if (tagTimeline.isART) {
timelineType = Timeline.TimeLineEnum.ART;
}
} else if (bubbleTimeline != null) {
ident = "@B@Bubble";
} else if (list_id != null) {
ident = "@l@" + list_id;
} else if (remoteInstance != null && !checkRemotely) {
if (pinnedTimeline.remoteInstance.type == RemoteInstance.InstanceType.NITTER) {
ident = "@R@" + pinnedTimeline.remoteInstance.host;
} else {
ident = "@R@" + remoteInstance;
}
} else if (search != null) {
ident = "@S@" + search;
} else {
ident = null;
}
if (timelineType != null) {
slug = timelineType != Timeline.TimeLineEnum.ART ? timelineType.getValue() + (ident != null ? "|" + ident : "") : Timeline.TimeLineEnum.TAG.getValue() + (ident != null ? "|" + ident : "");
}
ContextCompat.registerReceiver(requireActivity(), receive_action, new IntentFilter(Helper.RECEIVE_STATUS_ACTION), ContextCompat.RECEIVER_NOT_EXPORTED);
} }
/** /**

View file

@ -17,8 +17,6 @@ package app.fedilab.android.mastodon.ui.fragment.timeline;
import static app.fedilab.android.BaseMainActivity.currentAccount; import static app.fedilab.android.BaseMainActivity.currentAccount;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
@ -54,20 +52,15 @@ public class FragmentProfileTimeline extends Fragment {
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
binding = FragmentProfileTimelinesBinding.inflate(inflater, container, false); binding = FragmentProfileTimelinesBinding.inflate(inflater, container, false);
if (getArguments() != null) { if (getArguments() != null) {
new Thread(() -> { String cached_account_id = getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID);
String cached_account_id = getArguments().getString(Helper.ARG_CACHED_ACCOUNT_ID); try {
try { account = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, cached_account_id);
account = new CachedBundle(requireActivity()).getCachedAccount(currentAccount, cached_account_id); } catch (DBException e) {
} catch (DBException e) { e.printStackTrace();
e.printStackTrace(); }
} checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false);
checkRemotely = getArguments().getBoolean(Helper.ARG_CHECK_REMOTELY, false); initializeAfterBundle();
Handler mainHandler = new Handler(Looper.getMainLooper());
Runnable myRunnable = this::initializeAfterBundle;
mainHandler.post(myRunnable);
}).start();
} }
return binding.getRoot(); return binding.getRoot();
} }

View file

@ -15,7 +15,6 @@ package app.fedilab.android.mastodon.ui.pageadapter;
* see <http://www.gnu.org/licenses>. */ * see <http://www.gnu.org/licenses>. */
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.ViewGroup; import android.view.ViewGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -58,8 +57,6 @@ public class FedilabProfilePageAdapter extends FragmentStatePagerAdapter {
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position); bundle.putString(Helper.ARG_VIEW_MODEL_KEY, "FEDILAB_" + position);
FragmentMastodonTimeline fragmentMastodonTimeline; FragmentMastodonTimeline fragmentMastodonTimeline;
Log.v(Helper.TAG, ">>>>>>>>>FedilabProfilePageAdapter: " + account);
Log.v(Helper.TAG, ">>>>>>>>>FedilabProfilePageAdapter ID: " + account.id);
switch (position) { switch (position) {
case 0 -> { case 0 -> {
fragmentMastodonTimeline = new FragmentMastodonTimeline(); fragmentMastodonTimeline = new FragmentMastodonTimeline();