mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +00:00
Merge branch 'master' of https://github.com/austinhuang0131/instagrabber
This commit is contained in:
commit
5c97f54f9d
@ -78,8 +78,7 @@ public final class NotificationsViewerFragment extends Fragment implements Swipe
|
|||||||
try {
|
try {
|
||||||
binding.swipeRefreshLayout.setRefreshing(false);
|
binding.swipeRefreshLayout.setRefreshing(false);
|
||||||
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(getContext(), t.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
} catch (Throwable ignored) {}
|
||||||
catch(Throwable e) {}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -92,10 +91,10 @@ public final class NotificationsViewerFragment extends Fragment implements Swipe
|
|||||||
@Override
|
@Override
|
||||||
public void onPreviewClick(final Notification model) {
|
public void onPreviewClick(final Notification model) {
|
||||||
final NotificationImage notificationImage = model.getArgs().getMedia().get(0);
|
final NotificationImage notificationImage = model.getArgs().getMedia().get(0);
|
||||||
final long mediaId = Long.valueOf(notificationImage.getId().split("_")[0]);
|
final long mediaId = Long.parseLong(notificationImage.getId().split("_")[0]);
|
||||||
if (model.getType() == NotificationType.RESPONDED_STORY) {
|
if (model.getType() == NotificationType.RESPONDED_STORY) {
|
||||||
final NavDirections action = NotificationsViewerFragmentDirections
|
final NavDirections action = NotificationsViewerFragmentDirections
|
||||||
.actionNotificationsViewerFragmentToStoryViewerFragment(
|
.actionNotificationsToStory(
|
||||||
StoryViewerOptions.forStory(
|
StoryViewerOptions.forStory(
|
||||||
mediaId,
|
mediaId,
|
||||||
model.getArgs().getUsername()));
|
model.getArgs().getUsername()));
|
||||||
@ -277,8 +276,7 @@ public final class NotificationsViewerFragment extends Fragment implements Swipe
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void openProfile(final String username) {
|
private void openProfile(final String username) {
|
||||||
final NavDirections action = NotificationsViewerFragmentDirections
|
final NavDirections action = NotificationsViewerFragmentDirections.actionGlobalProfileFragment("@" + username);
|
||||||
.actionGlobalProfileFragment("@" + username);
|
|
||||||
NavHostFragment.findNavController(this).navigate(action);
|
NavHostFragment.findNavController(this).navigate(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -83,9 +83,12 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||||||
new FeedStoriesAdapter.OnFeedStoryClickListener() {
|
new FeedStoriesAdapter.OnFeedStoryClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onFeedStoryClick(FeedStoryModel model, int position) {
|
public void onFeedStoryClick(FeedStoryModel model, int position) {
|
||||||
|
final NavController navController = NavHostFragment.findNavController(FeedFragment.this);
|
||||||
|
if (isSafeToNavigate(navController)) {
|
||||||
final NavDirections action = FeedFragmentDirections
|
final NavDirections action = FeedFragmentDirections
|
||||||
.actionFeedFragmentToStoryViewerFragment(StoryViewerOptions.forFeedStoryPosition(position));
|
.actionFeedFragmentToStoryViewerFragment(StoryViewerOptions.forFeedStoryPosition(position));
|
||||||
NavHostFragment.findNavController(FeedFragment.this).navigate(action);
|
navController.navigate(action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -437,4 +440,9 @@ public class FeedFragment extends Fragment implements SwipeRefreshLayout.OnRefre
|
|||||||
binding.feedRecyclerView.smoothScrollToPosition(0);
|
binding.feedRecyclerView.smoothScrollToPosition(0);
|
||||||
// binding.storiesContainer.setExpanded(true);
|
// binding.storiesContainer.setExpanded(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSafeToNavigate(final NavController navController) {
|
||||||
|
return navController.getCurrentDestination() != null
|
||||||
|
&& navController.getCurrentDestination().getId() == R.id.feedFragment;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ import android.webkit.MimeTypeMap;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.IdRes;
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.appcompat.app.ActionBar;
|
import androidx.appcompat.app.ActionBar;
|
||||||
@ -474,7 +473,11 @@ public final class Utils {
|
|||||||
final List<String> navGraphNameList = Arrays.asList(navGraphNames);
|
final List<String> navGraphNameList = Arrays.asList(navGraphNames);
|
||||||
if (TextUtils.isEmpty(tabOrderString)) {
|
if (TextUtils.isEmpty(tabOrderString)) {
|
||||||
// Use top 5 entries for default list
|
// Use top 5 entries for default list
|
||||||
return navGraphNameList.subList(0, 5);
|
final List<String> top5navGraphNames = navGraphNameList.subList(0, 5);
|
||||||
|
final String newOrderString = android.text.TextUtils.join(",", top5navGraphNames);
|
||||||
|
Utils.settingsHelper.putString(PreferenceKeys.PREF_TAB_ORDER, newOrderString);
|
||||||
|
tabOrderString = newOrderString;
|
||||||
|
return top5navGraphNames;
|
||||||
}
|
}
|
||||||
// Make sure that the list from preference does not contain any invalid values
|
// Make sure that the list from preference does not contain any invalid values
|
||||||
final List<String> orderGraphNames = Arrays.stream(tabOrderString.split(","))
|
final List<String> orderGraphNames = Arrays.stream(tabOrderString.split(","))
|
||||||
@ -489,6 +492,7 @@ public final class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isNavRootInCurrentTabs(final String navRootString) {
|
public static boolean isNavRootInCurrentTabs(final String navRootString) {
|
||||||
|
if (navRootString == null || tabOrderString == null) return false;
|
||||||
return tabOrderString.contains(navRootString);
|
return tabOrderString.contains(navRootString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -326,6 +326,7 @@
|
|||||||
<androidx.constraintlayout.widget.Barrier
|
<androidx.constraintlayout.widget.Barrier
|
||||||
android:id="@+id/highlights_barrier"
|
android:id="@+id/highlights_barrier"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
app:constraint_referenced_ids="mainPostCount, mainFollowers, mainFollowing"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:barrierDirection="bottom" />
|
app:barrierDirection="bottom" />
|
||||||
|
|
||||||
|
@ -5,25 +5,6 @@
|
|||||||
android:id="@+id/notification_viewer_nav_graph"
|
android:id="@+id/notification_viewer_nav_graph"
|
||||||
app:startDestination="@id/notificationsViewer">
|
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">
|
|
||||||
<argument
|
|
||||||
android:name="type"
|
|
||||||
app:argType="string"
|
|
||||||
app:nullable="false"
|
|
||||||
android:defaultValue="notif"/>
|
|
||||||
<argument
|
|
||||||
android:name="targetId"
|
|
||||||
android:defaultValue="0L"
|
|
||||||
app:argType="long" />
|
|
||||||
<action
|
|
||||||
android:id="@+id/action_notificationsViewerFragment_to_storyViewerFragment"
|
|
||||||
app:destination="@id/storyViewerFragment" />
|
|
||||||
</fragment>
|
|
||||||
|
|
||||||
<include app:graph="@navigation/profile_nav_graph" />
|
<include app:graph="@navigation/profile_nav_graph" />
|
||||||
|
|
||||||
<action
|
<action
|
||||||
@ -100,4 +81,23 @@
|
|||||||
android:name="options"
|
android:name="options"
|
||||||
app:argType="awais.instagrabber.repositories.requests.StoryViewerOptions" />
|
app:argType="awais.instagrabber.repositories.requests.StoryViewerOptions" />
|
||||||
</fragment>
|
</fragment>
|
||||||
|
|
||||||
|
<fragment
|
||||||
|
android:id="@+id/notificationsViewer"
|
||||||
|
android:name="awais.instagrabber.fragments.NotificationsViewerFragment"
|
||||||
|
android:label="@string/title_notifications"
|
||||||
|
tools:layout="@layout/fragment_notifications_viewer">
|
||||||
|
<argument
|
||||||
|
android:name="type"
|
||||||
|
app:argType="string"
|
||||||
|
app:nullable="false"
|
||||||
|
android:defaultValue="notif"/>
|
||||||
|
<argument
|
||||||
|
android:name="targetId"
|
||||||
|
android:defaultValue="0L"
|
||||||
|
app:argType="long" />
|
||||||
|
<action
|
||||||
|
android:id="@+id/action_notifications_to_story"
|
||||||
|
app:destination="@id/storyViewerFragment" />
|
||||||
|
</fragment>
|
||||||
</navigation>
|
</navigation>
|
@ -1 +0,0 @@
|
|||||||
{}
|
|
@ -1 +0,0 @@
|
|||||||
{}
|
|
Loading…
Reference in New Issue
Block a user