Skip to content

Commit

Permalink
added logout button for staff - need to fix functionality/Other minor…
Browse files Browse the repository at this point in the history
… issues
  • Loading branch information
AdityaK2905 committed Nov 14, 2024
1 parent c06fa07 commit a1d8c35
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ProfileFragment : Fragment() {
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
// if not an attendee, set the layout to be the not logged in profile
if (!hasLoggedIn() or (hasLoggedIn() and isStaff())) {
if (!hasLoggedIn()) {
val view = inflater.inflate(R.layout.fragment_profile_not_logged_in, container, false)
val logoutButton = view.findViewById<Button>(R.id.logout_button)
logoutButton.setOnClickListener {
Expand All @@ -75,6 +75,15 @@ class ProfileFragment : Fragment() {
}
return view
}
if (isStaff()) {
val view = inflater.inflate(R.layout.fragment_profile_staff, container, false)
val logoutButton = view.findViewById<Button>(R.id.logout_button)
logoutButton.setOnClickListener {
val mainActivity: MainActivity = requireActivity() as MainActivity
mainActivity.logout()
}
return view
}

// set up LiveData observers
profileViewModel.currentProfileLiveData.observe(
Expand Down
88 changes: 88 additions & 0 deletions app/src/main/res/layout/fragment_profile_staff.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/witchyPurple">

<ImageView
android:layout_width="0dp"
android:layout_height="0dp"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@drawable/dark_fantasy_bg_2024"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<androidx.constraintlayout.widget.Guideline
android:id="@+id/guidelineTop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.05" />

<TextView
android:id="@+id/title_textview_profile"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="35dp"
android:fontFamily="@font/montserrat_bold"
android:gravity="start"
android:text="@string/profile"
android:textColor="@color/palePeach"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/guidelineTop" />

<TextView
android:id="@+id/logout_textview"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="30dp"
android:fontFamily="@font/montserrat_semi_bold"
android:gravity="center"
android:text="@string/not_logged_in_message"
android:textColor="@color/white"
android:textSize="17sp"
app:layout_constraintVertical_bias="0.40"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/title_textview_profile" />

<ImageButton
android:id="@+id/logoutButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="35dp"
android:background="@android:color/transparent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/guidelineTop"
app:srcCompat="@drawable/ic_logout" />

<com.google.android.material.button.MaterialButton
android:id="@+id/logout_button"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
app:cornerRadius="24dp"
app:strokeWidth="2.5dp"
app:strokeColor="@color/white"
android:fontFamily="@font/montserrat_bold"
android:paddingHorizontal="30dp"
android:text="@string/profile_login"
android:textAllCaps="false"
android:textColor="@color/white"
android:textSize="18sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/logout_textview"
tools:ignore="TouchTargetSizeCheck" />

</androidx.constraintlayout.widget.ConstraintLayout>

0 comments on commit a1d8c35

Please sign in to comment.