From e0bd51c52170420bbc0f8c6878acf34f03211ff8 Mon Sep 17 00:00:00 2001 From: A117870935 Date: Thu, 6 Jul 2023 15:23:07 +0530 Subject: [PATCH] Image edit functionality customized. --- .../client/editimage/EditImageActivity.kt | 42 +++++++++++-------- .../main/res/layout/activity_edit_image.xml | 15 +++---- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt b/app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt index c7f35fd725a0..028c95128ad7 100644 --- a/app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt +++ b/app/src/main/java/com/nextcloud/client/editimage/EditImageActivity.kt @@ -21,6 +21,7 @@ package com.nextcloud.client.editimage import android.graphics.Bitmap +import android.graphics.drawable.ColorDrawable import android.net.Uri import android.os.Build import android.os.Bundle @@ -29,9 +30,6 @@ import android.view.MenuItem import android.view.View import androidx.appcompat.content.res.AppCompatResources import androidx.core.content.ContextCompat -import androidx.core.graphics.drawable.DrawableCompat -import androidx.core.view.WindowCompat -import androidx.core.view.WindowInsetsCompat import com.canhub.cropper.CropImageView import com.nextcloud.client.di.Injectable import com.nextcloud.utils.extensions.getParcelableArgument @@ -86,21 +84,25 @@ class EditImageActivity : file = intent.extras?.getParcelableArgument(EXTRA_FILE, OCFile::class.java) ?: throw IllegalArgumentException("Missing file argument") - setSupportActionBar(binding.toolbar) - supportActionBar?.apply { - title = file.fileName - setDisplayHomeAsUpEnabled(true) - } - - val windowInsetsController = WindowCompat.getInsetsController(window, window.decorView) - windowInsetsController.hide(WindowInsetsCompat.Type.statusBars()) - - window.statusBarColor = ContextCompat.getColor(this, R.color.black) - window.navigationBarColor = getColor(R.color.black) + //NMC Customization + setupToolbar() + setupActionBar() setupCropper() } + //NMC Customization + private fun setupActionBar() { + supportActionBar?.let { + viewThemeUtils.platform.themeStatusBar(this) + it.setDisplayHomeAsUpEnabled(true) + it.setDisplayShowTitleEnabled(true) + //custom color for back arrow for NMC + viewThemeUtils.files.themeActionBar(this, it, file.fileName) + it.setBackgroundDrawable(ColorDrawable(resources.getColor(R.color.bg_default, null))) + } + } + override fun onCropImageComplete(view: CropImageView, result: CropImageView.CropResult) { if (!result.isSuccessful) { DisplayUtils.showSnackMessage(this, getString(R.string.image_editor_unable_to_edit_image)) @@ -137,14 +139,20 @@ class EditImageActivity : override fun onCreateOptionsMenu(menu: Menu?): Boolean { // add save button to action bar menuInflater.inflate(R.menu.custom_menu_placeholder, menu) - val saveIcon = AppCompatResources.getDrawable(this, R.drawable.ic_check)?.also { - DrawableCompat.setTint(it, resources.getColor(R.color.white, theme)) - } + //No need to apply NC tint here as we will be doing it later in code + val saveIcon = AppCompatResources.getDrawable(this, R.drawable.ic_tick) menu?.findItem(R.id.custom_menu_placeholder_item)?.apply { icon = saveIcon if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { contentDescription = getString(R.string.common_save) } + //NMC customization + icon = icon?.let { + viewThemeUtils.platform.colorDrawable( + it, + ContextCompat.getColor(this@EditImageActivity, R.color.fontAppbar) + ) + } } return true } diff --git a/app/src/main/res/layout/activity_edit_image.xml b/app/src/main/res/layout/activity_edit_image.xml index 931bb15d19be..43cd963c1f36 100644 --- a/app/src/main/res/layout/activity_edit_image.xml +++ b/app/src/main/res/layout/activity_edit_image.xml @@ -24,15 +24,10 @@ android:layout_height="match_parent" android:background="@color/black"> - + + + app:layout_constraintTop_toBottomOf="@+id/appbar" />