mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix issue #103 - Scroll to top for notifications when taping the bottom item menu.
This commit is contained in:
parent
ff0ff6cedc
commit
5e98e60d7d
2 changed files with 16 additions and 0 deletions
|
@ -116,6 +116,7 @@ import app.fedilab.android.helper.ThemeHelper;
|
|||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonConversation;
|
||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonNotification;
|
||||
import app.fedilab.android.ui.fragment.timeline.FragmentMastodonTimeline;
|
||||
import app.fedilab.android.ui.fragment.timeline.FragmentNotificationContainer;
|
||||
import app.fedilab.android.viewmodel.mastodon.AccountsVM;
|
||||
import app.fedilab.android.viewmodel.mastodon.InstancesVM;
|
||||
import app.fedilab.android.viewmodel.mastodon.TimelinesVM;
|
||||
|
@ -893,6 +894,9 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
|
|||
} else if (fragment instanceof FragmentMastodonConversation) {
|
||||
FragmentMastodonConversation fragmentMastodonConversation = ((FragmentMastodonConversation) fragment);
|
||||
fragmentMastodonConversation.scrollToTop();
|
||||
} else if (fragment instanceof FragmentNotificationContainer) {
|
||||
FragmentNotificationContainer fragmentNotificationContainer = ((FragmentNotificationContainer) fragment);
|
||||
fragmentNotificationContainer.scrollToTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,6 +61,18 @@ public class FragmentNotificationContainer extends Fragment {
|
|||
}
|
||||
|
||||
|
||||
public void scrollToTop() {
|
||||
if (binding != null) {
|
||||
FedilabNotificationPageAdapter fedilabNotificationPageAdapter = ((FedilabNotificationPageAdapter) binding.viewpager.getAdapter());
|
||||
if (fedilabNotificationPageAdapter != null) {
|
||||
FragmentMastodonNotification fragmentMastodonNotification = (FragmentMastodonNotification) fedilabNotificationPageAdapter.getCurrentFragment();
|
||||
if (fragmentMastodonNotification != null) {
|
||||
fragmentMastodonNotification.scrollToTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("ApplySharedPref")
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
|
|
Loading…
Reference in a new issue