mikepenz / AboutLibraries

AboutLibraries automatically collects all dependencies and licenses of any gradle project (Kotlin MultiPlatform), and provides easy to integrate UI components for Android and Compose-jb environments
http://mikepenz.github.io/AboutLibraries/
Apache License 2.0
3.67k stars 423 forks source link

Black activity and show only app bar #935

Closed maxrave-dev closed 1 year ago

maxrave-dev commented 1 year ago

About this issue

Checklist

mikepenz commented 1 year ago

When you open the activity, can you verify the libs you load contain information?

maxrave-dev commented 1 year ago

image This is aboutliraries.json but when load is only {"metadata":{"generated":"2023-11-05T15:48:30.735Z"},"libraries":[] }

mikepenz commented 1 year ago

So it seems something is wrong with the loading logic maybe? (either wrong file loaded or so 🤔 )

The json string you get? is it the one you attached above?

maxrave-dev commented 1 year ago

I fixed by using this code

val inputStream = requireContext().resources.openRawResource(R.raw.aboutlibraries)
            val scanner = Scanner(inputStream).useDelimiter("\\A")
            val stringBuilder = StringBuilder()
            while (scanner.hasNextLine()) {
                stringBuilder.append(scanner.nextLine())
            }
            Log.w("AboutLibraries", stringBuilder.toString())
            val localLib = Libs.Builder().withJson(stringBuilder.toString()).build()
                val intent = LibsBuilder()
                    .withLicenseShown(true)
                    .withVersionShown(true)
                    .withActivityTitle(getString(R.string.third_party_libraries))
                    .withSearchEnabled(true)
                    .withEdgeToEdge(true)
                    .withLibs(
                        localLib
                    )
                    .intent(requireContext())
                startActivity(intent)
        }