Skip to content

Commit 4d3f241

Browse files
committed
code clean up
1 parent 661da8d commit 4d3f241

File tree

2 files changed

+14
-33
lines changed

2 files changed

+14
-33
lines changed

app/src/main/java/com/kylix/submissionmade2/SplashActivity.kt

+14-17
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,32 @@ class SplashActivity : AppCompatActivity() {
1010
companion object {
1111
private const val TIME_FOR_SPLASH = 3000L
1212
private const val VERSION = BuildConfig.VERSION_NAME
13-
14-
/* private class SplashHandler(activity: SplashActivity): Handler(Looper.getMainLooper()) {
15-
private val weakReference: WeakReference<SplashActivity> = WeakReference(activity)
16-
17-
override fun handleMessage(msg: Message) {
18-
//super.handleMessage(msg)
19-
val activity = weakReference.get()
20-
Intent(activity, MainActivity::class.java)
21-
activity?.splashBinding?.progress?.stop()
22-
}
23-
}*/
2413
}
25-
private lateinit var splashBinding: ActivitySplashBinding
14+
15+
private var _splashBinding: ActivitySplashBinding? = null
16+
private val splashBinding get() = _splashBinding!!
2617

2718
override fun onCreate(savedInstanceState: Bundle?) {
2819
super.onCreate(savedInstanceState)
29-
splashBinding = ActivitySplashBinding.inflate(layoutInflater)
20+
_splashBinding = ActivitySplashBinding.inflate(layoutInflater)
3021
setContentView(splashBinding.root)
3122

32-
splashBinding.buildVersion.text = VERSION
23+
val splashHandler = Handler(mainLooper)
3324

34-
val handler = Handler(mainLooper)
25+
splashBinding.buildVersion.text = VERSION
3526
splashBinding.progress.start()
3627
splashBinding.progress.loadingColor = R.color.colorAccent
37-
handler.postDelayed({
28+
29+
splashHandler.postDelayed({
30+
splashBinding.progress.stop()
3831
val intent = Intent(this@SplashActivity, MainActivity::class.java)
3932
startActivity(intent)
40-
splashBinding.progress.stop()
4133
finish()
4234
}, TIME_FOR_SPLASH)
4335
}
36+
37+
override fun onDestroy() {
38+
_splashBinding = null
39+
super.onDestroy()
40+
}
4441
}

favorite/build.gradle

-16
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ plugins {
88

99
apply from: '../shared_dependencies.gradle'
1010

11-
/*
12-
leakCanary {
13-
// LeakCanary needs to know which variants have obfuscation turned on
14-
filterObfuscatedVariants { variant ->
15-
variant.name == "debug"
16-
}
17-
}
18-
*/
19-
2011
androidExtensions{
2112
experimental = true
2213
}
@@ -39,13 +30,6 @@ android {
3930
viewBinding = true
4031
}
4132

42-
/*buildTypes {
43-
release {
44-
minifyEnabled false
45-
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
46-
}
47-
}*/
48-
4933
compileOptions {
5034
sourceCompatibility JavaVersion.VERSION_1_8
5135
targetCompatibility JavaVersion.VERSION_1_8

0 commit comments

Comments
 (0)