2020-10-20 17:07:27 +03:00
|
|
|
package com.illusionware.npsbrowser.activities
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle
|
|
|
|
|
import android.view.MenuItem
|
|
|
|
|
import com.illusionware.npsbrowser.R
|
|
|
|
|
import com.illusionware.npsbrowser.fragments.mainactivity.MainActivityFragment
|
|
|
|
|
|
|
|
|
|
class MainActivity : BaseActivity() {
|
|
|
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) {
|
|
|
|
|
super.onCreate(savedInstanceState)
|
|
|
|
|
setTheme(R.style.NPSTheme)
|
|
|
|
|
setContentView(R.layout.activity_main)
|
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
|
supportFragmentManager.beginTransaction()
|
|
|
|
|
.replace(R.id.container, MainActivityFragment.newInstance())
|
|
|
|
|
.commitNow()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
override fun onOptionsItemSelected(item: MenuItem): Boolean {
|
|
|
|
|
when (item.itemId) {
|
|
|
|
|
android.R.id.home -> {
|
|
|
|
|
supportFragmentManager.popBackStack()
|
|
|
|
|
return true
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return super.onOptionsItemSelected(item)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun showUpButton() {
|
|
|
|
|
supportActionBar!!.setDisplayHomeAsUpEnabled(true)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fun hideUpButton() {
|
|
|
|
|
supportActionBar!!.setDisplayHomeAsUpEnabled(false)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|