Browse Source

Merge branch 'master' of https://github.com/austinhuang0131/instagrabber

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
9350c05634
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 1
      app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaViewHolder.java
  2. 10
      app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java
  3. 5
      app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java
  4. 2
      app/src/main/java/awais/instagrabber/utils/NumberUtils.java

1
app/src/main/java/awais/instagrabber/adapters/viewholder/directmessages/DirectMessageMediaViewHolder.java

@ -43,7 +43,6 @@ public class DirectMessageMediaViewHolder extends DirectMessageItemViewHolder {
layoutParams.width = widthHeight.first != null ? widthHeight.first : 0; layoutParams.width = widthHeight.first != null ? widthHeight.first : 0;
layoutParams.height = widthHeight.second != null ? widthHeight.second : 0; layoutParams.height = widthHeight.second != null ? widthHeight.second : 0;
binding.ivMediaPreview.requestLayout(); binding.ivMediaPreview.requestLayout();
binding.ivMediaPreview.requestLayout();
binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl()); binding.ivMediaPreview.setImageURI(mediaModel.getThumbUrl());
final MediaItemType modelMediaType = mediaModel.getMediaType(); final MediaItemType modelMediaType = mediaModel.getMediaType();
binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO || modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER binding.typeIcon.setVisibility(modelMediaType == MediaItemType.MEDIA_TYPE_VIDEO || modelMediaType == MediaItemType.MEDIA_TYPE_SLIDER

10
app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageSettingsFragment.java

@ -21,7 +21,6 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.AppCompatButton; import androidx.appcompat.widget.AppCompatButton;
import androidx.appcompat.widget.AppCompatImageView; import androidx.appcompat.widget.AppCompatImageView;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.navigation.NavDirections;
import androidx.navigation.fragment.NavHostFragment; import androidx.navigation.fragment.NavHostFragment;
import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
@ -35,6 +34,7 @@ import java.util.Arrays;
import java.util.List; import java.util.List;
import awais.instagrabber.BuildConfig; import awais.instagrabber.BuildConfig;
import awais.instagrabber.ProfileNavGraphDirections;
import awais.instagrabber.R; import awais.instagrabber.R;
import awais.instagrabber.adapters.DirectMessageMembersAdapter; import awais.instagrabber.adapters.DirectMessageMembersAdapter;
import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher; import awais.instagrabber.asyncs.direct_messages.DirectMessageInboxThreadFetcher;
@ -92,7 +92,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
final Object tag = v.getTag(); final Object tag = v.getTag();
if (tag instanceof ProfileModel) { if (tag instanceof ProfileModel) {
ProfileModel model = (ProfileModel) tag; ProfileModel model = (ProfileModel) tag;
final NavDirections action = DirectMessageThreadFragmentDirections.actionGlobalProfileFragment("@" + model.getUsername());
final ProfileNavGraphDirections.ActionGlobalProfileFragment action = DirectMessageThreadFragmentDirections
.actionGlobalProfileFragment();
action.setUsername("@" + model.getUsername());
NavHostFragment.findNavController(this).navigate(action); NavHostFragment.findNavController(this).navigate(action);
} }
}; };
@ -109,7 +111,9 @@ public class DirectMessageSettingsFragment extends Fragment implements SwipeRefr
}); });
final DialogInterface.OnClickListener clickListener = (d, w) -> { final DialogInterface.OnClickListener clickListener = (d, w) -> {
if (w == 0) { if (w == 0) {
final NavDirections action = DirectMessageThreadFragmentDirections.actionGlobalProfileFragment("@" + model.getUsername());
final ProfileNavGraphDirections.ActionGlobalProfileFragment action = DirectMessageThreadFragmentDirections
.actionGlobalProfileFragment();
action.setUsername("@" + model.getUsername());
NavHostFragment.findNavController(this).navigate(action); NavHostFragment.findNavController(this).navigate(action);
} else if (w == 1) { } else if (w == 1) {
new ChangeSettings(titleText.getText().toString()).execute("remove_users", model.getId()); new ChangeSettings(titleText.getText().toString()).execute("remove_users", model.getId());

5
app/src/main/java/awais/instagrabber/fragments/directmessages/DirectMessageThreadFragment.java

@ -51,6 +51,7 @@ import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import awais.instagrabber.ProfileNavGraphDirections;
import awais.instagrabber.R; import awais.instagrabber.R;
import awais.instagrabber.adapters.DirectMessageItemsAdapter; import awais.instagrabber.adapters.DirectMessageItemsAdapter;
import awais.instagrabber.asyncs.ImageUploader; import awais.instagrabber.asyncs.ImageUploader;
@ -520,7 +521,9 @@ public class DirectMessageThreadFragment extends Fragment {
} }
private void searchUsername(final String text) { private void searchUsername(final String text) {
final NavDirections action = DirectMessageThreadFragmentDirections.actionGlobalProfileFragment("@" + text);
final ProfileNavGraphDirections.ActionGlobalProfileFragment action = DirectMessageThreadFragmentDirections
.actionGlobalProfileFragment();
action.setUsername("@" + text);
NavHostFragment.findNavController(this).navigate(action); NavHostFragment.findNavController(this).navigate(action);
} }

2
app/src/main/java/awais/instagrabber/utils/NumberUtils.java

@ -59,7 +59,7 @@ public final class NumberUtils {
public static Pair<Integer, Integer> calculateWidthHeight(final int height, final int width, final int maxHeight, final int maxWidth) { public static Pair<Integer, Integer> calculateWidthHeight(final int height, final int width, final int maxHeight, final int maxWidth) {
int tempWidth = NumberUtils.getResultingWidth(maxHeight, height, width); int tempWidth = NumberUtils.getResultingWidth(maxHeight, height, width);
int tempHeight = maxHeight; int tempHeight = maxHeight;
if (width > maxWidth) {
if (tempWidth > maxWidth) {
tempHeight = NumberUtils.getResultingHeight(maxWidth, height, width); tempHeight = NumberUtils.getResultingHeight(maxWidth, height, width);
tempWidth = maxWidth; tempWidth = maxWidth;
} }

Loading…
Cancel
Save