mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +00:00
Navigate to profile using nav id to workaround different compiled NavDirections
This commit is contained in:
parent
a6a4b6292d
commit
2f957da290
@ -21,7 +21,6 @@ import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.appcompat.widget.AppCompatButton;
|
||||
import androidx.appcompat.widget.AppCompatImageView;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.NavDirections;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@ -35,7 +34,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import awais.instagrabber.BuildConfig;
|
||||
import awais.instagrabber.ProfileNavGraphDirections;
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.adapters.DirectMessageMembersAdapter;
|
||||
import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher;
|
||||
@ -93,8 +91,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
|
||||
final Object tag = v.getTag();
|
||||
if (tag instanceof ProfileModel) {
|
||||
ProfileModel model = (ProfileModel) tag;
|
||||
final NavDirections action = DirectMessageThreadFragmentDirections.actionGlobalProfileFragment("@" + model.getUsername());
|
||||
NavHostFragment.findNavController(this).navigate(action);
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putString("username", "@" + model.getUsername());
|
||||
NavHostFragment.findNavController(this).navigate(R.id.action_global_profileFragment, bundle);
|
||||
}
|
||||
};
|
||||
|
||||
@ -110,8 +109,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
|
||||
});
|
||||
final DialogInterface.OnClickListener clickListener = (d, w) -> {
|
||||
if (w == 0) {
|
||||
final NavDirections action = DirectMessageThreadFragmentDirections.actionGlobalProfileFragment("@" + model.getUsername());
|
||||
NavHostFragment.findNavController(this).navigate(action);
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putString("username", "@" + model.getUsername());
|
||||
NavHostFragment.findNavController(this).navigate(R.id.action_global_profileFragment, bundle);
|
||||
} else if (w == 1) {
|
||||
new ChangeSettings(titleText.getText().toString()).execute("remove_users", model.getId());
|
||||
onRefresh();
|
||||
|
@ -33,7 +33,6 @@ import androidx.fragment.app.Fragment;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
import androidx.lifecycle.ViewModel;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.NavDirections;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
@ -54,7 +53,6 @@ import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import awais.instagrabber.ProfileNavGraphDirections;
|
||||
import awais.instagrabber.R;
|
||||
import awais.instagrabber.adapters.DirectMessageItemsAdapter;
|
||||
import awais.instagrabber.asyncs.ImageUploader;
|
||||
@ -71,7 +69,6 @@ import awais.instagrabber.models.ProfileModel;
|
||||
import awais.instagrabber.models.direct_messages.DirectItemModel;
|
||||
import awais.instagrabber.models.direct_messages.InboxThreadModel;
|
||||
import awais.instagrabber.models.enums.DirectItemType;
|
||||
import awais.instagrabber.models.enums.DownloadMethod;
|
||||
import awais.instagrabber.models.enums.MediaItemType;
|
||||
import awais.instagrabber.models.enums.UserInboxDirection;
|
||||
import awais.instagrabber.utils.Constants;
|
||||
@ -549,8 +546,9 @@ public class DirectMessageThreadFragment extends Fragment {
|
||||
}
|
||||
|
||||
private void searchUsername(final String text) {
|
||||
final NavDirections action = DirectMessageThreadFragmentDirections.actionGlobalProfileFragment("@" + text);
|
||||
NavHostFragment.findNavController(this).navigate(action);
|
||||
final Bundle bundle = new Bundle();
|
||||
bundle.putString("username", "@" + text);
|
||||
NavHostFragment.findNavController(this).navigate(R.id.action_global_profileFragment, bundle);
|
||||
}
|
||||
|
||||
public static class DirectItemModelListViewModel extends ViewModel {
|
||||
|
Loading…
Reference in New Issue
Block a user