-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from paulcoding810/editor
Add code editor feature
- Loading branch information
Showing
15 changed files
with
448 additions
and
5 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
41 changes: 41 additions & 0 deletions
41
app/src/main/java/com/paulcoding/hviewer/ui/component/H7Tap.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,41 @@ | ||
package com.paulcoding.hviewer.ui.component | ||
|
||
import androidx.compose.foundation.clickable | ||
import androidx.compose.foundation.layout.Box | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.mutableIntStateOf | ||
import androidx.compose.runtime.mutableLongStateOf | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.setValue | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import com.paulcoding.hviewer.BuildConfig | ||
import com.paulcoding.hviewer.helper.makeToast | ||
|
||
@Composable | ||
fun H7Tap(modifier: Modifier = Modifier, onDevModeChange: (Boolean) -> Unit) { | ||
var tapCount by remember { mutableIntStateOf(0) } | ||
var lastTapTime by remember { mutableLongStateOf(0L) } | ||
Box(modifier = modifier | ||
.padding(16.dp) | ||
.clickable { | ||
val current = System.currentTimeMillis() | ||
if (current - lastTapTime > 2000) { | ||
tapCount = 1 | ||
} else { | ||
tapCount++ | ||
if (tapCount >= 7) { | ||
makeToast("Dev Mode Enabled") | ||
onDevModeChange(true) | ||
tapCount = 0 | ||
} | ||
} | ||
lastTapTime = current | ||
|
||
}) { | ||
Text("Version ${BuildConfig.VERSION_NAME}") | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.paulcoding.hviewer.ui.icon | ||
|
||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.PathFillType | ||
import androidx.compose.ui.graphics.SolidColor | ||
import androidx.compose.ui.graphics.StrokeCap | ||
import androidx.compose.ui.graphics.StrokeJoin | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.graphics.vector.path | ||
import androidx.compose.ui.unit.dp | ||
|
||
public val Javascript: ImageVector | ||
get() { | ||
if (_Javascript != null) { | ||
return _Javascript!! | ||
} | ||
_Javascript = ImageVector.Builder( | ||
name = "Javascript", | ||
defaultWidth = 24.dp, | ||
defaultHeight = 24.dp, | ||
viewportWidth = 960f, | ||
viewportHeight = 960f | ||
).apply { | ||
path( | ||
fill = SolidColor(Color.Black), | ||
fillAlpha = 1.0f, | ||
stroke = null, | ||
strokeAlpha = 1.0f, | ||
strokeLineWidth = 1.0f, | ||
strokeLineCap = StrokeCap.Butt, | ||
strokeLineJoin = StrokeJoin.Miter, | ||
strokeLineMiter = 1.0f, | ||
pathFillType = PathFillType.NonZero | ||
) { | ||
moveTo(300f, 600f) | ||
quadToRelative(-25f, 0f, -42.5f, -17.5f) | ||
reflectiveQuadTo(240f, 540f) | ||
verticalLineToRelative(-40f) | ||
horizontalLineToRelative(60f) | ||
verticalLineToRelative(40f) | ||
horizontalLineToRelative(60f) | ||
verticalLineToRelative(-180f) | ||
horizontalLineToRelative(60f) | ||
verticalLineToRelative(180f) | ||
quadToRelative(0f, 25f, -17.5f, 42.5f) | ||
reflectiveQuadTo(360f, 600f) | ||
close() | ||
moveToRelative(220f, 0f) | ||
quadToRelative(-17f, 0f, -28.5f, -11.5f) | ||
reflectiveQuadTo(480f, 560f) | ||
verticalLineToRelative(-40f) | ||
horizontalLineToRelative(60f) | ||
verticalLineToRelative(20f) | ||
horizontalLineToRelative(80f) | ||
verticalLineToRelative(-40f) | ||
horizontalLineTo(520f) | ||
quadToRelative(-17f, 0f, -28.5f, -11.5f) | ||
reflectiveQuadTo(480f, 460f) | ||
verticalLineToRelative(-60f) | ||
quadToRelative(0f, -17f, 11.5f, -28.5f) | ||
reflectiveQuadTo(520f, 360f) | ||
horizontalLineToRelative(120f) | ||
quadToRelative(17f, 0f, 28.5f, 11.5f) | ||
reflectiveQuadTo(680f, 400f) | ||
verticalLineToRelative(40f) | ||
horizontalLineToRelative(-60f) | ||
verticalLineToRelative(-20f) | ||
horizontalLineToRelative(-80f) | ||
verticalLineToRelative(40f) | ||
horizontalLineToRelative(100f) | ||
quadToRelative(17f, 0f, 28.5f, 11.5f) | ||
reflectiveQuadTo(680f, 500f) | ||
verticalLineToRelative(60f) | ||
quadToRelative(0f, 17f, -11.5f, 28.5f) | ||
reflectiveQuadTo(640f, 600f) | ||
close() | ||
} | ||
}.build() | ||
return _Javascript!! | ||
} | ||
|
||
private var _Javascript: ImageVector? = null |
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,76 @@ | ||
package com.paulcoding.hviewer.ui.icon | ||
|
||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.PathFillType | ||
import androidx.compose.ui.graphics.SolidColor | ||
import androidx.compose.ui.graphics.StrokeCap | ||
import androidx.compose.ui.graphics.StrokeJoin | ||
import androidx.compose.ui.graphics.vector.ImageVector | ||
import androidx.compose.ui.graphics.vector.path | ||
import androidx.compose.ui.unit.dp | ||
|
||
public val Save: ImageVector | ||
get() { | ||
if (_Save != null) { | ||
return _Save!! | ||
} | ||
_Save = ImageVector.Builder( | ||
name = "Save", | ||
defaultWidth = 24.dp, | ||
defaultHeight = 24.dp, | ||
viewportWidth = 960f, | ||
viewportHeight = 960f | ||
).apply { | ||
path( | ||
fill = SolidColor(Color.Black), | ||
fillAlpha = 1.0f, | ||
stroke = null, | ||
strokeAlpha = 1.0f, | ||
strokeLineWidth = 1.0f, | ||
strokeLineCap = StrokeCap.Butt, | ||
strokeLineJoin = StrokeJoin.Miter, | ||
strokeLineMiter = 1.0f, | ||
pathFillType = PathFillType.NonZero | ||
) { | ||
moveTo(840f, 280f) | ||
verticalLineToRelative(480f) | ||
quadToRelative(0f, 33f, -23.5f, 56.5f) | ||
reflectiveQuadTo(760f, 840f) | ||
horizontalLineTo(200f) | ||
quadToRelative(-33f, 0f, -56.5f, -23.5f) | ||
reflectiveQuadTo(120f, 760f) | ||
verticalLineToRelative(-560f) | ||
quadToRelative(0f, -33f, 23.5f, -56.5f) | ||
reflectiveQuadTo(200f, 120f) | ||
horizontalLineToRelative(480f) | ||
close() | ||
moveToRelative(-80f, 34f) | ||
lineTo(646f, 200f) | ||
horizontalLineTo(200f) | ||
verticalLineToRelative(560f) | ||
horizontalLineToRelative(560f) | ||
close() | ||
moveTo(480f, 720f) | ||
quadToRelative(50f, 0f, 85f, -35f) | ||
reflectiveQuadToRelative(35f, -85f) | ||
reflectiveQuadToRelative(-35f, -85f) | ||
reflectiveQuadToRelative(-85f, -35f) | ||
reflectiveQuadToRelative(-85f, 35f) | ||
reflectiveQuadToRelative(-35f, 85f) | ||
reflectiveQuadToRelative(35f, 85f) | ||
reflectiveQuadToRelative(85f, 35f) | ||
moveTo(240f, 400f) | ||
horizontalLineToRelative(360f) | ||
verticalLineToRelative(-160f) | ||
horizontalLineTo(240f) | ||
close() | ||
moveToRelative(-40f, -86f) | ||
verticalLineToRelative(446f) | ||
verticalLineToRelative(-560f) | ||
close() | ||
} | ||
}.build() | ||
return _Save!! | ||
} | ||
|
||
private var _Save: ImageVector? = null |
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
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
Oops, something went wrong.