This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6f50f4a
commit f7fef8b
Showing
8 changed files
with
106 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/src/main/java/com/bnyro/recorder/canvas_overlay/CanvasViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.bnyro.recorder.canvas_overlay | ||
|
||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.setValue | ||
import androidx.lifecycle.ViewModel | ||
|
||
class CanvasViewModel: ViewModel() { | ||
var currentPath by mutableStateOf(PathProperties()) | ||
} |
54 changes: 54 additions & 0 deletions
54
app/src/main/java/com/bnyro/recorder/canvas_overlay/OverlayView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.bnyro.recorder.canvas_overlay | ||
|
||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.material.icons.Icons | ||
import androidx.compose.material.icons.filled.Close | ||
import androidx.compose.material.icons.filled.Draw | ||
import androidx.compose.material3.Card | ||
import androidx.compose.material3.Icon | ||
import androidx.compose.material3.IconButton | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.res.painterResource | ||
import androidx.lifecycle.viewmodel.compose.viewModel | ||
import com.bnyro.recorder.R | ||
|
||
@Composable | ||
fun OverlayView(onDismissRequest: () -> Unit, canvasViewModel: CanvasViewModel = viewModel()) { | ||
Box(Modifier.fillMaxSize()) { | ||
MainCanvas() | ||
var currentDrawMode by remember { mutableStateOf(canvasViewModel.currentPath.drawMode) } | ||
Card(Modifier.align(Alignment.TopEnd)) { | ||
Row { | ||
IconButton( | ||
onClick = { | ||
currentDrawMode = DrawMode.Pen | ||
canvasViewModel.currentPath.drawMode = currentDrawMode | ||
}) { | ||
Icon(imageVector = Icons.Default.Draw, contentDescription = "Draw Mode") | ||
} | ||
IconButton( | ||
onClick = { | ||
currentDrawMode = DrawMode.Eraser | ||
canvasViewModel.currentPath.drawMode = currentDrawMode | ||
}) { | ||
Icon( | ||
painter = painterResource(id = R.drawable.ic_eraser_black_24dp), | ||
contentDescription = "Erase Mode" | ||
) | ||
} | ||
IconButton(onClick = { onDismissRequest() }) { | ||
Icon(Icons.Default.Close, "Close Overlay") | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 0 additions & 28 deletions
28
app/src/main/java/com/bnyro/recorder/ui/views/OverlayView.kt
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
app/src/main/java/com/bnyro/recorder/util/CustomViewModelStoreOwner.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.bnyro.recorder.util | ||
|
||
import androidx.lifecycle.ViewModelStore | ||
import androidx.lifecycle.ViewModelStoreOwner | ||
|
||
class CustomViewModelStoreOwner:ViewModelStoreOwner { | ||
override val viewModelStore: ViewModelStore = ViewModelStore() | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24.0" | ||
android:viewportHeight="24.0"> | ||
<path | ||
android:fillColor="#FF000000" | ||
android:pathData="M15.14,3C14.63,3 14.12,3.2 13.73,3.59L2.59,14.73C1.81,15.5 1.81,16.77 2.59,17.56L5.03,20H12.69L21.41,11.27C22.2,10.5 22.2,9.23 21.41,8.44L16.56,3.59C16.17,3.2 15.65,3 15.14,3M17,18L15,20H22V18"/> | ||
</vector> |