small fixes and general maintenance (see desc)

* post view:
  1. show username in bold, and full_name on the side
  2. fix comment & control button hide timing
* layout: show username instead of full_name in grids
* profile: fix whitespace on avatar
* dm: add FELIX_SHARE as a message type
* general maintenance
This commit is contained in:
Austin Huang 2020-11-01 14:43:07 -05:00
parent 2931f2d3ab
commit f3c50e87c4
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
11 changed files with 47 additions and 22 deletions

View File

@ -107,6 +107,7 @@ public final class DirectMessageItemsAdapter extends ListAdapter<DirectItemModel
return new DirectMessageReelShareViewHolder(baseBinding, binding, onClickListener, mentionClickListener);
}
case MEDIA_SHARE:
case FELIX_SHARE:
case CLIP: {
final LayoutDmMediaShareBinding binding = LayoutDmMediaShareBinding.inflate(layoutInflater, itemViewParent, false);
return new DirectMessageMediaShareViewHolder(baseBinding, binding, onClickListener);

View File

@ -97,6 +97,7 @@ public final class DirectMessageInboxItemViewHolder extends RecyclerView.ViewHol
case MEDIA_SHARE:
case RAVEN_MEDIA:
case CLIP:
case FELIX_SHARE:
messageText = context.getString(R.string.direct_messages_sent_media);
break;
case ACTION_LOG:

View File

@ -74,7 +74,7 @@ public class FeedGridItemViewHolder extends RecyclerView.ViewHolder {
}
if (layoutPreferences.isNameVisible()) {
binding.name.setVisibility(View.VISIBLE);
binding.name.setText(feedModel.getProfileModel().getName());
binding.name.setText(feedModel.getProfileModel().getUsername());
} else {
binding.name.setVisibility(View.GONE);
}

View File

@ -98,7 +98,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
private MediaService mediaService;
private Context context;
private BottomSheetBehavior<NestedScrollView> bottomSheetBehavior;
private boolean detailsVisible = true;
private boolean detailsVisible = true, video;
private VideoPlayerViewHelper videoPlayerViewHelper;
private SliderItemsAdapter sliderItemsAdapter;
private boolean wasControlsVisible;
@ -762,8 +762,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
}
private void setupTitles() {
binding.title.setText(feedModel.getProfileModel().getName());
binding.title.setText(feedModel.getProfileModel().getUsername());
binding.righttitle.setText(feedModel.getProfileModel().getName());
binding.title.setOnClickListener(v -> navigateToProfile("@" + feedModel.getProfileModel().getUsername()));
binding.righttitle.setOnClickListener(v -> navigateToProfile("@" + feedModel.getProfileModel().getUsername()));
final String locationName = feedModel.getLocationName();
if (!TextUtils.isEmpty(locationName)) {
binding.subtitle.setText(locationName);
@ -1079,6 +1081,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
}
private void enablePlayerControls(final boolean enable) {
video = enable;
if (enable) {
binding.playerControlsToggle.setVisibility(View.VISIBLE);
binding.playerControlsToggle.setOnClickListener(v -> {
@ -1165,6 +1168,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
binding.bottomBg.setVisibility(View.GONE);
binding.likesCount.setVisibility(View.GONE);
binding.commentsCount.setVisibility(View.GONE);
binding.comment.setVisibility(View.GONE);
binding.captionToggle.setVisibility(View.GONE);
binding.playerControlsToggle.setVisibility(View.GONE);
binding.like.setVisibility(View.GONE);
@ -1188,7 +1192,10 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment {
binding.likesCount.setVisibility(View.VISIBLE);
binding.commentsCount.setVisibility(View.VISIBLE);
binding.captionToggle.setVisibility(View.VISIBLE);
binding.playerControlsToggle.setVisibility(View.VISIBLE);
binding.comment.setVisibility(View.VISIBLE);
if (video) {
binding.playerControlsToggle.setVisibility(View.VISIBLE);
}
binding.download.setVisibility(View.VISIBLE);
binding.like.setVisibility(View.VISIBLE);
binding.save.setVisibility(View.VISIBLE);

View File

@ -234,16 +234,9 @@ public class DirectMessageThreadFragment extends Fragment {
switch (itemType) {
case MEDIA_SHARE:
case CLIP:
case FELIX_SHARE:
final long postId = directItemModel.getMediaModel().getPk();
final boolean isId = true;
final NavController navController = NavHostFragment.findNavController(this);
final NavDirections action = DirectMessageThreadFragmentDirections
.actionGlobalPostViewFragment(
0,
new String[]{String.valueOf(postId)},
isId
);
navController.navigate(action);
// open post
break;
case LINK:
Intent linkIntent = new Intent(Intent.ACTION_VIEW);
@ -322,6 +315,7 @@ public class DirectMessageThreadFragment extends Fragment {
switch (itemType) {
case MEDIA_SHARE:
case CLIP:
case FELIX_SHARE:
firstOption = R.string.view_post;
break;
case LINK:

View File

@ -55,7 +55,7 @@ public class AboutFragment extends BasePreferencesFragment {
preference.setIconSpaceReserved(false);
preference.setOnPreferenceClickListener(p -> {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://instagrabber.austinhuang.me"));
intent.setData(Uri.parse("https://barinsta.austinhuang.me"));
startActivity(intent);
return true;
});
@ -71,7 +71,7 @@ public class AboutFragment extends BasePreferencesFragment {
preference.setIconSpaceReserved(false);
preference.setOnPreferenceClickListener(p -> {
final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://github.com/austinhuang0131/instagrabber"));
intent.setData(Uri.parse("https://github.com/austinhuang0131/barinsta"));
startActivity(intent);
return true;
});

View File

@ -19,7 +19,8 @@ public enum DirectItemType implements Serializable {
ACTION_LOG(12),
PLACEHOLDER(13),
STORY_SHARE(14),
CLIP(15); // clip is just media_share but reel
CLIP(15), // media_share but reel
FELIX_SHARE(16); // media_share but igtv
private final int id;
private static Map<Integer, DirectItemType> map = new HashMap<>();

View File

@ -58,10 +58,10 @@ public final class Constants {
// spoof
public static final String USER_AGENT = "Mozilla/5.0 (Linux; Android 8.1.0; motorola one Build/OPKS28.63-18-3; wv) " +
"AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/70.0.3538.80 Mobile Safari/537.36 " +
"Instagram 161.0.0.37.121 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 248310224)";
"Instagram 165.1.0.29.119 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 253447818)";
public static final String I_USER_AGENT =
"Instagram 161.0.0.37.121 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 248310224)";
public static final String A_USER_AGENT = "https://InstaGrabber.AustinHuang.me / mailto:InstaGrabber@AustinHuang.me";
"Instagram 165.1.0.29.119 Android (27/8.1.0; 320dpi; 720x1362; motorola; motorola one; deen_sprout; qcom; pt_BR; 253447818)";
public static final String A_USER_AGENT = "https://Barinsta.AustinHuang.me / mailto:Barinsta@AustinHuang.me";
// see https://github.com/dilame/instagram-private-api/blob/master/src/core/constants.ts
public static final String SUPPORTED_CAPABILITIES = "[ { \"name\": \"SUPPORTED_SDK_VERSIONS\", \"value\":" +
" \"13.0,14.0,15.0,16.0,17.0,18.0,19.0,20.0,21.0,22.0,23.0,24.0,25.0,26.0,27.0,28.0,29.0,30.0,31.0," +

View File

@ -242,6 +242,7 @@ public final class ResponseBodyUtils {
if ("voice_media".equals(itemType)) return DirectItemType.VOICE_MEDIA;
if ("story_share".equals(itemType)) return DirectItemType.STORY_SHARE;
if ("clip".equals(itemType)) return DirectItemType.CLIP;
if ("felix_share".equals(itemType)) return DirectItemType.FELIX_SHARE;
return DirectItemType.TEXT;
}
@ -501,6 +502,10 @@ public final class ResponseBodyUtils {
directMedia = getDirectMediaModel(itemObject.getJSONObject("clip").getJSONObject("clip"));
break;
case FELIX_SHARE:
directMedia = getDirectMediaModel(itemObject.getJSONObject("felix_share").getJSONObject("video"));
break;
case MEDIA:
directMedia = getDirectMediaModel(itemObject.optJSONObject("media"));
break;

View File

@ -63,7 +63,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/title"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:singleLine="true"
@ -71,9 +71,24 @@
android:textColor="@color/white"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@id/subtitle"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toEndOf="@id/righttitle"
app:layout_constraintStart_toEndOf="@id/profile_pic"
app:layout_constraintTop_toTopOf="@id/profile_pic"
tools:text="Username Username Username" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/righttitle"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="8dp"
android:ellipsize="marquee"
android:singleLine="true"
android:textAppearance="@style/TextAppearance.MaterialComponents.Subtitle1"
android:textColor="@color/grey_600"
app:layout_constraintBottom_toBottomOf="@id/title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/title"
app:layout_constraintTop_toTopOf="@id/title"
tools:text="Full name Full name Full name Full name Full name Full name Full name " />
<androidx.appcompat.widget.AppCompatTextView

View File

@ -27,7 +27,8 @@
android:id="@+id/mainProfileImage"
android:layout_width="@dimen/profile_picture_size"
android:layout_height="@dimen/profile_picture_size"
android:padding="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:transitionName="profile_pic"
app:actualImageScaleType="centerCrop"
app:layout_constraintEnd_toStartOf="@id/mainPostCount"