简体ä¸æ–‡ | English
Introduction to the SDK
This is a framework for Android application development, which incorporates the author's years of experience in the Android industry. It provides an efficient way to develop and build Android mobile apps. Even beginners who have just started with Android app development can quickly get started. Whether you use the Java or Kotlin language, you can use this SDK.
Features
- Global lifecycle configuration: TaskStackGlobalConfig, and custom configuration. It supports configuring the lifecycles of Application, Activity, and Fragment, allowing you to write once and reuse in all projects.
-
BaseActivity and BaseFragment encapsulation based on the MVVM architecture. It supports seamless switching of Fragments in Activity, providing a perfect solution for Fragment switching without overlap. It also supports monitoring network changes in Activity. You can use the IDE plugin for more convenient development, available at https://github.com/dora4/dora-studio-plugin.
-
showShortToast() and showLongToast().
Convenient methods to display a Toast message at any point in your code. Automatically handles thread switching, so you don't need to worry about errors.
-
openActivity() and openActivityForResult() serie, deprecated, moved to IntentUtils.
Alternative methods to startActivity and startActivityForResult, providing a more convenient way to pass parameters.
-
onGetExtras()
Convenient method to retrieve parameters passed through an intent. Should be called before initData(). This ensures that all the required parameters are available during the initData() process.
-
onNetworkConnected() and onNetworkDisconnected()
Listeners for network connection status, indicating when the network is connected or disconnected.
-
onSetStatusBar() and onSetNavigationBar()
Convenient method for initializing system status bar and navigation bar.
-
showPage(), lastPage(), nextPage(), getFlowFragment(), getFlowFragmentContainerId(), getFlowFragmentPageKeys(), and isPageLoop()
This framework automatically manages the switching of Fragments within BaseActivity. It is commonly used in scenarios where there is no need for activity transition animations but rather direct changes to the overall layout of the interface. A detailed explanation is not provided here, but you can refer to the source code if you're interested.
-
-
DoraCrash allows configuring crash information to be written into files with just one line of code, making bugs easier to identify.
DoraCrash.initCrash(this, "YourAppFolder/log");
-
The app process can be automatically killed when the memory is low, and there won't be a black or white screen issue when the app is restarted.
-
Various utility classes are provided for worry-free development. For example, ToastUtils automatically handles thread switching for displaying toasts, LogUtils eliminates the hassle of naming tags, and there are also encapsulations for complex operations such as Java file reading and writing, system status bar and navigation bar adaptation tools, internationalization tools for multi-language support, image processing tools, reflection-related tools, etc.
Getting Started (Tutorial: https://github.com/dora4/dora_samples)
// Add the following code to the root build.gradle file of your project
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
// Add the following code to the build.gradle file of your app module
dependencies {
implementation 'com.github.dora4:dora:latest-version'
}
Replace "latest-version" with the latest stable version available on JitPack, such as 1.0.0. So the code will become implementation 'com.github.dora4:dora:1.0.0'.
If you find it useful, you may wish to click the Fork button in the upper right corner of the Github page to benefit more people!
Best Practices
Dora Chat (https://dorachat.com) Dora Music (Dora Music)