Skip to content

Commit

Permalink
fix(AboutFragment): activity recreation due to forced night mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutoshgngwr committed Jun 30, 2019
1 parent a09e0c3 commit c5c1359
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -9,6 +9,7 @@ import android.util.Log
import android.view.MenuItem
import androidx.appcompat.app.ActionBarDrawerToggle
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.view.GravityCompat
import androidx.fragment.app.Fragment
import com.github.ashutoshgngwr.noice.fragment.AboutFragment
Expand All @@ -27,6 +28,9 @@ class MainActivity : AppCompatActivity(), NavigationView.OnNavigationItemSelecte

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// force night mode and use custom theme with correct color values
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)

setContentView(R.layout.activity_main)

// setup toolbar to display animated drawer toggle button
Expand Down
Expand Up @@ -67,9 +67,6 @@ class AboutFragment : Fragment() {
}

override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
// force night mode and use custom theme with correct color values
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)

return AboutPage(context).run {
setImage(R.drawable.app_banner)
setDescription(getString(R.string.app_description))
Expand Down

0 comments on commit c5c1359

Please sign in to comment.