@Override protected void onCreate(Bundle savedInstanceState) { this.requestWindowFeature(Window.FEATURE_NO_TITLE); this.getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); setContentView(R.layout.activity_stdents); helpButton = (ImageView) findViewById(R.id.helpButton); addStudentButton = (TextView) findViewById(R.id.addStudentButton); className = (TextView) findViewById(R.id.className); studentListView = (ExpandableListView) findViewById(R.id.studentListView); sharedPreferences = AndroidUtils.getCommonSharedPrefs(getApplicationContext()); userUtils = new UserUtils(ShowClassEventCompanyUsersActivity.this); user = userUtils.getUserFromSharedPrefs(); Bundle bundle = getIntent().getExtras(); int role = bundle.getInt(AppConstants.EXTRA_USER_ROLE); if (role == 0) { throw new RuntimeException("must pass role!"); } else { userRole = UserRole.valueOf(role); setRoleBasedProperties(userRole); } int index = bundle.getInt(AppConstants.EXTRA_SELECTED_INDEX, -1); if (index == -1) { throw new RuntimeException("must pass EXTRA_SELECTED_INDEX!"); } else { classEventCompany = user.getClassEventCompanyArrayList().get(index); } setAdapter(); studentListView.setOnItemClickListener( new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {} }); studentListView.setOnGroupExpandListener( new ExpandableListView.OnGroupExpandListener() { int previousGroup = -1; @Override public void onGroupExpand(int groupPosition) { if (groupPosition != previousGroup) studentListView.collapseGroup(previousGroup); previousGroup = groupPosition; } }); addStudentButton.setOnClickListener(this); helpButton.setOnClickListener(this); className.setText(classEventCompany.getName()); }
@Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); super.onCreate(savedInstanceState); setContentView(R.layout.activity_teacher_take_attendance_current_location); txtAttendanceTaken = (TextView) findViewById(R.id.txtAttendanceTaken); absenceLayout = (TextView) findViewById(R.id.absenceLayout); presentLayout = (TextView) findViewById(R.id.presentLayout); listView = (ListView) findViewById(R.id.listView); saveButton = (Button) findViewById(R.id.saveButton); absenceLayout.setOnClickListener(this); presentLayout.setOnClickListener(this); userUtils = new UserUtils(EventHost_AttendanceTakenActivity.this); user = userUtils.getUserFromSharedPrefs(); Intent intent = getIntent(); userRole = UserRole.valueOf(intent.getIntExtra(AppConstants.EXTRA_USER_ROLE, -1)); int index = intent.getIntExtra(EXTRA_SELECTED_CLASS_INDEX, 0); classEventCompany = user.getEventArrayList().get(index); String json = intent.getStringExtra(EXTRA_ATTENDANCE_DATA); allAttendanceList = DataUtils.getAttendanceListFromJsonString(json); for (Attendance attendance : allAttendanceList) { if (attendance.isPresent()) { presentAttendanceList.add(attendance); } else { absentAttendanceList.add(attendance); } } allStudentList = classEventCompany.getUsers(); for (User student : allStudentList) { if (isInPresentAttendanceList(student.getUserId())) { presentStudentsList.add(student); } else { absentStudentsList.add(student); } } SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.ENGLISH); Date date = new Date(); format.applyPattern("MMM dd, yyyy"); txtAttendanceTaken.setText("Attendance Taken " + format.format(date)); showAbsentList(); saveButton.setVisibility(View.VISIBLE); }