damon is an android Model-View-Presenter framework
- @RequiresPresenter注入多Presenter
- @BindPresenter赋值
- Presenter缓存以及状态恢复
@RequiresPresenter(value = [ExamplePresenter1::class, ExamplePresenter2::class, ExamplePresenter3::class])
class MultiPresenterActivity : MvpAppCompatActivity(), ExampleView1, ExampleView2, ExampleView3 {
@BindPresenter
private var presenter2: ExamplePresenter2? = null
@BindPresenter
private var presenter3: ExamplePresenter3? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_multi_presenter)
presenter?.log("presenter1 from getPresenter")
presenter2?.log("presenter2 from @BindPresenter")
presenter3?.log("presenter3 from @BindPresenter")
}
}
implementation 'com.zyhang:damon:<latest-version>'
- 支持自动dispose
// rxjava support
implementation 'com.zyhang:damon-rxjava:<latest-version>'
// kotlin syntax
implementation 'com.zyhang:damon-rxjava-kotlin:<latest-version>'
Copyright 2017 zyhang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.