Code comments about hiding news discovery on Iceshrimp
This commit is contained in:
@@ -87,13 +87,13 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop,
|
|||||||
disableDiscover=instance.map(Instance::isAkkoma).orElse(false);
|
disableDiscover=instance.map(Instance::isAkkoma).orElse(false);
|
||||||
isIceshrimp=instance.map(Instance::isIceshrimp).orElse(false);
|
isIceshrimp=instance.map(Instance::isIceshrimp).orElse(false);
|
||||||
|
|
||||||
tabViews=new FrameLayout[isIceshrimp ? 3 : 4];
|
tabViews=new FrameLayout[isIceshrimp ? 3 : 4]; // reduce array size on Iceshrimp to hide news feed because it's unsupported and always returns an empty list
|
||||||
for(int i=0;i<tabViews.length;i++){
|
for(int i=0;i<tabViews.length;i++){
|
||||||
FrameLayout tabView=new FrameLayout(getActivity());
|
FrameLayout tabView=new FrameLayout(getActivity());
|
||||||
tabView.setId(switch(i){
|
tabView.setId(switch(i){
|
||||||
case 0 -> R.id.discover_posts;
|
case 0 -> R.id.discover_posts;
|
||||||
case 1 -> R.id.discover_hashtags;
|
case 1 -> R.id.discover_hashtags;
|
||||||
case 2 -> isIceshrimp ? R.id.discover_users : R.id.discover_news;
|
case 2 -> isIceshrimp ? R.id.discover_users : R.id.discover_news; // skip unsupported news discovery on Iceshrimp
|
||||||
case 3 -> R.id.discover_users;
|
case 3 -> R.id.discover_users;
|
||||||
default -> throw new IllegalStateException("Unexpected value: "+i);
|
default -> throw new IllegalStateException("Unexpected value: "+i);
|
||||||
});
|
});
|
||||||
@@ -139,7 +139,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop,
|
|||||||
transaction
|
transaction
|
||||||
.add(R.id.discover_posts, postsFragment)
|
.add(R.id.discover_posts, postsFragment)
|
||||||
.add(R.id.discover_hashtags, hashtagsFragment);
|
.add(R.id.discover_hashtags, hashtagsFragment);
|
||||||
if(!isIceshrimp)
|
if(!isIceshrimp) // skip unsupported news discovery on Iceshrimp
|
||||||
transaction.add(R.id.discover_news, newsFragment);
|
transaction.add(R.id.discover_news, newsFragment);
|
||||||
transaction
|
transaction
|
||||||
.add(R.id.discover_users, accountsFragment)
|
.add(R.id.discover_users, accountsFragment)
|
||||||
@@ -152,7 +152,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop,
|
|||||||
tab.setText(switch(position){
|
tab.setText(switch(position){
|
||||||
case 0 -> R.string.posts;
|
case 0 -> R.string.posts;
|
||||||
case 1 -> R.string.hashtags;
|
case 1 -> R.string.hashtags;
|
||||||
case 2 -> isIceshrimp ? R.string.for_you : R.string.news;
|
case 2 -> isIceshrimp ? R.string.for_you : R.string.news; // skip unsupported news discovery on Iceshrimp
|
||||||
case 3 -> R.string.for_you;
|
case 3 -> R.string.for_you;
|
||||||
default -> throw new IllegalStateException("Unexpected value: "+position);
|
default -> throw new IllegalStateException("Unexpected value: "+position);
|
||||||
});
|
});
|
||||||
@@ -273,7 +273,7 @@ public class DiscoverFragment extends AppKitFragment implements ScrollableToTop,
|
|||||||
return switch(page){
|
return switch(page){
|
||||||
case 0 -> postsFragment;
|
case 0 -> postsFragment;
|
||||||
case 1 -> hashtagsFragment;
|
case 1 -> hashtagsFragment;
|
||||||
case 2 -> isIceshrimp ? accountsFragment : newsFragment;
|
case 2 -> isIceshrimp ? accountsFragment : newsFragment; // skip unsupported news discovery on Iceshrimp
|
||||||
case 3 -> accountsFragment;
|
case 3 -> accountsFragment;
|
||||||
default -> throw new IllegalStateException("Unexpected value: "+page);
|
default -> throw new IllegalStateException("Unexpected value: "+page);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user