Rename EditPageScreen to CropScreen
This commit is contained in:
@@ -55,7 +55,7 @@ import org.fairscan.app.ui.Navigation
|
||||
import org.fairscan.app.ui.Screen
|
||||
import org.fairscan.app.ui.components.rememberCameraPermissionState
|
||||
import org.fairscan.app.ui.screens.document.DocumentScreen
|
||||
import org.fairscan.app.ui.screens.edit.EditPageScreen
|
||||
import org.fairscan.app.ui.screens.crop.CropScreen
|
||||
import org.fairscan.app.ui.screens.LibrariesScreen
|
||||
import org.fairscan.app.ui.screens.about.AboutEvent
|
||||
import org.fairscan.app.ui.screens.about.AboutScreen
|
||||
@@ -180,7 +180,7 @@ class MainActivity : ComponentActivity() {
|
||||
)
|
||||
}
|
||||
is Screen.Main.EditImage -> {
|
||||
EditPageScreen(
|
||||
CropScreen(
|
||||
pageId = documentUiState.currentPage?.key?.pageId ?: "",
|
||||
initState = cropInitialState,
|
||||
navigation = navigation,
|
||||
|
||||
@@ -44,7 +44,7 @@ import org.fairscan.app.ui.NavigationState
|
||||
import org.fairscan.app.ui.Screen
|
||||
import org.fairscan.app.ui.screens.document.CurrentPageUiState
|
||||
import org.fairscan.app.ui.screens.document.DocumentUiState
|
||||
import org.fairscan.app.ui.screens.edit.CropInitState
|
||||
import org.fairscan.app.ui.screens.crop.CropInitState
|
||||
import org.fairscan.app.ui.state.DocumentUiModel
|
||||
import org.fairscan.app.ui.state.PageThumbnail
|
||||
import org.fairscan.imageprocessing.ColorMode
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.fairscan.app.ui.screens.edit
|
||||
package org.fairscan.app.ui.screens.crop
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.res.Configuration
|
||||
@@ -64,13 +64,13 @@ import org.fairscan.imageprocessing.Quad
|
||||
@SuppressLint("UnusedMaterial3ScaffoldPaddingParameter")
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
fun EditPageScreen(
|
||||
fun CropScreen(
|
||||
pageId: String,
|
||||
initState: CropInitState,
|
||||
navigation: Navigation,
|
||||
onUpdatePageQuad: (Quad) -> Unit,
|
||||
) {
|
||||
val state = remember(pageId) { EditPageScreenState() }
|
||||
val state = remember(pageId) { CropScreenState() }
|
||||
val quadHandler = remember { QuadEditingHandler() }
|
||||
|
||||
if (initState is CropInitState.Ready && initState.pageId == pageId && state.bitmap == null) {
|
||||
@@ -145,7 +145,7 @@ private fun ActionButtons(
|
||||
|
||||
@Composable
|
||||
private fun DragQuadOverlay(
|
||||
state: EditPageScreenState,
|
||||
state: CropScreenState,
|
||||
quadHandler: QuadEditingHandler,
|
||||
bmp: Bitmap
|
||||
) {
|
||||
@@ -154,7 +154,7 @@ private fun DragQuadOverlay(
|
||||
val containerSize = state.containerSize!!
|
||||
val displaySize = QuadCoordinateUtils.calculateDisplaySize(bmp.width, bmp.height, containerSize)
|
||||
val liftWiggleThresholdPx = with(LocalDensity.current) {
|
||||
EditPageScreenState.LIFT_WIGGLE_MAX_DISTANCE.toPx()
|
||||
CropScreenState.LIFT_WIGGLE_MAX_DISTANCE.toPx()
|
||||
}
|
||||
|
||||
QuadOverlay(
|
||||
@@ -238,7 +238,7 @@ private fun DragQuadOverlay(
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun DragMagnifyingGlass(state: EditPageScreenState) {
|
||||
private fun DragMagnifyingGlass(state: CropScreenState) {
|
||||
// showLoupe becomes true immediately on touch-down and stays true for
|
||||
// one additional second after the finger is lifted.
|
||||
val showLoupe = remember { mutableStateOf(false) }
|
||||
@@ -314,7 +314,7 @@ fun EditPageScreenPreview() {
|
||||
BitmapFactory.decodeStream(input)
|
||||
}
|
||||
val quad = Quad(Point(.1, .1), Point(.9, .1), Point(.9, .9), Point(.1, .9))
|
||||
EditPageScreen(
|
||||
CropScreen(
|
||||
pageId = "123",
|
||||
initState = CropInitState.Ready("123",dummyImage, quad),
|
||||
navigation = dummyNavigation(),
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.fairscan.app.ui.screens.edit
|
||||
package org.fairscan.app.ui.screens.crop
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import androidx.compose.runtime.getValue
|
||||
@@ -34,7 +34,7 @@ sealed interface CropInitState {
|
||||
) : CropInitState
|
||||
}
|
||||
|
||||
class EditPageScreenState {
|
||||
class CropScreenState {
|
||||
companion object {
|
||||
val LIFT_WIGGLE_MAX_DISTANCE = 8.dp
|
||||
const val LIFT_WIGGLE_WINDOW_MS = 70L
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.fairscan.app.ui.screens.edit
|
||||
package org.fairscan.app.ui.screens.crop
|
||||
|
||||
import android.graphics.Bitmap
|
||||
import androidx.compose.foundation.Canvas
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.fairscan.app.ui.screens.edit
|
||||
package org.fairscan.app.ui.screens.crop
|
||||
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.unit.IntSize
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.fairscan.app.ui.screens.edit
|
||||
package org.fairscan.app.ui.screens.crop
|
||||
|
||||
import androidx.compose.ui.geometry.Offset
|
||||
import androidx.compose.ui.unit.IntSize
|
||||
@@ -12,7 +12,7 @@
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.fairscan.app.ui.screens.edit
|
||||
package org.fairscan.app.ui.screens.crop
|
||||
|
||||
import androidx.compose.foundation.Canvas
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
Reference in New Issue
Block a user