1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-07 23:47:30 +00:00

Merge pull request #36 from ammargitham/feature/scroll-stories-with-feed

scroll stories with feed
This commit is contained in:
Austin Huang 2020-08-07 11:42:09 -04:00 committed by GitHub
commit c293e9baff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 790 additions and 764 deletions

2
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Default ignored files
/shelf/

View File

@ -109,9 +109,9 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
postsAdapter.notifyItemRangeInserted(oldSize, result.length); postsAdapter.notifyItemRangeInserted(oldSize, result.length);
main.mainBinding.mainPosts.post(() -> { main.mainBinding.profileView.mainPosts.post(() -> {
main.mainBinding.mainPosts.setNestedScrollingEnabled(true); main.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(true);
main.mainBinding.mainPosts.setVisibility(View.VISIBLE); main.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
}); });
if (isHashtag) if (isHashtag)
@ -129,23 +129,23 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
.setUsername((isLocation || isHashtag) ? null : main.profileModel.getUsername()) .setUsername((isLocation || isHashtag) ? null : main.profileModel.getUsername())
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
else { else {
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
} }
model.setPageCursor(false, null); model.setPageCursor(false, null);
} }
} }
else { else {
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
main.mainBinding.privatePage1.setImageResource(R.drawable.ic_cancel); main.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
main.mainBinding.privatePage2.setText(R.string.empty_acc); main.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
main.mainBinding.privatePage.setVisibility(View.VISIBLE); main.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
} }
} }
}; };
private final FetchListener<FeedModel[]> feedFetchListener = new FetchListener<FeedModel[]>() { private final FetchListener<FeedModel[]> feedFetchListener = new FetchListener<FeedModel[]>() {
@Override @Override
public void doBefore() { public void doBefore() {
main.mainBinding.feedSwipeRefreshLayout.post(() -> main.mainBinding.feedSwipeRefreshLayout.setRefreshing(true)); main.mainBinding.feedView.feedSwipeRefreshLayout.post(() -> main.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(true));
} }
@Override @Override
@ -155,7 +155,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
main.feedItems.addAll(Arrays.asList(result)); main.feedItems.addAll(Arrays.asList(result));
feedAdapter.notifyItemRangeInserted(oldSize, result.length); feedAdapter.notifyItemRangeInserted(oldSize, result.length);
main.mainBinding.feedPosts.post(() -> main.mainBinding.feedPosts.setNestedScrollingEnabled(true)); main.mainBinding.feedView.feedPosts.post(() -> main.mainBinding.feedView.feedPosts.setNestedScrollingEnabled(true));
final PostModel feedPostModel = result[result.length - 1]; final PostModel feedPostModel = result[result.length - 1];
if (feedPostModel != null) { if (feedPostModel != null) {
@ -165,7 +165,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
} }
} }
main.mainBinding.feedSwipeRefreshLayout.setRefreshing(false); main.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(false);
} }
}; };
private final FetchListener<DiscoverItemModel[]> discoverFetchListener = new FetchListener<DiscoverItemModel[]>() { private final FetchListener<DiscoverItemModel[]> discoverFetchListener = new FetchListener<DiscoverItemModel[]>() {
@ -212,14 +212,14 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
private final FetchListener<FeedStoryModel[]> feedStoriesListener = new FetchListener<FeedStoryModel[]>() { private final FetchListener<FeedStoryModel[]> feedStoriesListener = new FetchListener<FeedStoryModel[]>() {
@Override @Override
public void doBefore() { public void doBefore() {
main.mainBinding.feedStories.setVisibility(View.GONE); main.mainBinding.feedView.feedStories.setVisibility(View.GONE);
} }
@Override @Override
public void onResult(final FeedStoryModel[] result) { public void onResult(final FeedStoryModel[] result) {
feedStoriesAdapter.setData(result); feedStoriesAdapter.setData(result);
if (result != null && result.length > 0) { if (result != null && result.length > 0) {
main.mainBinding.feedStories.setVisibility(View.VISIBLE); main.mainBinding.feedView.feedStories.setVisibility(View.VISIBLE);
stories = result; stories = result;
} }
} }
@ -274,8 +274,8 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
this.resources = main.getResources(); this.resources = main.getResources();
this.autoloadPosts = Utils.settingsHelper.getBoolean(AUTOLOAD_POSTS); this.autoloadPosts = Utils.settingsHelper.getBoolean(AUTOLOAD_POSTS);
main.mainBinding.swipeRefreshLayout.setOnRefreshListener(this); main.mainBinding.profileView.swipeRefreshLayout.setOnRefreshListener(this);
main.mainBinding.mainUrl.setMovementMethod(new LinkMovementMethod()); main.mainBinding.profileView.mainUrl.setMovementMethod(new LinkMovementMethod());
final LinearLayout iconSlider = main.findViewById(R.id.iconSlider); final LinearLayout iconSlider = main.findViewById(R.id.iconSlider);
final ImageView iconFeed = (ImageView) iconSlider.getChildAt(0); final ImageView iconFeed = (ImageView) iconSlider.getChildAt(0);
@ -285,7 +285,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
final boolean isBottomToolbar = Utils.settingsHelper.getBoolean(BOTTOM_TOOLBAR); final boolean isBottomToolbar = Utils.settingsHelper.getBoolean(BOTTOM_TOOLBAR);
isLoggedIn = !Utils.isEmpty(cookie); isLoggedIn = !Utils.isEmpty(cookie);
if (!isLoggedIn) { if (!isLoggedIn) {
main.mainBinding.drawerLayout.removeView(main.mainBinding.feedLayout); main.mainBinding.drawerLayout.removeView(main.mainBinding.feedView.feedLayout);
main.mainBinding.drawerLayout.removeView(main.mainBinding.discoverSwipeRefreshLayout); main.mainBinding.drawerLayout.removeView(main.mainBinding.discoverSwipeRefreshLayout);
iconFeed.setAlpha(0.4f); iconFeed.setAlpha(0.4f);
iconDiscover.setAlpha(0.4f); iconDiscover.setAlpha(0.4f);
@ -362,7 +362,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
@Override @Override
public void onDrawerOpened(@NonNull final View drawerView, @MouseDrawer.EdgeGravity final int gravity) { public void onDrawerOpened(@NonNull final View drawerView, @MouseDrawer.EdgeGravity final int gravity) {
if (gravity == GravityCompat.START || drawerView == main.mainBinding.feedLayout) { if (gravity == GravityCompat.START || drawerView == main.mainBinding.feedView.feedLayout) {
if (currentFeedPlayer != null) { if (currentFeedPlayer != null) {
currentFeedPlayer.setPlayWhenReady(true); currentFeedPlayer.setPlayWhenReady(true);
currentFeedPlayer.getPlaybackState(); currentFeedPlayer.getPlaybackState();
@ -375,7 +375,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
@Override @Override
public void onDrawerClosed(@NonNull final View drawerView, @MouseDrawer.EdgeGravity final int gravity) { public void onDrawerClosed(@NonNull final View drawerView, @MouseDrawer.EdgeGravity final int gravity) {
if (gravity == GravityCompat.START || drawerView == main.mainBinding.feedLayout) { if (gravity == GravityCompat.START || drawerView == main.mainBinding.feedView.feedLayout) {
if (currentFeedPlayer != null) { if (currentFeedPlayer != null) {
currentFeedPlayer.setPlayWhenReady(false); currentFeedPlayer.setPlayWhenReady(false);
currentFeedPlayer.getPlaybackState(); currentFeedPlayer.getPlaybackState();
@ -394,14 +394,14 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
main.mainBinding.drawerLayout.addDrawerListener(simpleDrawerListener); main.mainBinding.drawerLayout.addDrawerListener(simpleDrawerListener);
} }
collapsingToolbar = main.mainBinding.appBarLayout.getChildAt(0); collapsingToolbar = main.mainBinding.profileView.appBarLayout.getChildAt(0);
main.mainBinding.mainPosts.setNestedScrollingEnabled(false); main.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(false);
main.mainBinding.highlightsList.setLayoutManager(new LinearLayoutManager(main, LinearLayoutManager.HORIZONTAL, false)); main.mainBinding.profileView.highlightsList.setLayoutManager(new LinearLayoutManager(main, LinearLayoutManager.HORIZONTAL, false));
main.mainBinding.highlightsList.setAdapter(main.highlightsAdapter); main.mainBinding.profileView.highlightsList.setAdapter(main.highlightsAdapter);
int color = -1; int color = -1;
final Drawable background = main.mainBinding.appBarLayout.getBackground(); final Drawable background = main.mainBinding.profileView.appBarLayout.getBackground();
if (background instanceof MaterialShapeDrawable) { if (background instanceof MaterialShapeDrawable) {
final MaterialShapeDrawable drawable = (MaterialShapeDrawable) background; final MaterialShapeDrawable drawable = (MaterialShapeDrawable) background;
final ColorStateList fillColor = drawable.getFillColor(); final ColorStateList fillColor = drawable.getFillColor();
@ -415,19 +415,19 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
if (!bitmap.isRecycled()) bitmap.recycle(); if (!bitmap.isRecycled()) bitmap.recycle();
} }
if (color == -1 || color == 0) color = resources.getBoolean(R.bool.isNight) ? 0xff212121 : 0xfff5f5f5; if (color == -1 || color == 0) color = resources.getBoolean(R.bool.isNight) ? 0xff212121 : 0xfff5f5f5;
main.mainBinding.profileInfo.setBackgroundColor(color); main.mainBinding.profileView.profileInfo.setBackgroundColor(color);
if (!isBottomToolbar) main.mainBinding.toolbar.toolbar.setBackgroundColor(color); if (!isBottomToolbar) main.mainBinding.toolbar.toolbar.setBackgroundColor(color);
main.mainBinding.appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { main.mainBinding.profileView.appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {
private int height; private int height;
@Override @Override
public void onOffsetChanged(final AppBarLayout appBarLayout, final int verticalOffset) { public void onOffsetChanged(final AppBarLayout appBarLayout, final int verticalOffset) {
if (height == 0) { if (height == 0) {
height = main.mainBinding.profileInfo.getHeight(); height = main.mainBinding.profileView.profileInfo.getHeight();
collapsingToolbar.setMinimumHeight(height); collapsingToolbar.setMinimumHeight(height);
} }
main.mainBinding.profileInfo.setTranslationY(-Math.min(0, verticalOffset)); main.mainBinding.profileView.profileInfo.setTranslationY(-Math.min(0, verticalOffset));
} }
}); });
@ -440,9 +440,9 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
// change the next number to adjust grid // change the next number to adjust grid
final GridAutofitLayoutManager layoutManager = new GridAutofitLayoutManager(main, Utils.convertDpToPx(110)); final GridAutofitLayoutManager layoutManager = new GridAutofitLayoutManager(main, Utils.convertDpToPx(110));
main.mainBinding.mainPosts.setLayoutManager(layoutManager); main.mainBinding.profileView.mainPosts.setLayoutManager(layoutManager);
main.mainBinding.mainPosts.addItemDecoration(new GridSpacingItemDecoration(Utils.convertDpToPx(4))); main.mainBinding.profileView.mainPosts.addItemDecoration(new GridSpacingItemDecoration(Utils.convertDpToPx(4)));
main.mainBinding.mainPosts.setAdapter(postsAdapter = new PostsAdapter(main.allItems, v -> { main.mainBinding.profileView.mainPosts.setAdapter(postsAdapter = new PostsAdapter(main.allItems, v -> {
final Object tag = v.getTag(); final Object tag = v.getTag();
if (tag instanceof PostModel) { if (tag instanceof PostModel) {
final PostModel postModel = (PostModel) tag; final PostModel postModel = (PostModel) tag;
@ -465,7 +465,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
this.lazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> { this.lazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
if ((!autoloadPosts || isHashtag) && hasNextPage) { if ((!autoloadPosts || isHashtag) && hasNextPage) {
main.mainBinding.swipeRefreshLayout.setRefreshing(true); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
stopCurrentExecutor(); stopCurrentExecutor();
currentlyExecuting = new PostsFetcher((isHashtag || isLocation) ? main.userQuery : main.profileModel.getId(), endCursor, postsFetchListener) currentlyExecuting = new PostsFetcher((isHashtag || isLocation) ? main.userQuery : main.profileModel.getId(), endCursor, postsFetchListener)
.setUsername((isHashtag || isLocation) ? null : main.profileModel.getUsername()) .setUsername((isHashtag || isLocation) ? null : main.profileModel.getUsername())
@ -473,17 +473,17 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
endCursor = null; endCursor = null;
} }
}); });
main.mainBinding.mainPosts.addOnScrollListener(lazyLoader); main.mainBinding.profileView.mainPosts.addOnScrollListener(lazyLoader);
} }
private void setupFeed() { private void setupFeed() {
main.mainBinding.feedStories.setLayoutManager(new LinearLayoutManager(main, LinearLayoutManager.HORIZONTAL, false)); main.mainBinding.feedView.feedStories.setLayoutManager(new LinearLayoutManager(main, LinearLayoutManager.HORIZONTAL, false));
main.mainBinding.feedStories.setAdapter(feedStoriesAdapter); main.mainBinding.feedView.feedStories.setAdapter(feedStoriesAdapter);
refreshFeedStories(); refreshFeedStories();
final LinearLayoutManager layoutManager = new LinearLayoutManager(main); final LinearLayoutManager layoutManager = new LinearLayoutManager(main);
main.mainBinding.feedPosts.setLayoutManager(layoutManager); main.mainBinding.feedView.feedPosts.setLayoutManager(layoutManager);
main.mainBinding.feedPosts.setAdapter(feedAdapter = new FeedAdapter(main, main.feedItems, (view, text, isHashtag) -> main.mainBinding.feedView.feedPosts.setAdapter(feedAdapter = new FeedAdapter(main, main.feedItems, (view, text, isHashtag) ->
new AlertDialog.Builder(main).setMessage(isHashtag ? R.string.comment_view_mention_hash_search : R.string.comment_view_mention_user_search) new AlertDialog.Builder(main).setMessage(isHashtag ? R.string.comment_view_mention_hash_search : R.string.comment_view_mention_user_search)
.setTitle(text).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.ok, (dialog, which) -> { .setTitle(text).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.ok, (dialog, which) -> {
if (Main.scanHack != null) { if (Main.scanHack != null) {
@ -492,7 +492,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
} }
}).show())); }).show()));
main.mainBinding.feedSwipeRefreshLayout.setOnRefreshListener(() -> { main.mainBinding.feedView.feedSwipeRefreshLayout.setOnRefreshListener(() -> {
refreshFeedStories(); refreshFeedStories();
if (feedLazyLoader != null) feedLazyLoader.resetState(); if (feedLazyLoader != null) feedLazyLoader.resetState();
@ -501,15 +501,15 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
new FeedFetcher(feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new FeedFetcher(feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}); });
main.mainBinding.feedPosts.addOnScrollListener(feedLazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> { main.mainBinding.feedView.feedPosts.addOnScrollListener(feedLazyLoader = new RecyclerLazyLoader(layoutManager, (page, totalItemsCount) -> {
if (feedHasNextPage) { if (feedHasNextPage) {
main.mainBinding.feedSwipeRefreshLayout.setRefreshing(true); main.mainBinding.feedView.feedSwipeRefreshLayout.setRefreshing(true);
new FeedFetcher(feedEndCursor, feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new FeedFetcher(feedEndCursor, feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
feedEndCursor = null; feedEndCursor = null;
} }
})); }));
main.mainBinding.feedPosts.addOnScrollListener(new VideoAwareRecyclerScroller(main, main.feedItems, main.mainBinding.feedView.feedPosts.addOnScrollListener(new VideoAwareRecyclerScroller(main, main.feedItems,
(itemPos, player) -> currentFeedPlayer = player)); (itemPos, player) -> currentFeedPlayer = player));
new FeedFetcher(feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); new FeedFetcher(feedFetchListener).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -646,59 +646,59 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
postsAdapter.isSelecting = false; postsAdapter.isSelecting = false;
postsAdapter.notifyDataSetChanged(); postsAdapter.notifyDataSetChanged();
} }
main.mainBinding.appBarLayout.setExpanded(true, true); main.mainBinding.profileView.appBarLayout.setExpanded(true, true);
main.mainBinding.privatePage.setVisibility(View.GONE); main.mainBinding.profileView.privatePage.setVisibility(View.GONE);
main.mainBinding.privatePage2.setTextSize(28); main.mainBinding.profileView.privatePage2.setTextSize(28);
main.mainBinding.mainProfileImage.setImageBitmap(null); main.mainBinding.profileView.mainProfileImage.setImageBitmap(null);
main.mainBinding.mainHashtagImage.setImageBitmap(null); main.mainBinding.profileView.mainHashtagImage.setImageBitmap(null);
main.mainBinding.mainLocationImage.setImageBitmap(null); main.mainBinding.profileView.mainLocationImage.setImageBitmap(null);
main.mainBinding.mainUrl.setText(null); main.mainBinding.profileView.mainUrl.setText(null);
main.mainBinding.locationUrl.setText(null); main.mainBinding.profileView.locationUrl.setText(null);
main.mainBinding.mainFullName.setText(null); main.mainBinding.profileView.mainFullName.setText(null);
main.mainBinding.locationFullName.setText(null); main.mainBinding.profileView.locationFullName.setText(null);
main.mainBinding.mainPostCount.setText(null); main.mainBinding.profileView.mainPostCount.setText(null);
main.mainBinding.mainLocPostCount.setText(null); main.mainBinding.profileView.mainLocPostCount.setText(null);
main.mainBinding.mainTagPostCount.setText(null); main.mainBinding.profileView.mainTagPostCount.setText(null);
main.mainBinding.mainFollowers.setText(null); main.mainBinding.profileView.mainFollowers.setText(null);
main.mainBinding.mainFollowing.setText(null); main.mainBinding.profileView.mainFollowing.setText(null);
main.mainBinding.mainBiography.setText(null); main.mainBinding.profileView.mainBiography.setText(null);
main.mainBinding.locationBiography.setText(null); main.mainBinding.profileView.locationBiography.setText(null);
main.mainBinding.mainBiography.setEnabled(false); main.mainBinding.profileView.mainBiography.setEnabled(false);
main.mainBinding.locationBiography.setEnabled(false); main.mainBinding.profileView.locationBiography.setEnabled(false);
main.mainBinding.mainProfileImage.setEnabled(false); main.mainBinding.profileView.mainProfileImage.setEnabled(false);
main.mainBinding.mainLocationImage.setEnabled(false); main.mainBinding.profileView.mainLocationImage.setEnabled(false);
main.mainBinding.mainHashtagImage.setEnabled(false); main.mainBinding.profileView.mainHashtagImage.setEnabled(false);
main.mainBinding.mainBiography.setMentionClickListener(null); main.mainBinding.profileView.mainBiography.setMentionClickListener(null);
main.mainBinding.locationBiography.setMentionClickListener(null); main.mainBinding.profileView.locationBiography.setMentionClickListener(null);
main.mainBinding.mainUrl.setVisibility(View.GONE); main.mainBinding.profileView.mainUrl.setVisibility(View.GONE);
main.mainBinding.locationUrl.setVisibility(View.GONE); main.mainBinding.profileView.locationUrl.setVisibility(View.GONE);
main.mainBinding.isVerified.setVisibility(View.GONE); main.mainBinding.profileView.isVerified.setVisibility(View.GONE);
main.mainBinding.btnFollow.setVisibility(View.GONE); main.mainBinding.profileView.btnFollow.setVisibility(View.GONE);
main.mainBinding.btnRestrict.setVisibility(View.GONE); main.mainBinding.profileView.btnRestrict.setVisibility(View.GONE);
main.mainBinding.btnBlock.setVisibility(View.GONE); main.mainBinding.profileView.btnBlock.setVisibility(View.GONE);
main.mainBinding.btnSaved.setVisibility(View.GONE); main.mainBinding.profileView.btnSaved.setVisibility(View.GONE);
main.mainBinding.btnLiked.setVisibility(View.GONE); main.mainBinding.profileView.btnLiked.setVisibility(View.GONE);
main.mainBinding.btnTagged.setVisibility(View.GONE); main.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
main.mainBinding.btnMap.setVisibility(View.GONE); main.mainBinding.profileView.btnMap.setVisibility(View.GONE);
main.mainBinding.btnFollow.setOnClickListener(profileActionListener); main.mainBinding.profileView.btnFollow.setOnClickListener(profileActionListener);
main.mainBinding.btnRestrict.setOnClickListener(profileActionListener); main.mainBinding.profileView.btnRestrict.setOnClickListener(profileActionListener);
main.mainBinding.btnBlock.setOnClickListener(profileActionListener); main.mainBinding.profileView.btnBlock.setOnClickListener(profileActionListener);
main.mainBinding.btnSaved.setOnClickListener(profileActionListener); main.mainBinding.profileView.btnSaved.setOnClickListener(profileActionListener);
main.mainBinding.btnLiked.setOnClickListener(profileActionListener); main.mainBinding.profileView.btnLiked.setOnClickListener(profileActionListener);
main.mainBinding.btnTagged.setOnClickListener(profileActionListener); main.mainBinding.profileView.btnTagged.setOnClickListener(profileActionListener);
main.mainBinding.btnFollowTag.setOnClickListener(profileActionListener); main.mainBinding.profileView.btnFollowTag.setOnClickListener(profileActionListener);
main.mainBinding.infoContainer.setVisibility(View.GONE); main.mainBinding.profileView.infoContainer.setVisibility(View.GONE);
main.mainBinding.tagInfoContainer.setVisibility(View.GONE); main.mainBinding.profileView.tagInfoContainer.setVisibility(View.GONE);
main.mainBinding.locInfoContainer.setVisibility(View.GONE); main.mainBinding.profileView.locInfoContainer.setVisibility(View.GONE);
main.mainBinding.mainPosts.setNestedScrollingEnabled(false); main.mainBinding.profileView.mainPosts.setNestedScrollingEnabled(false);
main.mainBinding.highlightsList.setVisibility(View.GONE); main.mainBinding.profileView.highlightsList.setVisibility(View.GONE);
collapsingToolbar.setVisibility(View.GONE); collapsingToolbar.setVisibility(View.GONE);
main.highlightsAdapter.setData(null); main.highlightsAdapter.setData(null);
main.mainBinding.swipeRefreshLayout.setRefreshing(main.userQuery != null); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(main.userQuery != null);
if (main.userQuery == null) { if (main.userQuery == null) {
main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name); main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return; return;
@ -713,14 +713,14 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
main.profileModel = null; main.profileModel = null;
main.locationModel = null; main.locationModel = null;
main.mainBinding.toolbar.toolbar.setTitle(main.userQuery); main.mainBinding.toolbar.toolbar.setTitle(main.userQuery);
main.mainBinding.tagInfoContainer.setVisibility(View.VISIBLE); main.mainBinding.profileView.tagInfoContainer.setVisibility(View.VISIBLE);
main.mainBinding.btnFollowTag.setVisibility(View.GONE); main.mainBinding.profileView.btnFollowTag.setVisibility(View.GONE);
currentlyExecuting = new HashtagFetcher(main.userQuery.substring(1), hashtagModel -> { currentlyExecuting = new HashtagFetcher(main.userQuery.substring(1), hashtagModel -> {
main.hashtagModel = hashtagModel; main.hashtagModel = hashtagModel;
if (hashtagModel == null) { if (hashtagModel == null) {
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show(); Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name); main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return; return;
@ -729,177 +729,177 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
currentlyExecuting = new PostsFetcher(main.userQuery, postsFetchListener) currentlyExecuting = new PostsFetcher(main.userQuery, postsFetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
main.mainBinding.btnFollowTag.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnFollowTag.setVisibility(View.VISIBLE);
if (isLoggedIn) { if (isLoggedIn) {
new iStoryStatusFetcher(hashtagModel.getName(), null, false, true, false, false, result -> { new iStoryStatusFetcher(hashtagModel.getName(), null, false, true, false, false, result -> {
main.storyModels = result; main.storyModels = result;
if (result != null && result.length > 0) main.mainBinding.mainHashtagImage.setStoriesBorder(); if (result != null && result.length > 0) main.mainBinding.profileView.mainHashtagImage.setStoriesBorder();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
if (hashtagModel.getFollowing() == true) { if (hashtagModel.getFollowing() == true) {
main.mainBinding.btnFollowTag.setText(R.string.unfollow); main.mainBinding.profileView.btnFollowTag.setText(R.string.unfollow);
main.mainBinding.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_purple_background))); main, R.color.btn_purple_background)));
} }
else { else {
main.mainBinding.btnFollowTag.setText(R.string.follow); main.mainBinding.profileView.btnFollowTag.setText(R.string.follow);
main.mainBinding.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_pink_background))); main, R.color.btn_pink_background)));
} }
} else { } else {
if (Utils.dataBox.getFavorite(main.userQuery) != null) { if (Utils.dataBox.getFavorite(main.userQuery) != null) {
main.mainBinding.btnFollowTag.setText(R.string.unfavorite_short); main.mainBinding.profileView.btnFollowTag.setText(R.string.unfavorite_short);
main.mainBinding.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_purple_background))); main, R.color.btn_purple_background)));
} }
else { else {
main.mainBinding.btnFollowTag.setText(R.string.favorite_short); main.mainBinding.profileView.btnFollowTag.setText(R.string.favorite_short);
main.mainBinding.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollowTag.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_pink_background))); main, R.color.btn_pink_background)));
} }
} }
main.mainBinding.mainHashtagImage.setEnabled(false); main.mainBinding.profileView.mainHashtagImage.setEnabled(false);
new MyTask().execute(); new MyTask().execute();
main.mainBinding.mainHashtagImage.setEnabled(true); main.mainBinding.profileView.mainHashtagImage.setEnabled(true);
final String postCount = String.valueOf(hashtagModel.getPostCount()); final String postCount = String.valueOf(hashtagModel.getPostCount());
SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount)); SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount));
span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0); span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0); span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
main.mainBinding.mainTagPostCount.setText(span); main.mainBinding.profileView.mainTagPostCount.setText(span);
main.mainBinding.mainTagPostCount.setVisibility(View.VISIBLE); main.mainBinding.profileView.mainTagPostCount.setVisibility(View.VISIBLE);
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else if (isUser) { } else if (isUser) {
main.hashtagModel = null; main.hashtagModel = null;
main.locationModel = null; main.locationModel = null;
main.mainBinding.toolbar.toolbar.setTitle(main.userQuery); main.mainBinding.toolbar.toolbar.setTitle(main.userQuery);
main.mainBinding.infoContainer.setVisibility(View.VISIBLE); main.mainBinding.profileView.infoContainer.setVisibility(View.VISIBLE);
main.mainBinding.btnFollowTag.setVisibility(View.GONE); main.mainBinding.profileView.btnFollowTag.setVisibility(View.GONE);
currentlyExecuting = new ProfileFetcher(main.userQuery.substring(1), profileModel -> { currentlyExecuting = new ProfileFetcher(main.userQuery.substring(1), profileModel -> {
main.profileModel = profileModel; main.profileModel = profileModel;
if (profileModel == null) { if (profileModel == null) {
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show(); Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name); main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return; return;
} }
main.mainBinding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE); main.mainBinding.profileView.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
final String profileId = profileModel.getId(); final String profileId = profileModel.getId();
if (isLoggedIn || Utils.settingsHelper.getBoolean(Constants.STORIESIG)) { if (isLoggedIn || Utils.settingsHelper.getBoolean(Constants.STORIESIG)) {
new iStoryStatusFetcher(profileId, profileModel.getUsername(), false, false, new iStoryStatusFetcher(profileId, profileModel.getUsername(), false, false,
(!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), false, (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), false,
result -> { result -> {
main.storyModels = result; main.storyModels = result;
if (result != null && result.length > 0) if (result != null && result.length > 0) main.mainBinding.profileView.mainProfileImage.setStoriesBorder();
main.mainBinding.mainProfileImage.setStoriesBorder(); }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
new HighlightsFetcher(profileId, (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), result -> { new HighlightsFetcher(profileId, (!isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), result -> {
if (result != null && result.length > 0) { if (result != null && result.length > 0) {
main.mainBinding.highlightsList.setVisibility(View.VISIBLE); main.mainBinding.profileView.highlightsList.setVisibility(View.VISIBLE);
main.highlightsAdapter.setData(result); main.highlightsAdapter.setData(result);
} else main.mainBinding.highlightsList.setVisibility(View.GONE); }
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); else main.mainBinding.profileView.highlightsList.setVisibility(View.GONE);
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
if (isLoggedIn) { if (isLoggedIn) {
final String myId = Utils.getUserIdFromCookie(cookie); final String myId = Utils.getUserIdFromCookie(cookie);
if (!profileId.equals(myId)) { if (!profileId.equals(myId)) {
main.mainBinding.btnTagged.setVisibility(View.GONE); main.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
main.mainBinding.btnSaved.setVisibility(View.GONE); main.mainBinding.profileView.btnSaved.setVisibility(View.GONE);
main.mainBinding.btnLiked.setVisibility(View.GONE); main.mainBinding.profileView.btnLiked.setVisibility(View.GONE);
main.mainBinding.btnFollow.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnFollow.setVisibility(View.VISIBLE);
if (profileModel.getFollowing() == true) { if (profileModel.getFollowing() == true) {
main.mainBinding.btnFollow.setText(R.string.unfollow); main.mainBinding.profileView.btnFollow.setText(R.string.unfollow);
main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_purple_background))); main, R.color.btn_purple_background)));
} }
else if (profileModel.getRequested() == true) { else if (profileModel.getRequested() == true) {
main.mainBinding.btnFollow.setText(R.string.cancel); main.mainBinding.profileView.btnFollow.setText(R.string.cancel);
main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_purple_background))); main, R.color.btn_purple_background)));
} }
else { else {
main.mainBinding.btnFollow.setText(R.string.follow); main.mainBinding.profileView.btnFollow.setText(R.string.follow);
main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_pink_background))); main, R.color.btn_pink_background)));
} }
main.mainBinding.btnRestrict.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnRestrict.setVisibility(View.VISIBLE);
if (profileModel.getRestricted() == true) { if (profileModel.getRestricted() == true) {
main.mainBinding.btnRestrict.setText(R.string.unrestrict); main.mainBinding.profileView.btnRestrict.setText(R.string.unrestrict);
main.mainBinding.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_green_background))); main, R.color.btn_green_background)));
} }
else { else {
main.mainBinding.btnRestrict.setText(R.string.restrict); main.mainBinding.profileView.btnRestrict.setText(R.string.restrict);
main.mainBinding.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_orange_background))); main, R.color.btn_orange_background)));
} }
if (profileModel.isReallyPrivate()) { if (profileModel.isReallyPrivate()) {
main.mainBinding.btnBlock.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnBlock.setVisibility(View.VISIBLE);
main.mainBinding.btnTagged.setVisibility(View.GONE); main.mainBinding.profileView.btnTagged.setVisibility(View.GONE);
if (profileModel.getBlocked() == true) { if (profileModel.getBlocked() == true) {
main.mainBinding.btnBlock.setText(R.string.unblock); main.mainBinding.profileView.btnBlock.setText(R.string.unblock);
main.mainBinding.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_green_background))); main, R.color.btn_green_background)));
} else { } else {
main.mainBinding.btnBlock.setText(R.string.block); main.mainBinding.profileView.btnBlock.setText(R.string.block);
main.mainBinding.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnBlock.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_red_background))); main, R.color.btn_red_background)));
} }
} else { } else {
main.mainBinding.btnBlock.setVisibility(View.GONE); main.mainBinding.profileView.btnBlock.setVisibility(View.GONE);
main.mainBinding.btnSaved.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnSaved.setVisibility(View.VISIBLE);
main.mainBinding.btnTagged.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnTagged.setVisibility(View.VISIBLE);
if (profileModel.getBlocked() == true) { if (profileModel.getBlocked() == true) {
main.mainBinding.btnSaved.setText(R.string.unblock); main.mainBinding.profileView.btnSaved.setText(R.string.unblock);
main.mainBinding.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_green_background))); main, R.color.btn_green_background)));
} else { } else {
main.mainBinding.btnSaved.setText(R.string.block); main.mainBinding.profileView.btnSaved.setText(R.string.block);
main.mainBinding.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_red_background))); main, R.color.btn_red_background)));
} }
} }
} }
else { else {
main.mainBinding.btnTagged.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnTagged.setVisibility(View.VISIBLE);
main.mainBinding.btnSaved.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnSaved.setVisibility(View.VISIBLE);
main.mainBinding.btnLiked.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnLiked.setVisibility(View.VISIBLE);
main.mainBinding.btnSaved.setText(R.string.saved); main.mainBinding.profileView.btnSaved.setText(R.string.saved);
main.mainBinding.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnSaved.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_orange_background))); main, R.color.btn_orange_background)));
} }
} else { } else {
if (Utils.dataBox.getFavorite(main.userQuery) != null) { if (Utils.dataBox.getFavorite(main.userQuery) != null) {
main.mainBinding.btnFollow.setText(R.string.unfavorite_short); main.mainBinding.profileView.btnFollow.setText(R.string.unfavorite_short);
main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_purple_background))); main, R.color.btn_purple_background)));
} }
else { else {
main.mainBinding.btnFollow.setText(R.string.favorite_short); main.mainBinding.profileView.btnFollow.setText(R.string.favorite_short);
main.mainBinding.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnFollow.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_pink_background))); main, R.color.btn_pink_background)));
} }
main.mainBinding.btnFollow.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnFollow.setVisibility(View.VISIBLE);
if (!profileModel.isReallyPrivate()) { if (!profileModel.isReallyPrivate()) {
main.mainBinding.btnRestrict.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnRestrict.setVisibility(View.VISIBLE);
main.mainBinding.btnRestrict.setText(R.string.tagged); main.mainBinding.profileView.btnRestrict.setText(R.string.tagged);
main.mainBinding.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor( main.mainBinding.profileView.btnRestrict.setBackgroundTintList(ColorStateList.valueOf(ContextCompat.getColor(
main, R.color.btn_blue_background))); main, R.color.btn_blue_background)));
} }
} }
main.mainBinding.mainProfileImage.setEnabled(false); main.mainBinding.profileView.mainProfileImage.setEnabled(false);
new MyTask().execute(); new MyTask().execute();
main.mainBinding.mainProfileImage.setEnabled(true); main.mainBinding.profileView.mainProfileImage.setEnabled(true);
final long followersCount = profileModel.getFollowersCount(); final long followersCount = profileModel.getFollowersCount();
final long followingCount = profileModel.getFollowingCount(); final long followingCount = profileModel.getFollowingCount();
@ -909,82 +909,82 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount)); SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount));
span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0); span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0); span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
main.mainBinding.mainPostCount.setText(span); main.mainBinding.profileView.mainPostCount.setText(span);
final String followersCountStr = String.valueOf(followersCount); final String followersCountStr = String.valueOf(followersCount);
final int followersCountStrLen = followersCountStr.length(); final int followersCountStrLen = followersCountStr.length();
span = new SpannableStringBuilder(resources.getString(R.string.main_posts_followers, followersCountStr)); span = new SpannableStringBuilder(resources.getString(R.string.main_posts_followers, followersCountStr));
span.setSpan(new RelativeSizeSpan(1.2f), 0, followersCountStrLen, 0); span.setSpan(new RelativeSizeSpan(1.2f), 0, followersCountStrLen, 0);
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followersCountStrLen, 0); span.setSpan(new StyleSpan(Typeface.BOLD), 0, followersCountStrLen, 0);
main.mainBinding.mainFollowers.setText(span); main.mainBinding.profileView.mainFollowers.setText(span);
final String followingCountStr = String.valueOf(followingCount); final String followingCountStr = String.valueOf(followingCount);
final int followingCountStrLen = followingCountStr.length(); final int followingCountStrLen = followingCountStr.length();
span = new SpannableStringBuilder(resources.getString(R.string.main_posts_following, followingCountStr)); span = new SpannableStringBuilder(resources.getString(R.string.main_posts_following, followingCountStr));
span.setSpan(new RelativeSizeSpan(1.2f), 0, followingCountStrLen, 0); span.setSpan(new RelativeSizeSpan(1.2f), 0, followingCountStrLen, 0);
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followingCountStrLen, 0); span.setSpan(new StyleSpan(Typeface.BOLD), 0, followingCountStrLen, 0);
main.mainBinding.mainFollowing.setText(span); main.mainBinding.profileView.mainFollowing.setText(span);
main.mainBinding.mainFullName.setText(Utils.isEmpty(profileModel.getName()) ? profileModel.getUsername() : profileModel.getName()); main.mainBinding.profileView.mainFullName.setText(Utils.isEmpty(profileModel.getName()) ? profileModel.getUsername() : profileModel.getName());
CharSequence biography = profileModel.getBiography(); CharSequence biography = profileModel.getBiography();
main.mainBinding.mainBiography.setCaptionIsExpandable(true); main.mainBinding.profileView.mainBiography.setCaptionIsExpandable(true);
main.mainBinding.mainBiography.setCaptionIsExpanded(true); main.mainBinding.profileView.mainBiography.setCaptionIsExpanded(true);
if (Utils.hasMentions(biography)) { if (Utils.hasMentions(biography)) {
biography = Utils.getMentionText(biography); biography = Utils.getMentionText(biography);
main.mainBinding.mainBiography.setText(biography, TextView.BufferType.SPANNABLE); main.mainBinding.profileView.mainBiography.setText(biography, TextView.BufferType.SPANNABLE);
main.mainBinding.mainBiography.setMentionClickListener(mentionClickListener); main.mainBinding.profileView.mainBiography.setMentionClickListener(mentionClickListener);
} else { } else {
main.mainBinding.mainBiography.setText(biography); main.mainBinding.profileView.mainBiography.setText(biography);
main.mainBinding.mainBiography.setMentionClickListener(null); main.mainBinding.profileView.mainBiography.setMentionClickListener(null);
} }
final String url = profileModel.getUrl(); final String url = profileModel.getUrl();
if (Utils.isEmpty(url)) { if (Utils.isEmpty(url)) {
main.mainBinding.mainUrl.setVisibility(View.GONE); main.mainBinding.profileView.mainUrl.setVisibility(View.GONE);
} else { } else {
main.mainBinding.mainUrl.setVisibility(View.VISIBLE); main.mainBinding.profileView.mainUrl.setVisibility(View.VISIBLE);
main.mainBinding.mainUrl.setText(Utils.getSpannableUrl(url)); main.mainBinding.profileView.mainUrl.setText(Utils.getSpannableUrl(url));
} }
main.mainBinding.mainFullName.setSelected(true); main.mainBinding.profileView.mainFullName.setSelected(true);
main.mainBinding.mainBiography.setEnabled(true); main.mainBinding.profileView.mainBiography.setEnabled(true);
if (!profileModel.isReallyPrivate()) { if (!profileModel.isReallyPrivate()) {
main.mainBinding.mainFollowing.setClickable(true); main.mainBinding.profileView.mainFollowing.setClickable(true);
main.mainBinding.mainFollowers.setClickable(true); main.mainBinding.profileView.mainFollowers.setClickable(true);
if (isLoggedIn) { if (isLoggedIn) {
final View.OnClickListener followClickListener = v -> main.startActivity(new Intent(main, FollowViewer.class) final View.OnClickListener followClickListener = v -> main.startActivity(new Intent(main, FollowViewer.class)
.putExtra(Constants.EXTRAS_FOLLOWERS, v == main.mainBinding.mainFollowers) .putExtra(Constants.EXTRAS_FOLLOWERS, v == main.mainBinding.profileView.mainFollowers)
.putExtra(Constants.EXTRAS_NAME, profileModel.getUsername()) .putExtra(Constants.EXTRAS_NAME, profileModel.getUsername())
.putExtra(Constants.EXTRAS_ID, profileId)); .putExtra(Constants.EXTRAS_ID, profileId));
main.mainBinding.mainFollowers.setOnClickListener(followersCount > 0 ? followClickListener : null); main.mainBinding.profileView.mainFollowers.setOnClickListener(followersCount > 0 ? followClickListener : null);
main.mainBinding.mainFollowing.setOnClickListener(followingCount > 0 ? followClickListener : null); main.mainBinding.profileView.mainFollowing.setOnClickListener(followingCount > 0 ? followClickListener : null);
} }
if (profileModel.getPostCount() == 0) { if (profileModel.getPostCount() == 0) {
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
main.mainBinding.privatePage1.setImageResource(R.drawable.ic_cancel); main.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
main.mainBinding.privatePage2.setText(R.string.empty_acc); main.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
main.mainBinding.privatePage.setVisibility(View.VISIBLE); main.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
} }
else { else {
main.mainBinding.swipeRefreshLayout.setRefreshing(true); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
main.mainBinding.mainPosts.setVisibility(View.VISIBLE); main.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
currentlyExecuting = new PostsFetcher(profileId, postsFetchListener).setUsername(profileModel.getUsername()) currentlyExecuting = new PostsFetcher(profileId, postsFetchListener).setUsername(profileModel.getUsername())
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
} else { } else {
main.mainBinding.mainFollowers.setClickable(false); main.mainBinding.profileView.mainFollowers.setClickable(false);
main.mainBinding.mainFollowing.setClickable(false); main.mainBinding.profileView.mainFollowing.setClickable(false);
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
// error // error
main.mainBinding.privatePage1.setImageResource(R.drawable.lock); main.mainBinding.profileView.privatePage1.setImageResource(R.drawable.lock);
main.mainBinding.privatePage2.setText(R.string.priv_acc); main.mainBinding.profileView.privatePage2.setText(R.string.priv_acc);
main.mainBinding.privatePage.setVisibility(View.VISIBLE); main.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
main.mainBinding.mainPosts.setVisibility(View.GONE); main.mainBinding.profileView.mainPosts.setVisibility(View.GONE);
} }
} }
).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); ).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
@ -993,13 +993,13 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
main.profileModel = null; main.profileModel = null;
main.hashtagModel = null; main.hashtagModel = null;
main.mainBinding.toolbar.toolbar.setTitle(main.userQuery); main.mainBinding.toolbar.toolbar.setTitle(main.userQuery);
main.mainBinding.locInfoContainer.setVisibility(View.VISIBLE); main.mainBinding.profileView.locInfoContainer.setVisibility(View.VISIBLE);
currentlyExecuting = new LocationFetcher(main.userQuery.split("/")[0], locationModel -> { currentlyExecuting = new LocationFetcher(main.userQuery.split("/")[0], locationModel -> {
main.locationModel = locationModel; main.locationModel = locationModel;
if (locationModel == null) { if (locationModel == null) {
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show(); Toast.makeText(main, R.string.error_loading_profile, Toast.LENGTH_SHORT).show();
main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name); main.mainBinding.toolbar.toolbar.setTitle(R.string.app_name);
return; return;
@ -1011,77 +1011,77 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
if (isLoggedIn) { if (isLoggedIn) {
new iStoryStatusFetcher(profileId.split("/")[0], null, true, false, false, false, result -> { new iStoryStatusFetcher(profileId.split("/")[0], null, true, false, false, false, result -> {
main.storyModels = result; main.storyModels = result;
if (result != null && result.length > 0) main.mainBinding.mainLocationImage.setStoriesBorder(); if (result != null && result.length > 0) main.mainBinding.profileView.mainLocationImage.setStoriesBorder();
}).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
main.mainBinding.mainLocationImage.setEnabled(false); main.mainBinding.profileView.mainLocationImage.setEnabled(false);
new MyTask().execute(); new MyTask().execute();
main.mainBinding.mainLocationImage.setEnabled(true); main.mainBinding.profileView.mainLocationImage.setEnabled(true);
final String postCount = String.valueOf(locationModel.getPostCount()); final String postCount = String.valueOf(locationModel.getPostCount());
SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount)); SpannableStringBuilder span = new SpannableStringBuilder(resources.getString(R.string.main_posts_count, postCount));
span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0); span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0); span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
main.mainBinding.mainLocPostCount.setText(span); main.mainBinding.profileView.mainLocPostCount.setText(span);
main.mainBinding.locationFullName.setText(locationModel.getName()); main.mainBinding.profileView.locationFullName.setText(locationModel.getName());
CharSequence biography = locationModel.getBio(); CharSequence biography = locationModel.getBio();
main.mainBinding.locationBiography.setCaptionIsExpandable(true); main.mainBinding.profileView.locationBiography.setCaptionIsExpandable(true);
main.mainBinding.locationBiography.setCaptionIsExpanded(true); main.mainBinding.profileView.locationBiography.setCaptionIsExpanded(true);
if (Utils.isEmpty(biography)) { if (Utils.isEmpty(biography)) {
main.mainBinding.locationBiography.setVisibility(View.GONE); main.mainBinding.profileView.locationBiography.setVisibility(View.GONE);
} }
else if (Utils.hasMentions(biography)) { else if (Utils.hasMentions(biography)) {
main.mainBinding.locationBiography.setVisibility(View.VISIBLE); main.mainBinding.profileView.locationBiography.setVisibility(View.VISIBLE);
biography = Utils.getMentionText(biography); biography = Utils.getMentionText(biography);
main.mainBinding.locationBiography.setText(biography, TextView.BufferType.SPANNABLE); main.mainBinding.profileView.locationBiography.setText(biography, TextView.BufferType.SPANNABLE);
main.mainBinding.locationBiography.setMentionClickListener(mentionClickListener); main.mainBinding.profileView.locationBiography.setMentionClickListener(mentionClickListener);
} else { } else {
main.mainBinding.locationBiography.setVisibility(View.VISIBLE); main.mainBinding.profileView.locationBiography.setVisibility(View.VISIBLE);
main.mainBinding.locationBiography.setText(biography); main.mainBinding.profileView.locationBiography.setText(biography);
main.mainBinding.locationBiography.setMentionClickListener(null); main.mainBinding.profileView.locationBiography.setMentionClickListener(null);
} }
if (!locationModel.getGeo().startsWith("geo:0.0,0.0?z=17")) { if (!locationModel.getGeo().startsWith("geo:0.0,0.0?z=17")) {
main.mainBinding.btnMap.setVisibility(View.VISIBLE); main.mainBinding.profileView.btnMap.setVisibility(View.VISIBLE);
main.mainBinding.btnMap.setOnClickListener(v -> { main.mainBinding.profileView.btnMap.setOnClickListener(v -> {
final Intent intent = new Intent(Intent.ACTION_VIEW); final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(locationModel.getGeo())); intent.setData(Uri.parse(locationModel.getGeo()));
main.startActivity(intent); main.startActivity(intent);
}); });
} }
else { else {
main.mainBinding.btnMap.setVisibility(View.GONE); main.mainBinding.profileView.btnMap.setVisibility(View.GONE);
main.mainBinding.btnMap.setOnClickListener(null); main.mainBinding.profileView.btnMap.setOnClickListener(null);
} }
final String url = locationModel.getUrl(); final String url = locationModel.getUrl();
if (Utils.isEmpty(url)) { if (Utils.isEmpty(url)) {
main.mainBinding.locationUrl.setVisibility(View.GONE); main.mainBinding.profileView.locationUrl.setVisibility(View.GONE);
} else if (!url.startsWith("http")) { } else if (!url.startsWith("http")) {
main.mainBinding.locationUrl.setVisibility(View.VISIBLE); main.mainBinding.profileView.locationUrl.setVisibility(View.VISIBLE);
main.mainBinding.locationUrl.setText(Utils.getSpannableUrl("http://"+url)); main.mainBinding.profileView.locationUrl.setText(Utils.getSpannableUrl("http://"+url));
} else { } else {
main.mainBinding.locationUrl.setVisibility(View.VISIBLE); main.mainBinding.profileView.locationUrl.setVisibility(View.VISIBLE);
main.mainBinding.locationUrl.setText(Utils.getSpannableUrl(url)); main.mainBinding.profileView.locationUrl.setText(Utils.getSpannableUrl(url));
} }
main.mainBinding.locationFullName.setSelected(true); main.mainBinding.profileView.locationFullName.setSelected(true);
main.mainBinding.locationBiography.setEnabled(true); main.mainBinding.profileView.locationBiography.setEnabled(true);
if (locationModel.getPostCount() == 0) { if (locationModel.getPostCount() == 0) {
main.mainBinding.swipeRefreshLayout.setRefreshing(false); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(false);
main.mainBinding.privatePage1.setImageResource(R.drawable.ic_cancel); main.mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_cancel);
main.mainBinding.privatePage2.setText(R.string.empty_acc); main.mainBinding.profileView.privatePage2.setText(R.string.empty_acc);
main.mainBinding.privatePage.setVisibility(View.VISIBLE); main.mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
} }
else { else {
main.mainBinding.swipeRefreshLayout.setRefreshing(true); main.mainBinding.profileView.swipeRefreshLayout.setRefreshing(true);
main.mainBinding.mainPosts.setVisibility(View.VISIBLE); main.mainBinding.profileView.mainPosts.setVisibility(View.VISIBLE);
currentlyExecuting = new PostsFetcher(profileId, postsFetchListener) currentlyExecuting = new PostsFetcher(profileId, postsFetchListener)
.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); .executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
@ -1211,9 +1211,9 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
@Override @Override
protected void onPostExecute(Void result) { protected void onPostExecute(Void result) {
if (main.hashtagModel != null) main.mainBinding.mainHashtagImage.setImageBitmap(mIcon_val); if (main.hashtagModel != null) main.mainBinding.profileView.mainHashtagImage.setImageBitmap(mIcon_val);
else if (main.locationModel != null) main.mainBinding.mainLocationImage.setImageBitmap(mIcon_val); else if (main.locationModel != null) main.mainBinding.profileView.mainLocationImage.setImageBitmap(mIcon_val);
else main.mainBinding.mainProfileImage.setImageBitmap(mIcon_val); else main.mainBinding.profileView.mainProfileImage.setImageBitmap(mIcon_val);
} }
} }
@ -1223,34 +1223,34 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
final boolean iamme = (isLoggedIn && main.profileModel != null) final boolean iamme = (isLoggedIn && main.profileModel != null)
? Utils.getUserIdFromCookie(cookie).equals(main.profileModel.getId()) ? Utils.getUserIdFromCookie(cookie).equals(main.profileModel.getId())
: false; : false;
if (!isLoggedIn && Utils.dataBox.getFavorite(main.userQuery) != null && v == main.mainBinding.btnFollow) { if (!isLoggedIn && Utils.dataBox.getFavorite(main.userQuery) != null && v == main.mainBinding.profileView.btnFollow) {
Utils.dataBox.delFavorite(new DataBox.FavoriteModel(main.userQuery, Utils.dataBox.delFavorite(new DataBox.FavoriteModel(main.userQuery,
Long.parseLong(Utils.dataBox.getFavorite(main.userQuery).split("/")[1]), Long.parseLong(Utils.dataBox.getFavorite(main.userQuery).split("/")[1]),
main.locationModel != null ? main.locationModel.getName() : main.userQuery.replaceAll("^@", ""))); main.locationModel != null ? main.locationModel.getName() : main.userQuery.replaceAll("^@", "")));
onRefresh(); onRefresh();
} else if (!isLoggedIn && (v == main.mainBinding.btnFollow || v == main.mainBinding.btnFollowTag)) { } else if (!isLoggedIn && (v == main.mainBinding.profileView.btnFollow || v == main.mainBinding.profileView.btnFollowTag)) {
Utils.dataBox.addFavorite(new DataBox.FavoriteModel(main.userQuery, System.currentTimeMillis(), Utils.dataBox.addFavorite(new DataBox.FavoriteModel(main.userQuery, System.currentTimeMillis(),
main.locationModel != null ? main.locationModel.getName() : main.userQuery.replaceAll("^@", ""))); main.locationModel != null ? main.locationModel.getName() : main.userQuery.replaceAll("^@", "")));
onRefresh(); onRefresh();
} else if (v == main.mainBinding.btnFollow) { } else if (v == main.mainBinding.profileView.btnFollow) {
new ProfileAction().execute("follow"); new ProfileAction().execute("follow");
} else if (v == main.mainBinding.btnRestrict && isLoggedIn) { } else if (v == main.mainBinding.profileView.btnRestrict && isLoggedIn) {
new ProfileAction().execute("restrict"); new ProfileAction().execute("restrict");
} else if (v == main.mainBinding.btnSaved && !iamme) { } else if (v == main.mainBinding.profileView.btnSaved && !iamme) {
new ProfileAction().execute("block"); new ProfileAction().execute("block");
} else if (v == main.mainBinding.btnFollowTag) { } else if (v == main.mainBinding.profileView.btnFollowTag) {
new ProfileAction().execute("followtag"); new ProfileAction().execute("followtag");
} else if (v == main.mainBinding.btnTagged || (v == main.mainBinding.btnRestrict && !isLoggedIn)) { } else if (v == main.mainBinding.profileView.btnTagged || (v == main.mainBinding.profileView.btnRestrict && !isLoggedIn)) {
main.startActivity(new Intent(main, SavedViewer.class) main.startActivity(new Intent(main, SavedViewer.class)
.putExtra(Constants.EXTRAS_INDEX, "%"+main.profileModel.getId()) .putExtra(Constants.EXTRAS_INDEX, "%"+main.profileModel.getId())
.putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername()) .putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername())
); );
} else if (v == main.mainBinding.btnSaved) { } else if (v == main.mainBinding.profileView.btnSaved) {
main.startActivity(new Intent(main, SavedViewer.class) main.startActivity(new Intent(main, SavedViewer.class)
.putExtra(Constants.EXTRAS_INDEX, "$"+main.profileModel.getId()) .putExtra(Constants.EXTRAS_INDEX, "$"+main.profileModel.getId())
.putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername()) .putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername())
); );
} else if (v == main.mainBinding.btnLiked) { } else if (v == main.mainBinding.profileView.btnLiked) {
main.startActivity(new Intent(main, SavedViewer.class) main.startActivity(new Intent(main, SavedViewer.class)
.putExtra(Constants.EXTRAS_INDEX, "^"+main.profileModel.getId()) .putExtra(Constants.EXTRAS_INDEX, "^"+main.profileModel.getId())
.putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername()) .putExtra(Constants.EXTRAS_USER, "@"+main.profileModel.getUsername())

View File

@ -159,7 +159,7 @@ public final class Main extends BaseLanguageActivity {
if (!Utils.isEmpty(username)) { if (!Utils.isEmpty(username)) {
if (!BuildConfig.DEBUG) { if (!BuildConfig.DEBUG) {
userQuery = username; userQuery = username;
if (mainHelper != null && !mainBinding.swipeRefreshLayout.isRefreshing()) mainHelper.onRefresh(); if (mainHelper != null && !mainBinding.profileView.swipeRefreshLayout.isRefreshing()) mainHelper.onRefresh();
} }
// adds cookies to database for quick access // adds cookies to database for quick access
cookieModel = Utils.dataBox.getCookie(uid); cookieModel = Utils.dataBox.getCookie(uid);
@ -212,11 +212,11 @@ public final class Main extends BaseLanguageActivity {
}; };
final View.OnClickListener onClickListener = v -> { final View.OnClickListener onClickListener = v -> {
if (v == mainBinding.mainBiography) { if (v == mainBinding.profileView.mainBiography) {
Utils.copyText(this, mainBinding.mainBiography.getText().toString()); Utils.copyText(this, mainBinding.profileView.mainBiography.getText().toString());
} else if (v == mainBinding.locationBiography) { } else if (v == mainBinding.profileView.locationBiography) {
Utils.copyText(this, mainBinding.locationBiography.getText().toString()); Utils.copyText(this, mainBinding.profileView.locationBiography.getText().toString());
} else if (v == mainBinding.mainProfileImage || v == mainBinding.mainHashtagImage || v == mainBinding.mainLocationImage) { } else if (v == mainBinding.profileView.mainProfileImage || v == mainBinding.profileView.mainHashtagImage || v == mainBinding.profileView.mainLocationImage) {
if (storyModels == null || storyModels.length <= 0) { if (storyModels == null || storyModels.length <= 0) {
profileDialogListener.onClick(null, 0); profileDialogListener.onClick(null, 0);
} else { } else {
@ -227,26 +227,26 @@ public final class Main extends BaseLanguageActivity {
} }
}; };
mainBinding.mainBiography.setOnClickListener(onClickListener); mainBinding.profileView.mainBiography.setOnClickListener(onClickListener);
mainBinding.locationBiography.setOnClickListener(onClickListener); mainBinding.profileView.locationBiography.setOnClickListener(onClickListener);
mainBinding.mainProfileImage.setOnClickListener(onClickListener); mainBinding.profileView.mainProfileImage.setOnClickListener(onClickListener);
mainBinding.mainHashtagImage.setOnClickListener(onClickListener); mainBinding.profileView.mainHashtagImage.setOnClickListener(onClickListener);
mainBinding.mainLocationImage.setOnClickListener(onClickListener); mainBinding.profileView.mainLocationImage.setOnClickListener(onClickListener);
mainBinding.mainBiography.setEnabled(false); mainBinding.profileView.mainBiography.setEnabled(false);
mainBinding.mainProfileImage.setEnabled(false); mainBinding.profileView.mainProfileImage.setEnabled(false);
mainBinding.mainHashtagImage.setEnabled(false); mainBinding.profileView.mainHashtagImage.setEnabled(false);
mainBinding.mainLocationImage.setEnabled(false); mainBinding.profileView.mainLocationImage.setEnabled(false);
final boolean isQueryNull = userQuery == null; final boolean isQueryNull = userQuery == null;
if (isQueryNull) { if (isQueryNull) {
allItems.clear(); allItems.clear();
mainBinding.privatePage1.setImageResource(R.drawable.ic_info); mainBinding.profileView.privatePage1.setImageResource(R.drawable.ic_info);
mainBinding.privatePage2.setTextSize(20); mainBinding.profileView.privatePage2.setTextSize(20);
mainBinding.privatePage2.setText(mainHelper.isLoggedIn ? R.string.no_acc_logged_in : R.string.no_acc); mainBinding.profileView.privatePage2.setText(mainHelper.isLoggedIn ? R.string.no_acc_logged_in : R.string.no_acc);
mainBinding.privatePage.setVisibility(View.VISIBLE); mainBinding.profileView.privatePage.setVisibility(View.VISIBLE);
} }
if (!mainBinding.swipeRefreshLayout.isRefreshing() && userQuery != null) mainHelper.onRefresh(); if (!mainBinding.profileView.swipeRefreshLayout.isRefreshing() && userQuery != null) mainHelper.onRefresh();
mainHelper.onIntent(getIntent()); mainHelper.onIntent(getIntent());
} }
@ -460,10 +460,10 @@ public final class Main extends BaseLanguageActivity {
if (!mainHelper.isSelectionCleared()) return; if (!mainHelper.isSelectionCleared()) return;
final GridLayoutManager layoutManager = (GridLayoutManager) mainBinding.mainPosts.getLayoutManager(); final GridLayoutManager layoutManager = (GridLayoutManager) mainBinding.profileView.mainPosts.getLayoutManager();
if (layoutManager != null && layoutManager.findFirstCompletelyVisibleItemPosition() >= layoutManager.getSpanCount()) { if (layoutManager != null && layoutManager.findFirstCompletelyVisibleItemPosition() >= layoutManager.getSpanCount()) {
mainBinding.mainPosts.smoothScrollToPosition(0); mainBinding.profileView.mainPosts.smoothScrollToPosition(0);
mainBinding.appBarLayout.setExpanded(true, true); mainBinding.profileView.appBarLayout.setExpanded(true, true);
return; return;
} }

View File

@ -22,507 +22,14 @@
android:layout_weight="1"> android:layout_weight="1">
<!-- Profile View --> <!-- Profile View -->
<androidx.coordinatorlayout.widget.CoordinatorLayout <include
android:layout_width="match_parent" android:id="@+id/profile_view"
android:layout_height="match_parent"> layout="@layout/layout_profile_view" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- for users -->
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:id="@+id/infoContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@null"
android:orientation="vertical"
android:paddingBottom="5dp">
<LinearLayout
android:id="@+id/profileInfoText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profileInfo"
android:orientation="horizontal"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/isVerified"
android:layout_width="18dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:visibility="gone"
app:srcCompat="@drawable/verified" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainFullName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textSize="16sp"
tools:text="Austin Huang" />
</LinearLayout>
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/mainBiography"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profileInfoText"
android:background="?android:selectableItemBackground"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
tools:text="THE GLORIOUS (step)OWNER OF THIS APP" />
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/mainUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/mainBiography"
android:ellipsize="marquee"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
tools:text="https://austinhuang.me/"
android:visibility="gone" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/profileActions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/mainUrl">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnFollow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/follow"
android:textColor="@color/btn_pink_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_pink_background"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnRestrict"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/restrict"
android:textColor="@color/btn_orange_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_orange_background"
android:visibility="gone" />
<!-- only for invisible private accounts -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnBlock"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/block"
android:textColor="@color/btn_red_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_red_background"
android:visibility="gone" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/myActions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profileActions">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnTagged"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/tagged"
android:textColor="@color/btn_blue_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_blue_background"
android:visibility="gone" />
<!-- also used as block -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnSaved"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/saved"
android:textColor="@color/btn_orange_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_orange_background"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnLiked"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/liked"
android:textColor="@color/btn_lightpink_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_lightpink_background"
android:visibility="gone" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/highlightsList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/myActions"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/profileInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/profile_info_container_bottom_space">
<awais.instagrabber.customviews.CircularImageView
android:id="@+id/mainProfileImage"
android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size"
android:adjustViewBounds="true"
android:background="?selectableItemBackgroundBorderless" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainPostCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="35\nPosts" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainFollowers"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="68\nFollowers" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainFollowing"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="64\nFollowing" />
</LinearLayout>
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<!-- for hashtags -->
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/tagInfoContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/profile_info_container_bottom_space"
android:visibility="gone">
<awais.instagrabber.customviews.CircularImageView
android:id="@+id/mainHashtagImage"
android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size"
android:adjustViewBounds="true"
android:background="?selectableItemBackgroundBorderless" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainTagPostCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="35\nPosts" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnFollowTag"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:text="@string/follow"
android:textColor="@color/btn_pink_text_color"
android:textSize="20sp"
app:backgroundTint="@color/btn_pink_background" />
</LinearLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<!-- for locations -->
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:id="@+id/locInfoContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@null"
android:orientation="vertical"
android:paddingBottom="5dp"
android:visibility="gone">
<LinearLayout
android:id="@+id/locInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/profile_info_container_bottom_space">
<awais.instagrabber.customviews.CircularImageView
android:id="@+id/mainLocationImage"
android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size"
android:adjustViewBounds="true"
android:background="?selectableItemBackgroundBorderless" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainLocPostCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="35\nPosts" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnMap"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:text="@string/map"
android:textColor="@color/btn_green_text_color"
android:textSize="20sp"
app:backgroundTint="@color/btn_green_background" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/locationFullName"
android:layout_below="@id/locInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textSize="16sp"
tools:text="OUR HOUSE" />
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/locationBiography"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/locationFullName"
android:background="?android:selectableItemBackground"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
android:visibility="gone"
tools:text="IN THE MIDDLE OF OUR STREET" />
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/locationUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/locationBiography"
android:ellipsize="marquee"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
tools:text="https://austinhuang.me/"
android:visibility="gone" />
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mainPosts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
tools:listitem="@layout/item_post" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/privatePage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/private_page_margins"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="40dp"
android:visibility="gone">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/privatePage1"
android:layout_width="@dimen/private_page_margins"
android:layout_height="@dimen/private_page_margins"
app:srcCompat="@drawable/lock" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/privatePage2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/priv_acc"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="28sp" />
</LinearLayout>
</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
<!-- Feed View --> <!-- Feed View -->
<LinearLayout <include
android:id="@+id/feedLayout" android:id="@+id/feed_view"
android:layout_width="match_parent" layout="@layout/layout_feed_view" />
android:layout_height="match_parent"
android:layout_gravity="start"
android:animateLayoutChanges="true"
android:orientation="vertical"
android:tag="@android:string/yes">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/feedStories"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:paddingTop="24dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:visibility="gone" />
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/feedSwipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/feedPosts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="24dp"
tools:listitem="@layout/item_feed" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout>
<!-- Discover View --> <!-- Discover View -->
<LinearLayout <LinearLayout

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/feedLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:animateLayoutChanges="true"
android:tag="@android:string/yes">
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|snap|enterAlways">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/feedStories"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:paddingTop="24dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:visibility="gone" />
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/feedSwipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/feedPosts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingTop="8dp"
tools:listitem="@layout/item_feed" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View File

@ -0,0 +1,469 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- for users -->
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:id="@+id/infoContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@null"
android:orientation="vertical"
android:paddingBottom="5dp">
<LinearLayout
android:id="@+id/profileInfoText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profileInfo"
android:orientation="horizontal"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/isVerified"
android:layout_width="18dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:visibility="gone"
app:srcCompat="@drawable/verified" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainFullName"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textSize="16sp"
tools:text="Austin Huang" />
</LinearLayout>
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/mainBiography"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profileInfoText"
android:background="?android:selectableItemBackground"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
tools:text="THE GLORIOUS (step)OWNER OF THIS APP" />
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/mainUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/mainBiography"
android:ellipsize="marquee"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
tools:text="https://austinhuang.me/"
android:visibility="gone" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/profileActions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/mainUrl">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnFollow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/follow"
android:textColor="@color/btn_pink_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_pink_background"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnRestrict"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/restrict"
android:textColor="@color/btn_orange_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_orange_background"
android:visibility="gone" />
<!-- only for invisible private accounts -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnBlock"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/block"
android:textColor="@color/btn_red_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_red_background"
android:visibility="gone" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/myActions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/profileActions">
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnTagged"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/tagged"
android:textColor="@color/btn_blue_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_blue_background"
android:visibility="gone" />
<!-- also used as block -->
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnSaved"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/saved"
android:textColor="@color/btn_orange_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_orange_background"
android:visibility="gone" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnLiked"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_marginEnd="1dp"
android:layout_marginStart="1dp"
android:layout_marginRight="8dp"
android:layout_weight="1"
android:text="@string/liked"
android:textColor="@color/btn_lightpink_text_color"
android:textSize="16sp"
app:backgroundTint="@color/btn_lightpink_background"
android:visibility="gone" />
</androidx.appcompat.widget.LinearLayoutCompat>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/highlightsList"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/myActions"
android:clipToPadding="false"
android:orientation="horizontal"
android:paddingStart="5dp"
android:paddingLeft="5dp"
android:paddingEnd="5dp"
android:paddingRight="5dp"
android:visibility="gone" />
<LinearLayout
android:id="@+id/profileInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/profile_info_container_bottom_space">
<awais.instagrabber.customviews.CircularImageView
android:id="@+id/mainProfileImage"
android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size"
android:adjustViewBounds="true"
android:background="?selectableItemBackgroundBorderless" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainPostCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="35\nPosts" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainFollowers"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="68\nFollowers" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainFollowing"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:background="?selectableItemBackgroundBorderless"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="64\nFollowing" />
</LinearLayout>
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<!-- for hashtags -->
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<LinearLayout
android:id="@+id/tagInfoContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/profile_info_container_bottom_space"
android:visibility="gone">
<awais.instagrabber.customviews.CircularImageView
android:id="@+id/mainHashtagImage"
android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size"
android:adjustViewBounds="true"
android:background="?selectableItemBackgroundBorderless" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainTagPostCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="35\nPosts" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnFollowTag"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:text="@string/follow"
android:textColor="@color/btn_pink_text_color"
android:textSize="20sp"
app:backgroundTint="@color/btn_pink_background" />
</LinearLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
<!-- for locations -->
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<RelativeLayout
android:id="@+id/locInfoContainer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:background="@null"
android:orientation="vertical"
android:paddingBottom="5dp"
android:visibility="gone">
<LinearLayout
android:id="@+id/locInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="@dimen/profile_info_container_bottom_space">
<awais.instagrabber.customviews.CircularImageView
android:id="@+id/mainLocationImage"
android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size"
android:adjustViewBounds="true"
android:background="?selectableItemBackgroundBorderless" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/mainLocPostCount"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginEnd="12dp"
android:layout_marginRight="12dp"
android:layout_weight="1"
android:gravity="center"
android:textAppearance="@style/TextAppearance.AppCompat"
android:textSize="15sp"
tools:text="35\nPosts" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/btnMap"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="2"
android:text="@string/map"
android:textColor="@color/btn_green_text_color"
android:textSize="20sp"
app:backgroundTint="@color/btn_green_background" />
</LinearLayout>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/locationFullName"
android:layout_below="@id/locInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
android:textSize="16sp"
tools:text="OUR HOUSE" />
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/locationBiography"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/locationFullName"
android:background="?android:selectableItemBackground"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
android:visibility="gone"
tools:text="IN THE MIDDLE OF OUR STREET" />
<awais.instagrabber.customviews.RamboTextView
android:id="@+id/locationUrl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/locationBiography"
android:ellipsize="marquee"
android:paddingStart="10dp"
android:paddingLeft="10dp"
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="16sp"
tools:text="https://austinhuang.me/"
android:visibility="gone" />
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/mainPosts"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
tools:listitem="@layout/item_post" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
<LinearLayout
android:id="@+id/privatePage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/private_page_margins"
android:gravity="center"
android:orientation="vertical"
android:paddingTop="40dp"
android:visibility="gone">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/privatePage1"
android:layout_width="@dimen/private_page_margins"
android:layout_height="@dimen/private_page_margins"
app:srcCompat="@drawable/lock" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/privatePage2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/priv_acc"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="28sp" />
</LinearLayout>
</FrameLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>