forked from mirrors/Fedilab
		
	Fix expand media with fit preview images when sensitive
This commit is contained in:
		
							parent
							
								
									2ebbc27c0a
								
							
						
					
					
						commit
						a81f27faff
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		|  | @ -392,6 +392,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> | ||||||
|         boolean confirmFav = sharedpreferences.getBoolean(context.getString(R.string.SET_NOTIF_VALIDATION_FAV), false); |         boolean confirmFav = sharedpreferences.getBoolean(context.getString(R.string.SET_NOTIF_VALIDATION_FAV), false); | ||||||
|         boolean confirmBoost = sharedpreferences.getBoolean(context.getString(R.string.SET_NOTIF_VALIDATION), true); |         boolean confirmBoost = sharedpreferences.getBoolean(context.getString(R.string.SET_NOTIF_VALIDATION), true); | ||||||
|         boolean fullAttachement = sharedpreferences.getBoolean(context.getString(R.string.SET_FULL_PREVIEW), false); |         boolean fullAttachement = sharedpreferences.getBoolean(context.getString(R.string.SET_FULL_PREVIEW), false); | ||||||
|  |         boolean expand_media = sharedpreferences.getBoolean(context.getString(R.string.SET_EXPAND_MEDIA), false); | ||||||
|         boolean displayBookmark = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_BOOKMARK) + MainActivity.currentUserID + MainActivity.currentInstance, true); |         boolean displayBookmark = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_BOOKMARK) + MainActivity.currentUserID + MainActivity.currentInstance, true); | ||||||
|         boolean displayTranslate = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_TRANSLATE) + MainActivity.currentUserID + MainActivity.currentInstance, false); |         boolean displayTranslate = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_TRANSLATE) + MainActivity.currentUserID + MainActivity.currentInstance, false); | ||||||
|         boolean displayCounters = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_COUNTER_FAV_BOOST), false); |         boolean displayCounters = sharedpreferences.getBoolean(context.getString(R.string.SET_DISPLAY_COUNTER_FAV_BOOST), false); | ||||||
|  | @ -1278,7 +1279,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> | ||||||
|                 boolean singleMedia = statusToDeal.media_attachments.size() == 1; |                 boolean singleMedia = statusToDeal.media_attachments.size() == 1; | ||||||
|                 for (Attachment attachment : statusToDeal.media_attachments) { |                 for (Attachment attachment : statusToDeal.media_attachments) { | ||||||
|                     LayoutMediaBinding layoutMediaBinding = LayoutMediaBinding.inflate(LayoutInflater.from(context)); |                     LayoutMediaBinding layoutMediaBinding = LayoutMediaBinding.inflate(LayoutInflater.from(context)); | ||||||
|                     if (fullAttachement && !statusToDeal.sensitive) { |                     if (fullAttachement && (!statusToDeal.sensitive || expand_media)) { | ||||||
|                         float ratio = 1.0f; |                         float ratio = 1.0f; | ||||||
|                         float mediaH = -1.0f; |                         float mediaH = -1.0f; | ||||||
| 
 | 
 | ||||||
|  | @ -1317,7 +1318,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> | ||||||
|                         loadAndAddAttachment(context, layoutMediaBinding, holder, adapter, mediaPosition, -1.f, -1.f, -1.f, statusToDeal, attachment, singleMedia); |                         loadAndAddAttachment(context, layoutMediaBinding, holder, adapter, mediaPosition, -1.f, -1.f, -1.f, statusToDeal, attachment, singleMedia); | ||||||
|                     } |                     } | ||||||
|                     mediaPosition++; |                     mediaPosition++; | ||||||
|                     if ((fullAttachement && !statusToDeal.sensitive) || singleMedia) { |                     if ((fullAttachement && (!statusToDeal.sensitive || expand_media)) || singleMedia) { | ||||||
|                         holder.binding.mediaContainer.addView(layoutMediaBinding.getRoot()); |                         holder.binding.mediaContainer.addView(layoutMediaBinding.getRoot()); | ||||||
|                     } else { |                     } else { | ||||||
|                         holder.binding.attachmentsList.addView(layoutMediaBinding.getRoot()); |                         holder.binding.attachmentsList.addView(layoutMediaBinding.getRoot()); | ||||||
|  | @ -2100,7 +2101,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> | ||||||
|         boolean expand_media = sharedpreferences.getBoolean(context.getString(R.string.SET_EXPAND_MEDIA), false); |         boolean expand_media = sharedpreferences.getBoolean(context.getString(R.string.SET_EXPAND_MEDIA), false); | ||||||
| 
 | 
 | ||||||
|         LinearLayout.LayoutParams lp; |         LinearLayout.LayoutParams lp; | ||||||
|         if (fullAttachement && mediaH > 0 && !statusToDeal.sensitive) { |         if (fullAttachement && mediaH > 0 && (!statusToDeal.sensitive || expand_media)) { | ||||||
|             lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (int) (mediaH * ratio)); |             lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, (int) (mediaH * ratio)); | ||||||
|             layoutMediaBinding.media.setScaleType(ImageView.ScaleType.FIT_CENTER); |             layoutMediaBinding.media.setScaleType(ImageView.ScaleType.FIT_CENTER); | ||||||
|         } else { |         } else { | ||||||
|  | @ -2214,7 +2215,7 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> | ||||||
|             adapter.notifyItemChanged(holder.getBindingAdapterPosition()); |             adapter.notifyItemChanged(holder.getBindingAdapterPosition()); | ||||||
|         }); |         }); | ||||||
| 
 | 
 | ||||||
|         if (!statusToDeal.sensitive && (fullAttachement || singleImage)) { |         if ((!statusToDeal.sensitive || expand_media) && (fullAttachement || singleImage)) { | ||||||
|             layoutMediaBinding.getRoot().setPadding(0, 0, 0, 10); |             layoutMediaBinding.getRoot().setPadding(0, 0, 0, 10); | ||||||
|         } else { |         } else { | ||||||
|             layoutMediaBinding.getRoot().setPadding(0, 0, 10, 0); |             layoutMediaBinding.getRoot().setPadding(0, 0, 10, 0); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue