|
@ -56,6 +56,7 @@ import awais.instagrabber.R; |
|
|
import awais.instagrabber.activities.MainActivity; |
|
|
import awais.instagrabber.activities.MainActivity; |
|
|
import awais.instagrabber.adapters.FeedAdapterV2; |
|
|
import awais.instagrabber.adapters.FeedAdapterV2; |
|
|
import awais.instagrabber.adapters.HighlightsAdapter; |
|
|
import awais.instagrabber.adapters.HighlightsAdapter; |
|
|
|
|
|
import awais.instagrabber.asyncs.CreateThreadAction; |
|
|
import awais.instagrabber.asyncs.ProfileFetcher; |
|
|
import awais.instagrabber.asyncs.ProfileFetcher; |
|
|
import awais.instagrabber.asyncs.ProfilePostFetchService; |
|
|
import awais.instagrabber.asyncs.ProfilePostFetchService; |
|
|
import awais.instagrabber.asyncs.UsernameFetcher; |
|
|
import awais.instagrabber.asyncs.UsernameFetcher; |
|
@ -911,19 +912,18 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe |
|
|
|
|
|
|
|
|
private void setupButtons(final long profileId, final long myId) { |
|
|
private void setupButtons(final long profileId, final long myId) { |
|
|
profileDetailsBinding.btnTagged.setVisibility(isReallyPrivate() ? View.GONE : View.VISIBLE); |
|
|
profileDetailsBinding.btnTagged.setVisibility(isReallyPrivate() ? View.GONE : View.VISIBLE); |
|
|
profileDetailsBinding.btnDM.setVisibility(View.GONE); // temporary measure |
|
|
|
|
|
if (isLoggedIn) { |
|
|
if (isLoggedIn) { |
|
|
if (Objects.equals(profileId, myId)) { |
|
|
if (Objects.equals(profileId, myId)) { |
|
|
profileDetailsBinding.btnTagged.setVisibility(View.VISIBLE); |
|
|
profileDetailsBinding.btnTagged.setVisibility(View.VISIBLE); |
|
|
profileDetailsBinding.btnSaved.setVisibility(View.VISIBLE); |
|
|
profileDetailsBinding.btnSaved.setVisibility(View.VISIBLE); |
|
|
profileDetailsBinding.btnLiked.setVisibility(View.VISIBLE); |
|
|
profileDetailsBinding.btnLiked.setVisibility(View.VISIBLE); |
|
|
// profileDetailsBinding.btnDM.setVisibility(View.GONE); |
|
|
|
|
|
|
|
|
profileDetailsBinding.btnDM.setVisibility(View.GONE); |
|
|
profileDetailsBinding.btnSaved.setText(R.string.saved); |
|
|
profileDetailsBinding.btnSaved.setText(R.string.saved); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
profileDetailsBinding.btnSaved.setVisibility(View.GONE); |
|
|
profileDetailsBinding.btnSaved.setVisibility(View.GONE); |
|
|
profileDetailsBinding.btnLiked.setVisibility(View.GONE); |
|
|
profileDetailsBinding.btnLiked.setVisibility(View.GONE); |
|
|
// profileDetailsBinding.btnDM.setVisibility(View.VISIBLE); |
|
|
|
|
|
|
|
|
profileDetailsBinding.btnDM.setVisibility(View.VISIBLE); |
|
|
profileDetailsBinding.btnFollow.setVisibility(View.VISIBLE); |
|
|
profileDetailsBinding.btnFollow.setVisibility(View.VISIBLE); |
|
|
final Context context = getContext(); |
|
|
final Context context = getContext(); |
|
|
if (context == null) return; |
|
|
if (context == null) return; |
|
@ -1081,27 +1081,18 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe |
|
|
PostItemType.TAGGED); |
|
|
PostItemType.TAGGED); |
|
|
NavHostFragment.findNavController(this).navigate(action); |
|
|
NavHostFragment.findNavController(this).navigate(action); |
|
|
}); |
|
|
}); |
|
|
// profileDetailsBinding.btnDM.setOnClickListener(v -> { |
|
|
|
|
|
// profileDetailsBinding.btnDM.setEnabled(false); |
|
|
|
|
|
// new CreateThreadAction(cookie, profileModel.getPk(), thread -> { |
|
|
|
|
|
// if (thread == null) { |
|
|
|
|
|
// Toast.makeText(context, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
// profileDetailsBinding.btnDM.setEnabled(true); |
|
|
|
|
|
// return; |
|
|
|
|
|
// } |
|
|
|
|
|
// if (isAdded()) { |
|
|
|
|
|
// final Bundle bundle = new Bundle(); |
|
|
|
|
|
// bundle.putString("threadId", thread.getThreadId()); |
|
|
|
|
|
// bundle.putString("title", thread.getThreadTitle()); |
|
|
|
|
|
// if (isAdded()) { |
|
|
|
|
|
// final NavDirections action = ProfileFragmentDirections |
|
|
|
|
|
// .actionProfileFragmentToDMThreadFragment(thread.getThreadId(), profileModel.getUsername()); |
|
|
|
|
|
// NavHostFragment.findNavController(this).navigate(action); |
|
|
|
|
|
// } |
|
|
|
|
|
// } |
|
|
|
|
|
// profileDetailsBinding.btnDM.setEnabled(true); |
|
|
|
|
|
// }).execute(); |
|
|
|
|
|
// }); |
|
|
|
|
|
|
|
|
profileDetailsBinding.btnDM.setOnClickListener(v -> { |
|
|
|
|
|
profileDetailsBinding.btnDM.setEnabled(false); |
|
|
|
|
|
new CreateThreadAction(cookie, profileModel.getPk(), thread -> { |
|
|
|
|
|
if (thread == null) { |
|
|
|
|
|
Toast.makeText(context, R.string.downloader_unknown_error, Toast.LENGTH_SHORT).show(); |
|
|
|
|
|
profileDetailsBinding.btnDM.setEnabled(true); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
fragmentActivity.navigateToThread(thread.getThreadId(), profileModel.getUsername(), thread); |
|
|
|
|
|
profileDetailsBinding.btnDM.setEnabled(true); |
|
|
|
|
|
}).execute(); |
|
|
|
|
|
}); |
|
|
profileDetailsBinding.mainProfileImage.setOnClickListener(v -> { |
|
|
profileDetailsBinding.mainProfileImage.setOnClickListener(v -> { |
|
|
if (!hasStories) { |
|
|
if (!hasStories) { |
|
|
// show profile pic |
|
|
// show profile pic |
|
|