Skip to content

Commit

Permalink
android app: copy assets folder when being in the application, not wi…
Browse files Browse the repository at this point in the history
…dget

so it won't reinstall all of the time

Also make textSizeSp size accurate because of bigger ascii arts
  • Loading branch information
Toni500github committed Dec 15, 2024
1 parent 80e92c5 commit fba3277
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import androidx.preference.PreferenceFragmentCompat
import java.io.File
import java.io.FileOutputStream
import java.io.IOException
import java.nio.file.Files
import kotlin.io.path.Path


class SettingsActivity : AppCompatActivity() {
Expand Down Expand Up @@ -48,6 +50,9 @@ class SettingsActivity : AppCompatActivity() {
alert.show()
}
}

if (!Files.exists(Path(filesDir.absolutePath + "ascii")))
copyToAssetFolder(assets, filesDir.absolutePath, "ascii")
}

class SettingsFragment : PreferenceFragmentCompat() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal fun updateAppWidget(
) {
// create a TextPaint to be used to measure text size
val textPaint = TextPaint()
val textSizeSp = 14f
val textSizeSp = 8f
val textSizePx = textSizeSp * context.resources.displayMetrics.scaledDensity
textPaint.textSize = textSizePx

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ import android.widget.CheckBox
import android.widget.EditText
import android.widget.TextView
import androidx.core.text.HtmlCompat
import org.toni.customfetch_android.copyToAssetFolder
import org.toni.customfetch_android.databinding.CustomfetchConfigureBinding
import java.nio.file.Files
import kotlin.io.path.Path

// truncate text
var disableLineWrap = false
Expand Down Expand Up @@ -61,9 +58,6 @@ class customfetchConfigureActivity : Activity() {
binding = CustomfetchConfigureBinding.inflate(layoutInflater)
setContentView(binding.root)

if (!Files.exists(Path(filesDir.absolutePath + "ascii")))
copyToAssetFolder(assets, filesDir.absolutePath, "ascii")

argumentsConfig = binding.argumentsConfigure
additionalTruncateWidth = binding.additionalTruncateN
argsHelp = binding.argsHelp
Expand Down

0 comments on commit fba3277

Please sign in to comment.