a284628487 / androidpoint Goto Github PK
View Code? Open in Web Editor NEWAndroid Note
Android Note
面向 Android 的 OpenSL ES
https://developer.android.com/ndk/guides/audio/opensl-for-android
OpenSL ES 编程说明
https://developer.android.com/ndk/guides/audio/opensl-prog-notes
Android 扩展
https://developer.android.com/ndk/guides/audio/android-extensions#dynamic-interfaces
Getting Started
https://developer.android.com/ndk/guides/audio/opensl/getting-started
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
output.processResources.doFirst { pm ->
String manifestPath = output.processResources.manifestFile
println "=====ManifestPath=====$manifestPath"
// N:\xx\build\intermediates\merged_manifests\debug\AndroidManifest.xml
def manifestContent = file(manifestPath).getText()
def xml = new XmlParser().parseText(manifestContent)
xml.application[0].appendNode("meta-data", ['android:name': 'channel', 'android:value': 'baidu'])
def serialize = groovy.xml.XmlUtil.serialize(xml)
file(manifestPath).write(serialize)
}
println "originalFileName: ${outputFileName}"
outputFileName = "xxxxx.apk"
}
}
@Test
fun flowTest() {
val flow = flow<String> {
delay(1000)
println("emit 1 ${this.hashCode()}")
emit("${System.currentTimeMillis()}")
delay(1000)
println("emit 2 ${this.hashCode()}")
emit("${System.currentTimeMillis()}")
}
runBlocking {
val l = flow.take(1)
println("------ take(1) collect 1 ------")
l.collect()
println("------ take(1) collect 2 ------")
l.collect()
println("------ collect 1 ------")
flow.collect()
println("------ collect 2 ------")
flow.collect()
println("------ Flow Collect End ------")
}
}
------ take(1) collect 1 ------
emit 1 398887205
------ take(1) collect 2 ------
emit 1 1121172875
------ collect 1 ------
emit 1 649734728
emit 2 649734728
------ collect 2 ------
emit 1 1595953398
emit 2 1595953398
------ Flow Collect End ------
Empty
Android-Profiler: https://developer.android.com/studio/profile/android-profiler
testImplementation "junit:junit:4.13.2"
testImplementation "androidx.test:core:1.3.0"
testImplementation "androidx.test:core-ktx:1.3.0"
testImplementation "androidx.test.ext:junit:1.1.2"
testImplementation "androidx.test.ext:junit-ktx:1.1.2"
testImplementation "androidx.arch.core:core-testing:2.1.0"
testImplementation "org.robolectric:robolectric:4.3.1"
定义ActivityComponent模块
interface IApi {
fun sayHello()
}
class IApiImpl @Inject constructor(@ActivityContext private val context: Context) : IApi {
override fun sayHello() {
Log.e("IApiImpl${this.hashCode()}", "sayHello ${context}")
}
}
@Module
@InstallIn(ActivityComponent::class)
abstract class ApiModule {
@Binds
abstract fun bindApi(apiImpl: IApiImpl): IApi
}
在Activity中注入
@AndroidEntryPoint
class TestActivity: AppCompatActivity() {
@Inject lateinit var iApi: IApi
@Inject lateinit var iApi2: IApi
}
class Test2Activity: AppCompatActivity() {
@Inject lateinit var iApi: IApi
}
TestActivity和Test2Activity中获取到的IApi对象为不同的实例。
TestActivity中iApi和iApi2也是不同的实例对象。
修改IApiImpl和ApiModule,将IApiImpl修改为单例实现。
@Singleton
class IApiImpl @Inject constructor(@ApplicationContext private val context: Context) : IApi {
override fun sayHello() {
Log.e("IApiImpl${this.hashCode()}", "sayHello ${context}")
}
}
@Module
@InstallIn(SingletonComponent::class)
abstract class ApiModule {
@Binds
abstract fun bindApi(apiImpl: IApiImpl): IApi
}
EMPTY
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.