use of com.madonasyombua.growwithgoogleteamproject.models.User in project Devsfolio by Madonahs.
the class MainActivity method onCreate.
/**
* Theme can only be changed before setContentView is called.
* Therefore, I am changing the theme on here.
* store data
* @param savedInstanceState
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
sharedPref = new SharedPref(this);
if (sharedPref.loadNightModeState()) {
setTheme(R.style.DarkTheme);
} else {
setTheme(R.style.AppTheme);
}
prev_State = sharedPref.loadNightModeState();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
// This method will save the theme and initiates the preferenceChange listener
setCorrectTheme();
// Get all user information views from the drawer header view
View drawerHeaderView = navView.getHeaderView(0);
profilePicView = drawerHeaderView.findViewById(R.id.drawer_header_user_image);
userName = drawerHeaderView.findViewById(R.id.drawer_header_user_name);
userProfession = drawerHeaderView.findViewById(R.id.drawer_header_user_profession);
// Set action bar, navigation drawer, navigation drawer header
setSupportActionBar(toolbar);
setupNavDrawer();
setDrawerHeader();
fragment = getSupportFragmentManager().findFragmentByTag(TAG);
if (fragment == null) {
fragment = new FeedsFragment();
}
BottomNavigationView navigation = findViewById(R.id.navigation);
BottomNavigationViewHelper.disableShiftMode(navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.content, fragment, TAG);
transaction.commit();
/*TODO: Get user data from intent or load from DB if intent is null*/
Bundle data = getIntent().getBundleExtra(Constant.USER);
if (data != null)
user = User.build(data);
else
// TODO: load from DB
user = new User("this guy", "thisguy@devs.com", "000000");
}
Aggregations