mirror of
				https://github.com/KokaKiwi/BarInsta
				synced 2025-10-31 03:25:34 +00:00 
			
		
		
		
	restore share button
This commit is contained in:
		
							parent
							
								
									1c6cd348f4
								
							
						
					
					
						commit
						495a4a974f
					
				| @ -9,6 +9,7 @@ import android.annotation.SuppressLint; | ||||
| import android.app.Dialog; | ||||
| import android.content.Context; | ||||
| import android.content.DialogInterface; | ||||
| import android.content.Intent; | ||||
| import android.content.pm.PackageManager; | ||||
| import android.graphics.Color; | ||||
| import android.graphics.drawable.Animatable; | ||||
| @ -27,6 +28,7 @@ import android.view.Window; | ||||
| import android.view.WindowManager; | ||||
| import android.widget.FrameLayout; | ||||
| import android.widget.ScrollView; | ||||
| import android.widget.Toast; | ||||
| import android.widget.ViewSwitcher; | ||||
| 
 | ||||
| import androidx.annotation.NonNull; | ||||
| @ -497,7 +499,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { | ||||
|             } else { | ||||
|                 textRes = R.string.unliking; | ||||
|             } | ||||
|             binding.like.setText(textRes); | ||||
|             if (!feedModel.getLike()) { | ||||
|                 mediaService.like(feedModel.getPostId(), userId, csrfToken, likeCallback); | ||||
|             } else { | ||||
| @ -575,7 +576,6 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { | ||||
|             } else { | ||||
|                 textRes = R.string.removing; | ||||
|             } | ||||
|             binding.save.setText(textRes); | ||||
|             if (!feedModel.isSaved()) { | ||||
|                 mediaService.save(feedModel.getPostId(), userId, csrfToken, saveCallback); | ||||
|             } else { | ||||
| @ -734,6 +734,20 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { | ||||
|                 } | ||||
|             }); | ||||
|         } | ||||
|         binding.share.setOnLongClickListener(v -> { | ||||
|             Utils.displayToastAboveView(context, v, getString(R.string.share)); | ||||
|             return true; | ||||
|         }); | ||||
|         binding.share.setOnClickListener(v -> { | ||||
|             final boolean isPrivate = feedModel.getProfileModel().isPrivate(); | ||||
|             if (isPrivate) | ||||
|                 Toast.makeText(context, R.string.share_private_post, Toast.LENGTH_LONG).show(); | ||||
|             Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND); | ||||
|             sharingIntent.setType("text/plain"); | ||||
|             sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "https://instagram.com/p/"+feedModel.getShortCode()); | ||||
|             startActivity(Intent.createChooser(sharingIntent, | ||||
|                     isPrivate ? getString(R.string.share_private_post) : getString(R.string.share_public_post))); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     private void setupCounts() { | ||||
| @ -1061,6 +1075,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { | ||||
|                 binding.playerControlsToggle.setVisibility(View.GONE); | ||||
|                 binding.like.setVisibility(View.GONE); | ||||
|                 binding.save.setVisibility(View.GONE); | ||||
|                 binding.share.setVisibility(View.GONE); | ||||
|                 binding.download.setVisibility(View.GONE); | ||||
|                 binding.mediaCounter.setVisibility(View.GONE); | ||||
|                 wasControlsVisible = binding.playerControls.getRoot().getVisibility() == View.VISIBLE; | ||||
| @ -1087,6 +1102,7 @@ public class PostViewV2Fragment extends SharedElementTransitionDialogFragment { | ||||
|             binding.download.setVisibility(View.VISIBLE); | ||||
|             binding.like.setVisibility(View.VISIBLE); | ||||
|             binding.save.setVisibility(View.VISIBLE); | ||||
|             binding.share.setVisibility(View.VISIBLE); | ||||
|             if (wasControlsVisible) { | ||||
|                 showPlayerControls(); | ||||
|             } | ||||
|  | ||||
| @ -357,12 +357,30 @@ | ||||
|         app:iconSize="24dp" | ||||
|         app:iconTint="@color/white" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toStartOf="@id/download" | ||||
|         app:layout_constraintEnd_toStartOf="@id/share" | ||||
|         app:layout_constraintStart_toEndOf="@id/player_controls_toggle" | ||||
|         app:layout_constraintTop_toBottomOf="@id/buttons_barrier" | ||||
|         app:rippleColor="@color/grey_300" | ||||
|         tools:visibility="visible" /> | ||||
| 
 | ||||
|     <com.google.android.material.button.MaterialButton | ||||
|         android:id="@+id/share" | ||||
|         style="@style/Widget.MaterialComponents.Button.TextButton" | ||||
|         android:layout_width="0dp" | ||||
|         android:layout_height="48dp" | ||||
|         android:visibility="visible" | ||||
|         app:icon="?attr/actionModeShareDrawable" | ||||
|         app:iconGravity="textStart" | ||||
|         app:iconPadding="0dp" | ||||
|         app:iconSize="24dp" | ||||
|         app:iconTint="@color/white" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toStartOf="@id/download" | ||||
|         app:layout_constraintStart_toEndOf="@id/save" | ||||
|         app:layout_constraintTop_toBottomOf="@id/buttons_barrier" | ||||
|         app:rippleColor="@color/grey_300" | ||||
|         tools:visibility="visible" /> | ||||
| 
 | ||||
|     <!--android:text="@string/action_download" | ||||
|         android:textAppearance="@style/TextAppearance.MaterialComponents.Caption" | ||||
|         android:textColor="@color/white" | ||||
| @ -380,7 +398,7 @@ | ||||
|         app:iconTint="@color/white" | ||||
|         app:layout_constraintBottom_toBottomOf="parent" | ||||
|         app:layout_constraintEnd_toEndOf="parent" | ||||
|         app:layout_constraintStart_toEndOf="@id/save" | ||||
|         app:layout_constraintStart_toEndOf="@id/share" | ||||
|         app:layout_constraintTop_toBottomOf="@id/buttons_barrier" | ||||
|         app:rippleColor="@color/grey_300" | ||||
|         tools:visibility="visible" /> | ||||
|  | ||||
| @ -326,6 +326,7 @@ | ||||
|     <string name="comment">Comment</string> | ||||
|     <string name="layout">Layout</string> | ||||
|     <string name="opening_post">Opening post...</string> | ||||
|     <string name="share">Share</string> | ||||
|     <plurals name="likes_count"> | ||||
|         <item quantity="one">%d like</item> | ||||
|         <item quantity="other">%d likes</item> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user