Skip to content

Commit 10d3319

Browse files
committed
Cleanup
1 parent 2efad93 commit 10d3319

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

app/src/main/java/de/linux13524/ytldl/MainActivity.kt

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,35 @@ class MainActivity : FragmentActivity() {
2525
super.onCreate(savedInstanceState)
2626
setContentView(R.layout.activity_main)
2727

28+
initPermissions()
29+
initNavigation()
30+
initDownloadOptions()
31+
initFilesystem()
32+
33+
LogReader(::updateLog).run()
34+
}
35+
36+
private fun initNavigation(){
2837
val navController = findNavController(R.id.nav_host_fragment)
2938
val appBarConfiguration = AppBarConfiguration(navController.graph, drawer_layout)
3039

3140
toolbar.setupWithNavController(navController, appBarConfiguration)
3241
nav_view.setupWithNavController(navController)
42+
}
3343

34-
Filesystem.Settings.setDbPath("/data/data/de.linux13524.ytldl/databases/")
35-
Filesystem.Settings.setVideoPath(sdCardDir)
44+
private fun initDownloadOptions(){
45+
syncPreferencesWithGlobalDownloadOptions()
46+
// TODO: Add to settings fragment/preferences
47+
GlobalDownloadOptions.setSaveVideoName(true)
48+
GlobalDownloadOptions.setPath(sdCardDir)
49+
}
3650

37-
PermissionManager.checkPermissions(this)
51+
private fun initFilesystem(){
52+
FilesystemSettings.setDbPath("/data/data/de.linux13524.ytldl/databases/")
53+
}
3854

39-
LogReader(::updateLog).run()
55+
private fun initPermissions(){
56+
PermissionManager.checkPermissions(this)
4057
}
4158

4259
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {

0 commit comments

Comments
 (0)