Avoid displaying the back button when back should be handled by the system (#181)
After removing the home screen, displaying the back button on the camera screen didn't make sense anymore. See #179.
This commit is contained in:
committed by
GitHub
parent
6a3ccb854e
commit
d9844be4de
@@ -486,6 +486,10 @@ class MainActivity : ComponentActivity() {
|
||||
setResult(RESULT_CANCELED)
|
||||
finish()
|
||||
}
|
||||
},
|
||||
shouldDisplayBackButton = {
|
||||
viewModel.currentScreen.value !is Screen.Main.Camera
|
||||
|| launchMode == LaunchMode.EXTERNAL_SCAN_TO_PDF
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ data class Navigation(
|
||||
val toLibrariesScreen: () -> Unit,
|
||||
val toSettingsScreen: (() -> Unit)?,
|
||||
val back: () -> Unit,
|
||||
val shouldDisplayBackButton: () -> Boolean,
|
||||
)
|
||||
|
||||
@ConsistentCopyVisibility
|
||||
|
||||
@@ -25,7 +25,7 @@ import org.fairscan.app.ui.state.PageThumbnail
|
||||
import org.fairscan.imageprocessing.ColorMode
|
||||
|
||||
fun dummyNavigation(): Navigation {
|
||||
return Navigation({}, {}, {}, {}, {}, {}, {}, {})
|
||||
return Navigation({}, {}, {}, {}, {}, {}, {}, {}, { -> true})
|
||||
}
|
||||
|
||||
fun fakeDocument(pageIds: ImmutableList<String>, context: Context): DocumentUiModel {
|
||||
|
||||
@@ -85,12 +85,14 @@ fun MyScaffold(
|
||||
}
|
||||
}
|
||||
}
|
||||
BackButton(
|
||||
navigation.back,
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopStart)
|
||||
.windowInsetsPadding(WindowInsets.safeDrawing)
|
||||
)
|
||||
if (navigation.shouldDisplayBackButton()) {
|
||||
BackButton(
|
||||
navigation.back,
|
||||
modifier = Modifier
|
||||
.align(Alignment.TopStart)
|
||||
.windowInsetsPadding(WindowInsets.safeDrawing)
|
||||
)
|
||||
}
|
||||
AppOverflowMenu(
|
||||
navigation,
|
||||
modifier = Modifier
|
||||
|
||||
Reference in New Issue
Block a user