mirror of
https://github.com/izzy2lost/aab2apk.git
synced 2026-06-19 01:20:08 -07:00
v1.0.0 Working In Mac through manual run.
[Added] UI Tweaks
This commit is contained in:
+56
-52
@@ -1,54 +1,60 @@
|
||||
import androidx.compose.desktop.ui.tooling.preview.Preview
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.CircularProgressIndicator
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.material.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.compose.ui.window.*
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import theme.Styles
|
||||
import java.awt.FileDialog
|
||||
import java.awt.Frame
|
||||
import javax.swing.text.Style
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun App() {
|
||||
|
||||
var logs by remember { mutableStateOf("Logs:") }
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
|
||||
var logs by remember { mutableStateOf("========== Logs View ==========\n\n") }
|
||||
var isLoading by remember { mutableStateOf(false) }
|
||||
var isOpen by remember { mutableStateOf(false) }
|
||||
var showLoading by remember { mutableStateOf(false) }
|
||||
if (isOpen) {
|
||||
FileDialog { fileName, directory ->
|
||||
logs = "Logs: "
|
||||
isOpen = false
|
||||
val cmd = Constant.getCommand().replace("INPUT_FILE_PATH", "${directory}$fileName")
|
||||
.replace("OUTPUT_FILE_NAME", "${directory}${fileName.split(".")[0]}")
|
||||
Log.i("Command $cmd")
|
||||
showLoading = true
|
||||
val runtime = Runtime.getRuntime()
|
||||
val startTime = System.currentTimeMillis()
|
||||
val process = runtime.exec(cmd)
|
||||
process.waitFor()
|
||||
val endTime = System.currentTimeMillis()
|
||||
logs += if (process.exitValue() == 0) {
|
||||
Log.i("Command Executed in ${((endTime - startTime) / 1000)}s")
|
||||
"Command Executed in ${((endTime - startTime) / 1000)}s\n"
|
||||
}else{
|
||||
"Failed while running command"
|
||||
}
|
||||
logs += "Executing Command : \n$cmd\n"
|
||||
|
||||
FileHelper.performFileOperations(directory, fileName) { status, message ->
|
||||
Log.i("STATUS - $status\nMESSAGE - $message")
|
||||
logs += "STATUS - $status\nMESSAGE - $message"
|
||||
showLoading = false
|
||||
coroutineScope.launch(Dispatchers.IO) {
|
||||
isLoading = true
|
||||
val runtime = Runtime.getRuntime()
|
||||
val startTime = System.currentTimeMillis()
|
||||
try {
|
||||
val process = runtime.exec(cmd)
|
||||
process.waitFor()
|
||||
val endTime = System.currentTimeMillis()
|
||||
if (process.exitValue() == 0) {
|
||||
Log.i("Command Executed in ${((endTime - startTime) / 1000)}s")
|
||||
logs += "\nCommand Executed in ${((endTime - startTime) / 1000)}s\n"
|
||||
FileHelper.performFileOperations(directory, fileName) { status, message ->
|
||||
isLoading = false
|
||||
Log.i("STATUS - $status\nMESSAGE - $message")
|
||||
logs += "\nFiles Operations Starting...\n$message\n"
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
isLoading = false
|
||||
logs += "Failed -> ${e.printStackTrace()}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,39 +67,37 @@ fun App() {
|
||||
Spacer(modifier = Modifier.padding(12.dp))
|
||||
Text(
|
||||
text = "Aab To Apk",
|
||||
style = TextStyle(
|
||||
fontSize = 28.sp
|
||||
)
|
||||
style = Styles.TextStyleBold(28.sp)
|
||||
)
|
||||
Spacer(modifier = Modifier.padding(8.dp))
|
||||
Button(
|
||||
onClick = {
|
||||
isOpen = true
|
||||
},
|
||||
modifier = Modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp, bottom = 8.dp)
|
||||
.fillMaxWidth(0.32f),
|
||||
) {
|
||||
Text(
|
||||
text = "Choose File",
|
||||
color = Color.White,
|
||||
fontWeight = FontWeight.Medium,
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.padding(8.dp))
|
||||
Text(
|
||||
textAlign = TextAlign.Center,
|
||||
text = logs,
|
||||
style = TextStyle(
|
||||
color = Color.Blue,
|
||||
fontSize = 18.sp
|
||||
)
|
||||
)
|
||||
if (showLoading) {
|
||||
if (isLoading) {
|
||||
CircularProgressIndicator(
|
||||
modifier = Modifier.size(size = 64.dp),
|
||||
strokeWidth = 6.dp
|
||||
modifier = Modifier.size(size = 30.dp),
|
||||
strokeWidth = 4.dp
|
||||
)
|
||||
} else {
|
||||
Button(
|
||||
onClick = {
|
||||
isOpen = true
|
||||
},
|
||||
modifier = Modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp, bottom = 8.dp)
|
||||
.fillMaxWidth(0.32f),
|
||||
) {
|
||||
Text(
|
||||
text = "Choose File",
|
||||
style = Styles.TextStyleMedium(16.sp),
|
||||
color = Color.White,
|
||||
fontWeight = FontWeight.Medium,
|
||||
)
|
||||
}
|
||||
}
|
||||
Spacer(modifier = Modifier.padding(8.dp))
|
||||
TextField(
|
||||
modifier = Modifier.fillMaxSize().padding(start = 20.dp, end = 20.dp, bottom = 20.dp),
|
||||
value = logs,
|
||||
textStyle = Styles.TextStyleMedium(16.sp),
|
||||
onValueChange = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package theme
|
||||
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.TextUnit
|
||||
|
||||
object Styles {
|
||||
|
||||
fun TextStyleNormal(size: TextUnit) =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontFamily = codeFontFamily,
|
||||
fontSize = size,
|
||||
)
|
||||
|
||||
fun TextStyleMedium(size: TextUnit) =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontFamily = codeFontFamily,
|
||||
fontSize = size,
|
||||
)
|
||||
|
||||
fun TextStyleSemiBold(size: TextUnit) =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
fontFamily = codeFontFamily,
|
||||
fontSize = size,
|
||||
)
|
||||
|
||||
fun TextStyleBold(size: TextUnit) =
|
||||
TextStyle(
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontFamily = codeFontFamily,
|
||||
fontSize = size,
|
||||
)
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package theme
|
||||
|
||||
import androidx.compose.material.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.platform.Font
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
val codeFontFamily = FontFamily(
|
||||
Font(resource = "fonts/sans_regular.ttf", weight = FontWeight.Light),
|
||||
Font( resource = "fonts/sans_thin.ttf", weight = FontWeight.Normal),
|
||||
Font( resource = "fonts/sans_medium.ttf", weight = FontWeight.Medium),
|
||||
Font( resource = "fonts/sans_bold.ttf", weight = FontWeight.Bold)
|
||||
)
|
||||
|
||||
val typography = Typography(
|
||||
defaultFontFamily = codeFontFamily,
|
||||
h1 = TextStyle(
|
||||
fontWeight = FontWeight.Light,
|
||||
fontSize = 96.sp,
|
||||
letterSpacing = (-1.5).sp
|
||||
),
|
||||
h2 = TextStyle(
|
||||
fontWeight = FontWeight.Light,
|
||||
fontSize = 60.sp,
|
||||
letterSpacing = (-0.5).sp
|
||||
),
|
||||
h3 = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 48.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
h4 = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 30.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
h5 = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 24.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
h6 = TextStyle(
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 20.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
subtitle1 = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
letterSpacing = 0.15.sp
|
||||
),
|
||||
subtitle2 = TextStyle(
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 14.sp,
|
||||
letterSpacing = 0.1.sp
|
||||
),
|
||||
body1 = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
),
|
||||
body2 = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 14.sp,
|
||||
letterSpacing = 0.25.sp
|
||||
),
|
||||
button = TextStyle(
|
||||
fontWeight = FontWeight.Bold,
|
||||
fontSize = 14.sp,
|
||||
letterSpacing = 0.25.sp
|
||||
),
|
||||
caption = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 12.sp,
|
||||
letterSpacing = 0.4.sp
|
||||
),
|
||||
overline = TextStyle(
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 10.sp,
|
||||
letterSpacing = 1.sp
|
||||
)
|
||||
)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user