Making sure it compiles!
This commit is contained in:
parent
bef3c72513
commit
4db87feec4
|
@ -1,5 +1,7 @@
|
||||||
package org.joinmastodon.android.fragments;
|
package org.joinmastodon.android.fragments;
|
||||||
|
|
||||||
|
import static org.joinmastodon.android.GlobalUserPreferences.showFederatedTimeline;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.AnimatorSet;
|
import android.animation.AnimatorSet;
|
||||||
|
@ -68,7 +70,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
|
|
||||||
private String accountID;
|
private String accountID;
|
||||||
private MenuItem announcements;
|
private MenuItem announcements;
|
||||||
// private ImageView toolbarLogo;
|
// private ImageView toolbarLogo;
|
||||||
private Button toolbarShowNewPostsBtn;
|
private Button toolbarShowNewPostsBtn;
|
||||||
private boolean newPostsBtnShown;
|
private boolean newPostsBtnShown;
|
||||||
private AnimatorSet currentNewPostsAnim;
|
private AnimatorSet currentNewPostsAnim;
|
||||||
|
@ -109,7 +111,12 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
|
|
||||||
fragments.add(new HomeTimelineFragment());
|
fragments.add(new HomeTimelineFragment());
|
||||||
fragments.add(new LocalTimelineFragment());
|
fragments.add(new LocalTimelineFragment());
|
||||||
if (GlobalUserPreferences.showFederatedTimeline) fragments.add(new FederatedTimelineFragment());
|
if (showFederatedTimeline) fragments.add(new FederatedTimelineFragment());
|
||||||
|
args=new Bundle(args);
|
||||||
|
args.putBoolean("onlyPosts", true);
|
||||||
|
NotificationsListFragment postsFragment=new NotificationsListFragment();
|
||||||
|
postsFragment.setArguments(args);
|
||||||
|
fragments.add(postsFragment);
|
||||||
|
|
||||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||||
for (int i = 0; i < fragments.size(); i++) {
|
for (int i = 0; i < fragments.size(); i++) {
|
||||||
|
@ -302,7 +309,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
|
|
||||||
private void updateSwitcherMenu() {
|
private void updateSwitcherMenu() {
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
switcherPopup.getMenu().findItem(R.id.federated).setVisible(GlobalUserPreferences.showFederatedTimeline);
|
switcherPopup.getMenu().findItem(R.id.federated).setVisible(showFederatedTimeline);
|
||||||
|
|
||||||
if (!listItems.isEmpty()) {
|
if (!listItems.isEmpty()) {
|
||||||
MenuItem listsItem = switcherPopup.getMenu().findItem(R.id.lists);
|
MenuItem listsItem = switcherPopup.getMenu().findItem(R.id.lists);
|
||||||
|
@ -342,6 +349,8 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
} else if (id == R.id.federated) {
|
} else if (id == R.id.federated) {
|
||||||
navigateTo(2);
|
navigateTo(2);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (id == R.id.post_notifications) {
|
||||||
|
navigateTo(showFederatedTimeline ? 3 : 2);
|
||||||
} else if ((list = listItems.get(id)) != null) {
|
} else if ((list = listItems.get(id)) != null) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString("account", accountID);
|
args.putString("account", accountID);
|
||||||
|
@ -365,6 +374,11 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSwitcherIcon(int i) {
|
private void updateSwitcherIcon(int i) {
|
||||||
|
// todo: refactor when implementing pinned tabs
|
||||||
|
if (i == (showFederatedTimeline ? 3 : 2)) {
|
||||||
|
timelineIcon.setImageResource(R.drawable.ic_fluent_alert_24_regular);
|
||||||
|
timelineTitle.setText(R.string.sk_notify_posts);
|
||||||
|
} else {
|
||||||
timelineIcon.setImageResource(switch (i) {
|
timelineIcon.setImageResource(switch (i) {
|
||||||
default -> R.drawable.ic_fluent_home_24_regular;
|
default -> R.drawable.ic_fluent_home_24_regular;
|
||||||
case 1 -> R.drawable.ic_fluent_people_community_24_regular;
|
case 1 -> R.drawable.ic_fluent_people_community_24_regular;
|
||||||
|
@ -376,6 +390,7 @@ public class HomeTabFragment extends MastodonToolbarFragment implements Scrollab
|
||||||
case 2 -> R.string.sk_timeline_federated;
|
case 2 -> R.string.sk_timeline_federated;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onOptionsItemSelected(MenuItem item){
|
public boolean onOptionsItemSelected(MenuItem item){
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<item android:id="@+id/home" android:icon="@drawable/ic_fluent_home_24_regular" android:title="@string/sk_timeline_home" />
|
<item android:id="@+id/home" android:icon="@drawable/ic_fluent_home_24_regular" android:title="@string/sk_timeline_home" />
|
||||||
<item android:id="@+id/local" android:icon="@drawable/ic_fluent_people_community_24_regular" android:title="@string/sk_timeline_local" />
|
<item android:id="@+id/local" android:icon="@drawable/ic_fluent_people_community_24_regular" android:title="@string/sk_timeline_local" />
|
||||||
<item android:id="@+id/federated" android:icon="@drawable/ic_fluent_earth_24_regular" android:title="@string/sk_timeline_federated" />
|
<item android:id="@+id/federated" android:icon="@drawable/ic_fluent_earth_24_regular" android:title="@string/sk_timeline_federated" />
|
||||||
|
<item android:id="@+id/post_notifications" android:icon="@drawable/ic_fluent_alert_24_regular" android:title="@string/sk_notify_posts" />
|
||||||
<item android:id="@+id/lists" android:icon="@drawable/ic_fluent_people_list_24_regular" android:title="@string/sk_list_timelines" android:visible="false">
|
<item android:id="@+id/lists" android:icon="@drawable/ic_fluent_people_list_24_regular" android:title="@string/sk_list_timelines" android:visible="false">
|
||||||
<menu />
|
<menu />
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in New Issue