提交 dc268f94 编写于 作者: B Blankj

see 01/23 log

上级 9d0a0ab9
* `19/01/23` [add] Modify the demo of utilcode use kotlin. Publish v1.23.1.
* `19/01/22` [fix] AppUtils#installApp.
* `19/01/17` [fix] Publish v1.23.0.
* `19/01/16` [fix] BarUtils get Activity from view and delete the function of set status bar alpha.
* `19/01/15` [add] ColorUtils.
......
......@@ -41,7 +41,7 @@
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.0-brightgreen.svg
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.1-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.0-brightgreen.svg
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.1-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -15,5 +15,5 @@ dependencies {
api dep.free_proguard
api 'com.r0adkll:slidableactivity:2.0.5'
compileOnly dep.leakcanary.android_no_op
// api 'com.blankj:utilcode:1.23.0'
// api 'com.blankj:utilcode:1.23.1'
}
\ No newline at end of file
......@@ -83,7 +83,7 @@ open class BaseApplication : Application() {
}
}
protected fun isDebug(): Boolean {
fun isDebug(): Boolean {
if (isDebug == null) isDebug = AppUtils.isAppDebug()
return isDebug!!
}
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.23.0'
implementation 'com.blankj:utilcode:1.23.1'
```
......
......@@ -27,7 +27,7 @@ apply plugin: "com.blankj.bus"
给 base 模块添加 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 依赖:
```groovy
api "com.blankj:utilcode:1.23.0"
api "com.blankj:utilcode:1.23.1"
```
比如 module0 中存在的 `Module0Activity.java`,我们通常都是在它内部写一个 `start` 函数来启动它,现在我们给它添加 `@BusUtils.Subscribe` 注解,并给注解的 `name` 赋唯一值,要注意,函数务必要 `public static` 哦:
......
......@@ -2,7 +2,7 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.23.0'
implementation 'com.blankj:utilcode:1.23.1'
```
......
......@@ -183,7 +183,7 @@ class ActivityActivity : BaseBackActivity() {
0, 0)
.toBundle()
2 -> return ActivityOptionsCompat.makeThumbnailScaleUpAnimation(activityViewSharedElement,
bitmap!!,
bitmap,
0, 0)
.toBundle()
3 -> return ActivityOptionsCompat.makeSceneTransitionAnimation(this,
......
......@@ -68,7 +68,7 @@ class AppActivity : BaseBackActivity() {
.appendLine("getAppSignatureSHA1: " + AppUtils.getAppSignatureSHA1())
.appendLine("getAppSignatureSHA256: " + AppUtils.getAppSignatureSHA256())
.appendLine("getAppSignatureMD5: " + AppUtils.getAppSignatureMD5())
.append("getApkInfo: " + AppUtils.getApkInfo(AppUtils.getAppPath())!!)
.append("getApkInfo: " + AppUtils.getApkInfo(AppUtils.getAppPath()))
.create()
}
......
......@@ -67,7 +67,7 @@ class BarNavActivity : BaseBackActivity() {
}
private fun updateAboutNav() {
SpanUtils.with(aboutNavTv)
SpanUtils.with(barNavAboutTv)
.appendLine("navHeight: " + BarUtils.getNavBarHeight())
.appendLine("isNavBarVisible: " + BarUtils.isNavBarVisible(this))
.apply {
......
......@@ -41,7 +41,7 @@ class BarNotificationActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_bar)
showNotificationBtn.setOnClickListener(this)
barNotificationShowBtn.setOnClickListener(this)
}
override fun doBusiness() {
......@@ -50,7 +50,7 @@ class BarNotificationActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.showNotificationBtn -> {
R.id.barNotificationShowBtn -> {
BarUtils.setNotificationBarVisibility(true)
mHandler.postDelayed({ BarUtils.setNotificationBarVisibility(false) }, 2000)
}
......
......@@ -60,7 +60,7 @@ class BarStatusActivity : BaseBackActivity() {
}
private fun updateAboutStatus() {
aboutStatusTv.text = SpanUtils()
barStatusAboutTv.text = SpanUtils()
.appendLine("statusHeight: " + BarUtils.getStatusBarHeight())
.append("isStatusVisible: " + BarUtils.isStatusBarVisible(this))
.create()
......
......@@ -33,7 +33,7 @@ class BarStatusAlphaActivity : BaseActivity() {
private val translucentListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
mAlpha = progress
statusAlphaTv.text = mAlpha.toString()
barStatusAlphaAboutTv.text = mAlpha.toString()
updateStatusBar()
}
......@@ -55,9 +55,9 @@ class BarStatusAlphaActivity : BaseActivity() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
findViewById<View>(R.id.setTransparentBtn).setOnClickListener(this)
changeAlphaSb.setOnSeekBarChangeListener(translucentListener)
statusAlphaTv.text = mAlpha.toString()
barStatusAlphaSetTransparentBtn.setOnClickListener(this)
barStatusAlphaChangeAlphaSb.setOnSeekBarChangeListener(translucentListener)
barStatusAlphaAboutTv.text = mAlpha.toString()
updateStatusBar()
}
......@@ -69,12 +69,12 @@ class BarStatusAlphaActivity : BaseActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.setTransparentBtn -> changeAlphaSb.progress = 0
R.id.barStatusAlphaSetTransparentBtn -> barStatusAlphaChangeAlphaSb.progress = 0
}
}
private fun updateStatusBar() {
BarUtils.setStatusBarColor(this, Color.argb(mAlpha, 0, 0, 0))
BarUtils.addMarginTopEqualStatusBarHeight(statusAlphaTv)// 其实这个只需要调用一次即可
BarUtils.addMarginTopEqualStatusBarHeight(barStatusAlphaAboutTv)// 其实这个只需要调用一次即可
}
}
......@@ -31,7 +31,7 @@ class BarStatusAlphaFragment : BaseLazyFragment() {
private val translucentListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
mAlpha = progress
statusAlphaTv.text = mAlpha.toString()
barStatusAlphaFragmentAboutTv.text = mAlpha.toString()
updateFakeStatusBar()
}
......@@ -53,9 +53,9 @@ class BarStatusAlphaFragment : BaseLazyFragment() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
findViewById<View>(R.id.setTransparentBtn).setOnClickListener(this)
changeAlphaSb.setOnSeekBarChangeListener(translucentListener)
statusAlphaTv.text = mAlpha.toString()
barStatusAlphaFragmentSetTransparentBtn.setOnClickListener(this)
barStatusAlphaFragmentChangeAlphaSb.setOnSeekBarChangeListener(translucentListener)
barStatusAlphaFragmentAboutTv.text = mAlpha.toString()
updateFakeStatusBar()
}
......@@ -66,11 +66,11 @@ class BarStatusAlphaFragment : BaseLazyFragment() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.setTransparentBtn -> changeAlphaSb.progress = 0
R.id.setTransparentBtn -> barStatusAlphaFragmentChangeAlphaSb.progress = 0
}
}
fun updateFakeStatusBar() {
BarUtils.setStatusBarColor(fakeStatusBar, Color.argb(mAlpha, 0, 0, 0))
BarUtils.setStatusBarColor(barStatusAlphaFragmentFakeStatusBar, Color.argb(mAlpha, 0, 0, 0))
}
}
......@@ -40,7 +40,7 @@ class BarStatusColorActivity : BaseActivity() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
randomColorBtn.setOnClickListener(this)
barStatusColorRandomColorBtn.setOnClickListener(this)
updateStatusBar()
}
......@@ -52,7 +52,7 @@ class BarStatusColorActivity : BaseActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.randomColorBtn -> {
R.id.barStatusColorRandomColorBtn -> {
mColor = ColorUtils.getRandomColor()
updateStatusBar()
}
......@@ -61,7 +61,7 @@ class BarStatusColorActivity : BaseActivity() {
private fun updateStatusBar() {
BarUtils.setStatusBarColor(this, mColor)
statusColorTv.text = String.format(ColorUtils.int2ArgbString(mColor))
BarUtils.addMarginTopEqualStatusBarHeight(statusColorTv)// 其实这个只需要调用一次即可
barStatusColorAboutTv.text = String.format(ColorUtils.int2ArgbString(mColor))
BarUtils.addMarginTopEqualStatusBarHeight(barStatusColorAboutTv)// 其实这个只需要调用一次即可
}
}
......@@ -38,7 +38,7 @@ class BarStatusColorFragment : BaseLazyFragment() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
randomColorBtn.setOnClickListener(this)
barStatusColorFragmentRandomColorBtn.setOnClickListener(this)
updateFakeStatusBar()
}
......@@ -48,7 +48,7 @@ class BarStatusColorFragment : BaseLazyFragment() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.randomColorBtn -> {
R.id.barStatusColorFragmentRandomColorBtn -> {
mColor = ColorUtils.getRandomColor()
updateFakeStatusBar()
}
......@@ -56,7 +56,7 @@ class BarStatusColorFragment : BaseLazyFragment() {
}
private fun updateFakeStatusBar() {
BarUtils.setStatusBarColor(fakeStatusBar, mColor)
statusColorTv.text = String.format(ColorUtils.int2ArgbString(mColor))
BarUtils.setStatusBarColor(barStatusColorFragmentFakeStatusBar, mColor)
barStatusColorFragmentAboutColorTv.text = String.format(ColorUtils.int2ArgbString(mColor))
}
}
......@@ -7,6 +7,7 @@ import com.blankj.lib.base.BaseLazyFragment
import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.LogUtils
import kotlinx.android.synthetic.main.fragment_bar_status_custom.*
/**
* ```
......@@ -33,7 +34,7 @@ class BarStatusCustomFragment : BaseLazyFragment() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
BarUtils.setStatusBarCustom(findViewById(R.id.fakeStatusBar))
BarUtils.setStatusBarCustom(barStatusCustomFragmentFakeStatusBar)
}
override fun doLazyBusiness() {
......
......@@ -14,7 +14,6 @@ import com.blankj.utilcode.util.BarUtils
import com.blankj.utilcode.util.ColorUtils
import com.blankj.utilcode.util.Utils
import kotlinx.android.synthetic.main.activity_bar_status_drawer.*
import java.util.*
/**
......@@ -34,7 +33,6 @@ class BarStatusDrawerActivity : BaseDrawerActivity() {
}
}
private var mRandom: Random = Random()
private var mColor: Int = 0
private var mAlpha: Int = 0
......@@ -53,24 +51,24 @@ class BarStatusDrawerActivity : BaseDrawerActivity() {
}
}
private var mAlphaCheckedChangeListener: CompoundButton.OnCheckedChangeListener = CompoundButton.OnCheckedChangeListener { buttonView, isChecked ->
private var mAlphaCheckedChangeListener: CompoundButton.OnCheckedChangeListener = CompoundButton.OnCheckedChangeListener { _, isChecked ->
if (isChecked) {
changeAlphaSb.visibility = View.VISIBLE
randomColorBtn.visibility = View.GONE
setTransparentBtn.visibility = View.VISIBLE
barStatusAlphaChangeAlphaSb.visibility = View.VISIBLE
barStatusAlphaRandomColorBtn.visibility = View.GONE
barStatusAlphaSetTransparentBtn.visibility = View.VISIBLE
mDrawerContainerView.setBackgroundResource(R.drawable.bar_status_alpha_bg)
} else {
changeAlphaSb.visibility = View.GONE
randomColorBtn.visibility = View.VISIBLE
setTransparentBtn.visibility = View.GONE
barStatusAlphaChangeAlphaSb.visibility = View.GONE
barStatusAlphaRandomColorBtn.visibility = View.VISIBLE
barStatusAlphaSetTransparentBtn.visibility = View.GONE
mDrawerContainerView.setBackgroundColor(Color.WHITE)
}
updateStatusBar()
}
private var mFrontCheckedChangeListener: CompoundButton.OnCheckedChangeListener = CompoundButton.OnCheckedChangeListener { buttonView, isChecked -> updateStatusBar() }
private var mFrontCheckedChangeListener: CompoundButton.OnCheckedChangeListener = CompoundButton.OnCheckedChangeListener { _, _ -> updateStatusBar() }
override fun initData(bundle: Bundle?) {
mColor = ContextCompat.getColor(Utils.getApp(), R.color.colorPrimary)
......@@ -82,14 +80,14 @@ class BarStatusDrawerActivity : BaseDrawerActivity() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
alphaCb.setOnCheckedChangeListener(mAlphaCheckedChangeListener)
frontCb.setOnCheckedChangeListener(mFrontCheckedChangeListener)
changeAlphaSb.setOnSeekBarChangeListener(mColorListener)
randomColorBtn.setOnClickListener(this)
setTransparentBtn.setOnClickListener(this)
barStatusDrawerAlphaCb.setOnCheckedChangeListener(mAlphaCheckedChangeListener)
barStatusDrawerFrontCb.setOnCheckedChangeListener(mFrontCheckedChangeListener)
barStatusAlphaChangeAlphaSb.setOnSeekBarChangeListener(mColorListener)
barStatusAlphaRandomColorBtn.setOnClickListener(this)
barStatusAlphaSetTransparentBtn.setOnClickListener(this)
changeAlphaSb.visibility = View.GONE
setTransparentBtn.visibility = View.GONE
barStatusAlphaChangeAlphaSb.visibility = View.GONE
barStatusAlphaSetTransparentBtn.visibility = View.GONE
updateStatusBar()
}
......@@ -104,18 +102,18 @@ class BarStatusDrawerActivity : BaseDrawerActivity() {
mColor = ColorUtils.getRandomColor()
updateStatusBar()
}
R.id.setTransparentBtn -> changeAlphaSb.progress = 0
R.id.setTransparentBtn -> barStatusAlphaChangeAlphaSb.progress = 0
}
}
private fun updateStatusBar() {
if (alphaCb.isChecked) {
BarUtils.setStatusBarColor4Drawer(mDrawerRootLayout, fakeStatusBar, Color.argb(mAlpha, 0, 0, 0), frontCb.isChecked)
statusAboutTv.text = mAlpha.toString()
if (barStatusDrawerAlphaCb.isChecked) {
BarUtils.setStatusBarColor4Drawer(mDrawerRootLayout, barStatusDrawerFakeStatusBar, Color.argb(mAlpha, 0, 0, 0), barStatusDrawerFrontCb.isChecked)
barStatusDrawerAboutTv.text = mAlpha.toString()
} else {
BarUtils.setStatusBarColor4Drawer(mDrawerRootLayout, fakeStatusBar, mColor, frontCb.isChecked)
statusAboutTv.text = ColorUtils.int2ArgbString(mColor)
BarUtils.setStatusBarColor4Drawer(mDrawerRootLayout, barStatusDrawerFakeStatusBar, mColor, barStatusDrawerFrontCb.isChecked)
barStatusDrawerAboutTv.text = ColorUtils.int2ArgbString(mColor)
}
BarUtils.addMarginTopEqualStatusBarHeight(alphaCb)// 其实这个只需要调用一次即可
BarUtils.addMarginTopEqualStatusBarHeight(barStatusDrawerAlphaCb)// 其实这个只需要调用一次即可
}
}
......@@ -31,30 +31,30 @@ class BarStatusFragmentActivity : BaseActivity() {
}
private val itemIds = intArrayOf(
R.id.navigation_color,
R.id.navigation_alpha,
R.id.navigation_image_view,
R.id.navigation_custom
R.id.barStatusFragmentNavigationColor,
R.id.barStatusFragmentNavigationAlpha,
R.id.barStatusFragmentNavigationImageView,
R.id.barStatusFragmentNavigationCustom
)
private val mFragmentList = ArrayList<Fragment>()
private val mOnNavigationItemSelectedListener = BottomNavigationView.OnNavigationItemSelectedListener l@{ item ->
when (item.itemId) {
R.id.navigation_color -> {
statusBarVp.currentItem = 0
R.id.barStatusFragmentNavigationColor -> {
barStatusFragmentVp.currentItem = 0
return@l true
}
R.id.navigation_alpha -> {
statusBarVp.currentItem = 1
R.id.barStatusFragmentNavigationAlpha -> {
barStatusFragmentVp.currentItem = 1
return@l true
}
R.id.navigation_image_view -> {
statusBarVp.currentItem = 2
R.id.barStatusFragmentNavigationImageView -> {
barStatusFragmentVp.currentItem = 2
return@l true
}
R.id.navigation_custom -> {
statusBarVp.currentItem = 3
R.id.barStatusFragmentNavigationCustom -> {
barStatusFragmentVp.currentItem = 3
return@l true
}
else -> false
......@@ -75,8 +75,8 @@ class BarStatusFragmentActivity : BaseActivity() {
mFragmentList.add(BarStatusImageViewFragment.newInstance())
mFragmentList.add(BarStatusCustomFragment.newInstance())
statusBarVp.offscreenPageLimit = 3
statusBarVp.adapter = object : FragmentPagerAdapter(supportFragmentManager) {
barStatusFragmentVp.offscreenPageLimit = 3
barStatusFragmentVp.adapter = object : FragmentPagerAdapter(supportFragmentManager) {
override fun getItem(position: Int): Fragment {
return mFragmentList[position]
}
......@@ -86,13 +86,13 @@ class BarStatusFragmentActivity : BaseActivity() {
}
}
statusBarVp.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
barStatusFragmentVp.addOnPageChangeListener(object : ViewPager.OnPageChangeListener {
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
}
override fun onPageSelected(position: Int) {
statusBarNav.selectedItemId = itemIds[position]
barStatusFragmentNav.selectedItemId = itemIds[position]
}
override fun onPageScrollStateChanged(state: Int) {
......@@ -100,7 +100,7 @@ class BarStatusFragmentActivity : BaseActivity() {
}
})
statusBarNav.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
barStatusFragmentNav.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener)
}
override fun doBusiness() {
......
......@@ -33,7 +33,7 @@ class BarStatusImageViewActivity : BaseActivity() {
private val translucentListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
mAlpha = progress
statusAlphaTv.text = mAlpha.toString()
barStatusImageViewAboutTv.text = mAlpha.toString()
updateStatusBar()
}
......@@ -55,9 +55,9 @@ class BarStatusImageViewActivity : BaseActivity() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTransparentBtn.setOnClickListener(this)
changeAlphaSb.setOnSeekBarChangeListener(translucentListener)
statusAlphaTv.text = mAlpha.toString()
barStatusImageViewSetTransparentBtn.setOnClickListener(this)
barStatusImageViewChangeAlphaSb.setOnSeekBarChangeListener(translucentListener)
barStatusImageViewAboutTv.text = mAlpha.toString()
updateStatusBar()
}
......@@ -68,7 +68,7 @@ class BarStatusImageViewActivity : BaseActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.setTransparentBtn -> changeAlphaSb.progress = 0
R.id.setTransparentBtn -> barStatusImageViewChangeAlphaSb.progress = 0
}
}
......
......@@ -25,7 +25,7 @@ class BarStatusImageViewFragment : BaseLazyFragment() {
private val translucentListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
mAlpha = progress
statusAlphaTv.text = mAlpha.toString()
barStatusImageViewFragmentAboutTv.text = mAlpha.toString()
updateFakeStatusBar()
}
......@@ -47,9 +47,9 @@ class BarStatusImageViewFragment : BaseLazyFragment() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTransparentBtn.setOnClickListener(this)
changeAlphaSb.setOnSeekBarChangeListener(translucentListener)
statusAlphaTv.text = mAlpha.toString()
barStatusImageViewFragmentSetTransparentBtn.setOnClickListener(this)
barStatusImageViewFragmentChangeAlphaSb.setOnSeekBarChangeListener(translucentListener)
barStatusImageViewFragmentAboutTv.text = mAlpha.toString()
updateFakeStatusBar()
}
......@@ -60,12 +60,12 @@ class BarStatusImageViewFragment : BaseLazyFragment() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.setTransparentBtn -> changeAlphaSb.progress = 0
R.id.setTransparentBtn -> barStatusImageViewFragmentChangeAlphaSb.progress = 0
}
}
fun updateFakeStatusBar() {
BarUtils.setStatusBarColor(fakeStatusBar, Color.argb(mAlpha, 0, 0, 0))
BarUtils.setStatusBarColor(barStatusImageViewFragmentFakeStatusBar, Color.argb(mAlpha, 0, 0, 0))
}
companion object {
......
......@@ -15,7 +15,6 @@ import com.blankj.utilcode.util.ColorUtils
import com.blankj.utilcode.util.Utils
import com.r0adkll.slidr.Slidr
import kotlinx.android.synthetic.main.activity_bar_status_swipe_back.*
import java.util.*
/**
* ```
......@@ -34,14 +33,13 @@ class BarStatusSwipeBackActivity : BaseActivity() {
}
}
private var mRandom: Random = Random()
private var mColor: Int = 0
private var mAlpha: Int = 0
private val mColorListener = object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
mAlpha = progress
statusAboutTv.text = mAlpha.toString()
barStatusSwipeBackAboutTv.text = mAlpha.toString()
updateStatusBar()
}
......@@ -56,17 +54,17 @@ class BarStatusSwipeBackActivity : BaseActivity() {
private var mCheckedChangeListener: CompoundButton.OnCheckedChangeListener = CompoundButton.OnCheckedChangeListener { buttonView, isChecked ->
if (isChecked) {
changeAlphaSb.visibility = View.VISIBLE
randomColorBtn.visibility = View.GONE
setTransparentBtn.visibility = View.VISIBLE
barStatusSwipeBackChangeAlphaSb.visibility = View.VISIBLE
barStatusSwipeBackRandomColorBtn.visibility = View.GONE
barStatusSwipeBackSetTransparentBtn.visibility = View.VISIBLE
containerLl.setBackgroundResource(R.drawable.bar_status_alpha_bg)
barStatusSwipeBackContainerLl.setBackgroundResource(R.drawable.bar_status_alpha_bg)
} else {
changeAlphaSb.visibility = View.GONE
randomColorBtn.visibility = View.VISIBLE
setTransparentBtn.visibility = View.GONE
barStatusSwipeBackChangeAlphaSb.visibility = View.GONE
barStatusSwipeBackRandomColorBtn.visibility = View.VISIBLE
barStatusSwipeBackSetTransparentBtn.visibility = View.GONE
containerLl.setBackgroundColor(Color.WHITE)
barStatusSwipeBackContainerLl.setBackgroundColor(Color.WHITE)
}
updateStatusBar()
}
......@@ -82,12 +80,12 @@ class BarStatusSwipeBackActivity : BaseActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) {
Slidr.attach(this)
alphaCb.setOnCheckedChangeListener(mCheckedChangeListener)
changeAlphaSb.setOnSeekBarChangeListener(mColorListener)
randomColorBtn.setOnClickListener(this)
setTransparentBtn.setOnClickListener(this)
barStatusSwipeBackAlphaCb.setOnCheckedChangeListener(mCheckedChangeListener)
barStatusSwipeBackChangeAlphaSb.setOnSeekBarChangeListener(mColorListener)
barStatusSwipeBackRandomColorBtn.setOnClickListener(this)
barStatusSwipeBackSetTransparentBtn.setOnClickListener(this)
setTransparentBtn.visibility = View.GONE
barStatusSwipeBackSetTransparentBtn.visibility = View.GONE
updateStatusBar()
}
......@@ -102,18 +100,18 @@ class BarStatusSwipeBackActivity : BaseActivity() {
mColor = ColorUtils.getRandomColor()
updateStatusBar()
}
R.id.setTransparentBtn -> changeAlphaSb.progress = 0
R.id.setTransparentBtn -> barStatusSwipeBackChangeAlphaSb.progress = 0
}
}
private fun updateStatusBar() {
if (alphaCb.isChecked) {
if (barStatusSwipeBackAlphaCb.isChecked) {
BarUtils.setStatusBarColor(this, Color.argb(mAlpha, 0, 0, 0))
statusAboutTv.text = mAlpha.toString()
barStatusSwipeBackAboutTv.text = mAlpha.toString()
} else {
BarUtils.setStatusBarColor(this, mColor)
statusAboutTv.text = ColorUtils.int2ArgbString(mColor)
barStatusSwipeBackAboutTv.text = ColorUtils.int2ArgbString(mColor)
}
BarUtils.addMarginTopEqualStatusBarHeight(alphaCb)
BarUtils.addMarginTopEqualStatusBarHeight(barStatusSwipeBackAlphaCb)
}
}
......@@ -40,12 +40,12 @@ class DeviceActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_device)
shutdownBtn.setOnClickListener(this)
rebootBtn.setOnClickListener(this)
reboot2RecoveryBtn.setOnClickListener(this)
reboot2BootloaderBtn.setOnClickListener(this)
deviceShutdownBtn.setOnClickListener(this)
deviceRebootBtn.setOnClickListener(this)
deviceReboot2RecoveryBtn.setOnClickListener(this)
deviceReboot2BootloaderBtn.setOnClickListener(this)
SpanUtils.with(aboutDeviceTv)
SpanUtils.with(deviceAboutTv)
.appendLine("isRoot: " + DeviceUtils.isDeviceRooted())
.apply {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
......@@ -68,10 +68,10 @@ class DeviceActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.shutdownBtn -> DeviceUtils.shutdown()
R.id.rebootBtn -> DeviceUtils.reboot()
R.id.reboot2RecoveryBtn -> DeviceUtils.reboot2Recovery()
R.id.reboot2BootloaderBtn -> DeviceUtils.reboot2Bootloader()
R.id.deviceShutdownBtn -> DeviceUtils.shutdown()
R.id.deviceRebootBtn -> DeviceUtils.reboot()
R.id.deviceReboot2RecoveryBtn -> DeviceUtils.reboot2Recovery()
R.id.deviceReboot2BootloaderBtn -> DeviceUtils.reboot2Bootloader()
}
}
}
......@@ -52,7 +52,7 @@ class ImageActivity : BaseActivity() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
saveBtn.setOnClickListener(this)
imageSaveBtn.setOnClickListener(this)
src = ImageUtils.getBitmap(R.drawable.image_lena)
val round = ImageUtils.getBitmap(R.drawable.main_avatar_round)
......@@ -89,8 +89,8 @@ class ImageActivity : BaseActivity() {
add(ImageBean(R.string.image_compress_by_sample_size, ImageUtils.compressBySampleSize(src, 2)))
}
imagesRv.adapter = ImageAdapter(mList, R.layout.item_image)
imagesRv.layoutManager = LinearLayoutManager(this)
imageRv.adapter = ImageAdapter(mList, R.layout.item_image)
imageRv.layoutManager = LinearLayoutManager(this)
}
override fun doBusiness() {
......@@ -99,7 +99,7 @@ class ImageActivity : BaseActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.saveBtn -> {
R.id.imageSaveBtn -> {
val save = ImageUtils.save(src, Config.CACHE_PATH + "lena.jpg", Bitmap.CompressFormat.JPEG)
ToastUtils.showLong(if (save) "successful" else "failed")
}
......
......@@ -44,7 +44,7 @@ class KeyboardActivity : BaseBackActivity() {
keyboardInFragmentBtn.setOnClickListener(this)
KeyboardUtils.registerSoftInputChangedListener(this) { height ->
SpanUtils.with(aboutKeyboardTv)
SpanUtils.with(keyboardAboutTv)
.appendLine("isSoftInputVisible: " + KeyboardUtils.isSoftInputVisible(this@KeyboardActivity))
.append("height: $height")
.create()
......
......@@ -138,16 +138,16 @@ class LogActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_log)
toggleLogBtn.setOnClickListener(this)
toggleConsoleBtn.setOnClickListener(this)
toggleTagBtn.setOnClickListener(this)
toggleHeadBtn.setOnClickListener(this)
toggleBorderBtn.setOnClickListener(this)
toggleSingleBtn.setOnClickListener(this)
toggleFileBtn.setOnClickListener(this)
toggleDirBtn.setOnClickListener(this)
toggleConsoleFilterBtn.setOnClickListener(this)
toggleFileFilterBtn.setOnClickListener(this)
logToggleLogBtn.setOnClickListener(this)
logToggleConsoleBtn.setOnClickListener(this)
logToggleTagBtn.setOnClickListener(this)
logToggleHeadBtn.setOnClickListener(this)
logToggleBorderBtn.setOnClickListener(this)
logToggleSingleBtn.setOnClickListener(this)
logToggleFileBtn.setOnClickListener(this)
logToggleDirBtn.setOnClickListener(this)
logToggleConsoleFilterBtn.setOnClickListener(this)
logToggleFileFilterBtn.setOnClickListener(this)
logNoTagBtn.setOnClickListener(this)
logWithTagBtn.setOnClickListener(this)
logInNewThreadBtn.setOnClickListener(this)
......@@ -172,16 +172,16 @@ class LogActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.toggleLogBtn -> updateConfig(UPDATE_LOG)
R.id.toggleConsoleBtn -> updateConfig(UPDATE_CONSOLE)
R.id.toggleTagBtn -> updateConfig(UPDATE_TAG)
R.id.toggleHeadBtn -> updateConfig(UPDATE_HEAD)
R.id.toggleFileBtn -> updateConfig(UPDATE_FILE)
R.id.toggleDirBtn -> updateConfig(UPDATE_DIR)
R.id.toggleBorderBtn -> updateConfig(UPDATE_BORDER)
R.id.toggleSingleBtn -> updateConfig(UPDATE_SINGLE)
R.id.toggleConsoleFilterBtn -> updateConfig(UPDATE_CONSOLE_FILTER)
R.id.toggleFileFilterBtn -> updateConfig(UPDATE_FILE_FILTER)
R.id.logToggleLogBtn -> updateConfig(UPDATE_LOG)
R.id.logToggleConsoleBtn -> updateConfig(UPDATE_CONSOLE)
R.id.logToggleTagBtn -> updateConfig(UPDATE_TAG)
R.id.logToggleHeadBtn -> updateConfig(UPDATE_HEAD)
R.id.logToggleFileBtn -> updateConfig(UPDATE_FILE)
R.id.logToggleDirBtn -> updateConfig(UPDATE_DIR)
R.id.logToggleBorderBtn -> updateConfig(UPDATE_BORDER)
R.id.logToggleSingleBtn -> updateConfig(UPDATE_SINGLE)
R.id.logToggleConsoleFilterBtn -> updateConfig(UPDATE_CONSOLE_FILTER)
R.id.logToggleFileFilterBtn -> updateConfig(UPDATE_FILE_FILTER)
R.id.logNoTagBtn -> {
LogUtils.v("verbose")
LogUtils.d("debug")
......@@ -206,12 +206,12 @@ class LogActivity : BaseBackActivity() {
}
R.id.logNullBtn -> {
LogUtils.v(null as Any?)
LogUtils.d(null as Any?)
LogUtils.i(null as Any?)
LogUtils.w(null as Any?)
LogUtils.e(null as Any?)
LogUtils.a(null as Any?)
LogUtils.v(null)
LogUtils.d(null)
LogUtils.i(null)
LogUtils.w(null)
LogUtils.e(null)
LogUtils.a(null)
}
R.id.logManyParamsBtn -> {
......@@ -245,8 +245,8 @@ class LogActivity : BaseBackActivity() {
}
R.id.logArrayBtn -> {
LogUtils.e(ONE_D_ARRAY as Any)
LogUtils.e(TWO_D_ARRAY as Any)
LogUtils.e(ONE_D_ARRAY)
LogUtils.e(TWO_D_ARRAY)
}
R.id.logThrowableBtn -> LogUtils.e(THROWABLE)
......@@ -285,7 +285,7 @@ class LogActivity : BaseBackActivity() {
.setSingleTagSwitch(single)
.setConsoleFilter(consoleFilter)
.setFileFilter(fileFilter)
aboutLogTv.text = mConfig.toString()
logAboutTv.text = mConfig.toString()
}
private fun getDir(): String {
......
......@@ -38,7 +38,7 @@ class PathActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_path)
SpanUtils.with(aboutPathTv)
SpanUtils.with(pathAboutTv)
.appendLine("getRootPath: " + PathUtils.getRootPath())
.appendLine("getDataPath: " + PathUtils.getDataPath())
.appendLine("getDownloadCachePath: " + PathUtils.getDownloadCachePath())
......
......@@ -45,10 +45,10 @@ class PermissionActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_permission)
openAppSettingsBtn.setOnClickListener(this)
requestCalendarBtn.setOnClickListener(this)
requestRecordAudioBtn.setOnClickListener(this)
requestCalendarAndRecordAudioBtn.setOnClickListener(this)
permissionOpenAppSettingsBtn.setOnClickListener(this)
permissionRequestCalendarBtn.setOnClickListener(this)
permissionRequestRecordAudioBtn.setOnClickListener(this)
permissionRequestCalendarAndRecordAudioBtn.setOnClickListener(this)
val sb = StringBuilder()
for (s in PermissionUtils.getPermissions()) {
......@@ -68,10 +68,10 @@ class PermissionActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.openAppSettingsBtn -> PermissionUtils.launchAppDetailsSettings()
R.id.requestCalendarBtn -> requestCalendar()
R.id.requestRecordAudioBtn -> requestRecordAudio()
R.id.requestCalendarAndRecordAudioBtn -> requestCalendarAndRecordAudio()
R.id.permissionOpenAppSettingsBtn -> PermissionUtils.launchAppDetailsSettings()
R.id.permissionRequestCalendarBtn -> requestCalendar()
R.id.permissionRequestRecordAudioBtn -> requestRecordAudio()
R.id.permissionRequestCalendarAndRecordAudioBtn -> requestCalendarAndRecordAudio()
}
}
......@@ -137,7 +137,7 @@ class PermissionActivity : BaseBackActivity() {
}
private fun updateAboutPermission() {
SpanUtils.with(aboutPermissionTv)
SpanUtils.with(permissionAboutTv)
.append(permissions).setBold()
.appendLine("READ_CALENDAR: " + PermissionUtils.isGranted(Manifest.permission.READ_CALENDAR))
.appendLine("RECORD_AUDIO: " + PermissionUtils.isGranted(Manifest.permission.RECORD_AUDIO))
......
......@@ -39,14 +39,14 @@ class PhoneActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_phone)
dialBtn.setOnClickListener(this)
callBtn.setOnClickListener(this)
sendSmsBtn.setOnClickListener(this)
sendSmsSilentBtn.setOnClickListener(this)
phoneDialBtn.setOnClickListener(this)
phoneCallBtn.setOnClickListener(this)
phoneSendSmsBtn.setOnClickListener(this)
phoneSendSmsSilentBtn.setOnClickListener(this)
PermissionHelper.requestPhone(
{
SpanUtils.with(aboutPhoneTv)
SpanUtils.with(phoneAboutTv)
.appendLine("isPhone: " + PhoneUtils.isPhone())
.appendLine("getDeviceId: " + PhoneUtils.getDeviceId())
.appendLine("getIMEI: " + PhoneUtils.getIMEI())
......@@ -60,7 +60,7 @@ class PhoneActivity : BaseBackActivity() {
.create()
},
{
SpanUtils.with(aboutPhoneTv)
SpanUtils.with(phoneAboutTv)
.appendLine("isPhone: " + PhoneUtils.isPhone())
.appendLine("getDeviceId: " + "need permission")
.appendLine("getIMEI: " + "need permission")
......@@ -82,10 +82,10 @@ class PhoneActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.dialBtn -> PhoneUtils.dial("10000")
R.id.callBtn -> PermissionHelper.requestPhone { PhoneUtils.call("10000") }
R.id.sendSmsBtn -> PhoneUtils.sendSms("10000", "sendSms")
R.id.sendSmsSilentBtn -> PermissionHelper.requestSms { PhoneUtils.sendSmsSilent("10000", "sendSmsSilent") }
R.id.phoneDialBtn -> PhoneUtils.dial("10000")
R.id.phoneCallBtn -> PermissionHelper.requestPhone { PhoneUtils.call("10000") }
R.id.phoneSendSmsBtn -> PhoneUtils.sendSms("10000", "sendSms")
R.id.phoneSendSmsSilentBtn -> PermissionHelper.requestSms { PhoneUtils.sendSmsSilent("10000", "sendSmsSilent") }
}
}
}
......@@ -45,7 +45,7 @@ class ProcessActivity : BaseBackActivity() {
.appendLine("getAllBackgroundProcesses: " + getSetItems(set))
.appendLine("size: " + set.size)
.appendLine("isMainProcess: " + ProcessUtils.isMainProcess())
.append("getCurrentProcessName: " + ProcessUtils.getCurrentProcessName()!!)
.append("getCurrentProcessName: " + ProcessUtils.getCurrentProcessName())
.create()
}
......
package com.blankj.utilcode.pkg.feature.snackbar;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.text.SpannableStringBuilder;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.blankj.lib.base.BaseBackActivity;
import com.blankj.utilcode.pkg.R;
import com.blankj.utilcode.util.SnackbarUtils;
import com.blankj.utilcode.util.SpanUtils;
import com.blankj.utilcode.util.ToastUtils;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2016/10/17
* desc : demo about SnackbarUtils
* </pre>
*/
public class SnackbarActivity extends BaseBackActivity {
View snackBarRootView;
public static void start(Context context) {
Intent starter = new Intent(context, SnackbarActivity.class);
context.startActivity(starter);
}
@Override
public void initData(@Nullable Bundle bundle) {
}
@Override
public int bindLayout() {
return R.layout.activity_snackbar;
}
@Override
public void initView(Bundle savedInstanceState, @NonNull View contentView) {
setTitle(R.string.demo_snackbar);
snackBarRootView = findViewById(android.R.id.content);
findViewById(R.id.btn_short_snackbar).setOnClickListener(this);
findViewById(R.id.btn_short_snackbar_with_action).setOnClickListener(this);
findViewById(R.id.btn_long_snackbar).setOnClickListener(this);
findViewById(R.id.btn_long_snackbar_with_action).setOnClickListener(this);
findViewById(R.id.btn_indefinite_snackbar).setOnClickListener(this);
findViewById(R.id.btn_indefinite_snackbar_with_action).setOnClickListener(this);
findViewById(R.id.btn_add_view).setOnClickListener(this);
findViewById(R.id.btn_add_view_with_action).setOnClickListener(this);
findViewById(R.id.btn_show_success).setOnClickListener(this);
findViewById(R.id.btn_show_warning).setOnClickListener(this);
findViewById(R.id.btn_show_error).setOnClickListener(this);
findViewById(R.id.btn_dismiss_snackbar).setOnClickListener(this);
}
@Override
public void doBusiness() {
}
@Override
public void onWidgetClick(@NonNull View view) {
int i = view.getId();
if (i == R.id.btn_short_snackbar) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_short))
.setMessageColor(Color.WHITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.show();
} else if (i == R.id.btn_short_snackbar_with_action) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_short))
.setMessageColor(Color.WHITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.setAction(getString(R.string.snackbar_click), Color.YELLOW, new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtils.showShort(getString(R.string.snackbar_click));
}
})
.show();
} else if (i == R.id.btn_long_snackbar) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_long))
.setMessageColor(Color.WHITE)
.setDuration(SnackbarUtils.LENGTH_LONG)
.setBgResource(R.drawable.snackbar_custom_bg)
.show();
} else if (i == R.id.btn_long_snackbar_with_action) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_long))
.setMessageColor(Color.WHITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.setDuration(SnackbarUtils.LENGTH_LONG)
.setAction(getString(R.string.snackbar_click), Color.YELLOW, new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtils.showShort(getString(R.string.snackbar_click));
}
})
.show();
} else if (i == R.id.btn_indefinite_snackbar) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_indefinite))
.setMessageColor(Color.WHITE)
.setDuration(SnackbarUtils.LENGTH_INDEFINITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.show();
} else if (i == R.id.btn_indefinite_snackbar_with_action) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_indefinite))
.setMessageColor(Color.WHITE)
.setDuration(SnackbarUtils.LENGTH_INDEFINITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.setAction(getString(R.string.snackbar_click), Color.YELLOW, new View.OnClickListener() {
@Override
public void onClick(View v) {
ToastUtils.showShort(getString(R.string.snackbar_click));
}
})
.show();
} else if (i == R.id.btn_add_view) {
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
SnackbarUtils.with(snackBarRootView)
.setBgColor(Color.TRANSPARENT)
.setDuration(SnackbarUtils.LENGTH_INDEFINITE)
.show();
SnackbarUtils.addView(R.layout.snackbar_custom, params);
} else if (i == R.id.btn_add_view_with_action) {
ViewGroup.LayoutParams params;
SnackbarUtils.with(snackBarRootView)
.setBgColor(Color.TRANSPARENT)
.setDuration(SnackbarUtils.LENGTH_INDEFINITE)
.show();
params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
SnackbarUtils.addView(R.layout.snackbar_custom, params);
View snackbarView = SnackbarUtils.getView();
if (snackbarView != null) {
TextView tvSnackbarCustom = snackbarView.findViewById(R.id.tv_snackbar_custom);
tvSnackbarCustom.setText("点我可消失");
snackbarView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
SnackbarUtils.dismiss();
}
});
}
} else if (i == R.id.btn_show_success) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_success))
.showSuccess();
} else if (i == R.id.btn_show_warning) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_warning))
.showWarning();
} else if (i == R.id.btn_show_error) {
SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_error))
.showError();
} else if (i == R.id.btn_dismiss_snackbar) {
SnackbarUtils.dismiss();
}
}
private SpannableStringBuilder getMsg(@StringRes int resId) {
return new SpanUtils()
.appendImage(R.mipmap.ic_launcher, SpanUtils.ALIGN_CENTER)
.appendSpace(32)
.append(getString(resId)).setFontSize(24, true)
.create();
}
}
package com.blankj.utilcode.pkg.feature.snackbar
import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.support.annotation.StringRes
import android.text.SpannableStringBuilder
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.blankj.lib.base.BaseBackActivity
import com.blankj.utilcode.pkg.R
import com.blankj.utilcode.util.SnackbarUtils
import com.blankj.utilcode.util.SpanUtils
import com.blankj.utilcode.util.ToastUtils
import kotlinx.android.synthetic.main.activity_snackbar.*
/**
* ```
* author: Blankj
* blog : http://blankj.com
* time : 2016/10/17
* desc : demo about SnackbarUtils
* ```
*/
class SnackbarActivity : BaseBackActivity() {
companion object {
fun start(context: Context) {
val starter = Intent(context, SnackbarActivity::class.java)
context.startActivity(starter)
}
}
private lateinit var snackBarRootView: View
override fun initData(bundle: Bundle?) {
}
override fun bindLayout(): Int {
return R.layout.activity_snackbar
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_snackbar)
snackBarRootView = findViewById(android.R.id.content)
snackbarShowShortBtn.setOnClickListener(this)
snackbarShowShortWithActionBtn.setOnClickListener(this)
snackbarShowLongBtn.setOnClickListener(this)
snackbarShowLongWithActionBtn.setOnClickListener(this)
snackbarShowIndefiniteBtn.setOnClickListener(this)
snackbarShowIndefiniteWithActionBtn.setOnClickListener(this)
snackbarAddViewBtn.setOnClickListener(this)
snackbarAddViewWithActionBtn.setOnClickListener(this)
snackbarShowSuccessBtn.setOnClickListener(this)
snackbarShowWarningBtn.setOnClickListener(this)
snackbarShowErrorBtn.setOnClickListener(this)
snackbarDismissBtn.setOnClickListener(this)
}
override fun doBusiness() {
}
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.snackbarShowShortBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_short))
.setMessageColor(Color.WHITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.show()
R.id.snackbarShowShortWithActionBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_short))
.setMessageColor(Color.WHITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.setAction(getString(R.string.snackbar_click), Color.YELLOW) { ToastUtils.showShort(getString(R.string.snackbar_click)) }
.show()
R.id.snackbarShowLongBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_long))
.setMessageColor(Color.WHITE)
.setDuration(SnackbarUtils.LENGTH_LONG)
.setBgResource(R.drawable.snackbar_custom_bg)
.show()
R.id.snackbarShowLongWithActionBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_long))
.setMessageColor(Color.WHITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.setDuration(SnackbarUtils.LENGTH_LONG)
.setAction(getString(R.string.snackbar_click), Color.YELLOW) { ToastUtils.showShort(getString(R.string.snackbar_click)) }
.show()
R.id.snackbarShowIndefiniteBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_indefinite))
.setMessageColor(Color.WHITE)
.setDuration(SnackbarUtils.LENGTH_INDEFINITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.show()
R.id.snackbarShowIndefiniteWithActionBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_indefinite))
.setMessageColor(Color.WHITE)
.setDuration(SnackbarUtils.LENGTH_INDEFINITE)
.setBgResource(R.drawable.snackbar_custom_bg)
.setAction(getString(R.string.snackbar_click), Color.YELLOW) { ToastUtils.showShort(getString(R.string.snackbar_click)) }
.show()
R.id.snackbarAddViewBtn -> {
val params = ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
SnackbarUtils.with(snackBarRootView)
.setBgColor(Color.TRANSPARENT)
.setDuration(SnackbarUtils.LENGTH_INDEFINITE)
.show()
SnackbarUtils.addView(R.layout.snackbar_custom, params)
}
R.id.snackbarAddViewWithActionBtn -> {
val params: ViewGroup.LayoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT
)
SnackbarUtils.with(snackBarRootView)
.setBgColor(Color.TRANSPARENT)
.setDuration(SnackbarUtils.LENGTH_INDEFINITE)
.show()
SnackbarUtils.addView(R.layout.snackbar_custom, params)
val snackbarView = SnackbarUtils.getView()
if (snackbarView != null) {
val tvSnackbarCustom = snackbarView.findViewById<TextView>(R.id.tv_snackbar_custom)
tvSnackbarCustom.text = "点我可消失"
snackbarView.setOnClickListener { SnackbarUtils.dismiss() }
}
}
R.id.snackbarShowSuccessBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_success))
.showSuccess()
R.id.snackbarShowWarningBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_warning))
.showWarning()
R.id.snackbarShowErrorBtn -> SnackbarUtils.with(snackBarRootView)
.setMessage(getMsg(R.string.snackbar_error))
.showError()
R.id.snackbarDismissBtn -> SnackbarUtils.dismiss()
}
}
private fun getMsg(@StringRes resId: Int): SpannableStringBuilder {
return SpanUtils()
.appendImage(R.mipmap.ic_launcher, SpanUtils.ALIGN_CENTER)
.appendSpace(32)
.append(getString(resId)).setFontSize(24, true)
.create()
}
}
......@@ -19,6 +19,26 @@ import kotlinx.android.synthetic.main.activity_sp.*
*/
class SPStaticActivity : BaseBackActivity() {
companion object {
fun start(context: Context) {
val starter = Intent(context, SPStaticActivity::class.java)
context.startActivity(starter)
}
fun sp2String(): String {
val sb = StringBuilder()
val map = SPStaticUtils.getAll()
for ((key, value) in map) {
sb.append(key)
.append(": ")
.append(value)
.append("\n")
}
return sb.toString()
}
}
override fun initData(bundle: Bundle?) {
}
......@@ -28,12 +48,12 @@ class SPStaticActivity : BaseBackActivity() {
}
override fun initView(savedInstanceState: Bundle?, contentView: View) {
spPutStringBtn.setOnClickListener(this)
spPutIntBtn.setOnClickListener(this)
spPutLongBtn.setOnClickListener(this)
spStaticPutStringBtn.setOnClickListener(this)
spStaticPutIntBtn.setOnClickListener(this)
spStaticPutLongBtn.setOnClickListener(this)
spPutFloatBtn.setOnClickListener(this)
spPutBooleanBtn.setOnClickListener(this)
spClearBtn.setOnClickListener(this)
spStaticPutBooleanBtn.setOnClickListener(this)
spStaticClearBtn.setOnClickListener(this)
}
override fun doBusiness() {
......@@ -42,37 +62,17 @@ class SPStaticActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) {
when (view.id) {
R.id.spPutStringBtn -> SPStaticUtils.put("STRING", "string")
R.id.spPutIntBtn -> SPStaticUtils.put("INT", 21)
R.id.spPutLongBtn -> SPStaticUtils.put("LONG", java.lang.Long.MAX_VALUE)
R.id.spStaticPutStringBtn -> SPStaticUtils.put("STRING", "string")
R.id.spStaticPutIntBtn -> SPStaticUtils.put("INT", 21)
R.id.spStaticPutLongBtn -> SPStaticUtils.put("LONG", java.lang.Long.MAX_VALUE)
R.id.spPutFloatBtn -> SPStaticUtils.put("FLOAT", Math.PI.toFloat())
R.id.spPutBooleanBtn -> SPStaticUtils.put("BOOLEAN", true)
R.id.spClearBtn -> SPStaticUtils.clear()
R.id.spStaticPutBooleanBtn -> SPStaticUtils.put("BOOLEAN", true)
R.id.spStaticClearBtn -> SPStaticUtils.clear()
}
updateAboutSp()
}
private fun updateAboutSp() {
aboutSpTv!!.text = sp2String()
}
companion object {
fun start(context: Context) {
val starter = Intent(context, SPStaticActivity::class.java)
context.startActivity(starter)
}
fun sp2String(): String {
val sb = StringBuilder()
val map = SPStaticUtils.getAll()
for ((key, value) in map) {
sb.append(key)
.append(": ")
.append(value)
.append("\n")
}
return sb.toString()
}
spStaticAboutTv.text = sp2String()
}
}
......@@ -42,21 +42,15 @@ class SpanActivity : BaseBackActivity() {
private var lineHeight: Int = 0
private var textSize: Float = 0f
private var valueAnimator: ValueAnimator? = null
private lateinit var valueAnimator: ValueAnimator
private lateinit var mShader: Shader
private var mShaderWidth: Float = 0f
private lateinit var matrix: Matrix
private lateinit var mBlurMaskFilterSpan: BlurMaskFilterSpan
private lateinit var mShadowSpan: ShadowSpan
private lateinit var mForegroundAlphaColorSpan: ForegroundAlphaColorSpan
private lateinit var mForegroundAlphaColorSpanGroup: ForegroundAlphaColorSpanGroup
private lateinit var mPrinterString: String
internal var density: Float = 0f
override fun initData(bundle: Bundle?) {
......@@ -81,14 +75,14 @@ class SpanActivity : BaseBackActivity() {
}
}
lineHeight = aboutSpanTv.lineHeight
textSize = aboutSpanTv.textSize
lineHeight = spanAboutTv.lineHeight
textSize = spanAboutTv.textSize
density = resources.displayMetrics.density
// initAnimSpan();
// startAnim();
SpanUtils.with(aboutSpanTv)
SpanUtils.with(spanAboutTv)
.appendLine("SpanUtils").setBackgroundColor(Color.LTGRAY).setBold().setForegroundColor(Color.YELLOW).setHorizontalAlign(Layout.Alignment.ALIGN_CENTER)
.appendLine("前景色").setForegroundColor(Color.GREEN)
.appendLine("背景色").setBackgroundColor(Color.LTGRAY)
......@@ -198,7 +192,7 @@ class SpanActivity : BaseBackActivity() {
private fun startAnim() {
valueAnimator = ValueAnimator.ofFloat(0f, 1f)
valueAnimator!!.addUpdateListener { animation ->
valueAnimator.addUpdateListener { animation ->
// shader
matrix.reset()
matrix.setTranslate(animation.animatedValue as Float * mShaderWidth, 0f)
......@@ -218,13 +212,13 @@ class SpanActivity : BaseBackActivity() {
mForegroundAlphaColorSpanGroup.alpha = animation.animatedValue as Float
// update
aboutAnimSpanTv.text = animSsb
spanAboutAnimTv.text = animSsb
}
valueAnimator!!.interpolator = LinearInterpolator()
valueAnimator!!.duration = (600 * 3).toLong()
valueAnimator!!.repeatCount = ValueAnimator.INFINITE
valueAnimator!!.start()
valueAnimator.interpolator = LinearInterpolator()
valueAnimator.duration = (600 * 3).toLong()
valueAnimator.repeatCount = ValueAnimator.INFINITE
valueAnimator.start()
}
override fun doBusiness() {
......@@ -236,8 +230,8 @@ class SpanActivity : BaseBackActivity() {
}
override fun onDestroy() {
if (valueAnimator != null && valueAnimator!!.isRunning) {
valueAnimator!!.cancel()
if (valueAnimator.isRunning) {
valueAnimator.cancel()
}
super.onDestroy()
}
......
......@@ -42,16 +42,16 @@ class ToastActivity : BaseBackActivity() {
override fun initView(savedInstanceState: Bundle?, contentView: View) {
setTitle(R.string.demo_toast)
showShortToastBtn.setOnClickListener(this)
showLongToastBtn.setOnClickListener(this)
showGreenFontBtn.setOnClickListener(this)
showBgColorBtn.setOnClickListener(this)
showBgResourceBtn.setOnClickListener(this)
showSpanBtn.setOnClickListener(this)
showCustomViewBtn.setOnClickListener(this)
showMiddleBtn.setOnClickListener(this)
cancelToastBtn.setOnClickListener(this)
showToastDialogBtn.setOnClickListener(this)
toastShowShortBtn.setOnClickListener(this)
toastShowLongBtn.setOnClickListener(this)
toastShowGreenFontBtn.setOnClickListener(this)
toastShowBgColorBtn.setOnClickListener(this)
toastShowBgResourceBtn.setOnClickListener(this)
toastShowSpanBtn.setOnClickListener(this)
toastShowCustomViewBtn.setOnClickListener(this)
toastShowMiddleBtn.setOnClickListener(this)
toastCancelBtn.setOnClickListener(this)
toastShowToastDialogBtn.setOnClickListener(this)
}
override fun doBusiness() {
......@@ -61,35 +61,35 @@ class ToastActivity : BaseBackActivity() {
override fun onWidgetClick(view: View) {
resetToast()
when (view.id) {
R.id.showShortToastBtn -> Thread(Runnable { ToastUtils.showShort(R.string.toast_short) }).start()
R.id.showLongToastBtn -> Thread(Runnable { ToastUtils.showLong(R.string.toast_long) }).start()
R.id.showGreenFontBtn -> {
R.id.toastShowShortBtn -> Thread(Runnable { ToastUtils.showShort(R.string.toast_short) }).start()
R.id.toastShowLongBtn -> Thread(Runnable { ToastUtils.showLong(R.string.toast_long) }).start()
R.id.toastShowGreenFontBtn -> {
ToastUtils.setMsgColor(Color.GREEN)
ToastUtils.showLong(R.string.toast_green_font)
}
R.id.showBgColorBtn -> {
R.id.toastShowBgColorBtn -> {
ToastUtils.setBgColor(ContextCompat.getColor(this, R.color.colorAccent))
ToastUtils.showLong(R.string.toast_bg_color)
}
R.id.showBgResourceBtn -> {
R.id.toastShowBgResourceBtn -> {
ToastUtils.setBgResource(R.drawable.toast_shape_round_rect)
ToastUtils.showLong(R.string.toast_custom_bg)
}
R.id.showSpanBtn -> ToastUtils.showLong(
R.id.toastShowSpanBtn -> ToastUtils.showLong(
SpanUtils()
.appendImage(R.mipmap.ic_launcher, SpanUtils.ALIGN_CENTER)
.appendSpace(32)
.append(getString(R.string.toast_span)).setFontSize(24, true)
.create()
)
R.id.showCustomViewBtn -> Thread(Runnable { CustomToast.showLong(R.string.toast_custom_view) }).start()
R.id.showMiddleBtn -> {
R.id.toastShowCustomViewBtn -> Thread(Runnable { CustomToast.showLong(R.string.toast_custom_view) }).start()
R.id.toastShowMiddleBtn -> {
ToastUtils.setGravity(Gravity.CENTER, 0, 0)
ToastUtils.showLong(R.string.toast_middle)
}
R.id.cancelToastBtn -> ToastUtils.cancel()
R.id.showToastDialogBtn -> DialogHelper.showToastDialog()
R.id.toastCancelBtn -> ToastUtils.cancel()
R.id.toastShowToastDialogBtn -> DialogHelper.showToastDialog()
}
}
......
......@@ -20,7 +20,6 @@ import kotlinx.android.synthetic.main.activity_vibrate.*
class VibrateActivity : BaseBackActivity() {
companion object {
fun start(context: Context) {
val starter = Intent(context, VibrateActivity::class.java)
context.startActivity(starter)
......
......@@ -47,19 +47,6 @@ object DialogHelper {
.show()
}
fun showAdaptScreenDialog() {
val topActivity = ActivityUtils.getTopActivity()
if (topActivity == null || topActivity.isFinishing) return
AlertDialog.Builder(topActivity)
.setTitle(android.R.string.dialog_alert_title)
.setMessage("Message!")
.setPositiveButton(android.R.string.ok) { dialog, which -> }
.setNegativeButton(android.R.string.cancel) { dialog, which -> }
.setCancelable(false)
.create()
.show()
}
fun showKeyboardDialog() {
val topActivity = ActivityUtils.getTopActivity()
if (topActivity == null || topActivity.isFinishing) return
......
......@@ -6,7 +6,7 @@
android:viewportHeight="1024">
<path
android:fillColor="#000000"
android:fillColor="#FFFFFFFF"
android:pathData="M811.008 335.872c-2.048-7.168-11.264-9.216-17.408-4.096L690.176 435.2c-8.192
8.192-20.48 8.192-28.672 0l-72.704-72.704c-8.192-8.192-8.192-20.48
0-28.672l104.448-104.448c5.12-5.12
......
......@@ -8,7 +8,7 @@
android:padding="@dimen/spacing_16">
<TextView
android:id="@+id/aboutNavTv"
android:id="@+id/barNavAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......
......@@ -8,7 +8,7 @@
android:padding="@dimen/spacing_16">
<Button
android:id="@+id/showNotificationBtn"
android:id="@+id/barNotificationShowBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -8,7 +8,7 @@
android:padding="@dimen/spacing_16">
<TextView
android:id="@+id/aboutStatusTv"
android:id="@+id/barStatusAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......
......@@ -6,7 +6,6 @@
android:background="@drawable/bar_status_alpha_bg">
<LinearLayout
android:id="@+id/containerLl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
......@@ -15,14 +14,14 @@
android:paddingRight="@dimen/spacing_16">
<TextView
android:id="@+id/statusAlphaTv"
android:id="@+id/barStatusAlphaAboutTv"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<SeekBar
android:id="@+id/changeAlphaSb"
android:id="@+id/barStatusAlphaChangeAlphaSb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255"
......@@ -30,7 +29,7 @@
android:progress="112" />
<Button
android:id="@+id/setTransparentBtn"
android:id="@+id/barStatusAlphaSetTransparentBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -14,14 +14,14 @@
android:paddingRight="@dimen/spacing_16">
<TextView
android:id="@+id/statusColorTv"
android:id="@+id/barStatusColorAboutTv"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<Button
android:id="@+id/randomColorBtn"
android:id="@+id/barStatusColorRandomColorBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -5,7 +5,7 @@
android:layout_height="wrap_content">
<View
android:id="@+id/fakeStatusBar"
android:id="@+id/barStatusDrawerFakeStatusBar"
android:layout_width="match_parent"
android:layout_height="0dp" />
......@@ -18,7 +18,7 @@
android:paddingRight="@dimen/spacing_16">
<CheckBox
android:id="@+id/alphaCb"
android:id="@+id/barStatusDrawerAlphaCb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
......@@ -26,7 +26,7 @@
android:text="@string/bar_status_title_alpha" />
<CheckBox
android:id="@+id/frontCb"
android:id="@+id/barStatusDrawerFrontCb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
......@@ -34,14 +34,14 @@
android:text="@string/bar_status_is_front" />
<TextView
android:id="@+id/statusAboutTv"
android:id="@+id/barStatusDrawerAboutTv"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<SeekBar
android:id="@+id/changeAlphaSb"
android:id="@+id/barStatusAlphaChangeAlphaSb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255"
......@@ -49,14 +49,14 @@
android:progress="112" />
<Button
android:id="@+id/randomColorBtn"
android:id="@+id/barStatusAlphaRandomColorBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/bar_status_random_color" />
<Button
android:id="@+id/setTransparentBtn"
android:id="@+id/barStatusAlphaSetTransparentBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -8,7 +8,7 @@
android:orientation="vertical">
<android.support.v4.view.ViewPager
android:id="@+id/statusBarVp"
android:id="@+id/barStatusFragmentVp"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
......@@ -16,7 +16,7 @@
android:overScrollMode="never" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/statusBarNav"
android:id="@+id/barStatusFragmentNav"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
......
......@@ -25,14 +25,14 @@
android:paddingRight="@dimen/spacing_16">
<TextView
android:id="@+id/statusAlphaTv"
android:id="@+id/barStatusImageViewAboutTv"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<SeekBar
android:id="@+id/changeAlphaSb"
android:id="@+id/barStatusImageViewChangeAlphaSb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255"
......@@ -40,7 +40,7 @@
android:progress="112" />
<Button
android:id="@+id/setTransparentBtn"
android:id="@+id/barStatusImageViewSetTransparentBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/containerLl"
android:id="@+id/barStatusSwipeBackContainerLl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
......@@ -9,7 +9,7 @@
android:orientation="vertical">
<CheckBox
android:id="@+id/alphaCb"
android:id="@+id/barStatusSwipeBackAlphaCb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
......@@ -17,14 +17,14 @@
android:text="@string/bar_status_title_alpha" />
<TextView
android:id="@+id/statusAboutTv"
android:id="@+id/barStatusSwipeBackAboutTv"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<SeekBar
android:id="@+id/changeAlphaSb"
android:id="@+id/barStatusSwipeBackChangeAlphaSb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/spacing_16"
......@@ -34,7 +34,7 @@
android:progress="112" />
<Button
android:id="@+id/randomColorBtn"
android:id="@+id/barStatusSwipeBackRandomColorBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -43,7 +43,7 @@
android:text="@string/bar_status_random_color" />
<Button
android:id="@+id/setTransparentBtn"
android:id="@+id/barStatusSwipeBackSetTransparentBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -8,34 +8,34 @@
android:padding="@dimen/spacing_16">
<TextView
android:id="@+id/aboutDeviceTv"
android:id="@+id/deviceAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/shutdownBtn"
android:id="@+id/deviceShutdownBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/device_shutdown" />
<Button
android:id="@+id/rebootBtn"
android:id="@+id/deviceRebootBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/device_reboot" />
<Button
android:id="@+id/reboot2RecoveryBtn"
android:id="@+id/deviceReboot2RecoveryBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/device_reboot_to_recovery" />
<Button
android:id="@+id/reboot2BootloaderBtn"
android:id="@+id/deviceReboot2BootloaderBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -8,14 +8,14 @@
android:padding="@dimen/spacing_16">
<Button
android:id="@+id/saveBtn"
android:id="@+id/imageSaveBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/image_save" />
<android.support.v7.widget.RecyclerView
android:id="@+id/imagesRv"
android:id="@+id/imageRv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
......
......@@ -11,7 +11,7 @@
android:padding="@dimen/spacing_16">
<TextView
android:id="@+id/aboutKeyboardTv"
android:id="@+id/keyboardAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......@@ -21,7 +21,7 @@
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/aboutKeyboardTv"
android:layout_below="@id/keyboardAboutTv"
android:text="@string/keyboard_hide_soft_input" />
<Button
......
......@@ -8,76 +8,76 @@
android:padding="@dimen/spacing_16">
<TextView
android:id="@+id/aboutLogTv"
android:id="@+id/logAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/toggleLogBtn"
android:id="@+id/logToggleLogBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_log" />
<Button
android:id="@+id/toggleConsoleBtn"
android:id="@+id/logToggleConsoleBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_console" />
<Button
android:id="@+id/toggleTagBtn"
android:id="@+id/logToggleTagBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_tag" />
<Button
android:id="@+id/toggleHeadBtn"
android:id="@+id/logToggleHeadBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_head" />
<Button
android:id="@+id/toggleFileBtn"
android:id="@+id/logToggleFileBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_file" />
<Button
android:id="@+id/toggleDirBtn"
android:id="@+id/logToggleDirBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_dir" />
<Button
android:id="@+id/toggleBorderBtn"
android:id="@+id/logToggleBorderBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_border" />
<Button
android:id="@+id/toggleSingleBtn"
android:id="@+id/logToggleSingleBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_single" />
<Button
android:id="@+id/toggleConsoleFilterBtn"
android:id="@+id/logToggleConsoleFilterBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/log_toggle_console_filter" />
<Button
android:id="@+id/toggleFileFilterBtn"
android:id="@+id/logToggleFileFilterBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -8,7 +8,7 @@
android:padding="@dimen/spacing_16">
<TextView
android:id="@+id/aboutPathTv"
android:id="@+id/pathAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
......
......@@ -8,34 +8,34 @@
android:padding="@dimen/spacing_16">
<TextView
android:id="@+id/aboutPermissionTv"
android:id="@+id/permissionAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/openAppSettingsBtn"
android:id="@+id/permissionOpenAppSettingsBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/permission_open_app_settings" />
<Button
android:id="@+id/requestCalendarBtn"
android:id="@+id/permissionRequestCalendarBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/permission_request_calendar" />
<Button
android:id="@+id/requestRecordAudioBtn"
android:id="@+id/permissionRequestRecordAudioBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/permission_request_record_audio" />
<Button
android:id="@+id/requestCalendarAndRecordAudioBtn"
android:id="@+id/permissionRequestCalendarAndRecordAudioBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -8,34 +8,34 @@
android:padding="@dimen/spacing_16">
<TextView
android:id="@+id/aboutPhoneTv"
android:id="@+id/phoneAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/dialBtn"
android:id="@+id/phoneDialBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/phone_dial" />
<Button
android:id="@+id/callBtn"
android:id="@+id/phoneCallBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/phone_call" />
<Button
android:id="@+id/sendSmsBtn"
android:id="@+id/phoneSendSmsBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/phone_send_sms" />
<Button
android:id="@+id/sendSmsSilentBtn"
android:id="@+id/phoneSendSmsSilentBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -11,77 +11,77 @@
android:paddingTop="@dimen/spacing_16">
<Button
android:id="@+id/btn_short_snackbar"
android:id="@+id/snackbarShowShortBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_show_short" />
<Button
android:id="@+id/btn_short_snackbar_with_action"
android:id="@+id/snackbarShowShortWithActionBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_show_short_with_action" />
<Button
android:id="@+id/btn_long_snackbar"
android:id="@+id/snackbarShowLongBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_show_long" />
<Button
android:id="@+id/btn_long_snackbar_with_action"
android:id="@+id/snackbarShowLongWithActionBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_show_long_with_action" />
<Button
android:id="@+id/btn_indefinite_snackbar"
android:id="@+id/snackbarShowIndefiniteBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_show_indefinite" />
<Button
android:id="@+id/btn_indefinite_snackbar_with_action"
android:id="@+id/snackbarShowIndefiniteWithActionBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_show_indefinite_with_action" />
<Button
android:id="@+id/btn_add_view"
android:id="@+id/snackbarAddViewBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_add_view" />
<Button
android:id="@+id/btn_add_view_with_action"
android:id="@+id/snackbarAddViewWithActionBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_add_view_with_action" />
<Button
android:id="@+id/btn_show_success"
android:id="@+id/snackbarShowSuccessBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_show_success" />
<Button
android:id="@+id/btn_show_warning"
android:id="@+id/snackbarShowWarningBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/snackbar_show_warning" />
<Button
android:id="@+id/btn_show_error"
android:id="@+id/snackbarShowErrorBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -89,7 +89,7 @@
<Button
android:id="@+id/btn_dismiss_snackbar"
android:id="@+id/snackbarDismissBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -11,27 +11,27 @@
android:paddingTop="@dimen/spacing_16">
<TextView
android:id="@+id/aboutSpTv"
android:id="@+id/spStaticAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/spPutStringBtn"
android:id="@+id/spStaticPutStringBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sp_put_string" />
<Button
android:id="@+id/spPutIntBtn"
android:id="@+id/spStaticPutIntBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sp_put_int" />
<Button
android:id="@+id/spPutLongBtn"
android:id="@+id/spStaticPutLongBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -45,14 +45,14 @@
android:text="@string/sp_put_float" />
<Button
android:id="@+id/spPutBooleanBtn"
android:id="@+id/spStaticPutBooleanBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sp_put_boolean" />
<Button
android:id="@+id/spClearBtn"
android:id="@+id/spStaticClearBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -8,8 +8,7 @@
android:padding="@dimen/spacing_16">
<TextView
android:background="@color/light_black"
android:id="@+id/aboutAnimSpanTv"
android:id="@+id/spanAboutAnimTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......@@ -17,7 +16,7 @@
android:layerType="software" />
<TextView
android:id="@+id/aboutSpanTv"
android:id="@+id/spanAboutTv"
style="@style/TextStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -8,70 +8,70 @@
android:padding="@dimen/spacing_16">
<Button
android:id="@+id/showShortToastBtn"
android:id="@+id/toastShowShortBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_show_short" />
<Button
android:id="@+id/showLongToastBtn"
android:id="@+id/toastShowLongBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_show_long" />
<Button
android:id="@+id/showGreenFontBtn"
android:id="@+id/toastShowGreenFontBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_show_green_font" />
<Button
android:id="@+id/showBgColorBtn"
android:id="@+id/toastShowBgColorBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_show_bg_color" />
<Button
android:id="@+id/showBgResourceBtn"
android:id="@+id/toastShowBgResourceBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_show_bg_resource" />
<Button
android:id="@+id/showSpanBtn"
android:id="@+id/toastShowSpanBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_show_span" />
<Button
android:id="@+id/showCustomViewBtn"
android:id="@+id/toastShowCustomViewBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_show_custom_view" />
<Button
android:id="@+id/showMiddleBtn"
android:id="@+id/toastShowMiddleBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_show_middle" />
<Button
android:id="@+id/cancelToastBtn"
android:id="@+id/toastCancelBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/toast_cancel" />
<Button
android:id="@+id/showToastDialogBtn"
android:id="@+id/toastShowToastDialogBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -7,7 +7,7 @@
android:orientation="vertical">
<View
android:id="@+id/fakeStatusBar"
android:id="@+id/barStatusAlphaFragmentFakeStatusBar"
android:layout_width="match_parent"
android:layout_height="0dp" />
......@@ -20,14 +20,14 @@
android:paddingRight="@dimen/spacing_16">
<TextView
android:id="@+id/statusAlphaTv"
android:id="@+id/barStatusAlphaFragmentAboutTv"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<SeekBar
android:id="@+id/changeAlphaSb"
android:id="@+id/barStatusAlphaFragmentChangeAlphaSb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255"
......@@ -35,7 +35,7 @@
android:progress="112" />
<Button
android:id="@+id/setTransparentBtn"
android:id="@+id/barStatusAlphaFragmentSetTransparentBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -6,7 +6,7 @@
android:orientation="vertical">
<View
android:id="@+id/fakeStatusBar"
android:id="@+id/barStatusColorFragmentFakeStatusBar"
android:layout_width="match_parent"
android:layout_height="0dp" />
......@@ -19,14 +19,14 @@
android:paddingRight="@dimen/spacing_16">
<TextView
android:id="@+id/statusColorTv"
android:id="@+id/barStatusColorFragmentAboutColorTv"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<Button
android:id="@+id/randomColorBtn"
android:id="@+id/barStatusColorFragmentRandomColorBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -6,7 +6,7 @@
android:orientation="vertical">
<View
android:id="@+id/fakeStatusBar"
android:id="@+id/barStatusCustomFragmentFakeStatusBar"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@drawable/bar_status_custom" />
......
......@@ -5,35 +5,35 @@
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_header"
android:id="@+id/barStatusImageViewFragmentHeaderIv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/image_lena" />
<View
android:id="@+id/fakeStatusBar"
android:id="@+id/barStatusImageViewFragmentFakeStatusBar"
android:layout_width="match_parent"
android:layout_height="0dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/iv_header"
android:layout_below="@+id/barStatusImageViewFragmentHeaderIv"
android:gravity="center_horizontal"
android:orientation="vertical"
android:paddingLeft="@dimen/spacing_16"
android:paddingRight="@dimen/spacing_16">
<TextView
android:id="@+id/statusAlphaTv"
android:id="@+id/barStatusImageViewFragmentAboutTv"
style="@style/TextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" />
<SeekBar
android:id="@+id/changeAlphaSb"
android:id="@+id/barStatusImageViewFragmentChangeAlphaSb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="255"
......@@ -41,7 +41,7 @@
android:progress="112" />
<Button
android:id="@+id/setTransparentBtn"
android:id="@+id/barStatusImageViewFragmentSetTransparentBtn"
style="@style/WideBtnStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
......
......@@ -2,22 +2,22 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/navigation_color"
android:id="@+id/barStatusFragmentNavigationColor"
android:icon="@drawable/bar_status_nav_color"
android:title="@string/bar_status_title_color" />
<item
android:id="@+id/navigation_alpha"
android:id="@+id/barStatusFragmentNavigationAlpha"
android:icon="@drawable/bar_status_nav_alpha"
android:title="@string/bar_status_title_alpha" />
<item
android:id="@+id/navigation_image_view"
android:id="@+id/barStatusFragmentNavigationImageView"
android:icon="@drawable/bar_status_nav_image"
android:title="@string/bar_status_title_image_view" />
<item
android:id="@+id/navigation_custom"
android:id="@+id/barStatusFragmentNavigationCustom"
android:icon="@drawable/bar_status_nav_custom"
android:title="@string/bar_status_title_custom" />
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册