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)
|
setResult(RESULT_CANCELED)
|
||||||
finish()
|
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 toLibrariesScreen: () -> Unit,
|
||||||
val toSettingsScreen: (() -> Unit)?,
|
val toSettingsScreen: (() -> Unit)?,
|
||||||
val back: () -> Unit,
|
val back: () -> Unit,
|
||||||
|
val shouldDisplayBackButton: () -> Boolean,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ConsistentCopyVisibility
|
@ConsistentCopyVisibility
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import org.fairscan.app.ui.state.PageThumbnail
|
|||||||
import org.fairscan.imageprocessing.ColorMode
|
import org.fairscan.imageprocessing.ColorMode
|
||||||
|
|
||||||
fun dummyNavigation(): Navigation {
|
fun dummyNavigation(): Navigation {
|
||||||
return Navigation({}, {}, {}, {}, {}, {}, {}, {})
|
return Navigation({}, {}, {}, {}, {}, {}, {}, {}, { -> true})
|
||||||
}
|
}
|
||||||
|
|
||||||
fun fakeDocument(pageIds: ImmutableList<String>, context: Context): DocumentUiModel {
|
fun fakeDocument(pageIds: ImmutableList<String>, context: Context): DocumentUiModel {
|
||||||
|
|||||||
@@ -85,12 +85,14 @@ fun MyScaffold(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BackButton(
|
if (navigation.shouldDisplayBackButton()) {
|
||||||
navigation.back,
|
BackButton(
|
||||||
modifier = Modifier
|
navigation.back,
|
||||||
.align(Alignment.TopStart)
|
modifier = Modifier
|
||||||
.windowInsetsPadding(WindowInsets.safeDrawing)
|
.align(Alignment.TopStart)
|
||||||
)
|
.windowInsetsPadding(WindowInsets.safeDrawing)
|
||||||
|
)
|
||||||
|
}
|
||||||
AppOverflowMenu(
|
AppOverflowMenu(
|
||||||
navigation,
|
navigation,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
Reference in New Issue
Block a user