Fix background and back button function
This commit is contained in:
parent
75deac0e5b
commit
9f8e1f1e04
|
@ -173,8 +173,6 @@ class VideoEditActivity : BaseThemedWithBarActivity() {
|
|||
relativeY = y/fullImageRect.height()
|
||||
)
|
||||
|
||||
binding.cropSavedCard.isVisible = !cropRelativeDimensions.notCropped()
|
||||
|
||||
// If a crop was saved, change the color of the crop button to give a visual indication
|
||||
if(!cropRelativeDimensions.notCropped()){
|
||||
val typedValue = TypedValue()
|
||||
|
@ -258,7 +256,6 @@ class VideoEditActivity : BaseThemedWithBarActivity() {
|
|||
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
||||
|
||||
when(item.itemId) {
|
||||
android.R.id.home -> onBackPressed()
|
||||
R.id.action_save -> {
|
||||
returnWithValues()
|
||||
}
|
||||
|
@ -271,7 +268,9 @@ class VideoEditActivity : BaseThemedWithBarActivity() {
|
|||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if (noEdits()) super.onBackPressed()
|
||||
if(binding.cropImageView.isVisible) {
|
||||
showCropInterface(false)
|
||||
} else if (noEdits()) super.onBackPressed()
|
||||
else {
|
||||
val builder = AlertDialog.Builder(this)
|
||||
builder.apply {
|
||||
|
@ -304,8 +303,8 @@ class VideoEditActivity : BaseThemedWithBarActivity() {
|
|||
|
||||
if(show) mediaPlayer.pause()
|
||||
|
||||
// Only hide: showing happens on save only if necessary
|
||||
if(show) binding.cropSavedCard.visibility = View.GONE
|
||||
else if(!cropRelativeDimensions.notCropped()) binding.cropSavedCard.visibility = View.VISIBLE
|
||||
|
||||
binding.muter.visibility = visibilityOfOthers
|
||||
binding.speeder.visibility = visibilityOfOthers
|
||||
|
|
|
@ -264,8 +264,36 @@ public class CropOverlayView extends View {
|
|||
private void drawBackground(Canvas canvas) {
|
||||
|
||||
RectF rect = mCropWindowHandler.getRect();
|
||||
Paint background = getNewPaint(Color.argb(119, 0, 0, 0));
|
||||
|
||||
canvas.drawRect(rect.left, rect.top, rect.right, rect.bottom, getNewPaint(Color.argb(119, 0, 0, 0)));
|
||||
canvas.drawRect(
|
||||
mInitialCropWindowRect.left,
|
||||
mInitialCropWindowRect.top,
|
||||
rect.left,
|
||||
mInitialCropWindowRect.bottom,
|
||||
background
|
||||
);
|
||||
canvas.drawRect(
|
||||
rect.left,
|
||||
rect.bottom,
|
||||
mInitialCropWindowRect.right,
|
||||
mInitialCropWindowRect.bottom,
|
||||
background
|
||||
);
|
||||
canvas.drawRect(
|
||||
rect.right,
|
||||
mInitialCropWindowRect.top,
|
||||
mInitialCropWindowRect.right,
|
||||
rect.bottom,
|
||||
background
|
||||
);
|
||||
canvas.drawRect(
|
||||
rect.left,
|
||||
mInitialCropWindowRect.top,
|
||||
rect.right,
|
||||
rect.top,
|
||||
background
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0">
|
||||
<path
|
||||
android:fillColor="?attr/colorOnBackground"
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M17,15h2V7c0,-1.1 -0.9,-2 -2,-2H9v2h8v8zM7,17V1H5v4H1v2h4v10c0,1.1 0.9,2 2,2h10v4h2v-4h4v-2H7z"/>
|
||||
</vector>
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="411dp"
|
||||
android:tint="?attr/colorOnBackground"
|
||||
android:src="@drawable/ic_crop_black_24dp"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/left_guideline"
|
||||
app:layout_constraintRight_toRightOf="@+id/right_guideline"
|
||||
|
|
|
@ -78,7 +78,6 @@
|
|||
android:contentDescription="@string/video_crop"
|
||||
android:background="?attr/selectableItemBackgroundBorderless"
|
||||
android:padding="4dp"
|
||||
app:tint="@android:color/white"
|
||||
android:src="@drawable/ic_crop_black_24dp"
|
||||
app:layout_constraintBottom_toTopOf="@+id/thumbnail1"
|
||||
app:layout_constraintStart_toEndOf="@+id/speeder" />
|
||||
|
|
Loading…
Reference in New Issue