Minor layout tweaks.

This commit is contained in:
Alex Ning 2018-11-08 14:13:17 +08:00
parent 6e5a0e7ef3
commit 4373d3aa55
5 changed files with 13 additions and 17 deletions

View File

@ -270,9 +270,9 @@ class ParsePost {
url, url, permalink, score, postType, voteType, url, url, permalink, score, postType, voteType,
gilded, nsfw, stickied, isCrosspost)); gilded, nsfw, stickied, isCrosspost));
} else { } else {
//Link post //CP No Preview Link post
Log.i("CP no preview link", Integer.toString(i)); Log.i("CP no preview link", Integer.toString(i));
int postType = PostData.LINK_TYPE; int postType = PostData.NO_PREVIEW_LINK_TYPE;
PostData linkPostData = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime, PostData linkPostData = new PostData(id, fullName, subredditNamePrefixed, formattedPostTime,
title, previewUrl, url, permalink, score, postType, title, previewUrl, url, permalink, score, postType,
voteType, gilded, nsfw, stickied, isCrosspost); voteType, gilded, nsfw, stickied, isCrosspost);

View File

@ -191,7 +191,6 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
public void onResponse(Call<String> call, retrofit2.Response<String> response) { public void onResponse(Call<String> call, retrofit2.Response<String> response) {
if(getActivity() != null) { if(getActivity() != null) {
if(response.isSuccessful()) { if(response.isSuccessful()) {
Log.i("response", "success");
ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE); ClipboardManager clipboard = (ClipboardManager) getActivity().getSystemService(Context.CLIPBOARD_SERVICE);
ClipData clip = ClipData.newPlainText("response", response.body()); ClipData clip = ClipData.newPlainText("response", response.body());
clipboard.setPrimaryClip(clip); clipboard.setPrimaryClip(clip);

View File

@ -482,12 +482,12 @@ class PostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
@Override @Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) { public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
((DataViewHolder) holder).progressBar.setVisibility(View.GONE); ((DataViewHolder) holder).progressBar.setVisibility(View.GONE);
((DataViewHolder) holder).errorLinearLayout.setVisibility(View.VISIBLE); ((DataViewHolder) holder).errorRelativeLayout.setVisibility(View.VISIBLE);
((DataViewHolder)holder).errorLinearLayout.setOnClickListener(new View.OnClickListener() { ((DataViewHolder)holder).errorRelativeLayout.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {
((DataViewHolder) holder).progressBar.setVisibility(View.VISIBLE); ((DataViewHolder) holder).progressBar.setVisibility(View.VISIBLE);
((DataViewHolder) holder).errorLinearLayout.setVisibility(View.GONE); ((DataViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
loadImage(holder, postData); loadImage(holder, postData);
} }
}); });
@ -496,7 +496,7 @@ class PostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
@Override @Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) { public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
((DataViewHolder) holder).errorLinearLayout.setVisibility(View.GONE); ((DataViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
((DataViewHolder) holder).progressBar.setVisibility(View.GONE); ((DataViewHolder) holder).progressBar.setVisibility(View.GONE);
return false; return false;
} }
@ -537,7 +537,7 @@ class PostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
@BindView(R.id.image_view_wrapper_item_best_post) RelativeLayout relativeLayout; @BindView(R.id.image_view_wrapper_item_best_post) RelativeLayout relativeLayout;
@BindView(R.id.progress_bar_best_post_item) ProgressBar progressBar; @BindView(R.id.progress_bar_best_post_item) ProgressBar progressBar;
@BindView(R.id.image_view_best_post_item) AspectRatioImageView imageView; @BindView(R.id.image_view_best_post_item) AspectRatioImageView imageView;
@BindView(R.id.load_image_error_linear_layout_best_post_item) LinearLayout errorLinearLayout; @BindView(R.id.load_image_error_relative_layout_best_post_item) RelativeLayout errorRelativeLayout;
@BindView(R.id.image_view_no_preview_link_best_post_item) ImageView noPreviewLinkImageView; @BindView(R.id.image_view_no_preview_link_best_post_item) ImageView noPreviewLinkImageView;
@BindView(R.id.plus_button_item_best_post) ImageView upvoteButton; @BindView(R.id.plus_button_item_best_post) ImageView upvoteButton;
@BindView(R.id.score_text_view_item_best_post) TextView scoreTextView; @BindView(R.id.score_text_view_item_best_post) TextView scoreTextView;
@ -574,7 +574,7 @@ class PostRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
((DataViewHolder) holder).nsfwTextView.setVisibility(View.GONE); ((DataViewHolder) holder).nsfwTextView.setVisibility(View.GONE);
((DataViewHolder) holder).progressBar.setVisibility(View.GONE); ((DataViewHolder) holder).progressBar.setVisibility(View.GONE);
((DataViewHolder) holder).imageView.setVisibility(View.GONE); ((DataViewHolder) holder).imageView.setVisibility(View.GONE);
((DataViewHolder) holder).errorLinearLayout.setVisibility(View.GONE); ((DataViewHolder) holder).errorRelativeLayout.setVisibility(View.GONE);
((DataViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE); ((DataViewHolder) holder).noPreviewLinkImageView.setVisibility(View.GONE);
((DataViewHolder) holder).upvoteButton.clearColorFilter(); ((DataViewHolder) holder).upvoteButton.clearColorFilter();
((DataViewHolder) holder).downvoteButton.clearColorFilter(); ((DataViewHolder) holder).downvoteButton.clearColorFilter();

View File

@ -100,11 +100,6 @@ public class ViewImageActivity extends AppCompatActivity {
final Spannable text = new SpannableString(title); final Spannable text = new SpannableString(title);
setTitle(text); setTitle(text);
/*final RelativeLayout mRelativeLayout = findViewById(R.id.parent_relative_layout_view_image_activity);
mImageView = findViewById(R.id.image_view_view_image_activity);
mProgressBar = findViewById(R.id.progress_bar_view_image_activity);
mLoadErrorLinearLayout = findViewById(R.id.load_image_error_linear_layout_view_image_activity);*/
mLoadErrorLinearLayout.setOnClickListener(new View.OnClickListener() { mLoadErrorLinearLayout.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View view) { public void onClick(View view) {

View File

@ -151,12 +151,14 @@
android:id="@+id/image_view_best_post_item" android:id="@+id/image_view_best_post_item"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitStart" /> android:scaleType="fitStart" />
<LinearLayout <RelativeLayout
android:id="@+id/load_image_error_linear_layout_best_post_item" android:id="@+id/load_image_error_relative_layout_best_post_item"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_centerInParent="true"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
@ -167,7 +169,7 @@
android:gravity="center" android:gravity="center"
android:text="@string/tap_to_retry" /> android:text="@string/tap_to_retry" />
</LinearLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>