@@ -2,36 +2,36 @@ package info.hannes.logcat.ui
22
33import android.os.Bundle
44import android.view.MenuItem
5- import android.view.View
65import androidx.appcompat.app.AppCompatActivity
6+ import info.hannes.logcat.ui.databinding.ActivityLogBinding
77
88class LogcatActivity : AppCompatActivity () {
99
10+ private lateinit var binding: ActivityLogBinding
11+
1012 override fun onCreate (savedInstanceState : Bundle ? ) {
1113 super .onCreate(savedInstanceState)
12- setContentView( R .layout.activity_log )
13- supportActionBar?.setDisplayHomeAsUpEnabled( true )
14+ binding = ActivityLogBinding .inflate(layoutInflater )
15+ setContentView(binding.root )
1416
15- // Check that the activity is using the layout version with the fragment_container FrameLayout
16- if (findViewById<View >(R .id.fragment_container) != null ) {
17+ supportActionBar?.setDisplayHomeAsUpEnabled(true )
1718
18- // However, if we're being restored from a previous state,
19- // then we don't need to do anything and should return or else
20- // we could end up with overlapping fragments.
21- if (savedInstanceState != null ) {
22- return
23- }
19+ // However, if we're being restored from a previous state,
20+ // then we don't need to do anything and should return or else
21+ // we could end up with overlapping fragments.
22+ if (savedInstanceState != null ) {
23+ return
24+ }
2425
25- // Create a new Fragment to be placed in the activity layout
26- val firstFragment = LogcatFragment .newInstance(" logcat.log" , " search logcat" )
26+ // Create a new Fragment to be placed in the activity layout
27+ val firstFragment = LogcatFragment .newInstance(" logcat.log" , " search logcat" )
2728
28- // In case this activity was started with special instructions from an
29- // Intent, pass the Intent's extras to the fragment as arguments
30- // firstFragment.arguments = intent.extras
29+ // In case this activity was started with special instructions from an
30+ // Intent, pass the Intent's extras to the fragment as arguments
31+ // firstFragment.arguments = intent.extras
3132
32- // Add the fragment to the 'fragment_container' FrameLayout
33- supportFragmentManager.beginTransaction().add(R .id.fragment_container, firstFragment).commit()
34- }
33+ // Add the fragment to the 'fragment_container' FrameLayout
34+ supportFragmentManager.beginTransaction().add(R .id.fragment_container, firstFragment).commit()
3535 }
3636
3737 override fun onOptionsItemSelected (item : MenuItem ): Boolean {
0 commit comments