Skip to content

Commit 5cada7e

Browse files
authored
Merge pull request Blankj#843 from Blankj/1.23.5
1.23.5
2 parents 64fa78a + a799db2 commit 5cada7e

File tree

10,496 files changed

+1140955
-919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

10,496 files changed

+1140955
-919
lines changed

README-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.4-brightgreen.svg
44+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.5-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

4747
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.4-brightgreen.svg
44+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.23.5-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

4747
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

config.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ ext {
55
compileSdkVersion = 27
66
minSdkVersion = 14
77
targetSdkVersion = 27
8-
versionCode = 1_023_004
9-
versionName = '1.23.4'// E.g. 1.9.72 => 1,009,072
8+
versionCode = 1_023_005
9+
versionName = '1.23.5'// E.g. 1.9.72 => 1,009,072
1010

1111
bus = [
1212
isDebug: false,

launcher/pkg/src/main/java/com/blankj/launcher/pkg/MainActivity.kt

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ import kotlinx.android.synthetic.main.activity_main.*
2222
*/
2323
class MainActivity : BaseDrawerActivity() {
2424

25-
override fun initData(bundle: Bundle?) {
26-
27-
}
25+
override fun initData(bundle: Bundle?) {}
2826

2927
override fun bindLayout(): Int {
3028
return R.layout.activity_main
@@ -53,17 +51,11 @@ class MainActivity : BaseDrawerActivity() {
5351
launcherMainSubUtilBtn.setOnClickListener {
5452
BusUtils.post<Any>("SubUtilActivity#start", this)
5553
}
56-
// getWindow().setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE);
57-
5854
}
5955

60-
override fun doBusiness() {
56+
override fun doBusiness() {}
6157

62-
}
63-
64-
override fun onWidgetClick(view: View) {
65-
66-
}
58+
override fun onWidgetClick(view: View) {}
6759

6860
override fun onBackPressed() {
6961
ActivityUtils.startHomeActivity()

launcher/pkg/src/main/java/com/blankj/launcher/pkg/SplashActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ import android.view.View
55
import com.blankj.lib.base.BaseActivity
66

77
class SplashActivity : BaseActivity() {
8+
override fun isSwipeBack(): Boolean {
9+
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
10+
}
11+
812
override fun initData(bundle: Bundle?) {
913
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
1014
}

lib/base/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ dependencies {
1515
api dep.free_proguard
1616
api 'com.r0adkll:slidableactivity:2.0.5'
1717
compileOnly dep.leakcanary.android_no_op
18-
// api 'com.blankj:utilcode:1.23.4'
18+
// api 'com.blankj:utilcode:1.23.5'
1919
}

lib/base/src/main/java/com/blankj/lib/base/BaseActivity.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import android.os.Bundle
55
import android.support.v7.app.AppCompatActivity
66
import android.view.LayoutInflater
77
import android.view.View
8-
import com.blankj.utilcode.util.*
8+
import com.blankj.utilcode.util.AntiShakeUtils
9+
import com.blankj.utilcode.util.AppUtils
10+
import com.blankj.utilcode.util.ToastUtils
11+
import com.blankj.utilcode.util.Utils
12+
import com.r0adkll.slidr.Slidr
913

1014
/**
1115
* ```
@@ -20,13 +24,19 @@ abstract class BaseActivity : AppCompatActivity(), IBaseView {
2024
protected lateinit var mContentView: View
2125
protected lateinit var mActivity: Activity
2226

27+
abstract fun isSwipeBack(): Boolean
28+
2329
override fun onCreate(savedInstanceState: Bundle?) {
2430
mActivity = this
2531
super.onCreate(savedInstanceState)
2632
initData(intent.extras)
2733
setRootLayout(bindLayout())
2834
initView(savedInstanceState, mContentView)
2935
doBusiness()
36+
37+
if (isSwipeBack()) {
38+
Slidr.attach(this)
39+
}
3040
AppUtils.registerAppStatusChangedListener(this, object : Utils.OnAppStatusChangedListener {
3141
override fun onForeground() {
3242
ToastUtils.showShort("foreground")
@@ -53,6 +63,5 @@ abstract class BaseActivity : AppCompatActivity(), IBaseView {
5363
override fun onDestroy() {
5464
super.onDestroy()
5565
AppUtils.unregisterAppStatusChangedListener(this)
56-
KeyboardUtils.fixSoftInputLeaks(this);
5766
}
5867
}

lib/base/src/main/java/com/blankj/lib/base/BaseDrawerActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ abstract class BaseDrawerActivity : BaseActivity() {
2323
protected lateinit var mBaseDrawerRootLayout: DrawerLayout
2424
protected lateinit var mBaseDrawerContainerView: FrameLayout
2525

26+
override fun isSwipeBack(): Boolean {
27+
return false
28+
}
29+
2630
override fun setRootLayout(layoutId: Int) {
2731
super.setRootLayout(R.layout.activity_drawer)
2832
if (layoutId > 0) {

lib/base/src/main/java/com/blankj/lib/base/BaseLazyFragment.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ abstract class BaseLazyFragment : BaseFragment() {
3030
}
3131

3232
override fun doBusiness() {
33-
if (userVisibleHint) {
33+
if (userVisibleHint && !isDataLoaded) {
3434
doLazyBusiness()
3535
isDataLoaded = true
3636
}
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
package com.blankj.lib.base
22

3-
import android.support.annotation.StringRes
4-
import android.support.v4.content.ContextCompat
53
import android.view.LayoutInflater
64
import android.view.MenuItem
75
import com.blankj.utilcode.util.BarUtils
8-
import com.blankj.utilcode.util.Utils
9-
import com.r0adkll.slidr.Slidr
6+
import com.blankj.utilcode.util.ColorUtils
107
import kotlinx.android.synthetic.main.activity_back.*
118

129
/**
1310
* ```
1411
* author: blankj
1512
* blog : http://blankj.com
1613
* time : 2018/11/16
17-
* desc : base about back activity
14+
* desc : base about title bar activity
1815
* ```
1916
*/
20-
abstract class BaseBackActivity : BaseActivity() {
17+
abstract class BaseTitleBarActivity : BaseActivity() {
18+
19+
abstract fun bindTitle(): CharSequence
2120

2221
override fun setRootLayout(layoutId: Int) {
2322
super.setRootLayout(R.layout.activity_back)
24-
Slidr.attach(this)
2523
if (layoutId > 0) {
2624
LayoutInflater.from(this).inflate(layoutId, baseBackContainerView)
2725
}
2826
setSupportActionBar(baseBackToolbar)
2927
supportActionBar?.setDisplayHomeAsUpEnabled(true)
3028

31-
BarUtils.setStatusBarColor(this, ContextCompat.getColor(Utils.getApp(), R.color.colorPrimary))
29+
BarUtils.setStatusBarColor(this, ColorUtils.getColor(R.color.colorPrimary))
3230
BarUtils.addMarginTopEqualStatusBarHeight(baseBackRootLayout)
31+
32+
supportActionBar?.title = bindTitle()
3333
}
3434

3535
override fun onOptionsItemSelected(item: MenuItem): Boolean {
@@ -39,7 +39,7 @@ abstract class BaseBackActivity : BaseActivity() {
3939
return super.onOptionsItemSelected(item)
4040
}
4141

42-
override fun setTitle(@StringRes resId: Int) {
43-
supportActionBar?.title = getString(resId)
42+
override fun isSwipeBack(): Boolean {
43+
return true
4444
}
4545
}

lib/base/src/main/res/layout/activity_back.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
</android.support.design.widget.AppBarLayout>
2222

2323
<android.support.v4.widget.NestedScrollView
24+
android:id="@+id/baseBackNsv"
2425
android:layout_width="match_parent"
2526
android:layout_height="match_parent"
2627
app:layout_behavior="@string/appbar_scrolling_view_behavior">

subutil/lib/src/main/java/com/blankj/subutil/util/HttpsUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Create by MilkZS on 2019/1/9 13:36
1212
*/
13-
public class HttpsUtil {
13+
public final class HttpsUtil {
1414

1515
private static final int CONNECT_TIMEOUT_TIME = 15000;
1616
private static final int READ_TIMEOUT_TIME = 19000;

subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/SubUtilActivity.kt

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import android.content.Context
44
import android.content.Intent
55
import android.os.Bundle
66
import android.view.View
7-
import com.blankj.lib.base.BaseBackActivity
7+
import com.blankj.lib.base.BaseTitleBarActivity
88
import com.blankj.subutil.pkg.R
99
import com.blankj.subutil.pkg.feature.location.LocationActivity
1010
import com.blankj.subutil.pkg.feature.pinyin.PinyinActivity
@@ -18,7 +18,7 @@ import com.blankj.utilcode.util.BusUtils
1818
* desc : MainActivity
1919
* ```
2020
*/
21-
class SubUtilActivity : BaseBackActivity() {
21+
class SubUtilActivity : BaseTitleBarActivity() {
2222

2323
companion object {
2424
@BusUtils.Subscribe(name = "SubUtilActivity#start")
@@ -28,25 +28,21 @@ class SubUtilActivity : BaseBackActivity() {
2828
}
2929
}
3030

31-
override fun initData(bundle: Bundle?) {
32-
31+
override fun bindTitle(): CharSequence {
32+
return getString(R.string.sub_util)
3333
}
3434

35+
override fun initData(bundle: Bundle?) {}
36+
3537
override fun bindLayout(): Int {
3638
return R.layout.activity_util_sub
3739
}
3840

39-
override fun initView(savedInstanceState: Bundle?, contentView: View) {
40-
setTitle(R.string.sub_util)
41-
}
41+
override fun initView(savedInstanceState: Bundle?, contentView: View) {}
4242

43-
override fun doBusiness() {
43+
override fun doBusiness() {}
4444

45-
}
46-
47-
override fun onWidgetClick(view: View) {
48-
49-
}
45+
override fun onWidgetClick(view: View) {}
5046

5147
fun locationClick(view: View) {
5248
LocationActivity.start(this)

subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/location/LocationActivity.kt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import android.content.ServiceConnection
77
import android.os.Bundle
88
import android.os.IBinder
99
import android.view.View
10-
import com.blankj.lib.base.BaseBackActivity
10+
import com.blankj.lib.base.BaseTitleBarActivity
1111
import com.blankj.subutil.pkg.R
1212
import com.blankj.subutil.pkg.helper.PermissionHelper
1313
import com.blankj.utilcode.util.SpanUtils
@@ -21,7 +21,7 @@ import kotlinx.android.synthetic.main.activity_location.*
2121
* desc : demo about LocationUtils
2222
* ```
2323
*/
24-
class LocationActivity : BaseBackActivity() {
24+
class LocationActivity : BaseTitleBarActivity() {
2525

2626
companion object {
2727
fun start(context: Context) {
@@ -41,9 +41,7 @@ class LocationActivity : BaseBackActivity() {
4141
private lateinit var mLocationService: LocationService
4242

4343
private var conn: ServiceConnection = object : ServiceConnection {
44-
override fun onServiceDisconnected(name: ComponentName) {
45-
46-
}
44+
override fun onServiceDisconnected(name: ComponentName) {}
4745

4846
override fun onServiceConnected(name: ComponentName, service: IBinder) {
4947
mLocationService = (service as LocationService.LocationBinder).service
@@ -66,17 +64,17 @@ class LocationActivity : BaseBackActivity() {
6664
}
6765
}
6866

69-
override fun initData(bundle: Bundle?) {
70-
67+
override fun bindTitle(): CharSequence {
68+
return getString(R.string.demo_location)
7169
}
7270

71+
override fun initData(bundle: Bundle?) {}
72+
7373
override fun bindLayout(): Int {
7474
return R.layout.activity_location
7575
}
7676

7777
override fun initView(savedInstanceState: Bundle?, contentView: View) {
78-
setTitle(R.string.demo_location)
79-
8078
SpanUtils.with(locationAboutTv)
8179
.appendLine("lastLatitude: unknown")
8280
.appendLine("lastLongitude: unknown")
@@ -92,9 +90,7 @@ class LocationActivity : BaseBackActivity() {
9290
bindService(Intent(this, LocationService::class.java), conn, Context.BIND_AUTO_CREATE)
9391
}
9492

95-
override fun onWidgetClick(view: View) {
96-
97-
}
93+
override fun onWidgetClick(view: View) {}
9894

9995
override fun onDestroy() {
10096
unbindService(conn)

subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/location/LocationService.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ class LocationService : Service() {
4949
mOnGetLocationListener?.getLocation(lastLatitude, lastLongitude, latitude, longitude, country, locality, street)
5050
}
5151

52-
override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {
53-
54-
}
52+
override fun onStatusChanged(provider: String, status: Int, extras: Bundle) {}
5553
}
5654

5755
fun setOnGetLocationListener(onGetLocationListener: OnGetLocationListener) {

subutil/pkg/src/main/java/com/blankj/subutil/pkg/feature/pinyin/PinyinActivity.kt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import android.content.Context
44
import android.content.Intent
55
import android.os.Bundle
66
import android.view.View
7-
import com.blankj.lib.base.BaseBackActivity
7+
import com.blankj.lib.base.BaseTitleBarActivity
88
import com.blankj.subutil.pkg.R
99
import com.blankj.subutil.util.PinyinUtils
1010
import kotlinx.android.synthetic.main.activity_pinyin.*
@@ -17,7 +17,7 @@ import kotlinx.android.synthetic.main.activity_pinyin.*
1717
* desc : demo about PinyinUtils
1818
* ```
1919
*/
20-
class PinyinActivity : BaseBackActivity() {
20+
class PinyinActivity : BaseTitleBarActivity() {
2121

2222
companion object {
2323
fun start(context: Context) {
@@ -26,17 +26,17 @@ class PinyinActivity : BaseBackActivity() {
2626
}
2727
}
2828

29-
override fun initData(bundle: Bundle?) {
30-
29+
override fun bindTitle(): CharSequence {
30+
return getString(R.string.demo_pinyin)
3131
}
3232

33+
override fun initData(bundle: Bundle?) {}
34+
3335
override fun bindLayout(): Int {
3436
return R.layout.activity_pinyin
3537
}
3638

3739
override fun initView(savedInstanceState: Bundle?, contentView: View) {
38-
setTitle(R.string.demo_pinyin)
39-
4040
val surnames = "乐乘乜仇会便区单参句召员宓弗折曾朴查洗盖祭种秘繁缪能蕃覃解谌适都阿难黑"
4141
val size = surnames.length
4242
val sb = StringBuilder("汉字转拼音: " + PinyinUtils.ccs2Pinyin("汉字转拼音", " ")
@@ -58,11 +58,7 @@ class PinyinActivity : BaseBackActivity() {
5858
pinyinAboutTv.text = sb.toString()
5959
}
6060

61-
override fun doBusiness() {
61+
override fun doBusiness() {}
6262

63-
}
64-
65-
override fun onWidgetClick(view: View) {
66-
67-
}
63+
override fun onWidgetClick(view: View) {}
6864
}

0 commit comments

Comments
 (0)