Skip to content

Commit

Permalink
Merge pull request #39 from ponces/dev-fix-fabs
Browse files Browse the repository at this point in the history
feat: add reboot FAB after direct flash, make them undraggable and align them at the right side if not already
  • Loading branch information
marat2509 authored Jan 6, 2024
2 parents 17b248a + 470c142 commit 3e1480b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
25 changes: 3 additions & 22 deletions app/src/main/java/me/bmax/apatch/ui/screen/Home.kt
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ fun StartPatch(showDialog: MutableState<Boolean>, navigator: DestinationsNavigat
fun FloatButton(navigator: DestinationsNavigator) {
val state by APApplication.apStateLiveData.observeAsState(APApplication.State.UNKNOWN_STATE)

var patchOff by remember { mutableStateOf(IntOffset.Zero) }
var skeyOff by remember { mutableStateOf(IntOffset.Zero) }

var showAuthKeyDialog = remember { mutableStateOf(false) }
var showSetKeyDialog = remember { mutableStateOf(false) }
var permissionRequest = remember { mutableStateOf(false) }
Expand Down Expand Up @@ -239,16 +236,8 @@ fun FloatButton(navigator: DestinationsNavigator) {
StartPatch(showDialog = showSetKeyDialog, navigator)
}

Column() {
Box(Modifier
.offset { patchOff }
.pointerInput(Unit) {
detectDragGestures { change, dragAmount ->
change.consume()
patchOff += dragAmount.round()
}
}
) {
Column(horizontalAlignment = Alignment.End) {
Box() {
ExtendedFloatingActionButton(
onClick = {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
Expand All @@ -262,15 +251,7 @@ fun FloatButton(navigator: DestinationsNavigator) {
)
}
Spacer(Modifier.height(8.dp))
Box(Modifier
.offset { skeyOff }
.pointerInput(Unit) {
detectDragGestures { change, dragAmount ->
change.consume()
skeyOff += dragAmount.round()
}
}
) {
Box() {
ExtendedFloatingActionButton(
onClick = {
if(state != APApplication.State.UNKNOWN_STATE) {
Expand Down
7 changes: 4 additions & 3 deletions app/src/main/java/me/bmax/apatch/ui/screen/Patch.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import kotlinx.coroutines.withContext
import me.bmax.apatch.R
import me.bmax.apatch.TAG
import me.bmax.apatch.apApp
import me.bmax.apatch.util.reboot
import java.io.File
import java.io.FileNotFoundException
import java.io.IOException
Expand Down Expand Up @@ -61,8 +62,8 @@ fun PatchScreen(navigator: DestinationsNavigator, uri: Uri?, superKey: String) {
text += '\n'
}
})
if(ret) {
// showFloatAction = true
if(ret && uri == null) {
showFloatAction = true
}
}
}
Expand All @@ -79,7 +80,7 @@ fun PatchScreen(navigator: DestinationsNavigator, uri: Uri?, superKey: String) {
onClick = {
scope.launch {
withContext(Dispatchers.IO) {
// reboot()
reboot()
}
}
},
Expand Down

0 comments on commit 3e1480b

Please sign in to comment.