Android Source code of Final Year Project Management System
SupervisorsProfiles.kt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
package com.fyp.evaluation.Student import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.os.RecoverySystem import android.view.View import android.widget.EditText import android.widget.RelativeLayout import android.widget.Toast import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.fyp.evaluation.Adapter.Adapter_SupervisorProfile import com.fyp.evaluation.Model.Model_SupervisorProfile import com.fyp.evaluation.R import com.fyp.evaluation.RetrieveData import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.FirebaseUser import com.google.firebase.database.DataSnapshot import com.google.firebase.database.DatabaseError import com.google.firebase.database.FirebaseDatabase import com.google.firebase.database.ValueEventListener class SupervisorsProfiles : AppCompatActivity() { private var btnBack:RelativeLayout? = null private var btnSearch:RelativeLayout? = null private var editTextSearch:EditText? = null private var recyclerView:RecyclerView? = null private var adapter:Adapter_SupervisorProfile? = null private lateinit var arrayList: ArrayList<Model_SupervisorProfile> private var firebaseUser:FirebaseUser? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_supervisors_profiles) btnBack = findViewById(R.id.btnBack_sp) btnSearch = findViewById(R.id.btn_search) editTextSearch = findViewById(R.id.et_search_sp) recyclerView = findViewById(R.id.recyclerView_sp) if (supportActionBar!=null) { supportActionBar!!.hide() } firebaseUser = FirebaseAuth.getInstance().currentUser arrayList = ArrayList() recyclerView?.setHasFixedSize(true) recyclerView?.layoutManager = LinearLayoutManager(this) btnBack?.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { finish() } }) btnSearch?.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { var id = editTextSearch?.text?.trim().toString() if (id.isEmpty()) { editTextSearch?.setBackgroundDrawable(resources.getDrawable(R.drawable.edit_text_shape_focused)) } else { editTextSearch?.setText("") loadSupervisorProfiles(id) } } }) } fun loadSupervisorProfiles(sID:String?) { var ref = FirebaseDatabase.getInstance().reference.child("Users") ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { if (snapshot.exists()) { (arrayList as ArrayList<Model_SupervisorProfile>).clear() for (dataSnapShot in snapshot.children) { var uid = dataSnapShot.child("uid").getValue(String::class.java) var id_supervisor = dataSnapShot.child("supervisor_id").getValue(String::class.java) var category = dataSnapShot.child("category").getValue(String::class.java) var profileImage = dataSnapShot.child("profile_image").getValue(String::class.java) var name = dataSnapShot.child("name").getValue(String::class.java) var email = dataSnapShot.child("email").getValue(String::class.java) if (category.equals("supervisor") && id_supervisor.equals(sID)) { var model = Model_SupervisorProfile(uid,profileImage,name,email) arrayList.add(model) } } adapter = Adapter_SupervisorProfile(this@SupervisorsProfiles,arrayList) recyclerView?.adapter = adapter } } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } } |
SupervisorPreview.kt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
package com.fyp.evaluation.Student import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.view.WindowManager import android.widget.* import androidx.cardview.widget.CardView import com.fyp.evaluation.R import com.fyp.evaluation.SharedPreference import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.FirebaseUser import com.google.firebase.database.* import com.makeramen.roundedimageview.RoundedImageView import com.squareup.picasso.Picasso class SupervisorPreview : AppCompatActivity() { private var backBtn:RelativeLayout? = null private var profileImage:RoundedImageView? = null private var btnRequest:CardView? = null private var nameTxtView:TextView? = null private var requestTxtView:TextView? = null private var statusActiveTxtView:TextView? = null private var statusNotActiveTxtView:TextView? = null private var spinner:Spinner? = null private var arrayList = mutableListOf<String>() private var firebaseUser:FirebaseUser? = null private var uidSupervisor:String = "" private lateinit var sharedPreference:SharedPreference private var nameCurrentUser:String? = null private var profileImageCurrentUser:String? = null private var semesterCurrentUser:String? = null private var pnameCurrentUser:String? = null private var gnameCurrentUser:String = "" private lateinit var refRequestCancelTemp:ValueEventListener private lateinit var refRequestCancel:DatabaseReference private lateinit var refIsAllowedTemp:ValueEventListener private lateinit var refIsAllowed:DatabaseReference private lateinit var refRetrieveTemp:ValueEventListener private lateinit var refRetrieve:DatabaseReference override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_supervisor_preview) backBtn = findViewById(R.id.btnBack_supervisor_preview) profileImage = findViewById(R.id.profileImage_supervisor_preview) btnRequest = findViewById(R.id.Btnrequest_supervisor_preview) nameTxtView = findViewById(R.id.txtViewname_supervisor_preview) requestTxtView = findViewById(R.id.txtView_request) statusActiveTxtView = findViewById(R.id.txtView_statusActive_supervisor_preview) statusNotActiveTxtView = findViewById(R.id.txtView_statusNotActive_supervisor_preview) spinner = findViewById(R.id.spinner_supervisor_preview) window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS) if (supportActionBar!=null) { supportActionBar!!.hide() } spinner?.setPopupBackgroundResource(R.color.card_color1) sharedPreference = SharedPreference(this@SupervisorPreview) nameCurrentUser = sharedPreference.getName() profileImageCurrentUser = sharedPreference.getProfileImage() pnameCurrentUser = sharedPreference.getProjectName() gnameCurrentUser = sharedPreference.getGroupName().toString() semesterCurrentUser = sharedPreference.getSemester() firebaseUser = FirebaseAuth.getInstance().currentUser var intent = intent uidSupervisor = intent.getStringExtra("uid").toString() var profile_image = intent.getStringExtra("profileImage") var name = intent.getStringExtra("name") Picasso.get().load(profile_image).into(profileImage) nameTxtView?.setText(name.toString()) retrieveSlots(uidSupervisor) retrieveProjects(uidSupervisor) isAlloted() backBtn?.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { finish() } }) btnRequest?.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { var status = requestTxtView?.getText().toString() if (status.equals("Cancel")) { cancelRequest() } else { sendRequest() } } }) } private fun sendRequest() { requestTxtView?.setText("Sending") var ref = FirebaseDatabase.getInstance().reference.child("Requests") var key = ref.push().key var hashMap = HashMap<String,String>() hashMap.put("id_supervisor",uidSupervisor) hashMap.put("id",firebaseUser!!.uid) hashMap.put("name",nameCurrentUser!!) hashMap.put("profile_image",profileImageCurrentUser!!) hashMap.put("project_name",pnameCurrentUser!!) hashMap.put("group_name",gnameCurrentUser!!) hashMap.put("semester",semesterCurrentUser!!) hashMap.put("status","pending") hashMap.put("key",key.toString()) ref.child(key!!).setValue(hashMap).addOnCompleteListener { task-> if(task.isSuccessful) { requestTxtView?.setText("Cancel") } } } private fun cancelRequest() { var ref = FirebaseDatabase.getInstance().reference.child("Requests") refRequestCancelTemp = ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { if (snapshot.exists()) { for (dataSnapShot in snapshot.children) { var id = dataSnapShot.child("id").getValue(String::class.java) var id_supervisor = dataSnapShot.child("id_supervisor").getValue(String::class.java) var key = dataSnapShot.child("key").getValue(String::class.java) if (id.equals(firebaseUser!!.uid) && id_supervisor.equals(uidSupervisor)) { FirebaseDatabase.getInstance().reference.child("Requests").child(key!!).removeValue() ref.removeEventListener(refRequestCancelTemp) } } requestTxtView?.setText("Request") } } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } private fun retrieveRequestStatus() { var ref = FirebaseDatabase.getInstance().reference.child("Requests") refRetrieveTemp = ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { if (snapshot.exists()) { for (dataSnapShot in snapshot.children) { var id = dataSnapShot.child("id").getValue(String::class.java) var id_supervisor = dataSnapShot.child("id_supervisor").getValue(String::class.java) var status = dataSnapShot.child("status").getValue(String::class.java) if (id.equals(firebaseUser!!.uid) && id_supervisor.equals(uidSupervisor)) { if (status.equals("pending")) { requestTxtView?.setText("Cancel") requestTxtView?.isEnabled = true btnRequest?.isEnabled = true } if (status.equals("rejected")) { requestTxtView?.setText("Request") requestTxtView?.isEnabled = true btnRequest?.isEnabled = true } } } ref.removeEventListener(refRetrieveTemp) } } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } private fun isAlloted() { var flag = false var ref = FirebaseDatabase.getInstance().reference.child("Requests") refIsAllowedTemp = ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { if (snapshot.exists()) { for (dataSnapShot in snapshot.children) { var id = dataSnapShot.child("id").getValue(String::class.java) var id_supervisor = dataSnapShot.child("id_supervisor").getValue(String::class.java) var status = dataSnapShot.child("status").getValue(String::class.java) if (id.equals(firebaseUser!!.uid)) { if (status.equals("accepted")) { if (id_supervisor.equals(uidSupervisor)) { flag = true requestTxtView?.setText("Alloted") requestTxtView?.isEnabled = false btnRequest?.isEnabled = false } else { btnRequest?.visibility = View.INVISIBLE } } } } ref.removeEventListener(refIsAllowedTemp) if (!flag) { retrieveRequestStatus() } } else { requestTxtView?.setText("Request") requestTxtView?.isEnabled = true btnRequest?.isEnabled = true } } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } private fun retrieveSlots(uid:String?) { var slots = "20" var flag = false var ref = FirebaseDatabase.getInstance().reference.child("Slots").child(uid!!) ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { if (snapshot.exists()) { slots = snapshot.child("id").getValue(String::class.java)!! flag = true } if (flag) { var temp = slots.toInt() temp -=20 if (temp>0) { statusActiveTxtView?.visibility = View.VISIBLE statusNotActiveTxtView?.visibility = View.INVISIBLE } else { statusActiveTxtView?.visibility = View.INVISIBLE statusNotActiveTxtView?.visibility = View.VISIBLE } } } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } private fun retrieveProjects(uid:String?) { var ref = FirebaseDatabase.getInstance().reference.child("Projects").child(uid!!) ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { if (snapshot.exists()) { (arrayList as ArrayList<String>).clear() for (dataSnapShot in snapshot.children) { var project = dataSnapShot.child("project").getValue(String::class.java) arrayList.add(project.toString()) } var adapterProjects = ArrayAdapter<String>(this@SupervisorPreview,R.layout.support_simple_spinner_dropdown_item,arrayList) spinner?.adapter = adapterProjects } } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } override fun onPause() { // refRequestCancel.removeEventListener(refRequestCancelTemp) // refIsAllowed.removeEventListener(refIsAllowedTemp) // refRetrieve.removeEventListener(refRetrieveTemp) super.onPause() } } |
MeetingNotification.kt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
package com.fyp.evaluation.Student import android.media.Image import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.ImageView import android.widget.RelativeLayout import android.widget.TextView import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.fyp.evaluation.Adapter.Adapter_MeetingNotification import com.fyp.evaluation.Firebase import com.fyp.evaluation.Model.Model_MeetingNotifications import com.fyp.evaluation.R import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.FirebaseUser import com.google.firebase.database.DataSnapshot import com.google.firebase.database.DatabaseError import com.google.firebase.database.FirebaseDatabase import com.google.firebase.database.ValueEventListener class MeetingNotification : AppCompatActivity() { var btnBack:RelativeLayout? = null var view:View? = null var recyclerView:RecyclerView? = null var adapter:Adapter_MeetingNotification? = null var arrayList = ArrayList<Model_MeetingNotifications>() var firebareUser:FirebaseUser? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_meeting_notification) btnBack = findViewById(R.id.btnBack) recyclerView = findViewById(R.id.recyclerView) view = findViewById(R.id.include) if (supportActionBar!=null) { supportActionBar!!.hide() } recyclerView?.setHasFixedSize(true) recyclerView?.layoutManager = LinearLayoutManager(this) firebareUser = FirebaseAuth.getInstance().currentUser // var database = Firebase(this) // arrayList = database.getMeetingNotifications(firebareUser!!.uid) getMeetingNotifications(firebareUser!!.uid) btnBack?.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { finish() } }) } fun getMeetingNotifications(id:String?) { var flag = false var ref = FirebaseDatabase.getInstance().reference.child("MeetingSchedule") ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { if(snapshot.exists()) { (arrayList as ArrayList<Model_MeetingNotifications>).clear() for (dataSnapShot in snapshot.children) { var uid = dataSnapShot.child("uid").getValue(String::class.java) var key = dataSnapShot.child("key").getValue(String::class.java) var datetime = dataSnapShot.child("datetime").getValue(String::class.java) var message = dataSnapShot.child("message").getValue(String::class.java) if (uid!!.equals(id)) { flag = true arrayList.add(Model_MeetingNotifications(uid,key!!,datetime!!,message!!)) } } if (flag==false) { view!!.visibility = View.VISIBLE } else { view?.visibility = View.GONE adapter = Adapter_MeetingNotification(this@MeetingNotification,arrayList) recyclerView?.adapter = adapter } } else { view!!.visibility = View.VISIBLE } } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } } |
GroupMembers.kt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
package com.fyp.evaluation.Student import androidx.appcompat.app.AppCompatActivity import android.os.Bundle import android.view.View import android.widget.RelativeLayout import android.widget.Toast import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import com.fyp.evaluation.Adapter.Adapter_GroupMembers import com.fyp.evaluation.Model.Model_GroupMembers import com.fyp.evaluation.Model.Users import com.fyp.evaluation.R import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.FirebaseUser import com.google.firebase.database.DataSnapshot import com.google.firebase.database.DatabaseError import com.google.firebase.database.FirebaseDatabase import com.google.firebase.database.ValueEventListener class GroupMembers : AppCompatActivity() { private lateinit var backBtn:RelativeLayout private lateinit var recyclerView: RecyclerView private lateinit var adapter: Adapter_GroupMembers private lateinit var arrayList:ArrayList<Model_GroupMembers> private var firebaseUser:FirebaseUser? = null private var mAauth:FirebaseAuth? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_group_members) backBtn = findViewById(R.id.gm_btnBack) recyclerView = findViewById(R.id.gm_recyclerView) if (supportActionBar!=null) { supportActionBar!!.hide() } firebaseUser = FirebaseAuth.getInstance().currentUser var ref = FirebaseDatabase.getInstance().reference.child("Users").child(firebaseUser!!.uid) ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { var gname = snapshot.child("group_name").getValue(String::class.java) retrieveGroupMembers(gname) } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) backBtn.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { finish() } }) arrayList = ArrayList() recyclerView.setHasFixedSize(true) recyclerView.layoutManager = LinearLayoutManager(this) } private fun retrieveGroupMembers(gname:String?) { var ref = FirebaseDatabase.getInstance().reference.child("Users") ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { (arrayList as ArrayList<Model_GroupMembers>).clear() for (dataSnapShot in snapshot.children) { var data = dataSnapShot.getValue(Users::class.java) var g_name = data?.getGroup_Name() var u_id = data?.getUID() if (g_name.equals(gname) && !(firebaseUser!!.uid.equals(u_id))) { var profileImage= data!!.getProfile_Image() var name = data.getName() var pname = data!!.getProject_Name() var model = Model_GroupMembers(profileImage,name,pname,gname) arrayList.add(model) } } adapter = Adapter_GroupMembers(applicationContext,arrayList) recyclerView.adapter = adapter } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } } |
Dashboard.kt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
package com.fyp.evaluation.Student import android.content.Intent import android.content.SharedPreferences import android.os.Build import android.os.Bundle import android.view.MenuItem import android.view.View import android.view.WindowManager import android.widget.ImageView import android.widget.TextView import android.widget.Toast import androidx.appcompat.app.ActionBarDrawerToggle import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.Toolbar import androidx.cardview.widget.CardView import androidx.core.view.GravityCompat import androidx.core.view.isVisible import androidx.drawerlayout.widget.DrawerLayout import com.fyp.evaluation.* import com.google.android.material.navigation.NavigationView import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.FirebaseUser import com.google.firebase.database.DataSnapshot import com.google.firebase.database.DatabaseError import com.google.firebase.database.FirebaseDatabase import com.google.firebase.database.ValueEventListener import com.squareup.picasso.Picasso import de.hdodenhof.circleimageview.CircleImageView class Dashboard : AppCompatActivity() , NavigationView.OnNavigationItemSelectedListener { private lateinit var drawerLayout: DrawerLayout private lateinit var menuBtn:ImageView var navigationView: NavigationView? = null var toolbar:Toolbar? = null private var profileImage:CircleImageView? = null private var profileImage2:CircleImageView? = null private var nameTxtView:TextView? = null private var nameTxtView2:TextView? = null private var btnCross:ImageView? = null private var layoutNotificationCount:CardView? = null private var notificationCount:TextView? = null private lateinit var sectionGroupMembers:CardView private lateinit var sectionSupervisor:CardView private lateinit var sectionChat:CardView private lateinit var sectionMeetingSchedule:CardView private lateinit var sharedPreference: SharedPreference private var firebaseUser:FirebaseUser? = null override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.nav_drawer) profileImage = findViewById(R.id.img_dashboard) nameTxtView = findViewById(R.id.name_dashboard) sectionGroupMembers = findViewById(R.id.section_group_members) sectionSupervisor = findViewById(R.id.section_supervisor) sectionChat = findViewById(R.id.section_chat) sectionMeetingSchedule = findViewById(R.id.section_meeting_schedule) menuBtn = findViewById(R.id.menubtn) toolbar = findViewById(R.id.toolbar) drawerLayout = findViewById(R.id.drawer_layout) navigationView = findViewById(R.id.nav_view) layoutNotificationCount = findViewById(R.id.layout_notification_count) notificationCount = findViewById(R.id.tv_notification_count) var headerView = navigationView?.getHeaderView(0) profileImage2 = headerView?.findViewById(R.id.profileImage_nav_header_student) nameTxtView2 = headerView?.findViewById(R.id.txtViewName_nav_header_student) btnCross = headerView?.findViewById(R.id.btnCross_nav_header_student) if (supportActionBar!=null) { supportActionBar!!.hide() } firebaseUser = FirebaseAuth.getInstance().currentUser countMeetingNotifications(firebaseUser!!.uid) sharedPreference = SharedPreference(this@Dashboard) var name = sharedPreference.getName() var urlImage = sharedPreference.getProfileImage() if (!name.equals("null")) { nameTxtView?.visibility = View.VISIBLE nameTxtView2?.visibility = View.VISIBLE nameTxtView?.setText(name) nameTxtView2!!.setText(name) } if (!urlImage.equals("null")) { Picasso.get().load(urlImage).into(profileImage) profileImage?.visibility = View.VISIBLE Picasso.get().load(urlImage).into(profileImage2) profileImage2?.visibility = View.VISIBLE } val toggle = ActionBarDrawerToggle( this, drawerLayout, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close ) toggle.isDrawerIndicatorEnabled = false navigationView?.setNavigationItemSelectedListener(this) drawerLayout.addDrawerListener(toggle) toggle.syncState() toggle.toolbarNavigationClickListener = View.OnClickListener { drawerLayout.openDrawer(GravityCompat.START) } menuBtn.setOnClickListener { if (drawerLayout.isDrawerOpen(GravityCompat.START)) { // drawerLayout.closeDrawer(GravityCompat.START) } else { drawerLayout.openDrawer(GravityCompat.START) } } btnCross?.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { if (drawerLayout.isDrawerOpen(GravityCompat.START)) { drawerLayout.closeDrawer(GravityCompat.START) } } }) sectionChat.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { startActivity(Intent(this@Dashboard,MainActivity::class.java)) } }) sectionGroupMembers.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { startActivity(Intent(this@Dashboard,GroupMembers::class.java)) } }) sectionSupervisor.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { startActivity(Intent(this@Dashboard,SupervisorsProfiles::class.java)) } }) sectionMeetingSchedule.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { startActivity(Intent(this@Dashboard,MeetingNotification::class.java)) } }) layoutNotificationCount?.setOnClickListener(object: View.OnClickListener { override fun onClick(v: View?) { if (layoutNotificationCount?.visibility==View.VISIBLE) { startActivity(Intent(this@Dashboard,MeetingNotification::class.java)) } } }) } private fun countMeetingNotifications(uid: String) { var count:Int = 0 var ref = FirebaseDatabase.getInstance().reference.child("MeetingSchedule") ref.addValueEventListener(object: ValueEventListener { override fun onDataChange(snapshot: DataSnapshot) { if (snapshot.exists()) { count = 0 for (dataSnapShot in snapshot.children) { var id = dataSnapShot.child("uid").getValue(String::class.java) if (uid.equals(id)) { count++ } } if (count>0) { layoutNotificationCount?.visibility = View.VISIBLE notificationCount?.setText(count.toString()) } else { count = 0 layoutNotificationCount?.visibility = View.INVISIBLE notificationCount?.setText("0") } // ref.removeEventListener(listener!!) } else { count = 0 layoutNotificationCount?.visibility = View.INVISIBLE notificationCount?.setText("") } } override fun onCancelled(error: DatabaseError) { TODO("Not yet implemented") } }) } override fun onNavigationItemSelected(item: MenuItem): Boolean { var id = item.itemId if (id.equals(R.id.nav_logout)) { sharedPreference.clearCategory() FirebaseAuth.getInstance().signOut() startActivity(Intent(this@Dashboard, Welcome::class.java)) finish() } if(id.equals(R.id.nav_profile)) { startActivity(Intent(this@Dashboard, Profile::class.java)) finish() } return false } } |
Download Android Code of Final Year Project Management System More helping material for FYP Management System SRS Documentation of Final Year Project Management System Functional and Non-functional Requirements of Final Year Project Management System Modules of Final Year Project Management System Use case diagram of …
Android Source code of Final Year Project Management System Read More »