mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-12-23 13:26:59 +00:00
Move activity notification viewer to its own nav graph. Fixes https://github.com/austinhuang0131/barinsta/issues/247
This commit is contained in:
parent
ebea1404c9
commit
c1b5094dc7
@ -35,7 +35,6 @@ import androidx.lifecycle.LiveData;
|
||||
import androidx.navigation.NavBackStackEntry;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.NavDestination;
|
||||
import androidx.navigation.NavDirections;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
@ -58,7 +57,6 @@ import awais.instagrabber.customviews.helpers.CustomHideBottomViewOnScrollBehavi
|
||||
import awais.instagrabber.databinding.ActivityMainBinding;
|
||||
import awais.instagrabber.fragments.PostViewV2Fragment;
|
||||
import awais.instagrabber.fragments.main.FeedFragment;
|
||||
import awais.instagrabber.fragments.settings.MorePreferencesFragmentDirections;
|
||||
import awais.instagrabber.interfaces.FetchListener;
|
||||
import awais.instagrabber.models.IntentModel;
|
||||
import awais.instagrabber.models.SuggestionModel;
|
||||
@ -634,14 +632,10 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage
|
||||
}
|
||||
|
||||
private void showActivityView() {
|
||||
binding.bottomNavView.setSelectedItemId(R.id.more_nav_graph);
|
||||
binding.bottomNavView.post(() -> {
|
||||
if (currentNavControllerLiveData == null) return;
|
||||
final NavController navController = currentNavControllerLiveData.getValue();
|
||||
if (navController == null) return;
|
||||
final NavDirections navDirections = MorePreferencesFragmentDirections.actionMorePreferencesFragmentToNotificationsViewer();
|
||||
navController.navigate(navDirections);
|
||||
});
|
||||
navController.navigate(R.id.action_global_notificationsViewerFragment);
|
||||
}
|
||||
|
||||
private void bindActivityCheckerService() {
|
||||
|
@ -103,8 +103,7 @@ public class MorePreferencesFragment extends BasePreferencesFragment {
|
||||
screen.addPreference(getDivider(context));
|
||||
if (isLoggedIn) {
|
||||
screen.addPreference(getPreference(R.string.action_notif, R.drawable.ic_not_liked, preference -> {
|
||||
final NavDirections navDirections = MorePreferencesFragmentDirections.actionMorePreferencesFragmentToNotificationsViewer();
|
||||
NavHostFragment.findNavController(this).navigate(navDirections);
|
||||
NavHostFragment.findNavController(this).navigate(R.id.action_global_notificationsViewerFragment);
|
||||
return true;
|
||||
}));
|
||||
}
|
||||
|
@ -38,6 +38,12 @@
|
||||
app:nullable="false" />
|
||||
</action>
|
||||
|
||||
<include app:graph="@navigation/notification_viewer_nav_graph" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_notificationsViewerFragment"
|
||||
app:destination="@id/notification_viewer_nav_graph" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/directMessagesInboxFragment"
|
||||
android:name="awais.instagrabber.fragments.directmessages.DirectMessageInboxFragment"
|
||||
|
@ -57,6 +57,12 @@
|
||||
app:nullable="false" />
|
||||
</action>
|
||||
|
||||
<include app:graph="@navigation/notification_viewer_nav_graph" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_notificationsViewerFragment"
|
||||
app:destination="@id/notification_viewer_nav_graph" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/discoverFragment"
|
||||
android:name="awais.instagrabber.fragments.main.DiscoverFragment"
|
||||
|
@ -57,6 +57,12 @@
|
||||
app:nullable="false" />
|
||||
</action>
|
||||
|
||||
<include app:graph="@navigation/notification_viewer_nav_graph" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_notificationsViewerFragment"
|
||||
app:destination="@id/notification_viewer_nav_graph" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/feedFragment"
|
||||
android:name="awais.instagrabber.fragments.main.FeedFragment"
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation 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/more_nav_graph"
|
||||
app:startDestination="@id/morePreferencesFragment">
|
||||
|
||||
@ -9,6 +8,7 @@
|
||||
<include app:graph="@navigation/hashtag_nav_graph" />
|
||||
<include app:graph="@navigation/location_nav_graph" />
|
||||
<include app:graph="@navigation/comments_nav_graph" />
|
||||
<include app:graph="@navigation/notification_viewer_nav_graph" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_profileFragment"
|
||||
@ -37,6 +37,10 @@
|
||||
app:nullable="false" />
|
||||
</action>
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_notificationsViewerFragment"
|
||||
app:destination="@id/notification_viewer_nav_graph" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/morePreferencesFragment"
|
||||
android:name="awais.instagrabber.fragments.settings.MorePreferencesFragment"
|
||||
@ -47,9 +51,6 @@
|
||||
<action
|
||||
android:id="@+id/action_morePreferencesFragment_to_aboutFragment"
|
||||
app:destination="@id/aboutFragment" />
|
||||
<action
|
||||
android:id="@+id/action_morePreferencesFragment_to_notificationsViewer"
|
||||
app:destination="@id/notificationsViewer" />
|
||||
<action
|
||||
android:id="@+id/action_morePreferencesFragment_to_favoritesFragment"
|
||||
app:destination="@id/favoritesFragment" />
|
||||
@ -69,11 +70,6 @@
|
||||
android:id="@+id/aboutFragment"
|
||||
android:name="awais.instagrabber.fragments.settings.AboutFragment"
|
||||
android:label="@string/action_about" />
|
||||
<fragment
|
||||
android:id="@+id/notificationsViewer"
|
||||
android:name="awais.instagrabber.fragments.NotificationsViewerFragment"
|
||||
android:label="@string/title_notifications"
|
||||
tools:layout="@layout/fragment_notifications_viewer" />
|
||||
<fragment
|
||||
android:id="@+id/themePreferencesFragment"
|
||||
android:name="awais.instagrabber.fragments.settings.ThemePreferencesFragment"
|
||||
|
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<navigation 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/notification_viewer_nav_graph"
|
||||
app:startDestination="@id/notificationsViewer">
|
||||
|
||||
<fragment
|
||||
android:id="@+id/notificationsViewer"
|
||||
android:name="awais.instagrabber.fragments.NotificationsViewerFragment"
|
||||
android:label="@string/title_notifications"
|
||||
tools:layout="@layout/fragment_notifications_viewer" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_notificationsViewerFragment"
|
||||
app:destination="@id/notificationsViewer" />
|
||||
</navigation>
|
@ -58,6 +58,12 @@
|
||||
app:nullable="false" />
|
||||
</action>
|
||||
|
||||
<include app:graph="@navigation/notification_viewer_nav_graph" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_global_notificationsViewerFragment"
|
||||
app:destination="@id/notification_viewer_nav_graph" />
|
||||
|
||||
<fragment
|
||||
android:id="@+id/profileFragment"
|
||||
android:name="awais.instagrabber.fragments.main.ProfileFragment"
|
||||
|
Loading…
Reference in New Issue
Block a user