Revert "Hardcoding fosstodon and having a half working thing"

This reverts commit 08a3ec99ce.
This commit is contained in:
LucasGGamerM 2023-02-20 11:20:01 -03:00
parent 1837e5204b
commit 6404d9cf9a
3 changed files with 1 additions and 40 deletions

View File

@ -58,12 +58,6 @@ public class CustomLocalTimelineFragment extends PinnableStatusListFragment {
setTitle(domain); setTitle(domain);
} }
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.hashtag_timeline, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override @Override
protected TimelineDefinition makeTimelineDefinition() { protected TimelineDefinition makeTimelineDefinition() {
return TimelineDefinition.ofCustomLocalTimeline(domain); return TimelineDefinition.ofCustomLocalTimeline(domain);

View File

@ -46,7 +46,6 @@ import org.joinmastodon.android.events.ListDeletedEvent;
import org.joinmastodon.android.events.ListUpdatedCreatedEvent; import org.joinmastodon.android.events.ListUpdatedCreatedEvent;
import org.joinmastodon.android.events.SelfUpdateStateChangedEvent; import org.joinmastodon.android.events.SelfUpdateStateChangedEvent;
import org.joinmastodon.android.model.Announcement; import org.joinmastodon.android.model.Announcement;
import org.joinmastodon.android.model.CustomLocalTimeline;
import org.joinmastodon.android.model.Hashtag; import org.joinmastodon.android.model.Hashtag;
import org.joinmastodon.android.model.HeaderPaginationList; import org.joinmastodon.android.model.HeaderPaginationList;
import org.joinmastodon.android.model.ListTimeline; import org.joinmastodon.android.model.ListTimeline;
@ -89,20 +88,17 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
private PopupMenu switcherPopup; private PopupMenu switcherPopup;
private final Map<Integer, ListTimeline> listItems = new HashMap<>(); private final Map<Integer, ListTimeline> listItems = new HashMap<>();
private final Map<Integer, Hashtag> hashtagsItems = new HashMap<>(); private final Map<Integer, Hashtag> hashtagsItems = new HashMap<>();
private final Map<Integer, CustomLocalTimeline> customLocalTimelineItems = new HashMap<>();
private List<TimelineDefinition> timelineDefinitions; private List<TimelineDefinition> timelineDefinitions;
private int count; private int count;
private Fragment[] fragments; private Fragment[] fragments;
private FrameLayout[] tabViews; private FrameLayout[] tabViews;
private TimelineDefinition[] timelines; private TimelineDefinition[] timelines;
private final Map<Integer, TimelineDefinition> timelinesByMenuItem = new HashMap<>(); private final Map<Integer, TimelineDefinition> timelinesByMenuItem = new HashMap<>();
private SubMenu hashtagsMenu, listsMenu, customLocalTimelinesMenu; private SubMenu hashtagsMenu, listsMenu;
private PopupMenu overflowPopup; private PopupMenu overflowPopup;
private View overflowActionView = null; private View overflowActionView = null;
private boolean announcementsBadged, settingsBadged; private boolean announcementsBadged, settingsBadged;
private CustomLocalTimeline fosstodon;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -115,9 +111,6 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
fragments = new Fragment[count]; fragments = new Fragment[count];
tabViews = new FrameLayout[count]; tabViews = new FrameLayout[count];
timelines = new TimelineDefinition[count]; timelines = new TimelineDefinition[count];
fosstodon = new CustomLocalTimeline();
fosstodon.domain = "fosstodon.org";
customLocalTimelineItems.put(1, fosstodon);
} }
@Override @Override
@ -311,18 +304,6 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
}); });
} }
private void addCustomLocalTimelinesToOverflowMenu() {
Context ctx = getContext();
customLocalTimelinesMenu.clear();
customLocalTimelinesMenu.getItem().setVisible(customLocalTimelineItems.size() > 0);
UiUtils.insetPopupMenuIcon(ctx, UiUtils.makeBackItem(customLocalTimelinesMenu));
customLocalTimelineItems.forEach((id, customLocalTimeline) -> {
MenuItem item = customLocalTimelinesMenu.add(Menu.NONE, id, Menu.NONE, customLocalTimeline.domain);
item.setIcon(R.drawable.ic_fluent_people_community_24_regular);
UiUtils.insetPopupMenuIcon(ctx, item);
});
}
public void updateToolbarLogo(){ public void updateToolbarLogo(){
Toolbar toolbar = getToolbar(); Toolbar toolbar = getToolbar();
ViewParent parentView = toolbarFrame.getParent(); ViewParent parentView = toolbarFrame.getParent();
@ -366,7 +347,6 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
settings = m.findItem(R.id.settings); settings = m.findItem(R.id.settings);
hashtagsMenu = m.findItem(R.id.hashtags).getSubMenu(); hashtagsMenu = m.findItem(R.id.hashtags).getSubMenu();
listsMenu = m.findItem(R.id.lists).getSubMenu(); listsMenu = m.findItem(R.id.lists).getSubMenu();
customLocalTimelinesMenu = m.findItem(R.id.custom_local_timelines).getSubMenu();
announcements.setVisible(!announcementsBadged); announcements.setVisible(!announcementsBadged);
announcementsAction.setVisible(announcementsBadged); announcementsAction.setVisible(announcementsBadged);
@ -377,7 +357,6 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
addListsToOverflowMenu(); addListsToOverflowMenu();
addHashtagsToOverflowMenu(); addHashtagsToOverflowMenu();
addCustomLocalTimelinesToOverflowMenu();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
m.setGroupDividerEnabled(true); m.setGroupDividerEnabled(true);
@ -460,7 +439,6 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
int id = item.getItemId(); int id = item.getItemId();
ListTimeline list; ListTimeline list;
Hashtag hashtag; Hashtag hashtag;
CustomLocalTimeline customLocalTimeline;
if (item.getItemId() == R.id.menu_back) { if (item.getItemId() == R.id.menu_back) {
getToolbar().post(() -> overflowPopup.show()); getToolbar().post(() -> overflowPopup.show());
@ -480,10 +458,6 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
args.putString("hashtag", hashtag.name); args.putString("hashtag", hashtag.name);
args.putBoolean("following", hashtag.following); args.putBoolean("following", hashtag.following);
Nav.go(getActivity(), HashtagTimelineFragment.class, args); Nav.go(getActivity(), HashtagTimelineFragment.class, args);
} else if ((customLocalTimeline = customLocalTimelineItems.get(id)) != null) {
args.putString("domain", customLocalTimeline.domain);
// args.putBoolean("following", hashtag.following);
Nav.go(getActivity(), CustomLocalTimelineFragment.class, args);
} }
return true; return true;
} }

View File

@ -29,12 +29,5 @@
android:visible="false"> android:visible="false">
<menu /> <menu />
</item> </item>
<item
android:id="@+id/custom_local_timelines"
android:icon="@drawable/ic_fluent_people_community_24_filled"
android:title="@string/sk_hashtags_you_follow"
android:visible="false">
<menu />
</item>
</group> </group>
</menu> </menu>