diff --git a/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java b/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
index 689c7769..e035ea07 100644
--- a/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
+++ b/app/src/main/java/awais/instagrabber/fragments/HashTagFragment.java
@@ -289,7 +289,7 @@ public class HashTagFragment extends Fragment {
private void setTitle() {
final ActionBar actionBar = fragmentActivity.getSupportActionBar();
if (actionBar != null) {
- actionBar.setTitle(hashtag.substring(1));
+ actionBar.setTitle(hashtag);
}
}
diff --git a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
index 63d0b1bd..9ef9111c 100644
--- a/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
+++ b/app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
@@ -434,7 +434,7 @@ public class DirectMessageThreadFragment extends Fragment {
private void searchUsername(final String text) {
// startActivity(new Intent(requireContext(), ProfileViewer.class).putExtra(Constants.EXTRAS_USERNAME, text));
- final NavDirections action = DirectMessageThreadFragmentDirections.actionDirectMessagesThreadFragmentToProfileFragment("@" + text);
+ final NavDirections action = DirectMessageThreadFragmentDirections.actionGlobalProfileFragment("@" + text);
NavHostFragment.findNavController(this).navigate(action);
}
diff --git a/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java
index 66b86222..2e742a27 100644
--- a/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java
+++ b/app/src/main/java/awais/instagrabber/fragments/main/FeedFragment.java
@@ -152,55 +152,9 @@ public class FeedFragment extends Fragment {
}
}
};
-
- @Override
- public void onCreate(@Nullable final Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- fragmentActivity = (MainActivity) requireActivity();
- storiesService = StoriesService.getInstance();
- }
-
- @Override
- public View onCreateView(@NonNull final LayoutInflater inflater,
- final ViewGroup container,
- final Bundle savedInstanceState) {
- if (root != null) {
- shouldRefresh = false;
- return root;
- }
- binding = FragmentFeedBinding.inflate(inflater, container, false);
- root = binding.getRoot();
- return root;
- }
-
- @Override
- public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
- if (!shouldRefresh) return;
- // setupActionBar();
- setupFeedStories();
- setupFeed();
- shouldRefresh = false;
- }
-
- @Override
- public void onPause() {
- super.onPause();
- if (videoAwareRecyclerScroller != null) {
- videoAwareRecyclerScroller.stopPlaying();
- }
- }
-
- @Override
- public void onResume() {
- super.onResume();
- if (videoAwareRecyclerScroller != null && SHOULD_AUTO_PLAY) {
- videoAwareRecyclerScroller.startPlaying();
- }
- }
-
- final MentionClickListener mentionClickListener = (view, text, isHashtag, isLocation) -> {
+ private final MentionClickListener mentionClickListener = (view, text, isHashtag, isLocation) -> {
if (isHashtag) {
- final NavDirections action = FeedFragmentDirections.actionFeedFragmentToHashTagFragment(text);
+ final NavDirections action = FeedFragmentDirections.actionGlobalHashTagFragment(text);
NavHostFragment.findNavController(this).navigate(action);
return;
}
@@ -209,10 +163,9 @@ public class FeedFragment extends Fragment {
NavHostFragment.findNavController(this).navigate(action);
return;
}
- final NavDirections action = FeedFragmentDirections.actionFeedFragmentToProfileFragment("@" + text);
+ final NavDirections action = FeedFragmentDirections.actionGlobalProfileFragment("@" + text);
NavHostFragment.findNavController(this).navigate(action);
};
-
private final View.OnClickListener postViewClickListener = v -> {
final Object tag = v.getTag();
if (!(tag instanceof FeedModel)) return;
@@ -293,6 +246,51 @@ public class FeedFragment extends Fragment {
}
};
+ @Override
+ public void onCreate(@Nullable final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ fragmentActivity = (MainActivity) requireActivity();
+ storiesService = StoriesService.getInstance();
+ }
+
+ @Override
+ public View onCreateView(@NonNull final LayoutInflater inflater,
+ final ViewGroup container,
+ final Bundle savedInstanceState) {
+ if (root != null) {
+ shouldRefresh = false;
+ return root;
+ }
+ binding = FragmentFeedBinding.inflate(inflater, container, false);
+ root = binding.getRoot();
+ return root;
+ }
+
+ @Override
+ public void onViewCreated(@NonNull final View view, @Nullable final Bundle savedInstanceState) {
+ if (!shouldRefresh) return;
+ // setupActionBar();
+ setupFeedStories();
+ setupFeed();
+ shouldRefresh = false;
+ }
+
+ @Override
+ public void onPause() {
+ super.onPause();
+ if (videoAwareRecyclerScroller != null) {
+ videoAwareRecyclerScroller.stopPlaying();
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ if (videoAwareRecyclerScroller != null && SHOULD_AUTO_PLAY) {
+ videoAwareRecyclerScroller.startPlaying();
+ }
+ }
+
private void setupFeed() {
feedViewModel = new ViewModelProvider(fragmentActivity).get(FeedViewModel.class);
final LinearLayoutManager layoutManager = new LinearLayoutManager(requireContext());
diff --git a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
index 9d6f0b80..94614545 100644
--- a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
+++ b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
@@ -29,6 +29,8 @@ import androidx.core.content.ContextCompat;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
+import androidx.navigation.NavDirections;
+import androidx.navigation.fragment.NavHostFragment;
import java.util.ArrayList;
import java.util.Arrays;
@@ -54,6 +56,7 @@ import awais.instagrabber.customviews.helpers.RecyclerLazyLoader;
import awais.instagrabber.databinding.FragmentProfileBinding;
import awais.instagrabber.fragments.main.viewmodels.PostsViewModel;
import awais.instagrabber.interfaces.FetchListener;
+import awais.instagrabber.interfaces.MentionClickListener;
import awais.instagrabber.models.PostModel;
import awais.instagrabber.models.ProfileModel;
import awais.instagrabber.models.StoryModel;
@@ -109,9 +112,7 @@ public class ProfileFragment extends Fragment {
remove();
}
};
- private final PrimaryActionModeCallback multiSelectAction = new PrimaryActionModeCallback(
- R.menu.multi_select_download_menu,
- new CallbacksHelper() {
+ private final PrimaryActionModeCallback multiSelectAction = new PrimaryActionModeCallback(R.menu.multi_select_download_menu, new CallbacksHelper() {
@Override
public void onDestroy(final ActionMode mode) {
onBackPressedCallback.handleOnBackPressed();
@@ -159,6 +160,21 @@ public class ProfileFragment extends Fragment {
binding.privatePage.setVisibility(View.VISIBLE);
}
};
+ private final MentionClickListener mentionClickListener = (view, text, isHashtag, isLocation) -> {
+ Log.d(TAG, "action...");
+ if (isHashtag) {
+ final NavDirections action = ProfileFragmentDirections.actionGlobalHashTagFragment(text);
+ NavHostFragment.findNavController(this).navigate(action);
+ return;
+ }
+ if (isLocation) {
+ final NavDirections action = FeedFragmentDirections.actionFeedFragmentToLocationFragment(text);
+ NavHostFragment.findNavController(this).navigate(action);
+ return;
+ }
+ final NavDirections action = ProfileFragmentDirections.actionGlobalProfileFragment("@" + text);
+ NavHostFragment.findNavController(this).navigate(action);
+ };
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
@@ -409,7 +425,7 @@ public class ProfileFragment extends Fragment {
if (Utils.hasMentions(biography)) {
biography = Utils.getMentionText(biography);
binding.mainBiography.setText(biography, TextView.BufferType.SPANNABLE);
- // binding.mainBiography.setMentionClickListener(mentionClickListener);
+ binding.mainBiography.setMentionClickListener(mentionClickListener);
} else {
binding.mainBiography.setText(biography);
binding.mainBiography.setMentionClickListener(null);
@@ -596,7 +612,6 @@ public class ProfileFragment extends Fragment {
.putExtra(Constants.EXTRAS_INDEX, "%" + profileModel.getId())
.putExtra(Constants.EXTRAS_USER, "@" + profileModel.getUsername())
));
- // binding.btnFollowTag.setOnClickListener(profileActionListener);
}
private void setUsernameDelayed() {
diff --git a/app/src/main/res/navigation/direct_messages_nav_graph.xml b/app/src/main/res/navigation/direct_messages_nav_graph.xml
index c8c434ae..f128d28c 100644
--- a/app/src/main/res/navigation/direct_messages_nav_graph.xml
+++ b/app/src/main/res/navigation/direct_messages_nav_graph.xml
@@ -5,6 +5,17 @@
android:id="@+id/direct_messages_nav_graph"
app:startDestination="@id/directMessagesInboxFragment">
+
+
+
+
+
+
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/navigation/feed_nav_graph.xml b/app/src/main/res/navigation/feed_nav_graph.xml
index 341d424b..d081a60a 100644
--- a/app/src/main/res/navigation/feed_nav_graph.xml
+++ b/app/src/main/res/navigation/feed_nav_graph.xml
@@ -5,6 +5,28 @@
android:id="@+id/feed_nav_graph"
app:startDestination="@id/feedFragment">
+
+
+
+
+
+
+
+
+
+
+
+
-
-
@@ -40,31 +56,11 @@
android:name="isHashtag"
app:argType="boolean" />
-
-
-
-
-
-
+ tools:layout="@layout/fragment_location">
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/navigation/profile_nav_graph.xml b/app/src/main/res/navigation/profile_nav_graph.xml
index dd294b61..1b3c63da 100644
--- a/app/src/main/res/navigation/profile_nav_graph.xml
+++ b/app/src/main/res/navigation/profile_nav_graph.xml
@@ -4,9 +4,38 @@
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/profile_nav_graph"
app:startDestination="@id/profileFragment">
+
+
+
+
+
+
+
+
+
+
+
+ tools:layout="@layout/fragment_profile" >
+
+
+
+
+
\ No newline at end of file