See here for more general information about the Backpack apps.
The goal of the Backpack library is deduplication of application code, easier maintance for multiple apps at one and prevention of silly mistakes when creating a new Backpack app.
Following components are included:
Component | Description | Implementation |
---|---|---|
BackpackApplication | Application class | Direct reference to from app's manifest |
BackpackMainActivity | Base Settings activity | - super.onCreate - binding = TheBinding.inflate(layoutInflater).asContentView() - setSupportActionBar(binding.toolbar) - findNavController(R.id.nav_host_id).applyToActionBar() |
BackpackSettingsActivity | Base Settings Activity | - bindInterface - super.onCreate - BackpackSettings interface |
BackpackAnalysisFragment | Base Analysis Fragment | - bindInterface(this) - return super.onCreateView - BackpackAnalysis interface |
BackpackMainFragment | Base Main Fragment | - own binding handling - super.onCreateView (but return binding.root) - bindInterface (onViewCreated) - implement BackupFab - BackpackMain interface |
BackpackSettingsFragment | Base Settings Fragment | - bindInterface - super.onCreatePreferences - BackpackSettingsView interface |
CryptoManager | Almighty manager class for hashing, encryption / decryption, randoms | - see available methods |
BackupFab | Backup interface FAB | - <com.cyb3rko.backpack.views.BackupFab /> (match_parent, match_parent) - set 4 event handlers setOnOpen, setOnClose, setOnImport, setOnExport |
AboutDialog | Dialog for Software and Device information | - call show(...), see parameter names |
ErrorDialog | Dialog for all kinds of error | - call show(...) or showCustom(...) for custom error message, see parameter names |
ObjectSerializer | (De)Serializer for data objects | - call serialize(obj: Any): ByteArray or deserialize(bytes: ByteArray): Any |
Serializable | Base data class for Backpack app content | - override 'const val serialVersionUID' to some random number - Random Long Generator |
BuildInfo | Data class to pass BuildConfig information to Backpack parent fragment instance | - see parameter names |
Themes | Predefined themes for light and dark mode | - name="Theme.BackpackDemo" parent="Theme.Backpack" /> - name="TextAppearance.Toolbar.Subtitle" parent="Toolbar.Subtitle" /> - name="Preference.SwitchPreferenceCompat" parent="@style/PreferenceSwitch.Backpack" /> - v29: name="Theme.BackpackDemo" parent="Theme.Backpack.E2E" /> |
Data Extraction / Backup rules | Ready to use data extraction and backup rules for the app manifest | - android:dataExtractionRules="@xml/data_extraction_rules" - android:fullBackupContent="@xml/backup_rules" |
Animations | Animations for fragment transitions | - shrink_in.xml / shrink_out.xml - slide_in.xml / slide_out.xml |
Icons | A few colored icons (credits already included) | - ic_arrow, ic_art, ic_empty, ic_git, ic_information, ic_information_scaled, ic_security, ic_settings |