Skip to content

Commit

Permalink
0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
luihum committed Dec 8, 2021
1 parent d11895c commit 10e8803
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 29 deletions.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
android:roundIcon="@drawable/ic_launcher"
android:supportsRtl="true"
android:theme="@style/Theme.ProgressArchiver95">
<provider
<!-- <provider
android:name="com.luihum.progressarchiver95.ArchiveProvider"
android:authorities="com.luihum.progressarchiver95.ArchiveProvider.pb95archive"
android:permission="android.permission.MANAGE_DOCUMENTS"
Expand All @@ -24,7 +24,7 @@
<intent-filter>
<action android:name="android.content.action.DOCUMENTS_PROVIDER"/>
</intent-filter>
</provider>
</provider>-->
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/com/luihum/progressarchiver95/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ package com.luihum.progressarchiver95

import java.io.File
val ARCHIVE_BASE_DIR = File("/data/data/com.luihum.progressarchiver95/files/archive/")

class Constants
38 changes: 36 additions & 2 deletions app/src/main/java/com/luihum/progressarchiver95/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,27 @@ class MainActivity : AppCompatActivity() {
context = this
context.packageManager.also { pm = it }
binding = ActivityMainBinding.inflate(layoutInflater)
val archiveDir = File(filesDir, "archive")
val archiveDir = File(getExternalFilesDir(null)/*filesDir*/, "archive")
val statusLabel = binding.statusText
val versionLabel = binding.versionLabel
val archiveButton = binding.archiveButton
val abiList = binding.foundAbiList
val dpiList = binding.foundDpiList
val langList = binding.foundLangList
val apkInfo: ApplicationInfo
val apkInfoB: PackageInfo
val apkPath: String
val apkPathHandle: File
val apkVer: String
var copyBase = binding.copybase.isChecked
var copyDpis = binding.copydpis.isChecked
var copyLang = binding.copylang.isChecked
archiveDir.mkdir()
setContentView(binding.root)
setSupportActionBar(binding.toolbar)
binding.copydpis.setOnClickListener { copyDpis = binding.copydpis.isChecked }
binding.copybase.setOnClickListener { copyBase = binding.copybase.isChecked }
binding.copylang.setOnClickListener { copyLang = binding.copylang.isChecked }
try {
apkInfo = pm.getApplicationInfo("com.spookyhousestudios.progressbar95", 0)
apkInfoB = pm.getPackageInfo("com.spookyhousestudios.progressbar95", 0)
Expand Down Expand Up @@ -89,6 +92,15 @@ class MainActivity : AppCompatActivity() {
})
dpiList.text = dpiList.text.toString() + dpiFound
}
if (!
apkName.endsWith("armeabi_v7a") &&!
apkName.endsWith("arm64_v8a") &&!
apkName.endsWith("x86") &&!
apkName.endsWith("x86_64") &&!
apkName.endsWith("dpi") &&
apkName != "base"
) langList.text = langList.text.toString() + apkName + "\n"

}

archiveButton.setOnClickListener {
Expand All @@ -102,12 +114,21 @@ class MainActivity : AppCompatActivity() {
}
val dpis = apks.filter { f: File -> f.nameWithoutExtension.endsWith("dpi")}
val base = apks.filter { f: File -> f.name.equals("base.apk") }
val langs = apks.filter { f: File ->
!f.nameWithoutExtension.endsWith("armeabi_v7a") &&!
f.nameWithoutExtension.endsWith("arm64_v8a") &&!
f.nameWithoutExtension.endsWith("x86") &&!
f.nameWithoutExtension.endsWith("x86_64") &&!
f.nameWithoutExtension.endsWith("dpi") &&
f.nameWithoutExtension != "base"
}
Log.d("ProgressArchiver95", "ABIs: $abis")
Log.d("ProgressArchiver95", "DPIs: $dpis")
Log.d("ProgressArchiver95", "Base: $base")
var chosenApks: Sequence<File> = abis
if (copyDpis) chosenApks += dpis
if (copyBase) chosenApks += base
if (copyLang) chosenApks += langs
chosenApks.forEach { a ->
Log.d("ProgressArchiver95", "Found APK: " + a.absolutePath.toString())
val archiveVerDir = File(archiveDir, apkVer)
Expand Down Expand Up @@ -149,7 +170,20 @@ class MainActivity : AppCompatActivity() {
}
private fun oldArchive(context: Context): Boolean {
Toast.makeText(context,getString(R.string.old_archive_mode_started),Toast.LENGTH_SHORT).show()

val archiveDir = File(getExternalFilesDir(null), "archive")
val apkInfo: ApplicationInfo = pm.getApplicationInfo("com.spookyhousestudios.progressbar95", 0)
val apkInfoB: PackageInfo = pm.getPackageInfo("com.spookyhousestudios.progressbar95", 0)
val apkPath: String = apkInfo.publicSourceDir.removeSuffix("base.apk")
val apkVer: String = apkInfoB.versionName
val apkPathHandle = File(apkPath,"")
val base = apkPathHandle.walk().maxDepth(1).filter { f: File -> f.name == "base.apk"}.first()
val archiveVerDir = File(archiveDir, apkVer)
archiveVerDir.mkdir()
val target = File(archiveVerDir, base.name)
target.createNewFile()
base.copyTo(target, true)
Log.d("ProgressArchiver95", "Archived ${base.name} successfully")
Toast.makeText(context, "Archived $apkVer successfully", Toast.LENGTH_SHORT).show()
return true
}

Expand Down
68 changes: 50 additions & 18 deletions app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.19" />
app:layout_constraintVertical_bias="0.198" />

<Button
android:id="@+id/archive_button"
Expand All @@ -32,7 +33,8 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/status_text" />
app:layout_constraintTop_toBottomOf="@+id/status_text"
app:layout_constraintVertical_bias="0.49" />

<Switch
android:id="@+id/copybase"
Expand All @@ -41,55 +43,85 @@
android:text="@string/copy_base"
app:layout_constraintBottom_toTopOf="@+id/copydpis"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.505"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/status_text" />
app:layout_constraintTop_toBottomOf="@+id/status_text"
app:layout_constraintVertical_bias="0.41000003"
app:layout_constraintVertical_chainStyle="packed" />

<Switch
android:id="@+id/copylang"
android:layout_width="312dp"
android:layout_height="50dp"
android:text="@string/copy_lang"
app:layout_constraintBottom_toTopOf="@+id/archive_button"
app:layout_constraintEnd_toEndOf="@+id/copydpis"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/copydpis"
app:layout_constraintTop_toBottomOf="@+id/copydpis" />

<Switch
android:id="@+id/copydpis"
android:layout_width="312dp"
android:layout_height="50dp"
android:text="@string/copy_dpis"
app:layout_constraintBottom_toTopOf="@+id/archive_button"
app:layout_constraintBottom_toTopOf="@+id/copylang"
app:layout_constraintEnd_toEndOf="@+id/copybase"
app:layout_constraintHorizontal_bias="0.494"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="@+id/copybase"
app:layout_constraintTop_toBottomOf="@+id/status_text" />
app:layout_constraintTop_toBottomOf="@+id/copybase" />

<TextView
android:id="@+id/version_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:textSize="20sp"
app:layout_constraintBottom_toTopOf="@+id/archive_button"
app:layout_constraintEnd_toEndOf="@+id/copydpis"
app:layout_constraintStart_toStartOf="@+id/copydpis" />
app:layout_constraintBottom_toTopOf="@+id/foundLangList"
app:layout_constraintEnd_toEndOf="@+id/copylang"
app:layout_constraintHorizontal_bias="0.496"
app:layout_constraintStart_toStartOf="@+id/copylang"
app:layout_constraintTop_toBottomOf="@+id/archive_button"
app:layout_constraintVertical_bias="0.52" />

<TextView
android:id="@+id/foundAbiList"
android:id="@+id/foundLangList"
android:layout_width="94dp"
android:layout_height="157dp"
android:text="@string/langs_found"
android:textSize="17sp"
app:layout_constraintBottom_toBottomOf="@+id/foundDpiList"
app:layout_constraintEnd_toStartOf="@+id/foundDpiList"
app:layout_constraintHorizontal_bias="0.488"
app:layout_constraintStart_toEndOf="@+id/foundAbiList"
app:layout_constraintTop_toTopOf="@+id/foundDpiList"
app:layout_constraintVertical_bias="0.083" />

<TextView
android:id="@+id/foundAbiList"
android:layout_width="94dp"
android:layout_height="130dp"
android:text="@string/abis_found"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintBottom_toBottomOf="@+id/foundDpiList"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.102"
app:layout_constraintHorizontal_bias="0.141"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/archive_button"
app:layout_constraintVertical_bias="0.614" />
app:layout_constraintTop_toTopOf="@+id/foundDpiList"
app:layout_constraintVertical_bias="0.648" />

<TextView
android:id="@+id/foundDpiList"
android:layout_width="94dp"
android:layout_height="157dp"
android:layout_height="130dp"
android:text="@string/dpis_found"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.743"
app:layout_constraintHorizontal_bias="0.781"
app:layout_constraintStart_toEndOf="@+id/foundAbiList"
app:layout_constraintTop_toBottomOf="@+id/archive_button"
app:layout_constraintVertical_bias="0.616" />
app:layout_constraintVertical_bias="0.685" />

</androidx.constraintlayout.widget.ConstraintLayout>

<com.google.android.material.appbar.AppBarLayout
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
<string name="copy_base">Salin base.apk</string>
<string name="pb95_not_found">Progressbar95 tidak ditemukan...</string>
<string name="copy_lang">Salin bahasa</string>
<string name="langs_found">Bahasa:</string>
<string name="langs_found">Bahasa:\n</string>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
<string name="about">Sobre</string>
<string name="unknown">Desconhecido</string>
<string name="about_content">ProgressArchiver95 v0.4.0\n\nCréditos:\n Criador Original: Luihum#1287\n Logo: SamCool939\n Teste: Lol Guy (Android 10)\n Agradecimentos Especiais: Christian230102\n Tradutores:\n Português (Brasil) - Luihum\n \nComo usar:\nSimplesmente selecione os APKs que você quer arquivar e clique no botão Arquivar.\nUma lista de ABIs e DPIs encontradas em seu dispositivo está disponível.\nSuas versões arquivadas são armazenadas internamente e disponíveis pela interface SAF, tudo que usa o SAF suporta ProgressArchiver95.\nSAF (Storage Access Framework) é usado in muitos apps para selecionar arquivos, como Discord, Chrome, Termux, Firefox, e o aplicativo Arquivos.\nSe você não encontra, os apps são depuráveis, então você pode usar ADB para extrair os arquivos do armazenamento interno. Contate-me (Luihum#1287) para instruções nisso.\nO modo de arquivação antigo (tradução incompleta)</string>
<string name="copy_lang">Copiar idiomas</string>
<string name="langs_found">Idiomas:</string>
<string name="copy_lang">Idiomas:\n</string>
<string name="langs_found">Idiomas:\n</string>
</resources>
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
<string name="old_archive_mode_started">Old archive mode started</string>
<string name="unknown">Unknown</string>
<string name="about">About</string>
<string name="about_content">ProgressArchiver95 v0.4.0\n\nCredits:\n Original Creator: Luihum#1287\n Logo: SamCool939\n Testing: Lol Guy (Android 10)\n Special Thanks: Christian230102\n Translators:\n Portuguese (Brazil) - Luihum\n \nHow to use:\nSimply select the APKs you want to archive and click the Archive button.\nA list of ABIs and DPIs that were found on your device is available.\nYour archived versions are stored internally and made available through the standard SAF interface, so anything that uses SAF will support ProgressArchiver95.\nSAF (Storage Access Framework) is used in many apps to select files, such as Discord, Chrome, Termux, Firefox, and the built-in Files app.\nIf you don\'t see it, the apps are debuggable, so you can use ADB to extract the files from internal storage. Contact me (Luihum#1287) for instructions on this. \nOld archive mode only extracts the base.apk, ignoring ABIs. This is intended for versions before 0.50 before the split APK scheme.\n\nWhat are split APKs?\nRecently, Google has changed the way Android apps are distributed and installed. Previously, everything: the code, assets, DPI-optimized assets, the low-level instructions for the CPU, translations, etc. were all in one file, called the \"fat APK\". \nBut as the name suggests, fat APKs are pretty large, with lots of code and assets that weren\'t used for the specific device. This proved problematic with the size increase of apps, particularly games, which were already big, plus the unused data.\nTo fix this problem, Google developed the split APK system: the developer sends a bundle with every APK to the Play Store, and the Play Store client downloads that and unpacks only the needed files. The rest is discarded.\nNow, every app is split into various APKs:\n- base.apk, containing the shared code, assets, data and everything; the biggest file of the three parts, for Progressbar95 easily more than 90MB;\n- the ABIs: split_config.armeabi_v7a.apk, split_config.arm64_v8a.apk, split_config.x86_64.apk and split_config.x86.apk. These contain the low-level code for the CPU. Respectively, ARMv7 (on most older phones), ARMv8 (on newer phones, 64-bit), x86_64 (mostly on computers) and x86 (32-bit, on older CPUs). Progressbar95 doesn\'t support x86, but just in case ProgressArchiver95 supports it. Some phones may have multiple ABIs.\n- the DPIs: ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi, nodpi and tvdpi. These contain optimized assets for the various screen resolutions. Unlike ABIs, they\'re not strictly required, but the game looks nicer on some screens with the correct DPI file.\n- Last and least, the language APKs. There\'s many of them: en, pt, it, es, ch, jp, ru... The purpose of those is unknown.\nThe game won\\\'t install if the required ABI is missing, or if the base.apk is missing. Due to the way ABIs work, some versions of the game may not work on all devices.\nThis broke traditional APK extraction apps, which were designed with fat APKs in mind. So I made ProgressArchiver95, a tool specifically made to archive Progressbar95 easily.\n\n</string>
<string name="about_content">ProgressArchiver95 v0.5.0\n\nCredits:\n Original Creator: Luihum#1287\n Logo: SamCool939\n Testing: Lol Guy (Android 10)\n Special Thanks: Christian230102\n Translators:\n Portuguese (Brazil) - Luihum\n Indonesian - SamCool939\n \nHow to use:\nSimply select the APKs you want to archive and click the Archive button.\nA list of ABIs and DPIs that were found on your device is available.\nYour archived versions are stored internally and made available through the standard SAF interface, so anything that uses SAF will support ProgressArchiver95.\nSAF (Storage Access Framework) is used in many apps to select files, such as Discord, Chrome, Termux, Firefox, and the built-in Files app.\nIf you don\'t see it, the apps are debuggable, so you can use ADB to extract the files from internal storage. Contact me (Luihum#1287) for instructions on this. \nOld archive mode only extracts the base.apk, ignoring ABIs. This is intended for versions before 0.50 before the split APK scheme.\n\nWhat are split APKs?\nRecently, Google has changed the way Android apps are distributed and installed. Previously, everything: the code, assets, DPI-optimized assets, the low-level instructions for the CPU, translations, etc. were all in one file, called the \"fat APK\". \nBut as the name suggests, fat APKs are pretty large, with lots of code and assets that weren\'t used for the specific device. This proved problematic with the size increase of apps, particularly games, which were already big, plus the unused data.\nTo fix this problem, Google developed the split APK system: the developer sends a bundle with every APK to the Play Store, and the Play Store client downloads that and unpacks only the needed files. The rest is discarded.\nNow, every app is split into various APKs:\n- base.apk, containing the shared code, assets, data and everything; the biggest file of the three parts, for Progressbar95 easily more than 90MB;\n- the ABIs: split_config.armeabi_v7a.apk, split_config.arm64_v8a.apk, split_config.x86_64.apk and split_config.x86.apk. These contain the low-level code for the CPU. Respectively, ARMv7 (on most older phones), ARMv8 (on newer phones, 64-bit), x86_64 (mostly on computers) and x86 (32-bit, on older CPUs). Progressbar95 doesn\'t support x86, but just in case ProgressArchiver95 supports it. Some phones may have multiple ABIs.\n- the DPIs: ldpi, mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi, nodpi and tvdpi. These contain optimized assets for the various screen resolutions. Unlike ABIs, they\'re not strictly required, but the game looks nicer on some screens with the correct DPI file.\n- Last and least, the language APKs. There\'s many of them: en, pt, it, es, ch, jp, ru... The purpose of those is unknown.\nThe game won\'t install if the required ABI is missing, or if the base.apk is missing. Due to the way ABIs work, some versions of the game may not work on all devices.\nThis broke traditional APK extraction apps, which were designed with fat APKs in mind. So I made ProgressArchiver95, a tool specifically made to archive Progressbar95 easily.\n\n</string>
<string name="ok" translatable="false">OK</string>
<string name="copy_lang">Copy languages</string>
<string name="langs_found">Languages:</string>
<string name="langs_found">Languages:\n</string>
</resources>

0 comments on commit 10e8803

Please sign in to comment.