implementation 'com.koonny.appcompat:appcompat:LATEST_VERSION'
class MainActivity : BaseActivity<ActivityMainBinding>(ActivityMainBinding::inflate) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// TODO
}
}
class FirstFragment : BaseFragment<ActivityMainBinding>(ActivityMainBinding::inflate) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// TODO
}
}
class DoneDialog : BaseDialogFragment<DialogDoneBinding>(DialogDoneBinding::inflate) {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// TODO
}
}
class MainActivity {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
button.click {
// 点击间隔3秒
// TODO
}
button.click(200) {
// 点击间隔200毫秒
// TODO
}
}
}
// Date、String、Long的格式转换
class MainActivity {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val nowMill = NOW_MILLS
val nowDate = NOW_DATE
val nowString = NOW_STRING
val result = NOW_MILLS.toDate().time.formatString("yyyy-MM-dd")
}
}
class MainActivity {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val versionCode = appVersion.versionCode
val versionName = appVersion.versionName
}
}
class FirstActivity {
fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
startActivity(
Intent(this, MainActivity::class.java).apply {
putExtra("result", "abc")
})
}
}
class MainActivity {
fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val result by intentString("result")
}
}
class MainActivity {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val result = "2132133".isPassword
val result1 = "sdasd".isPhoneNumber
}
}
FlowEventBus.post("action1", "success")
FlowEventBus.subscribe<String>("action1") {
Log.d("event", it)
}
Copyright 2023 jyygithub
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.