EffectiveAndroidUI 项目教程

随笔3周前发布 张哲源
29 0 0

EffectiveAndroidUI 项目教程

EffectiveAndroidUISample project created to show some of the best Android practices to work in the Android UI Layer. The UI layer of this project has been implemented using MVP or MVVM (without binding engine) to show how this patterns works. This project is used during the talk “EffectiveAndroidUI”.项目地址:https://gitcode.com/gh_mirrors/ef/EffectiveAndroidUI

1. 项目的目录结构及介绍

EffectiveAndroidUI 项目的目录结构如下:

  1. EffectiveAndroidUI/

  2. ├── app/

  3. │ ├── src/

  4. │ │ ├── main/

  5. │ │ │ ├── java/

  6. │ │ │ │ ├── com/

  7. │ │ │ │ │ ├── github/

  8. │ │ │ │ │ │ ├── pedrovgs/

  9. │ │ │ │ │ │ │ ├── effectiveandroidui/

  10. │ │ │ │ │ │ │ │ ├── activity/

  11. │ │ │ │ │ │ │ │ ├── adapter/

  12. │ │ │ │ │ │ │ │ ├── component/

  13. │ │ │ │ │ │ │ │ ├── fragment/

  14. │ │ │ │ │ │ │ │ ├── interactor/

  15. │ │ │ │ │ │ │ │ ├── module/

  16. │ │ │ │ │ │ │ │ ├── presenter/

  17. │ │ │ │ │ │ │ │ ├── renderer/

  18. │ │ │ │ │ │ │ │ ├── view/

  19. │ │ │ │ │ │ │ │ └── widget/

  20. │ │ │ ├── res/

  21. │ │ │ │ ├── drawable/

  22. │ │ │ │ ├── layout/

  23. │ │ │ │ ├── menu/

  24. │ │ │ │ ├── mipmap/

  25. │ │ │ │ ├── values/

  26. │ │ │ │ └── xml/

  27. │ │ │ └── AndroidManifest.xml

  28. │ │ └── test/

  29. │ │ └── java/

  30. │ │ └── com/

  31. │ │ └── github/

  32. │ │ └── pedrovgs/

  33. │ │ └── effectiveandroidui/

  34. │ └── build.gradle

  35. ├── gradle/

  36. │ └── wrapper/

  37. ├── .gitignore

  38. ├── build.gradle

  39. ├── gradle.properties

  40. ├── gradlew

  41. ├── gradlew.bat

  42. ├── LICENSE.txt

  43. ├── README.md

  44. └── settings.gradle

目录结构介绍

  • app/: 包含应用程序的主要代码和资源文件。
    • src/: 源代码目录。
      • main/: 主代码目录。
        • java/: Java 代码目录。
          • com/github/pedrovgs/effectiveandroidui/: 主要包目录,包含各种功能模块的代码。
        • res/: 资源文件目录,包含布局、图片、字符串等资源。
        • AndroidManifest.xml: 应用程序的配置文件。
      • test/: 测试代码目录。
    • build.gradle: 应用程序的构建脚本。
  • gradle/: Gradle 包装器目录。
  • .gitignore: Git 忽略文件配置。
  • build.gradle: 项目的构建脚本。
  • gradle.properties: Gradle 属性文件。
  • gradlew: Gradle 包装器脚本(Unix)。
  • gradlew.bat: Gradle 包装器脚本(Windows)。
  • LICENSE.txt: 项目许可证文件。
  • README.md: 项目说明文件。
  • settings.gradle: 项目设置文件。

2. 项目的启动文件介绍

项目的启动文件是 app/src/main/java/com/github/pedrovgs/effectiveandroidui/activity/SplashActivity.java。这个文件是应用程序的入口点,负责启动应用程序并跳转到主界面。

SplashActivity.java

  1. package com.github.pedrovgs.effectiveandroidui.activity;

  2. import android.content.Intent;

  3. import android.os.Bundle;

  4. import android.os.Handler;

  5. import androidx.appcompat.app.AppCompatActivity;

  6. import com.github.pedrovgs.effectiveandroidui.R;

  7. public class SplashActivity extends AppCompatActivity {

  8. private static final long SPLASH_DISPLAY_LENGTH = 1000;

  9. @Override

  10. protected void onCreate(Bundle savedInstanceState) {

  11. super.onCreate(savedInstanceState);

  12. setContentView(R.layout

EffectiveAndroidUISample project created to show some of the best Android practices to work in the Android UI Layer. The UI layer of this project has been implemented using MVP or MVVM (without binding engine) to show how this patterns works. This project is used during the talk “EffectiveAndroidUI”.项目地址:https://gitcode.com/gh_mirrors/ef/EffectiveAndroidUI

© 版权声明

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...