Loading app/src/main/java/app/fedilab/android/activities/ContextActivity.java +0 −2 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import androidx.preference.PreferenceManager; import app.fedilab.android.BaseMainActivity; import app.fedilab.android.R; import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.client.entities.app.QuickLoad; import app.fedilab.android.client.entities.app.StatusCache; import app.fedilab.android.databinding.ActivityConversationBinding; import app.fedilab.android.exception.DBException; Loading Loading @@ -99,7 +98,6 @@ public class ContextActivity extends BaseActivity { new Thread(() -> { try { new StatusCache(getApplication()).updateIfExists(statusCache); 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/client/entities/app/QuickLoad.javadeleted 100644 → 0 +0 −647 File deleted.Preview size limit exceeded, changes collapsed. Show changes app/src/main/java/app/fedilab/android/helper/CacheHelper.java +0 −13 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import java.util.Objects; import app.fedilab.android.client.entities.app.BaseAccount; import app.fedilab.android.client.entities.app.CacheAccount; import app.fedilab.android.client.entities.app.QuickLoad; import app.fedilab.android.client.entities.app.StatusCache; import app.fedilab.android.client.entities.app.StatusDraft; import app.fedilab.android.exception.DBException; Loading @@ -49,11 +48,6 @@ public class CacheHelper { } catch (DBException e) { e.printStackTrace(); } try { count.add(new QuickLoad(context).count(account)); } catch (DBException e) { e.printStackTrace(); } try { count.add(new StatusDraft(context).count(account)); } catch (DBException e) { Loading Loading @@ -126,13 +120,6 @@ public class CacheHelper { e.printStackTrace(); } } if (cacheAccount.clear_other) { try { new QuickLoad(context).deleteForAccount(cacheAccount.account); } catch (DBException e) { e.printStackTrace(); } } if (cacheAccount.clear_drafts) { try { new StatusDraft(context).removeAllDraftFor(cacheAccount.account); Loading app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java +22 −62 Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; Loading @@ -44,9 +42,7 @@ import app.fedilab.android.BaseMainActivity; import app.fedilab.android.R; import app.fedilab.android.client.entities.api.Notification; import app.fedilab.android.client.entities.api.Notifications; import app.fedilab.android.client.entities.api.Pagination; import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.client.entities.app.QuickLoad; import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.MastodonHelper; Loading Loading @@ -279,20 +275,6 @@ public class FragmentMastodonNotification extends Fragment implements Notificati if (binding == null || !isAdded() || getActivity() == null) { return; } new Thread(() -> { QuickLoad quickLoad = new QuickLoad(requireActivity()).getSavedValue(BaseMainActivity.currentUserID, BaseMainActivity.currentInstance, notificationType); if (direction != FragmentMastodonTimeline.DIRECTION.REFRESH && !fetchingMissing && !binding.swipeContainer.isRefreshing() && direction == null && quickLoad != null && quickLoad.notifications != null && quickLoad.notifications.size() > 0) { Notifications notifications = new Notifications(); notifications.notifications = quickLoad.notifications; notifications.pagination = new Pagination(); notifications.pagination.max_id = quickLoad.notifications.get(quickLoad.statuses.size() - 1).id; notifications.pagination.min_id = quickLoad.notifications.get(0).id; Handler mainHandler = new Handler(Looper.getMainLooper()); Runnable myRunnable = () -> initializeNotificationView(notifications); mainHandler.post(myRunnable); } else { Handler mainHandler = new Handler(Looper.getMainLooper()); Runnable myRunnable = () -> { if (!isAdded()) { return; } Loading @@ -315,10 +297,6 @@ public class FragmentMastodonNotification extends Fragment implements Notificati } }); } }; mainHandler.post(myRunnable); } }).start(); } private List<Notification> aggregateNotifications(List<Notification> notifications) { Loading Loading @@ -469,30 +447,12 @@ public class FragmentMastodonNotification extends Fragment implements Notificati @Override public void onDestroyView() { if (mLayoutManager != null) { int position = mLayoutManager.findFirstVisibleItemPosition(); new Thread(() -> { try { new QuickLoad(requireActivity()).storeNotifications(position, user_id, instance, notificationType, notificationList); } catch (Exception ignored) { } }).start(); } LocalBroadcastManager.getInstance(requireActivity()).unregisterReceiver(receive_action); super.onDestroyView(); } @Override public void onPause() { if (mLayoutManager != null) { int position = mLayoutManager.findFirstVisibleItemPosition(); new Thread(() -> { try { new QuickLoad(requireActivity()).storeNotifications(position, user_id, instance, notificationType, notificationList); } catch (Exception ignored) { } }).start(); } super.onPause(); } Loading app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java +161 −212 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ import app.fedilab.android.client.entities.api.Pagination; import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.client.entities.api.Statuses; import app.fedilab.android.client.entities.app.PinnedTimeline; import app.fedilab.android.client.entities.app.QuickLoad; import app.fedilab.android.client.entities.app.RemoteInstance; import app.fedilab.android.client.entities.app.TagTimeline; import app.fedilab.android.client.entities.app.Timeline; Loading Loading @@ -514,15 +513,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. @Override public void onPause() { if (mLayoutManager != null) { int position = mLayoutManager.findFirstVisibleItemPosition(); new Thread(() -> { try { new QuickLoad(requireActivity()).storeTimeline(position, user_id, instance, timelineType, statuses, ident); } catch (Exception ignored) { } }).start(); } storeMarker(); super.onPause(); } Loading @@ -531,15 +521,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. public void onDestroyView() { //Update last read id for home timeline if (isAdded()) { if (mLayoutManager != null) { int position = mLayoutManager.findFirstVisibleItemPosition(); new Thread(() -> { try { new QuickLoad(requireActivity()).storeTimeline(position, user_id, instance, timelineType, statuses, ident); } catch (Exception ignored) { } }).start(); } storeMarker(); } LocalBroadcastManager.getInstance(requireActivity()).unregisterReceiver(receive_action); Loading Loading @@ -699,37 +680,9 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. * @param direction - DIRECTION null if first call, then is set to TOP or BOTTOM depending of scroll */ private void route(DIRECTION direction, boolean fetchingMissing) { new Thread(() -> { if (binding == null || getActivity() == null || !isAdded()) { return; } boolean nitterInstance = false; //For remote instance, we check if it's a Nitter timeline if (timelineType == Timeline.TimeLineEnum.REMOTE) { nitterInstance = pinnedTimeline != null && pinnedTimeline.remoteInstance.type == RemoteInstance.InstanceType.NITTER; } QuickLoad quickLoad = null; //For timelines that can be stored we check if there is a stored TL in db //HOME TL, is excluded and should use its own cache if (!QuickLoad.cannotBeStored(timelineType)) { quickLoad = new QuickLoad(requireActivity()).getSavedValue(BaseMainActivity.currentUserID, BaseMainActivity.currentInstance, timelineType, ident); } if (!nitterInstance && !fetchingMissing && !binding.swipeContainer.isRefreshing() && direction == null && quickLoad != null && quickLoad.statuses != null && quickLoad.statuses.size() > 0) { Statuses statuses = new Statuses(); statuses.statuses = quickLoad.statuses; statuses.pagination = new Pagination(); statuses.pagination.max_id = quickLoad.statuses.get(quickLoad.statuses.size() - 1).id; statuses.pagination.min_id = quickLoad.statuses.get(0).id; Handler mainHandler = new Handler(Looper.getMainLooper()); QuickLoad finalQuickLoad = quickLoad; Runnable myRunnable = () -> initializeStatusesCommonView(statuses, finalQuickLoad.position); mainHandler.post(myRunnable); } else { Handler mainHandler = new Handler(Looper.getMainLooper()); Runnable myRunnable = () -> { if (!isAdded()) { return; } // --- HOME TIMELINE --- if (timelineType == Timeline.TimeLineEnum.HOME) { //for more visibility it's done through loadHomeStrategy method Loading Loading @@ -895,11 +848,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. }); } } }; mainHandler.post(myRunnable); } }).start(); } Loading Loading
app/src/main/java/app/fedilab/android/activities/ContextActivity.java +0 −2 Original line number Diff line number Diff line Loading @@ -37,7 +37,6 @@ import androidx.preference.PreferenceManager; import app.fedilab.android.BaseMainActivity; import app.fedilab.android.R; import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.client.entities.app.QuickLoad; import app.fedilab.android.client.entities.app.StatusCache; import app.fedilab.android.databinding.ActivityConversationBinding; import app.fedilab.android.exception.DBException; Loading Loading @@ -99,7 +98,6 @@ public class ContextActivity extends BaseActivity { new Thread(() -> { try { new StatusCache(getApplication()).updateIfExists(statusCache); 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/client/entities/app/QuickLoad.javadeleted 100644 → 0 +0 −647 File deleted.Preview size limit exceeded, changes collapsed. Show changes
app/src/main/java/app/fedilab/android/helper/CacheHelper.java +0 −13 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import java.util.Objects; import app.fedilab.android.client.entities.app.BaseAccount; import app.fedilab.android.client.entities.app.CacheAccount; import app.fedilab.android.client.entities.app.QuickLoad; import app.fedilab.android.client.entities.app.StatusCache; import app.fedilab.android.client.entities.app.StatusDraft; import app.fedilab.android.exception.DBException; Loading @@ -49,11 +48,6 @@ public class CacheHelper { } catch (DBException e) { e.printStackTrace(); } try { count.add(new QuickLoad(context).count(account)); } catch (DBException e) { e.printStackTrace(); } try { count.add(new StatusDraft(context).count(account)); } catch (DBException e) { Loading Loading @@ -126,13 +120,6 @@ public class CacheHelper { e.printStackTrace(); } } if (cacheAccount.clear_other) { try { new QuickLoad(context).deleteForAccount(cacheAccount.account); } catch (DBException e) { e.printStackTrace(); } } if (cacheAccount.clear_drafts) { try { new StatusDraft(context).removeAllDraftFor(cacheAccount.account); Loading
app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonNotification.java +22 −62 Original line number Diff line number Diff line Loading @@ -20,8 +20,6 @@ import android.content.Intent; import android.content.IntentFilter; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; Loading @@ -44,9 +42,7 @@ import app.fedilab.android.BaseMainActivity; import app.fedilab.android.R; import app.fedilab.android.client.entities.api.Notification; import app.fedilab.android.client.entities.api.Notifications; import app.fedilab.android.client.entities.api.Pagination; import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.client.entities.app.QuickLoad; import app.fedilab.android.databinding.FragmentPaginationBinding; import app.fedilab.android.helper.Helper; import app.fedilab.android.helper.MastodonHelper; Loading Loading @@ -279,20 +275,6 @@ public class FragmentMastodonNotification extends Fragment implements Notificati if (binding == null || !isAdded() || getActivity() == null) { return; } new Thread(() -> { QuickLoad quickLoad = new QuickLoad(requireActivity()).getSavedValue(BaseMainActivity.currentUserID, BaseMainActivity.currentInstance, notificationType); if (direction != FragmentMastodonTimeline.DIRECTION.REFRESH && !fetchingMissing && !binding.swipeContainer.isRefreshing() && direction == null && quickLoad != null && quickLoad.notifications != null && quickLoad.notifications.size() > 0) { Notifications notifications = new Notifications(); notifications.notifications = quickLoad.notifications; notifications.pagination = new Pagination(); notifications.pagination.max_id = quickLoad.notifications.get(quickLoad.statuses.size() - 1).id; notifications.pagination.min_id = quickLoad.notifications.get(0).id; Handler mainHandler = new Handler(Looper.getMainLooper()); Runnable myRunnable = () -> initializeNotificationView(notifications); mainHandler.post(myRunnable); } else { Handler mainHandler = new Handler(Looper.getMainLooper()); Runnable myRunnable = () -> { if (!isAdded()) { return; } Loading @@ -315,10 +297,6 @@ public class FragmentMastodonNotification extends Fragment implements Notificati } }); } }; mainHandler.post(myRunnable); } }).start(); } private List<Notification> aggregateNotifications(List<Notification> notifications) { Loading Loading @@ -469,30 +447,12 @@ public class FragmentMastodonNotification extends Fragment implements Notificati @Override public void onDestroyView() { if (mLayoutManager != null) { int position = mLayoutManager.findFirstVisibleItemPosition(); new Thread(() -> { try { new QuickLoad(requireActivity()).storeNotifications(position, user_id, instance, notificationType, notificationList); } catch (Exception ignored) { } }).start(); } LocalBroadcastManager.getInstance(requireActivity()).unregisterReceiver(receive_action); super.onDestroyView(); } @Override public void onPause() { if (mLayoutManager != null) { int position = mLayoutManager.findFirstVisibleItemPosition(); new Thread(() -> { try { new QuickLoad(requireActivity()).storeNotifications(position, user_id, instance, notificationType, notificationList); } catch (Exception ignored) { } }).start(); } super.onPause(); } Loading
app/src/main/java/app/fedilab/android/ui/fragment/timeline/FragmentMastodonTimeline.java +161 −212 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ import app.fedilab.android.client.entities.api.Pagination; import app.fedilab.android.client.entities.api.Status; import app.fedilab.android.client.entities.api.Statuses; import app.fedilab.android.client.entities.app.PinnedTimeline; import app.fedilab.android.client.entities.app.QuickLoad; import app.fedilab.android.client.entities.app.RemoteInstance; import app.fedilab.android.client.entities.app.TagTimeline; import app.fedilab.android.client.entities.app.Timeline; Loading Loading @@ -514,15 +513,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. @Override public void onPause() { if (mLayoutManager != null) { int position = mLayoutManager.findFirstVisibleItemPosition(); new Thread(() -> { try { new QuickLoad(requireActivity()).storeTimeline(position, user_id, instance, timelineType, statuses, ident); } catch (Exception ignored) { } }).start(); } storeMarker(); super.onPause(); } Loading @@ -531,15 +521,6 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. public void onDestroyView() { //Update last read id for home timeline if (isAdded()) { if (mLayoutManager != null) { int position = mLayoutManager.findFirstVisibleItemPosition(); new Thread(() -> { try { new QuickLoad(requireActivity()).storeTimeline(position, user_id, instance, timelineType, statuses, ident); } catch (Exception ignored) { } }).start(); } storeMarker(); } LocalBroadcastManager.getInstance(requireActivity()).unregisterReceiver(receive_action); Loading Loading @@ -699,37 +680,9 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. * @param direction - DIRECTION null if first call, then is set to TOP or BOTTOM depending of scroll */ private void route(DIRECTION direction, boolean fetchingMissing) { new Thread(() -> { if (binding == null || getActivity() == null || !isAdded()) { return; } boolean nitterInstance = false; //For remote instance, we check if it's a Nitter timeline if (timelineType == Timeline.TimeLineEnum.REMOTE) { nitterInstance = pinnedTimeline != null && pinnedTimeline.remoteInstance.type == RemoteInstance.InstanceType.NITTER; } QuickLoad quickLoad = null; //For timelines that can be stored we check if there is a stored TL in db //HOME TL, is excluded and should use its own cache if (!QuickLoad.cannotBeStored(timelineType)) { quickLoad = new QuickLoad(requireActivity()).getSavedValue(BaseMainActivity.currentUserID, BaseMainActivity.currentInstance, timelineType, ident); } if (!nitterInstance && !fetchingMissing && !binding.swipeContainer.isRefreshing() && direction == null && quickLoad != null && quickLoad.statuses != null && quickLoad.statuses.size() > 0) { Statuses statuses = new Statuses(); statuses.statuses = quickLoad.statuses; statuses.pagination = new Pagination(); statuses.pagination.max_id = quickLoad.statuses.get(quickLoad.statuses.size() - 1).id; statuses.pagination.min_id = quickLoad.statuses.get(0).id; Handler mainHandler = new Handler(Looper.getMainLooper()); QuickLoad finalQuickLoad = quickLoad; Runnable myRunnable = () -> initializeStatusesCommonView(statuses, finalQuickLoad.position); mainHandler.post(myRunnable); } else { Handler mainHandler = new Handler(Looper.getMainLooper()); Runnable myRunnable = () -> { if (!isAdded()) { return; } // --- HOME TIMELINE --- if (timelineType == Timeline.TimeLineEnum.HOME) { //for more visibility it's done through loadHomeStrategy method Loading Loading @@ -895,11 +848,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter. }); } } }; mainHandler.post(myRunnable); } }).start(); } Loading