Skip to content

Commit a8b4caa

Browse files
committed
[skip ci]
1 parent 5252995 commit a8b4caa

File tree

12 files changed

+211
-73
lines changed

12 files changed

+211
-73
lines changed

app/proguard-rules.pro

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,22 @@
1818

1919
# If you keep the line number information, uncomment this to
2020
# hide the original source file name.
21-
#-renamesourcefileattribute SourceFile
21+
#-renamesourcefileattribute SourceFile
22+
23+
# Gemini
24+
# java.lang.IllegalArgumentException: Cannot find class with name "com.perkedel.htlauncher. enumerations. PageViewStyle" . Ensure that the serialName for this argument is the default fully qualified name
25+
# https://stackoverflow.com/questions/22399572/java-lang-classnotfoundexception-didnt-find-class-on-path-dexpathlist
26+
-keep class com.perkedel.htlauncher.enumerations.PageViewStyle { *; }
27+
-keep class com.perkedel.htlauncher.enumerations.PageGridType { *; }
28+
-keep class com.perkedel.htlauncher.enumerations.ShowWhichIcon { *; }
29+
-keep class com.perkedel.htlauncher.enumerations.ThirdButtonPosition { *; }
30+
-keep class com.perkedel.htlauncher.enumerations.Screen { *; }
31+
-keep class com.perkedel.htlauncher.enumerations.ItemDetailPaneNavigate { *; }
32+
-keep class com.perkedel.htlauncher.enumerations.ItemExtraPaneNavigate { *; }
33+
-keep class com.perkedel.htlauncher.enumerations.InternalCategories { *; }
34+
-keep class com.perkedel.htlauncher.enumerations.EditWhich { *; }
35+
-keep class com.perkedel.htlauncher.enumerations.ConfigSelected { *; }
36+
-keep class com.perkedel.htlauncher.enumerations.ButtonTypes { *; }
37+
-keep class com.perkedel.htlauncher.enumerations.ActionGoToSystemSetting { *; }
38+
-keep class com.perkedel.htlauncher.enumerations.ActionDataLaunchType { *; }
39+
-keeppackagenames com.perkedel.htlauncher.enumerations

app/src/main/java/com/perkedel/htlauncher/HTViewModel.kt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ class HTViewModel(
187187
// systemUiController.isStatusBarVisible = false
188188

189189
// You must Folders!!
190-
val homeSafData:HomepagesWeHave = HTLauncherHardcodes.HOMESCREEN_FILE
190+
var homeSafData:HomepagesWeHave = HTLauncherHardcodes.HOMESCREEN_FILE
191191
var homeSafFileUri:Uri = Uri.EMPTY
192192
if(!initing) {
193193

@@ -228,6 +228,7 @@ class HTViewModel(
228228

229229

230230
} else {
231+
homeSafData = HTLauncherHardcodes.HOMESCREEN_FILE_DUMMY
231232
Log.d("InitFileLoader", "Save Dir Not Selected")
232233
}
233234

@@ -362,6 +363,7 @@ class HTViewModel(
362363

363364
val predeterminedPage: PageData = when(i){
364365
context.resources.getString(R.string.home_screen_page_file) -> HTLauncherHardcodes.HOMEPAGE_FILE
366+
context.resources.getString(R.string.dummy_page_file) -> HTLauncherHardcodes.HOMEPAGE_FILE_DUMMY
365367
"Settings" -> HTLauncherHardcodes.SETTINGS_PAGE_FILE
366368
else -> PageData(
367369
name = i,
@@ -419,7 +421,8 @@ class HTViewModel(
419421
j == ActionInternalCommand.SystemSettings.name ||
420422
j == ActionInternalCommand.Preferences.name ||
421423
j == InternalCategories.SettingsSystem.name ||
422-
j == InternalCategories.SettingsOverall.name
424+
j == InternalCategories.SettingsOverall.name ||
425+
j == ActionInternalCommand.GetStarted.name
423426
// Log.d("ItemLoader","Item is internal command $j")
424427
// val itemIsCategory:Boolean =
425428
// j == InternalCategories.SettingsSystem.name ||
@@ -483,6 +486,13 @@ class HTViewModel(
483486
setIsReady(into = true)
484487
initing = true
485488
updateIniting(initing)
489+
} else {
490+
// add dummy
491+
uiStating.pageList["Dummy"] = HTLauncherHardcodes.HOMEPAGE_FILE_DUMMY
492+
uiStating.itemList["GetStarted"] = HTLauncherHardcodes.GET_STARTED_FILE
493+
// setIsReady(into = true)
494+
// initing = true
495+
// updateIniting(initing)
486496
}
487497

488498
} else {
@@ -759,10 +769,12 @@ class HTViewModel(
759769
of == context.resources.getString(ActionInternalCommand.Preferences.id) ||
760770
of == context.resources.getString(InternalCategories.SettingsSystem.id) ||
761771
of == context.resources.getString(InternalCategories.SettingsOverall.id) ||
762-
of.startsWith("Settings")
772+
of.startsWith("Settings") ||
773+
of == context.resources.getString(ActionInternalCommand.GetStarted.id)
763774
// val itemIsCategory:Boolean =
764775
// of == context.resources.getString(InternalCategories.SettingsSystem.id) ||
765776
// of == context.resources.getString(InternalCategories.SettingsOverall.id)
777+
val itemIsCategory:Boolean = of.startsWith("Category")
766778
// if(itemIsInternalCommand) Log.d("GetItemData","Internal Command ${of}")
767779
// if(itemIsCategory) Log.d("GetItemData","Internal Category ${of}")
768780
// Log.d("GetItemData","Item $of requested")
@@ -789,6 +801,7 @@ class HTViewModel(
789801
type = ActionDataLaunchType.Internal,
790802
)
791803
),
804+
isCategory = itemIsCategory
792805
)
793806
// "AllApps" -> HTLauncherHardcodes.ALLAPPS_FILE
794807
// "Telephone" -> HTLauncherHardcodes.TELEPHONE_FILE

app/src/main/java/com/perkedel/htlauncher/Navigation.kt

Lines changed: 58 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ fun Navigation(
253253
// )
254254
val currentScreen:String = backStackEntry?.destination?.route ?: Screen.HomeScreen.name
255255
var hideTopBar: MutableState<Boolean> = rememberSaveable { mutableStateOf(false) }
256+
var selectedSaveDirMan:MutableState<Uri> = rememberSaveable { mutableStateOf(Uri.parse("")) }
256257
val htuiState : HTUIState by anViewModel.uiState.collectAsState()
258+
// val htuiState : HTUIState = rememberSaveable { mutableStateOf(anViewModel.uiState.collectAsState()) }
257259
// val context: Context = LocalContext.current
258260

259261
// https://www.tutorialspoint.com/how-to-get-the-build-version-number-of-an-android-application
@@ -311,6 +313,11 @@ fun Navigation(
311313
} catch (e:IOException){
312314
e.printStackTrace()
313315
}
316+
}
317+
LaunchedEffect(
318+
selectedSaveDirMan.value
319+
) {
320+
314321
}
315322
LaunchedEffect(
316323
key1 = hideTopBar.value
@@ -361,6 +368,7 @@ fun Navigation(
361368
Intent.FLAG_GRANT_WRITE_URI_PERMISSION
362369
val saveDirResolver = context.contentResolver
363370
val saveDirLauncher = rememberLauncherForActivityResult(ActivityResultContracts.OpenDocumentTree()) { dirUri ->
371+
Log.d("SaveDirLauncher","Select Save Dir ${dirUri}")
364372
if (dirUri != null){
365373
println("Selected Save Dir `${dirUri}`")
366374
// saveDirResult.value = dirUri
@@ -377,74 +385,73 @@ fun Navigation(
377385
val saveDir = stringPreferencesKey("saveDir")
378386
dataStore[saveDir] = dirUri.toString()
379387
}
380-
}
388+
anViewModel.preloadFiles(context,saveDirResolver,htuiState, listOfFolder = listOfFolder, folders = folders, json = json, force = true)
381389

382-
println("About to launch a test!")
383-
coroutineScope.launch {
390+
println("About to launch a test!")
384391
println("Let's try test.json!")
385392
println("Parse URI! ${Uri.parse(totalUriTest)}")
386393
println("Oh yeah!")
387-
try {
388-
// https://stackoverflow.com/a/24869904/9079640
389-
// Java.nio is only available since API 26. Min was 21, crash!
394+
val doTest:Boolean = false
395+
if(doTest){
396+
try {
397+
// https://stackoverflow.com/a/24869904/9079640
398+
// Java.nio is only available since API 26. Min was 21, crash!
390399

391400
// val tempFile = kotlin.io.path.createTempFile()
392401
// println(runCatching {
393402
// val urei = DocumentFile.fromTreeUri(context,Uri.parse("${htuiState.selectedSaveDir}")!!)!!.findFile("test.json")!!.uri
394403
// val compatPath =
395-
var urei:Uri
404+
var urei:Uri
396405
// if(Build.VERSION.SDK_INT >= 26) {
397-
urei = getATextFile(
398-
dirUri = dirUri,
399-
context = context,
400-
fileName = "test.json",
401-
initData = json.encodeToString<TestJsonData>(TestJsonData(
402-
test = "This is a file"
403-
)),
404-
hardOverwrite = true,
405-
)
406-
println("Urei! ${urei}")
407-
jsonTestRaw.value = openATextFile(
406+
urei = getATextFile(
407+
dirUri = dirUri,
408+
context = context,
409+
fileName = "test.json",
410+
initData = json.encodeToString<TestJsonData>(TestJsonData(
411+
test = "This is a file"
412+
)),
413+
hardOverwrite = true,
414+
)
415+
println("Urei! ${urei}")
416+
jsonTestRaw.value = openATextFile(
408417
// Uri.withAppendedPath(htuiState.selectedSaveDir, "test.json"),
409418
// htuiState.selectedSaveDir!!.path,
410419
// fromTreeUri(context, Uri.withAppendedPath(htuiState.selectedSaveDir, "test.json"))!!.uri,
411420
// Uri.parse(totalUriTest), // FUCK YOU WHY CAN'T YOU GIVE ME FUCKING EXAMPLE!??!?!
412-
uri = urei, // FRUCKING FRNALLY!!! THANK YOU MPV KT
413-
contentResolver = saveDirResolver,
414-
newLine = true,
415-
)
416-
// https://stackoverflow.com/a/75573771/9079640
417-
// https://stackoverflow.com/questions/77073202/getting-unexpected-json-token-at-offset-0-with-kotlin-serialization
421+
uri = urei, // FRUCKING FRNALLY!!! THANK YOU MPV KT
422+
contentResolver = saveDirResolver,
423+
newLine = true,
424+
)
425+
// https://stackoverflow.com/a/75573771/9079640
426+
// https://stackoverflow.com/questions/77073202/getting-unexpected-json-token-at-offset-0-with-kotlin-serialization
418427
// Gson().fromJson(jsonTestRaw.value, TypeToken<TestJsonData>(){}.type)
419428
// println("JSON Test:\n${jsonTestRaw.value}")
420429
// println("Find Parser!\n\n${Json.parseToJsonElement(jsonTestRaw.value)}")
421-
println("JSON ABRUR \n${jsonTestRaw.value}")
422-
anViewModel.changeTestResult(jsonTestRaw.value)
430+
println("JSON ABRUR \n${jsonTestRaw.value}")
431+
anViewModel.changeTestResult(jsonTestRaw.value)
423432
// })
424433
// }
425-
} catch (e:Exception){
426-
println("WERROR EXCEPTION")
427-
e.printStackTrace()
428-
} catch (e:IOException){
429-
println("WERROR IOEXCEPTION")
430-
e.printStackTrace()
431-
}
434+
} catch (e:Exception){
435+
println("WERROR EXCEPTION")
436+
e.printStackTrace()
437+
} catch (e:IOException){
438+
println("WERROR IOEXCEPTION")
439+
e.printStackTrace()
440+
}
432441

433-
println("Okay Parser Found, let's interpret!")
434-
try{
442+
println("Okay Parser Found, let's interpret!")
443+
try{
435444
// anViewModel.injectTestJsonResult(Json.parseToJsonElement(jsonTestRaw.value))
436-
anViewModel.injectTestJsonResult(json.decodeFromString<TestJsonData>(jsonTestRaw.value))
445+
anViewModel.injectTestJsonResult(json.decodeFromString<TestJsonData>(jsonTestRaw.value))
437446

438-
println("READ THE INJECT JSON ${htuiState.testJsonElement}")
447+
println("READ THE INJECT JSON ${htuiState.testJsonElement}")
439448
// println("& TEST VALUE IS `${htuiState.testJsonElement.jsonObject.getValue("test")}`")
440-
} catch (e:Exception){
441-
println("WERROR EXCEPTION JSON")
442-
e.printStackTrace()
449+
} catch (e:Exception){
450+
println("WERROR EXCEPTION JSON")
451+
e.printStackTrace()
452+
}
443453
}
444454
}
445-
coroutineScope.launch {
446-
anViewModel.preloadFiles(context,saveDirResolver,htuiState, listOfFolder = listOfFolder, folders = folders, json = json, force = true)
447-
}
448455
} else {
449456
println("No Save Dir Selected")
450457
}
@@ -950,6 +957,11 @@ fun Navigation(
950957
}
951958
)
952959
}
960+
composable(
961+
route = Screen.GetStarted.name
962+
) {
963+
Text("Get Started")
964+
}
953965
composable(route = Screen.AllAppsScreen.name,
954966
enterTransition = {
955967
slideIntoContainer(
@@ -1976,6 +1988,9 @@ fun onLaunchAction(
19761988
message = readout,
19771989
)
19781990
}
1991+
containAction == context.resources.getString(ActionInternalCommand.GetStarted.id) -> {
1992+
navController.navigate(Screen.GetStarted.name)
1993+
}
19791994
else -> {}
19801995
}
19811996
} catch (e:Exception){

app/src/main/java/com/perkedel/htlauncher/constanta/HTLauncherHardcodes.kt

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ object HTLauncherHardcodes {
2323

2424
val HOMESCREEN_FILE:HomepagesWeHave = HomepagesWeHave(
2525

26+
)
27+
val HOMESCREEN_FILE_DUMMY:HomepagesWeHave = HomepagesWeHave(
28+
pagesPath = listOf(
29+
"Dummy",
30+
)
2631
)
2732
val HOMEPAGE_FILE:PageData = PageData(
2833
name = "Home",
@@ -38,6 +43,25 @@ object HTLauncherHardcodes {
3843
"Settings",
3944
"AllApps"
4045
)
46+
)
47+
val HOMEPAGE_FILE_DUMMY:PageData = PageData(
48+
name = "Dummy",
49+
isHome = true,
50+
items = listOf(
51+
"GetStarted",
52+
"Telephone",
53+
"Contacts",
54+
"Messages",
55+
"Camera",
56+
"Gallery",
57+
"Clock",
58+
"SOS",
59+
"Settings",
60+
"AllApps"
61+
)
62+
)
63+
val POC_APPS_PAGE:PageData = PageData(
64+
4165
)
4266
val ORGANIZER_PAGE_FILE:PageData = PageData(
4367
name = "Organizer",
@@ -120,7 +144,18 @@ object HTLauncherHardcodes {
120144
)
121145
)
122146
)
123-
147+
val GET_STARTED_FILE:ItemData = ItemData(
148+
name = "GetStarted",
149+
label = "GetStarted",
150+
aria = "GetStarted",
151+
action = listOf(
152+
ActionData(
153+
name = "GetStarted",
154+
action = "GetStarted",
155+
type = ActionDataLaunchType.Internal,
156+
)
157+
)
158+
)
124159

125160
val ALARM_APP_IMPLEMENTATIONS:Map<String,SearchableApps> = mapOf(
126161
// https://stackoverflow.com/a/4281243/9079640

app/src/main/java/com/perkedel/htlauncher/enumerations/ActionInternalCommand.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,5 @@ enum class ActionInternalCommand(@StringRes val id:Int = 0, @StringRes val label
3838
Aria(id = R.string.internal_commands_aria, label = R.string.internal_commands_aria_label, image = R.drawable.aria, icon = Icons.Default.Accessibility), // Read aloud label or aria field on click
3939
GoToPage(id = R.string.internal_commands_GoToPage, label = R.string.internal_commands_GoToPage_label, image = R.drawable.go_to_page, icon = Icons.Default.Pages), // Go to page which in this homescreen
4040
OpenAPage(id = R.string.internal_commands_OpenAPage, label = R.string.internal_commands_OpenAPage_label, image = R.drawable.open_a_page, icon = Icons.AutoMirrored.Default.MenuOpen), // Open a launcher page in a dialog
41+
GetStarted(id = R.string.internal_commands_get_started, label = R.string.internal_commands_get_started_label, image = R.drawable.get_started, icon = Icons.AutoMirrored.Default.MenuOpen), // OOBE setup
4142
}

app/src/main/java/com/perkedel/htlauncher/enumerations/PageViewStyle.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package com.perkedel.htlauncher.enumerations
33
import androidx.annotation.StringRes
44
import com.perkedel.htlauncher.R
55

6-
enum class PageViewStyle(val type:Int = 0, @StringRes val label:Int = 0) {
6+
enum class PageViewStyle(val type:Int = 0, @StringRes val label:Int = R.string.editor_page_view_style_default) {
77
Default(type = 0, label = R.string.editor_page_view_style_default),
88
Grid(type = 1, label = R.string.editor_page_view_style_grid),
99
Column(type = 2, label = R.string.editor_page_view_style_column), // a.k.a. vertical list

app/src/main/java/com/perkedel/htlauncher/enumerations/Screen.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,5 @@ enum class Screen (@StringRes val title: Int){
2828
LevelEditor(title = R.string.editor_screen),
2929
ItemsExplorer(title = R.string.items_explorer_screen),
3030
OpenAPage(title = R.string.open_page_screen),
31+
GetStarted(title = R.string.get_started_screen),
3132
}

app/src/main/java/com/perkedel/htlauncher/ui/page/BasePage.kt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,16 @@ fun BasePage(
225225
}
226226
// Rest of the items
227227
repeat(times = pageOfIt.items.size){
228+
// val isCategory = uiState.itemList[pageOfIt.items[it]]?.isCategory ?: false
229+
val isCategory = viewModel.getItemData(
230+
pageOfIt.items[it],
231+
context = context,
232+
ignoreFile = false,
233+
forceReload = false
234+
).isCategory
228235
item(
229236
// span = if(uiState.itemList[pageOfIt.items[it]]?.isCategory == true) {GridItemSpan(this.maxLineSpan)} else null
230-
span = { if(uiState.itemList[pageOfIt.items[it]]?.isCategory == true) GridItemSpan(this.maxLineSpan) else GridItemSpan(1) }
237+
span = { if(isCategory) GridItemSpan(this.maxLineSpan) else GridItemSpan(1) }
231238
){
232239
ItemCell(
233240
readTheItemData = viewModel.getItemData(

0 commit comments

Comments
 (0)