Browse Source

layout finalization

legacy
Austin Huang 4 years ago
parent
commit
7ddf356de9
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 2
      app/src/main/java/awais/instagrabber/MainHelper.java
  2. 4
      app/src/main/java/awais/instagrabber/activities/Main.java
  3. 12
      app/src/main/java/awais/instagrabber/adapters/FeedAdapter.java
  4. 4
      app/src/main/java/awais/instagrabber/adapters/viewholder/FeedItemViewHolder.java
  5. 4
      app/src/main/res/layout/layout_profile_view.xml

2
app/src/main/java/awais/instagrabber/MainHelper.java

@ -280,7 +280,7 @@ public final class MainHelper implements SwipeRefreshLayout.OnRefreshListener {
isLoggedIn = !Utils.isEmpty(cookie); isLoggedIn = !Utils.isEmpty(cookie);
if (!isLoggedIn) { if (!isLoggedIn) {
main.mainBinding.drawerLayout.removeView(main.mainBinding.feedView.feedLayout); main.mainBinding.drawerLayout.removeView(main.mainBinding.feedView.feedLayout);
main.mainBinding.drawerLayout.removeView(main.mainBinding.discoverSwipeRefreshLayout);
main.mainBinding.drawerLayout.removeView(main.mainBinding.discoverLayout);
iconFeed.setAlpha(0.4f); iconFeed.setAlpha(0.4f);
iconDiscover.setAlpha(0.4f); iconDiscover.setAlpha(0.4f);
} else { } else {

4
app/src/main/java/awais/instagrabber/activities/Main.java

@ -81,7 +81,7 @@ public final class Main extends BaseLanguageActivity {
(!mainHelper.isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), true, result -> { (!mainHelper.isLoggedIn && Utils.settingsHelper.getBoolean(Constants.STORIESIG)), true, result -> {
if (result != null && result.length > 0) if (result != null && result.length > 0)
startActivity(new Intent(Main.this, StoryViewer.class) startActivity(new Intent(Main.this, StoryViewer.class)
.putExtra(Constants.EXTRAS_USERNAME, userQuery)
.putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
.putExtra(Constants.EXTRAS_HIGHLIGHT, highlightModel.getTitle()) .putExtra(Constants.EXTRAS_HIGHLIGHT, highlightModel.getTitle())
.putExtra(Constants.EXTRAS_STORIES, result) .putExtra(Constants.EXTRAS_STORIES, result)
); );
@ -199,7 +199,7 @@ public final class Main extends BaseLanguageActivity {
((hashtagModel != null) ? Constants.EXTRAS_HASHTAG : (locationModel != null ? Constants.EXTRAS_LOCATION : Constants.EXTRAS_PROFILE)), ((hashtagModel != null) ? Constants.EXTRAS_HASHTAG : (locationModel != null ? Constants.EXTRAS_LOCATION : Constants.EXTRAS_PROFILE)),
((hashtagModel != null) ? hashtagModel : (locationModel != null ? locationModel : profileModel))); ((hashtagModel != null) ? hashtagModel : (locationModel != null ? locationModel : profileModel)));
} }
else intent = new Intent(this, StoryViewer.class).putExtra(Constants.EXTRAS_USERNAME, userQuery)
else intent = new Intent(this, StoryViewer.class).putExtra(Constants.EXTRAS_USERNAME, userQuery.replace("@", ""))
.putExtra(Constants.EXTRAS_STORIES, storyModels) .putExtra(Constants.EXTRAS_STORIES, storyModels)
.putExtra(Constants.EXTRAS_HASHTAG, (hashtagModel != null)); .putExtra(Constants.EXTRAS_HASHTAG, (hashtagModel != null));
startActivity(intent); startActivity(intent);

12
app/src/main/java/awais/instagrabber/adapters/FeedAdapter.java

@ -7,8 +7,10 @@ import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.graphics.Typeface; import android.graphics.Typeface;
import android.net.Uri; import android.net.Uri;
import android.text.SpannableString;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.Spanned; import android.text.Spanned;
import android.text.method.LinkMovementMethod;
import android.text.style.StyleSpan; import android.text.style.StyleSpan;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@ -198,7 +200,13 @@ public final class FeedAdapter extends RecyclerView.Adapter<FeedItemViewHolder>
final ProfileModel profileModel = feedModel.getProfileModel(); final ProfileModel profileModel = feedModel.getProfileModel();
if (profileModel != null) { if (profileModel != null) {
glideRequestManager.load(profileModel.getSdProfilePic()).into(viewHolder.profilePic); glideRequestManager.load(profileModel.getSdProfilePic()).into(viewHolder.profilePic);
viewHolder.username.setText("@"+profileModel.getUsername());
final int titleLen = profileModel.getUsername().length() + 1;
final SpannableString spannableString = new SpannableString("@"+profileModel.getUsername());
spannableString.setSpan(new CommentMentionClickSpan(), 0, titleLen, 0);
viewHolder.username.setText(spannableString);
viewHolder.username.setMovementMethod(new LinkMovementMethod());
viewHolder.username.setMentionClickListener((view, text, isHashtag) ->
mentionClickListener.onClick(null, profileModel.getUsername(), false));
} }
viewHolder.viewPost.setOnClickListener(clickListener); viewHolder.viewPost.setOnClickListener(clickListener);
@ -416,8 +424,6 @@ public final class FeedAdapter extends RecyclerView.Adapter<FeedItemViewHolder>
@NonNull @NonNull
@Override @Override
public Object instantiateItem(@NonNull final ViewGroup container, final int position) { public Object instantiateItem(@NonNull final ViewGroup container, final int position) {
if (BuildConfig.DEBUG) container.setBackgroundColor(0xFF_0a_c0_09); // todo remove
final Context context = container.getContext(); final Context context = container.getContext();
final ViewerPostModel sliderItem = sliderItems[position]; final ViewerPostModel sliderItem = sliderItems[position];

4
app/src/main/java/awais/instagrabber/adapters/viewholder/FeedItemViewHolder.java

@ -16,8 +16,8 @@ import awais.instagrabber.customviews.RamboTextView;
public final class FeedItemViewHolder extends RecyclerView.ViewHolder { public final class FeedItemViewHolder extends RecyclerView.ViewHolder {
public final ImageView profilePic, btnMute, btnDownload; public final ImageView profilePic, btnMute, btnDownload;
public final TextView username, commentsCount, videoViews, mediaCounter, tvPostDate, location;
public final RamboTextView viewerCaption;
public final TextView commentsCount, videoViews, mediaCounter, tvPostDate, location;
public final RamboTextView username, viewerCaption;
public final View btnComments, videoViewsParent, viewPost; public final View btnComments, videoViewsParent, viewPost;
public final ViewPager mediaList; public final ViewPager mediaList;
public final PhotoView imageView; public final PhotoView imageView;

4
app/src/main/res/layout/layout_profile_view.xml

@ -434,10 +434,6 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:clipToPadding="false" android:clipToPadding="false"
android:paddingStart="8dp"
android:paddingLeft="8dp"
android:paddingEnd="8dp"
android:paddingRight="8dp"
tools:listitem="@layout/item_post" /> tools:listitem="@layout/item_post" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout> </androidx.swiperefreshlayout.widget.SwipeRefreshLayout>

Loading…
Cancel
Save