mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 06:37:30 +00:00
parent
4cfb8e6a41
commit
ce764ec82f
@ -56,6 +56,7 @@ import awais.instagrabber.models.PostsLayoutPreferences;
|
|||||||
import awais.instagrabber.models.enums.PostItemType;
|
import awais.instagrabber.models.enums.PostItemType;
|
||||||
import awais.instagrabber.repositories.responses.Media;
|
import awais.instagrabber.repositories.responses.Media;
|
||||||
import awais.instagrabber.repositories.responses.saved.SavedCollection;
|
import awais.instagrabber.repositories.responses.saved.SavedCollection;
|
||||||
|
import awais.instagrabber.utils.AppExecutors;
|
||||||
import awais.instagrabber.utils.Constants;
|
import awais.instagrabber.utils.Constants;
|
||||||
import awais.instagrabber.utils.CookieUtils;
|
import awais.instagrabber.utils.CookieUtils;
|
||||||
import awais.instagrabber.utils.DownloadUtils;
|
import awais.instagrabber.utils.DownloadUtils;
|
||||||
@ -450,7 +451,9 @@ public class CollectionPostsFragment extends Fragment implements SwipeRefreshLay
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSwipeRefreshState() {
|
private void updateSwipeRefreshState() {
|
||||||
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching());
|
AppExecutors.INSTANCE.getMainThread().execute(() ->
|
||||||
|
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void navigateToProfile(final String username) {
|
private void navigateToProfile(final String username) {
|
||||||
|
@ -67,7 +67,7 @@ import awais.instagrabber.utils.TextUtils;
|
|||||||
import awais.instagrabber.utils.Utils;
|
import awais.instagrabber.utils.Utils;
|
||||||
import awais.instagrabber.webservices.GraphQLRepository;
|
import awais.instagrabber.webservices.GraphQLRepository;
|
||||||
import awais.instagrabber.webservices.ServiceCallback;
|
import awais.instagrabber.webservices.ServiceCallback;
|
||||||
import awais.instagrabber.webservices.StoriesRepository;
|
//import awais.instagrabber.webservices.StoriesRepository;
|
||||||
import awais.instagrabber.webservices.TagsService;
|
import awais.instagrabber.webservices.TagsService;
|
||||||
import kotlinx.coroutines.Dispatchers;
|
import kotlinx.coroutines.Dispatchers;
|
||||||
|
|
||||||
@ -87,11 +87,11 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
private String hashtag;
|
private String hashtag;
|
||||||
private Hashtag hashtagModel = null;
|
private Hashtag hashtagModel = null;
|
||||||
private ActionMode actionMode;
|
private ActionMode actionMode;
|
||||||
private StoriesRepository storiesRepository;
|
// private StoriesRepository storiesRepository;
|
||||||
private boolean isLoggedIn;
|
private boolean isLoggedIn;
|
||||||
private TagsService tagsService;
|
private TagsService tagsService;
|
||||||
private GraphQLRepository graphQLRepository;
|
private GraphQLRepository graphQLRepository;
|
||||||
private boolean storiesFetching;
|
// private boolean storiesFetching;
|
||||||
private Set<Media> selectedFeedModels;
|
private Set<Media> selectedFeedModels;
|
||||||
private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_HASHTAG_POSTS_LAYOUT);
|
private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_HASHTAG_POSTS_LAYOUT);
|
||||||
private LayoutHashtagDetailsBinding hashtagDetailsBinding;
|
private LayoutHashtagDetailsBinding hashtagDetailsBinding;
|
||||||
@ -280,7 +280,7 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
final String cookie = settingsHelper.getString(Constants.COOKIE);
|
final String cookie = settingsHelper.getString(Constants.COOKIE);
|
||||||
isLoggedIn = !TextUtils.isEmpty(cookie) && CookieUtils.getUserIdFromCookie(cookie) > 0;
|
isLoggedIn = !TextUtils.isEmpty(cookie) && CookieUtils.getUserIdFromCookie(cookie) > 0;
|
||||||
tagsService = isLoggedIn ? TagsService.getInstance() : null;
|
tagsService = isLoggedIn ? TagsService.getInstance() : null;
|
||||||
storiesRepository = isLoggedIn ? StoriesRepository.Companion.getInstance() : null;
|
// storiesRepository = isLoggedIn ? StoriesRepository.Companion.getInstance() : null;
|
||||||
graphQLRepository = isLoggedIn ? null : GraphQLRepository.Companion.getInstance();
|
graphQLRepository = isLoggedIn ? null : GraphQLRepository.Companion.getInstance();
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
@ -578,7 +578,9 @@ public class HashTagFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSwipeRefreshState() {
|
private void updateSwipeRefreshState() {
|
||||||
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching() || storiesFetching);
|
AppExecutors.INSTANCE.getMainThread().execute(() ->
|
||||||
|
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void navigateToProfile(final String username) {
|
private void navigateToProfile(final String username) {
|
||||||
|
@ -64,7 +64,7 @@ import awais.instagrabber.utils.Utils;
|
|||||||
import awais.instagrabber.webservices.GraphQLRepository;
|
import awais.instagrabber.webservices.GraphQLRepository;
|
||||||
import awais.instagrabber.webservices.LocationService;
|
import awais.instagrabber.webservices.LocationService;
|
||||||
import awais.instagrabber.webservices.ServiceCallback;
|
import awais.instagrabber.webservices.ServiceCallback;
|
||||||
import awais.instagrabber.webservices.StoriesRepository;
|
//import awais.instagrabber.webservices.StoriesRepository;
|
||||||
import kotlinx.coroutines.Dispatchers;
|
import kotlinx.coroutines.Dispatchers;
|
||||||
|
|
||||||
import static awais.instagrabber.utils.Utils.settingsHelper;
|
import static awais.instagrabber.utils.Utils.settingsHelper;
|
||||||
@ -81,11 +81,11 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
private long locationId;
|
private long locationId;
|
||||||
private Location locationModel;
|
private Location locationModel;
|
||||||
private ActionMode actionMode;
|
private ActionMode actionMode;
|
||||||
private StoriesRepository storiesRepository;
|
// private StoriesRepository storiesRepository;
|
||||||
private GraphQLRepository graphQLRepository;
|
private GraphQLRepository graphQLRepository;
|
||||||
private LocationService locationService;
|
private LocationService locationService;
|
||||||
private boolean isLoggedIn;
|
private boolean isLoggedIn;
|
||||||
private boolean storiesFetching;
|
// private boolean storiesFetching;
|
||||||
private Set<Media> selectedFeedModels;
|
private Set<Media> selectedFeedModels;
|
||||||
private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_LOCATION_POSTS_LAYOUT);
|
private PostsLayoutPreferences layoutPreferences = Utils.getPostsLayoutPreferences(Constants.PREF_LOCATION_POSTS_LAYOUT);
|
||||||
private LayoutLocationDetailsBinding locationDetailsBinding;
|
private LayoutLocationDetailsBinding locationDetailsBinding;
|
||||||
@ -274,7 +274,7 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
final String cookie = settingsHelper.getString(Constants.COOKIE);
|
final String cookie = settingsHelper.getString(Constants.COOKIE);
|
||||||
isLoggedIn = !TextUtils.isEmpty(cookie) && CookieUtils.getUserIdFromCookie(cookie) > 0;
|
isLoggedIn = !TextUtils.isEmpty(cookie) && CookieUtils.getUserIdFromCookie(cookie) > 0;
|
||||||
locationService = isLoggedIn ? LocationService.getInstance() : null;
|
locationService = isLoggedIn ? LocationService.getInstance() : null;
|
||||||
storiesRepository = StoriesRepository.Companion.getInstance();
|
// storiesRepository = StoriesRepository.Companion.getInstance();
|
||||||
graphQLRepository = isLoggedIn ? null : GraphQLRepository.Companion.getInstance();
|
graphQLRepository = isLoggedIn ? null : GraphQLRepository.Companion.getInstance();
|
||||||
setHasOptionsMenu(true);
|
setHasOptionsMenu(true);
|
||||||
}
|
}
|
||||||
@ -578,7 +578,9 @@ public class LocationFragment extends Fragment implements SwipeRefreshLayout.OnR
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSwipeRefreshState() {
|
private void updateSwipeRefreshState() {
|
||||||
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching() || storiesFetching);
|
AppExecutors.INSTANCE.getMainThread().execute(() ->
|
||||||
|
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void navigateToProfile(final String username) {
|
private void navigateToProfile(final String username) {
|
||||||
|
@ -39,6 +39,7 @@ import awais.instagrabber.fragments.main.ProfileFragmentDirections;
|
|||||||
import awais.instagrabber.models.PostsLayoutPreferences;
|
import awais.instagrabber.models.PostsLayoutPreferences;
|
||||||
import awais.instagrabber.models.enums.PostItemType;
|
import awais.instagrabber.models.enums.PostItemType;
|
||||||
import awais.instagrabber.repositories.responses.Media;
|
import awais.instagrabber.repositories.responses.Media;
|
||||||
|
import awais.instagrabber.utils.AppExecutors;
|
||||||
import awais.instagrabber.utils.Constants;
|
import awais.instagrabber.utils.Constants;
|
||||||
import awais.instagrabber.utils.CookieUtils;
|
import awais.instagrabber.utils.CookieUtils;
|
||||||
import awais.instagrabber.utils.DownloadUtils;
|
import awais.instagrabber.utils.DownloadUtils;
|
||||||
@ -313,7 +314,9 @@ public final class SavedViewerFragment extends Fragment implements SwipeRefreshL
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSwipeRefreshState() {
|
private void updateSwipeRefreshState() {
|
||||||
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching());
|
AppExecutors.INSTANCE.getMainThread().execute(() ->
|
||||||
|
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void navigateToProfile(final String username) {
|
private void navigateToProfile(final String username) {
|
||||||
|
@ -53,6 +53,7 @@ import awais.instagrabber.fragments.main.DiscoverFragmentDirections;
|
|||||||
import awais.instagrabber.models.PostsLayoutPreferences;
|
import awais.instagrabber.models.PostsLayoutPreferences;
|
||||||
import awais.instagrabber.repositories.responses.Media;
|
import awais.instagrabber.repositories.responses.Media;
|
||||||
import awais.instagrabber.repositories.responses.discover.TopicCluster;
|
import awais.instagrabber.repositories.responses.discover.TopicCluster;
|
||||||
|
import awais.instagrabber.utils.AppExecutors;
|
||||||
import awais.instagrabber.utils.Constants;
|
import awais.instagrabber.utils.Constants;
|
||||||
import awais.instagrabber.utils.DownloadUtils;
|
import awais.instagrabber.utils.DownloadUtils;
|
||||||
import awais.instagrabber.utils.ResponseBodyUtils;
|
import awais.instagrabber.utils.ResponseBodyUtils;
|
||||||
@ -375,7 +376,9 @@ public class TopicPostsFragment extends Fragment implements SwipeRefreshLayout.O
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSwipeRefreshState() {
|
private void updateSwipeRefreshState() {
|
||||||
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching());
|
AppExecutors.INSTANCE.getMainThread().execute(() ->
|
||||||
|
binding.swipeRefreshLayout.setRefreshing(binding.posts.isFetching())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void navigateToProfile(final String username) {
|
private void navigateToProfile(final String username) {
|
||||||
|
@ -369,7 +369,9 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateSwipeRefreshState() {
|
private void updateSwipeRefreshState() {
|
||||||
binding.feedSwipeRefreshLayout.setRefreshing(binding.feedRecyclerView.isFetching() || storiesFetching);
|
AppExecutors.INSTANCE.getMainThread().execute(() ->
|
||||||
|
binding.feedSwipeRefreshLayout.setRefreshing(binding.feedRecyclerView.isFetching() || storiesFetching)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupFeedStories() {
|
private void setupFeedStories() {
|
||||||
|
@ -857,7 +857,11 @@ class ProfileFragment : Fragment(), OnRefreshListener, ConfirmDialogFragmentCall
|
|||||||
.setLifeCycleOwner(this)
|
.setLifeCycleOwner(this)
|
||||||
.setPostFetchService(ProfilePostFetchService(profile, currentUser != null))
|
.setPostFetchService(ProfilePostFetchService(profile, currentUser != null))
|
||||||
.setLayoutPreferences(layoutPreferences)
|
.setLayoutPreferences(layoutPreferences)
|
||||||
.addFetchStatusChangeListener { binding.swipeRefreshLayout.isRefreshing = it }
|
.addFetchStatusChangeListener {
|
||||||
|
AppExecutors.mainThread.execute {
|
||||||
|
binding.swipeRefreshLayout.isRefreshing = it
|
||||||
|
}
|
||||||
|
}
|
||||||
.setFeedItemCallback(feedItemCallback)
|
.setFeedItemCallback(feedItemCallback)
|
||||||
.setSelectionModeCallback(selectionModeCallback)
|
.setSelectionModeCallback(selectionModeCallback)
|
||||||
.init()
|
.init()
|
||||||
|
Loading…
Reference in New Issue
Block a user