@Override
protected void onCreate(Bundle savedInstanceState) {
fragmentManager = getSupportFragmentManager();
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
int nightMode = sharedPreferences.getInt(getResources().getString(R.string.key_night_mode),
AppCompatDelegate.MODE_NIGHT_YES);
AppCompatDelegate.setDefaultNightMode(nightMode);
setTheme(R.style.AppTheme_NoActionBar);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (findViewById(R.id.main_fragment_container) != null) {
if (savedInstanceState != null) {
return;
}
SearchFragment searchFragment = new SearchFragment();
fragmentManager.beginTransaction()
.add(R.id.main_fragment_container, searchFragment)
.commit();
}
}
MainActivity.java 文件源码
java
阅读 21
收藏 0
点赞 0
评论 0
项目:AURdroid
作者:
评论列表
文章目录