diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 65fda9b1e..0540c7525 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -23,6 +23,7 @@ android:roundIcon="@mipmap/ic_launcher_23_round" android:theme="@style/AppTheme"> + + // NOTIFICATIONS @POST("notifications/device/") diff --git a/app/src/main/java/org/hackillinois/android/database/entity/Event.kt b/app/src/main/java/org/hackillinois/android/database/entity/Event.kt index 004ec4e8c..d68b7c039 100644 --- a/app/src/main/java/org/hackillinois/android/database/entity/Event.kt +++ b/app/src/main/java/org/hackillinois/android/database/entity/Event.kt @@ -72,34 +72,6 @@ data class Event( return list } -// fun getIndoorMapAndDirectionInfo() = locations.flatMap { -// it.tags.map { tag -> getMapAndDirectionForTag(tag) } -// } - -// @Ignore -// private val ecebLatLng = LatLng(40.115071, -88.228196) -// @Ignore -// private val siebelLatLng = LatLng(40.113833, -88.224903) -// @Ignore -// private val kenneyLatLng = LatLng(40.1131422, -88.229537) -// @Ignore -// private val dclLatLng = LatLng(40.1133081, -88.2288307) - -// @Ignore -// private val mapAndDirectionInfoMap: Map = mapOf( -// "KENNEY" to IndoorMapAndDirectionInfo("Kenney", R.drawable.kenney, kenneyLatLng), -// "DCL" to IndoorMapAndDirectionInfo("DCL", R.drawable.dcl, dclLatLng), -// "ECEB1" to IndoorMapAndDirectionInfo("ECEB Floor 1", R.drawable.eceb_floor_1, ecebLatLng), -// "ECEB2" to IndoorMapAndDirectionInfo("ECEB Floor 2", R.drawable.eceb_floor_2, ecebLatLng), -// "ECEB3" to IndoorMapAndDirectionInfo("ECEB Floor 3", R.drawable.eceb_floor_3, ecebLatLng), -// "SIEBEL0" to IndoorMapAndDirectionInfo("Siebel Basement", R.drawable.siebel_floor_0, siebelLatLng), -// "SIEBEL1" to IndoorMapAndDirectionInfo("Siebel Floor 1", R.drawable.siebel_floor_1, siebelLatLng), -// "SIEBEL2" to IndoorMapAndDirectionInfo("Siebel Floor 2", R.drawable.siebel_floor_2, siebelLatLng) -// ) - -// private fun getMapAndDirectionForTag(tag: String) = mapAndDirectionInfoMap[tag] -// ?: IndoorMapAndDirectionInfo("Siebel Floor 1", R.drawable.siebel_floor_1, siebelLatLng) - override fun getType() = 1 } @@ -118,6 +90,9 @@ data class IndoorMapAndDirectionInfo( data class EventCode(val code: String) +data class MeetingEventId(val eventId: String) + +data class MeetingCheckInResponse(var status: String) data class EventCheckInResponse( val newPoints: Int, val totalPoints: Int, diff --git a/app/src/main/java/org/hackillinois/android/database/entity/Roles.kt b/app/src/main/java/org/hackillinois/android/database/entity/Roles.kt index 45e6d04b7..aa17aa048 100644 --- a/app/src/main/java/org/hackillinois/android/database/entity/Roles.kt +++ b/app/src/main/java/org/hackillinois/android/database/entity/Roles.kt @@ -16,6 +16,5 @@ data class Roles( @ColumnInfo(name = "key") var key = 1 - fun isStaff() = roles.contains("Staff") - fun isAdmin() = roles.contains("Admin") + fun isStaff() = roles.contains("STAFF") } diff --git a/app/src/main/java/org/hackillinois/android/repository/EventRepository.kt b/app/src/main/java/org/hackillinois/android/repository/EventRepository.kt index 14b38b71e..4ff88c33f 100644 --- a/app/src/main/java/org/hackillinois/android/repository/EventRepository.kt +++ b/app/src/main/java/org/hackillinois/android/repository/EventRepository.kt @@ -60,13 +60,10 @@ class EventRepository { return responseString } suspend fun checkInEvent(code: String): EventCheckInResponse { - Log.d("send event token", code) - var apiResponse: EventCheckInResponse = EventCheckInResponse(-1, -1, "") + var apiResponse = EventCheckInResponse(-1, -1, "") withContext(Dispatchers.IO) { try { - Log.d("Sending code: ", code) - apiResponse = App.getAPI().eventCodeCheckIn(EventCode(code)) Log.d("code sent!", apiResponse.toString()) } catch (e: Exception) { @@ -76,6 +73,21 @@ class EventRepository { return apiResponse } + suspend fun checkInMeeting(eventId: String): MeetingCheckInResponse { + var apiResponse = MeetingCheckInResponse("") + + withContext(Dispatchers.IO) { + try { + val body = MeetingEventId(eventId) + App.getAPI().staffMeetingCheckIn(body) + apiResponse.status = "Success" // no response is sent from API, so just manually done + } catch (e: Exception) { + Log.d("STAFF MEETING API ERROR", "${e.message}") + } + } + return apiResponse + } + suspend fun checkInEventAsStaff(userToken: String, eventId: String): EventCheckInAsStaffResponse { val userTokenEventIdPair = UserTokenEventIdPair(userToken, eventId) Log.d("send event token", userTokenEventIdPair.toString()) @@ -88,10 +100,10 @@ class EventRepository { false, RegistrationData( AttendeeData( - listOf() - ) - ) - ) + listOf(), + ), + ), + ), ) withContext(Dispatchers.IO) { diff --git a/app/src/main/java/org/hackillinois/android/view/LoginActivity.kt b/app/src/main/java/org/hackillinois/android/view/LoginActivity.kt index cabbca22c..0e3a8e79e 100644 --- a/app/src/main/java/org/hackillinois/android/view/LoginActivity.kt +++ b/app/src/main/java/org/hackillinois/android/view/LoginActivity.kt @@ -83,9 +83,9 @@ class LoginActivity : AppCompatActivity() { // verify user's roles are correct if (getOAuthProvider() == "google") { - verifyRole(api, jwt.token, "Staff") + verifyRole(api, jwt.token, "STAFF") } else { - verifyRole(api, jwt.token, "Attendee") + verifyRole(api, jwt.token, "ATTENDEE") } } catch (e: Exception) { showFailedToLogin(e.message) @@ -97,12 +97,13 @@ class LoginActivity : AppCompatActivity() { GlobalScope.launch { try { val loginRoles: Roles = api.roles() + Log.d("ROLES", "${loginRoles.roles}") // Check if user's roles are correct. If not, display corresponding error message if (loginRoles.roles.contains(role)) { JWTUtilities.writeJWT(applicationContext, jwt) // save JWT to sharedPreferences for auto-login in the future launchMainActivity() } else { - if (role == "Staff") { + if (role == "STAFF") { showFailedToLoginStaff() } else { showFailedToLoginAttendee() diff --git a/app/src/main/java/org/hackillinois/android/view/MainActivity.kt b/app/src/main/java/org/hackillinois/android/view/MainActivity.kt index 0dcb177c7..19369b91b 100644 --- a/app/src/main/java/org/hackillinois/android/view/MainActivity.kt +++ b/app/src/main/java/org/hackillinois/android/view/MainActivity.kt @@ -4,14 +4,14 @@ import android.content.Context import android.content.Intent import android.os.Bundle import android.util.Log -import android.view.LayoutInflater +import android.view.View import android.widget.ImageButton import android.widget.Toast import androidx.appcompat.app.AppCompatActivity import androidx.core.content.ContextCompat import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentTransaction -import androidx.lifecycle.ViewModelProviders +import androidx.lifecycle.ViewModelProvider import com.google.firebase.FirebaseApp import com.google.firebase.messaging.FirebaseMessaging import kotlinx.android.synthetic.main.activity_main.* @@ -26,6 +26,7 @@ import org.hackillinois.android.view.leaderboard.LeaderboardFragment import org.hackillinois.android.view.onboarding.OnboardingActivity import org.hackillinois.android.view.profile.ProfileFragment import org.hackillinois.android.view.scanner.ScannerFragment +import org.hackillinois.android.view.scanner.StaffScannerFragment import org.hackillinois.android.view.schedule.ScheduleFragment import org.hackillinois.android.viewmodel.MainViewModel import kotlin.concurrent.thread @@ -35,8 +36,7 @@ class MainActivity : AppCompatActivity() { private lateinit var viewModel: MainViewModel private var currentSelection = 0 - -// var groupMatchingSelectedProfile: Profile? = null + private var onScanner = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) @@ -48,7 +48,8 @@ class MainActivity : AppCompatActivity() { val startFragment = HomeFragment() supportFragmentManager.beginTransaction().replace(R.id.contentFrame, startFragment).commit() - viewModel = ViewModelProviders.of(this).get(MainViewModel::class.java).apply { +// ViewModelProvider(this).get(ProfileViewModel::class.java) + viewModel = ViewModelProvider(this).get(MainViewModel::class.java).apply { init() val owner = this@MainActivity } @@ -56,23 +57,26 @@ class MainActivity : AppCompatActivity() { } private fun setupBottomAppBar() { + // by default, home button is selected val selectedIconColor = ContextCompat.getColor(this, R.color.selectedAppBarIcon) val unselectedIconColor = ContextCompat.getColor(this, R.color.unselectedAppBarIcon) + bottomAppBar.homeButton.setColorFilter(selectedIconColor) + val bottomBarButtons = listOf( bottomAppBar.homeButton, bottomAppBar.scheduleButton, bottomAppBar.leaderboard, - bottomAppBar.profile + bottomAppBar.profile, ) - // by default, home button is selected - bottomAppBar.homeButton.setColorFilter(selectedIconColor) - // make all buttons unselectedColor and then set selected button to selectedColor bottomBarButtons.forEach { button -> button.setOnClickListener { view -> val newSelection = bottomBarButtons.indexOf(button) + if (onScanner) { + onScanner = false + } if (newSelection != currentSelection) { currentSelection = newSelection @@ -92,19 +96,41 @@ class MainActivity : AppCompatActivity() { } private fun setupCodeEntrySheet() { - val inflater: LayoutInflater = layoutInflater - - val scannerFragment = ScannerFragment() - code_entry_fab.setOnClickListener { + // set currentSelection to invalid index since scanner was selected + currentSelection = -1 + + // check if user is staff or attendee if (!hasLoggedIn()) { val toast = Toast.makeText(applicationContext, getString(R.string.login_error_msg), Toast.LENGTH_LONG) -// ((toast.view as LinearLayout).getChildAt(0) as TextView).gravity = Gravity.CENTER_HORIZONTAL toast.show() -// Snackbar.make(findViewById(android.R.id.content), getString(R.string.login_error_msg), Snackbar.LENGTH_SHORT).show() } else { - switchFragment(scannerFragment, true) + // set all bottom bar buttons to be the unselected color + val bottomBarButtons = listOf( + bottomAppBar.homeButton, + bottomAppBar.scheduleButton, + bottomAppBar.leaderboard, + bottomAppBar.profile, + ) + val unselectedIconColor = ContextCompat.getColor(this, R.color.unselectedAppBarIcon) + bottomBarButtons.forEach { (it as ImageButton).setColorFilter(unselectedIconColor) } + + // if staff, send them to fragment to select meeting attendance or attendee check-in + // if attendee, send them right to the scanner fragment + val scannerFragment = ScannerFragment() + val staffScannerFragment = StaffScannerFragment() + if (isStaff()) { + // check if already on scanner attendance page for staff + if (!onScanner) { + switchFragment(staffScannerFragment, false) + } + } else { + switchFragment(scannerFragment, true) + bottomAppBar.visibility = View.INVISIBLE + code_entry_fab.visibility = View.INVISIBLE + } } + onScanner = true } } @@ -118,16 +144,6 @@ class MainActivity : AppCompatActivity() { transaction.commit() } - fun switchFragmentWithAnimation(fragment: Fragment, addToBackStack: Boolean, anim: R.anim) { - val transaction = supportFragmentManager.beginTransaction() - transaction.replace(R.id.contentFrame, fragment) - transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) - if (addToBackStack) { - transaction.addToBackStack(null) - } - transaction.commit() - } - private fun updateFirebaseToken() { FirebaseApp.initializeApp(applicationContext) FirebaseMessaging.getInstance().getToken().addOnSuccessListener { firebaseToken -> diff --git a/app/src/main/java/org/hackillinois/android/view/eventinfo/EventInfoFragment.kt b/app/src/main/java/org/hackillinois/android/view/eventinfo/EventInfoFragment.kt index 66e989aec..22de824ac 100644 --- a/app/src/main/java/org/hackillinois/android/view/eventinfo/EventInfoFragment.kt +++ b/app/src/main/java/org/hackillinois/android/view/eventinfo/EventInfoFragment.kt @@ -1,7 +1,6 @@ package org.hackillinois.android.view.eventinfo import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -43,13 +42,12 @@ class EventInfoFragment : Fragment(), OnMapReadyCallback { viewModel.event.observe( this, Observer { event -> - Log.i("EventInfoFragment", event.toString()) currentEvent = event updateEventUI(currentEvent) if (mapIsReady && !mapUpdated) { setupMap() } - } + }, ) viewModel.isFavorited.observe(this, Observer { updateFavoritedUI(it) }) } @@ -75,7 +73,6 @@ class EventInfoFragment : Fragment(), OnMapReadyCallback { googleMap.isIndoorEnabled = true mapIsReady = true - Log.i("EventInfoFragment", "Map is ready") if (currentEvent != null) { setupMap() } @@ -84,7 +81,7 @@ class EventInfoFragment : Fragment(), OnMapReadyCallback { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { val view = inflater.inflate(R.layout.fragment_event_info, container, false) view.exit_button.setOnClickListener { activity?.onBackPressed() } @@ -98,7 +95,6 @@ class EventInfoFragment : Fragment(), OnMapReadyCallback { } private fun setupMap() { - Log.i("EventInfoFragment", "Setting up map") addMarkersToMap(currentEvent!!) if (currentEvent!!.locations.isNotEmpty()) { moveCameraToLocation(currentEvent!!.locations.first()) @@ -130,20 +126,14 @@ class EventInfoFragment : Fragment(), OnMapReadyCallback { } private fun addMarkersToMap(event: Event) { - Log.i("EventInfoFragment", "Adding Markers to map") event.locations.forEach { eventLocation -> val latLng = LatLng(eventLocation.latitude, eventLocation.longitude) var marker = googleMap.addMarker( MarkerOptions() .position(latLng) - .title(eventLocation.description) + .title(eventLocation.description), ) - Log.i("Map", marker.toString()) } - - Log.i("Map", viewModel.event?.value.toString()) - Log.i("Map", viewModel.event?.value?.locations.toString()) - Log.i("Map", "hello") } private fun updateEventUI(event: Event?) { diff --git a/app/src/main/java/org/hackillinois/android/view/onboarding/OnboardingActivity.kt b/app/src/main/java/org/hackillinois/android/view/onboarding/OnboardingActivity.kt index 5f398d635..73419ff2b 100644 --- a/app/src/main/java/org/hackillinois/android/view/onboarding/OnboardingActivity.kt +++ b/app/src/main/java/org/hackillinois/android/view/onboarding/OnboardingActivity.kt @@ -15,12 +15,12 @@ import org.hackillinois.android.view.LoginActivity class OnboardingActivity : FragmentActivity() { private val images = listOf( - R.drawable.login_logo_with_text_2023, + R.drawable.login_logo_2023, R.drawable.countdown_2023, R.drawable.schedule_2023, R.drawable.scan_2023, R.drawable.profile_2023, - R.drawable.leaderboard_2023 + R.drawable.leaderboard_2023, ) private val titles = listOf( @@ -29,7 +29,7 @@ class OnboardingActivity : FragmentActivity() { R.string.onboarding_schedule_title, R.string.onboarding_scan_title, R.string.onboarding_profile_title, - R.string.onboarding_leaderboard_title + R.string.onboarding_leaderboard_title, ) private val descriptions = listOf( @@ -38,7 +38,7 @@ class OnboardingActivity : FragmentActivity() { R.string.onboarding_schedule_description, R.string.onboarding_scan_description, R.string.onboarding_profile_description, - R.string.onboarding_leaderboard_description + R.string.onboarding_leaderboard_description, ) override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/hackillinois/android/view/onboarding/OnboardingPageFragment.kt b/app/src/main/java/org/hackillinois/android/view/onboarding/OnboardingPageFragment.kt index 78fb46a8c..4177132ba 100644 --- a/app/src/main/java/org/hackillinois/android/view/onboarding/OnboardingPageFragment.kt +++ b/app/src/main/java/org/hackillinois/android/view/onboarding/OnboardingPageFragment.kt @@ -15,7 +15,7 @@ class OnboardingPageFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View = inflater.inflate(R.layout.fragment_onboarding_page, container, false) override fun onViewCreated(view: View, savedInstanceState: Bundle?) { diff --git a/app/src/main/java/org/hackillinois/android/view/profile/ProfileFragment.kt b/app/src/main/java/org/hackillinois/android/view/profile/ProfileFragment.kt index c2fc3a4a1..6eab42d22 100644 --- a/app/src/main/java/org/hackillinois/android/view/profile/ProfileFragment.kt +++ b/app/src/main/java/org/hackillinois/android/view/profile/ProfileFragment.kt @@ -70,7 +70,7 @@ class ProfileFragment : Fragment() { override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, - savedInstanceState: Bundle? + savedInstanceState: Bundle?, ): View? { if (!hasLoggedIn() or (hasLoggedIn() and isStaff())) { val view = inflater.inflate(R.layout.fragment_profile_not_logged_in, container, false) @@ -244,7 +244,7 @@ class ProfileFragment : Fragment() { val context = requireActivity().applicationContext return context.getSharedPreferences( context.getString(R.string.authorization_pref_file_key), - Context.MODE_PRIVATE + Context.MODE_PRIVATE, ).getString("provider", "") ?: "" == "google" } } diff --git a/app/src/main/java/org/hackillinois/android/view/scanner/ScannerFragment.kt b/app/src/main/java/org/hackillinois/android/view/scanner/ScannerFragment.kt index 7f51cfabb..45f002c5f 100644 --- a/app/src/main/java/org/hackillinois/android/view/scanner/ScannerFragment.kt +++ b/app/src/main/java/org/hackillinois/android/view/scanner/ScannerFragment.kt @@ -20,8 +20,10 @@ import androidx.fragment.app.Fragment import androidx.lifecycle.Observer import androidx.lifecycle.ViewModelProviders import com.budiyev.android.codescanner.* +import com.google.android.material.bottomappbar.BottomAppBar import com.google.android.material.chip.Chip import com.google.android.material.chip.ChipGroup +import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.zxing.BarcodeFormat import kotlinx.android.synthetic.main.fragment_scanner.view.* import org.hackillinois.android.R @@ -37,6 +39,7 @@ class ScannerFragment : Fragment() { private lateinit var eventId: String private lateinit var eventName: String + private var isMeetingAttendance: Boolean = false private lateinit var codeScanner: CodeScanner @@ -55,6 +58,7 @@ class ScannerFragment : Fragment() { eventId = arguments?.getString(EVENT_ID_KEY) ?: "" eventName = arguments?.getString(EVENT_NAME_KEY) ?: "" + isMeetingAttendance = arguments?.getBoolean(IS_MEETING_ATTENDANCE_KEY) ?: false viewModel = ViewModelProviders.of(this).get(ScannerViewModel::class.java).apply { init(eventName) @@ -66,14 +70,14 @@ class ScannerFragment : Fragment() { } else { displayScanResult(it) } - } + }, ) roles.observe( this@ScannerFragment, Observer { userRoles = it showStaffChipGroup(it) - } + }, ) } } @@ -120,6 +124,11 @@ class ScannerFragment : Fragment() { } closeButton.setOnClickListener { + // set bottom app bar visible again and pop scanner from the backstack + val appBar = activity!!.findViewById(R.id.bottomAppBar) + val scannerBtn = activity!!.findViewById(R.id.code_entry_fab) + appBar.visibility = View.VISIBLE + scannerBtn.visibility = View.VISIBLE activity?.supportFragmentManager?.popBackStackImmediate() } @@ -133,13 +142,20 @@ class ScannerFragment : Fragment() { isFlashEnabled = false decodeCallback = DecodeCallback { if (userRoles != null && userRoles!!.isStaff()) { - val userString = getUserIdFromQrString(it.text) - Log.d("USER QR CODE", userString) - viewModel.checkUserIntoEventAsStaff(userString, getStaffCheckInEventId()) + // check if QR is for meeting attendance or staff attendee check-in + if (isMeetingAttendance) { + // do stuff + val eventId: String = getEventCodeFromQrString(it.text) + Log.d("QRCODE", "$eventId") + viewModel.scanQrToCheckInMeeting(eventId) + } else { + val userString = getUserIdFromQrString(it.text) + viewModel.checkUserIntoEventAsStaff(userString, getStaffCheckInEventId()) + } } else { + // handle attendee event self check-in val eventId: String = getEventCodeFromQrString(it.text) - Log.d("EVENT CODE STRING", it.toString()) - viewModel.scanQrToCheckIn(eventId) + viewModel.scanQrToCheckInEvent(eventId) } } errorCallback = ErrorCallback { @@ -196,14 +212,25 @@ class ScannerFragment : Fragment() { private fun displayStaffScanResult(lastScanStatus: ScanStatus?) = lastScanStatus?.let { val responseString = when (it.userMessage) { - "Success" -> "Success! The attendant has the following dietary restrictions: ${it.dietary}" + "Success" -> { + if (isMeetingAttendance) { + "Success! Your attendance has been recorded!" + } else { + "Success! The attendant has the following dietary restrictions: ${it.dietary}" + } + } "InvalidEventId" -> "The event code doesn't seem to be correct. Try selecting the event again or select another event" "BadUserToken" -> "The QR code may have expired or might be invalid. Please refresh the QR code and try again" "AlreadyCheckedIn" -> "Looks like the attendant is already checked in." - else -> "Something isn't quite right." + else -> { + if (isMeetingAttendance) { + "Scan Failed. ${it.userMessage}" + } else { + "Something isn't quite right." + } + } } - // make toast from response - Log.d("SCAN STATUS RESULT", responseString) + // make dialog from response if (activity != null) { AlertDialog.Builder(requireActivity()) .setMessage(responseString) @@ -231,17 +258,13 @@ class ScannerFragment : Fragment() { } private fun showStaffChipGroup(it: Roles?) = it?.let { - staffChipGroup.visibility = if (it.isStaff()) View.VISIBLE else View.INVISIBLE + staffChipGroup.visibility = if (it.isStaff() && !isMeetingAttendance) View.VISIBLE else View.INVISIBLE } private fun getStaffCheckInEventId(): String { return chipIdToEventId[staffChipGroup.checkedChipId] ?: "0b8ea2a94ba4224c075f016256fbddfa" } - private fun updateOverrideSwitchVisibility(it: Roles?) = it?.let { -// staffOverrideSwitch.visibility = if (it.isAdmin()) View.VISIBLE else View.GONE - } - private fun hideStatusTextVisibility(views: List) { for (view in views) { view.visibility = View.INVISIBLE @@ -251,12 +274,14 @@ class ScannerFragment : Fragment() { companion object { val EVENT_ID_KEY = "event_id" val EVENT_NAME_KEY = "event_name" + val IS_MEETING_ATTENDANCE_KEY = "is_meeting_attendance_key" - fun newInstance(eventId: String, eventName: String): ScannerFragment { + fun newInstance(eventId: String, eventName: String, isMeetingAttendance: Boolean): ScannerFragment { val fragment = ScannerFragment() val args = Bundle().apply { putString(EVENT_ID_KEY, eventId) putString(EVENT_NAME_KEY, eventName) + putBoolean(IS_MEETING_ATTENDANCE_KEY, isMeetingAttendance) } fragment.arguments = args return fragment @@ -267,7 +292,7 @@ class ScannerFragment : Fragment() { val context = requireActivity().applicationContext return context.getSharedPreferences( context.getString(R.string.authorization_pref_file_key), - Context.MODE_PRIVATE + Context.MODE_PRIVATE, ).getString("provider", "") ?: "" == "google" } } diff --git a/app/src/main/java/org/hackillinois/android/view/scanner/StaffScannerFragment.kt b/app/src/main/java/org/hackillinois/android/view/scanner/StaffScannerFragment.kt new file mode 100644 index 000000000..92d87b3bd --- /dev/null +++ b/app/src/main/java/org/hackillinois/android/view/scanner/StaffScannerFragment.kt @@ -0,0 +1,46 @@ +package org.hackillinois.android.view.scanner + +import android.os.Bundle +import android.view.LayoutInflater +import android.view.View +import android.view.ViewGroup +import android.widget.Button +import androidx.fragment.app.Fragment +import com.google.android.material.bottomappbar.BottomAppBar +import com.google.android.material.floatingactionbutton.FloatingActionButton +import org.hackillinois.android.R +import org.hackillinois.android.view.MainActivity + +class StaffScannerFragment : Fragment() { + override fun onCreateView( + inflater: LayoutInflater, + container: ViewGroup?, + savedInstanceState: Bundle?, + ): View? { + val view = inflater.inflate(R.layout.fragment_staff_scanner, container, false) + + // get bottom app bar and scanner button views from the MainActivity + val appBar = activity!!.findViewById(R.id.bottomAppBar) + val scannerBtn = activity!!.findViewById(R.id.code_entry_fab) + + // when meeting attendance button is clicked + val meetingAttendanceButton = view.findViewById