All Downloads are FREE. Search and download functionalities are using the official Maven repository.

haerzig.core.CopyrightNotice.kt Maven / Gradle / Ivy

package haerzig.core

import android.content.Context
import android.util.Log
import java.io.BufferedReader
import java.io.IOException
import java.io.InputStreamReader
import java.lang.StringBuilder

class CopyrightNotice(val title: String, val url: String, val year: String, val owner: String, val licenseFileName: String) {
    fun getText(context: Context): String {
        val b = StringBuilder()
        try {
            if (b.isNotEmpty()) {
                b.append("



") } context.assets.open(licenseFileName).use { input -> val r = BufferedReader(InputStreamReader(input)) val total = StringBuilder() var line: String? while (r.readLine().also { line = it } != null) { total.append(line).append('\n') } var text = total.toString() text = text.replace("", String.format("Copyright © %s %s", year, owner)) b.append(text) } } catch (e: IOException) { Log.w(TAG, e) } return b.toString() } companion object { private val TAG = CopyrightNotice::class.java.simpleName } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy