Android towards个人项目记录

这是一个个人开发的学习项目,采用模块化开发方式,初期使用Java,逐渐转向Kotlin。项目集成了多种开源技术,如Retrofit、RxJava等,并对底层基础组件进行了拆分,以便独立使用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

介绍

首页感谢网络上开源的各种api,资源,代码,可以借鉴学习。
先上GitHub地址
https://github.com/zguop/Towards

项目介绍

这是一款完全按照自己的想法开发的应用,借鉴于github许多开源项目,不定时上传代码。
    
    项目主要用于学习,认为觉得好的东西会使用上,
	前期项目以java编写,逐渐转为kotlin编写。

朝着模块化进行开发... 
对底层所有基础组件模块进行拆分,底层基础模块可以独立使用。

项目架构:尝试过各种模式,mvc,mvp,mvvm 项目中都有它们的影子

    代码尽量简洁,封装性强。

列举一用到的库:
kotlin: 目前更新业务代码,全部是基础kotlin编写。
dataBinding:之前大量使用,接下来可能不会断重构,渐渐不会去使用这个。
retrofit:网络请求结合rxJava
rxJava:并没有太多的深入使用,简单应用它。
Glide:加载图片
statusBar:沉浸式的状态栏
greenDao:用的数据库

        ...还有很多使用到的主流框架

来看看项目里的效果图吧

这里写图片描述这里写图片描述
这里写图片描述这里写图片描述
6.图片选择
这里写图片描述这里写图片描述
7.主题切换
这里写图片描述

声明

这个属于个人开发作品。诸位勿传播于非技术人员,拒绝用于商业用途。
api和素材均来源网络,如有侵权请告知,立马删除。如果因他人下载使用产生纠纷均与本人无关
勿大面积传播,以免被查水表谢谢合作_

###常见问题
1.ViewPager with adapter XXX requires a view id
遇到这个问题的时候,原因是viewPager是直接new出来的,没有给这个ViewPager设置id,设置ViewpagerAdapter的时候报了这个错误,给ViewPager设置id就行了
2.android.database.sqlite.SQLiteException: no such column
Cursor查询sql的时候,默名的会多有括号存在。解决 查看错误sql 拼接好括号
3.Binary XML file line #25: Binary XML file line #25: Error inflating class TextView
字面意思很明显,我遇到了在子模块中使用了android:textColor="?attr/skin_text_dark_color",主题色,而skin_text_dark_color在子模块中并不存在导致
4.fragment使用viewPager嵌套fragment所遇到的问题
出现了Fragment的UserVisibleHint属性获取不一致的问题,实现懒加载数据出现了问题,解决办法统一UserVisibleHint的属性。解决判断父fragment是否可见,设置它的当前fragment的可见属性
5.关于主题色的使用
关于主题颜色,6.0以上在xml使用android:textColor="@color/skin_general_text_not",使用selector和在6.0以下是不一样的,6.0以上没有什么问题,但是在6.0以下颜色解析会和真实颜色不一样,显示出不一样的颜色,Xml解析颜色成ColorStateList存在色差的问题。在代码中,动态的去设置一遍颜色。用代码将selector转换成ColorStateList再设置到view上。

### Android Studio Project Build-Logic Module Purpose and Usage In the context of an Android Studio project, the `build-logic` module serves as a centralized location for defining common build configurations across multiple modules within a multi-module project[^1]. This approach enhances maintainability by ensuring consistency in configuration settings such as plugin application, dependency management, and property definitions. #### Centralized Configuration Management The primary function of this module is to encapsulate shared Gradle logic used throughout different parts of the project. By isolating these concerns into one place, developers avoid duplicating code snippets related to dependencies or plugins inside each subproject's `build.gradle` files. Instead, all relevant scripts reside under the `buildSrc` directory (or another designated folder), which acts like any other standard Java/Kotlin source set but specifically tailored towards customizing builds[^2]. For instance: ```groovy // File path: build-logic/convention/plugins/android-library-conventions.gradle.kts plugins { id("com.android.library") kotlin("android") } android { compileSdkVersion(33) defaultConfig { minSdk = 21 targetSdk = 33 } } ``` This script applies consistent settings for Android libraries without needing repetition elsewhere. #### Dependency Version Control Another significant advantage lies in managing versions centrally through properties defined either directly within Groovy/Kotlin DSLs or via external JSON/YAML files loaded during evaluation time. Such practice reduces errors caused by mismatched artifact revisions while making updates straightforward since only single entries require modification instead of scattered occurrences spread over numerous places[^3]: Example setup might look something similar below where specific API levels are managed uniformly: ```kotlin object Versions { const val COMPILE_SDK_VERSION = 33 const val MIN_SDK_VERSION = 21 const val TARGET_SDK_VERSION = 33 object Libraries { const val KOTLIN = "1.8.0" const val COROUTINES = "1.6.4" } } ``` Then referenced accordingly when declaring dependencies: ```groovy dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib:${Versions.Libraries.KOTLIN}") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.Libraries.COROUTINES}") } ``` --related questions-- 1. How does integrating third-party libraries impact performance optimization strategies? 2. What best practices should be followed regarding organizing large-scale applications with many feature modules? 3. Can you provide examples demonstrating how to implement continuous integration pipelines using GitHub Actions alongside Android projects configured with separate build-logic directories? 4. In what ways do modern IDE features facilitate debugging complex issues arising from misconfigurations between interdependent components?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值