Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
baronhsieh2005 committed Sep 29, 2024
1 parent 9197ca1 commit 1a8b9c6
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.recyclerview.widget.RecyclerView
import com.pennapps.labs.pennmobile.R
import com.pennapps.labs.pennmobile.databinding.TeamMemberBinding


class AboutAdapter(
private var members: ArrayList<String>,
) : RecyclerView.Adapter<AboutAdapter.TeamViewHolder>() {
Expand All @@ -30,7 +29,7 @@ class AboutAdapter(
holder: TeamViewHolder,
position: Int,
) {
holder.name_tv.text = members[position]
holder.nameTv.text = members[position]
val imageId =
when (members[position]) {
"Marta García Ferreiro" -> R.drawable.marta
Expand All @@ -52,13 +51,13 @@ class AboutAdapter(
"Baron Ping-Yeh Hsieh" -> R.drawable.baron
else -> null
}
if (imageId != null) holder.person_iv.setImageResource(imageId)
if (imageId != null) holder.personIv.setImageResource(imageId)
}

inner class TeamViewHolder(
itemBinding: TeamMemberBinding,
) : RecyclerView.ViewHolder(itemBinding.root) {
val person_iv: ImageView = itemBinding.personIv
val name_tv: TextView = itemBinding.nameTv
val personIv: ImageView = itemBinding.personIv
val nameTv: TextView = itemBinding.nameTv
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ class GsrReservationsAdapter(
.load(imageUrl)
.fit()
.centerCrop()
.into(holder.gsr_reservation_iv)
.into(holder.gsrReservationIv)

holder.gsr_reservation_location_tv.text = roomName
holder.gsr_reservation_date_tv.text = day + "\n" + fromHour + "-" + toHour
holder.gsrReservationLocationTv.text = roomName
holder.gsrReservationDateTv.text = day + "\n" + fromHour + "-" + toHour

holder.gsr_reservation_cancel_button.setOnClickListener {
holder.gsrReservationCancelButton.setOnClickListener {
// create dialog to confirm that you want to cancel reservation
val builder = AlertDialog.Builder(mContext)
builder.setTitle("Are you sure?")
Expand Down Expand Up @@ -142,9 +142,9 @@ class GsrReservationsAdapter(
inner class GsrReservationViewHolder(
itemBinding: GsrReservationBinding,
) : RecyclerView.ViewHolder(itemBinding.root) {
val gsr_reservation_cancel_button = itemBinding.gsrReservationCancelBtn
val gsr_reservation_location_tv = itemBinding.gsrReservationLocationTv
val gsr_reservation_date_tv = itemBinding.gsrReservationDateTv
val gsr_reservation_iv = itemBinding.gsrReservationIv
val gsrReservationCancelButton = itemBinding.gsrReservationCancelBtn
val gsrReservationLocationTv = itemBinding.gsrReservationLocationTv
val gsrReservationDateTv = itemBinding.gsrReservationDateTv
val gsrReservationIv = itemBinding.gsrReservationIv
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ class HomeGsrBuildingAdapter(
position: Int,
) {
val building = buildings[position]
holder.home_gsr_building_tv.text = building
holder.homeGsrBuildingTv.text = building
if (building == "Huntsman Hall") {
holder.home_gsr_building_iv.setImageResource(R.drawable.huntsman)
holder.homeGsrBuildingIv.setImageResource(R.drawable.huntsman)
} else {
holder.home_gsr_building_iv.setImageResource(R.drawable.weigle)
holder.homeGsrBuildingIv.setImageResource(R.drawable.weigle)
}
holder.itemView.setOnClickListener {
fragmentTransact(GsrTabbedFragment(), false)
Expand All @@ -50,8 +50,8 @@ class HomeGsrBuildingAdapter(
inner class HomeGsrBuildingViewHolder(
itemBinding: HomeGsrBuildingBinding,
) : RecyclerView.ViewHolder(itemBinding.root) {
val home_gsr_building_iv: ImageView = itemBinding.homeGsrBuildingIv
val home_gsr_building_tv: TextView = itemBinding.homeGsrBuildingTv
val homeGsrBuildingIv: ImageView = itemBinding.homeGsrBuildingIv
val homeGsrBuildingTv: TextView = itemBinding.homeGsrBuildingTv
}

private fun fragmentTransact(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ class HomeGsrReservationAdapter(

override fun getItemCount(): Int = activeReservations.size


inner class GSRReservationViewHolder(
itemBinding: GsrListItemBinding,
) : RecyclerView.ViewHolder(itemBinding.root) {
val itemImage : ImageView = itemBinding.itemGsrImage
val itemLocation : TextView = itemBinding.itemGsrLocation
val itemDate : TextView = itemBinding.itemGsrDate
val itemImage: ImageView = itemBinding.itemGsrImage
val itemLocation: TextView = itemBinding.itemGsrLocation
val itemDate: TextView = itemBinding.itemGsrDate
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ class PollOptionAdapter(
holder: PollHolder,
pollOption: PollOption,
) {
holder.tv_option.text = pollOption.choice
holder.tvOption.text = pollOption.choice

var startX: Float? = null
var startY: Float? = null
holder.seek_bar.setOnTouchListener { v, event ->
holder.seekBar.setOnTouchListener { v, event ->
when (event.action) {
MotionEvent.ACTION_DOWN -> {
startX = event.x
Expand All @@ -77,24 +77,24 @@ class PollOptionAdapter(
true
}
if (pollOption.selected) {
holder.tv_option.setTextColor(mContext.resources.getColor(R.color.color_secondary))
holder.tv_percent.setTextColor(mContext.resources.getColor(R.color.color_secondary))
holder.tv_votes.setTextColor(mContext.resources.getColor(R.color.color_secondary))
holder.seek_bar.progressDrawable = mContext.getDrawable(R.drawable.poll_track_selected)
holder.card_view.foreground = mContext.getDrawable(R.drawable.card_view_border)
holder.tvOption.setTextColor(mContext.resources.getColor(R.color.color_secondary))
holder.tvPercent.setTextColor(mContext.resources.getColor(R.color.color_secondary))
holder.tvVotes.setTextColor(mContext.resources.getColor(R.color.color_secondary))
holder.seekBar.progressDrawable = mContext.getDrawable(R.drawable.poll_track_selected)
holder.cardView.foreground = mContext.getDrawable(R.drawable.card_view_border)
} else {
holder.tv_option.setTextColor(Color.parseColor("#13284B"))
holder.tv_percent.setTextColor(Color.parseColor("#13284B"))
holder.tv_votes.setTextColor(Color.parseColor("#13284B"))
holder.seek_bar.progressDrawable = mContext.getDrawable(R.drawable.poll_track)
holder.card_view.foreground = null
holder.tvOption.setTextColor(Color.parseColor("#13284B"))
holder.tvPercent.setTextColor(Color.parseColor("#13284B"))
holder.tvVotes.setTextColor(Color.parseColor("#13284B"))
holder.seekBar.progressDrawable = mContext.getDrawable(R.drawable.poll_track)
holder.cardView.foreground = null
}
if (poll.isVisible) {
holder.tv_votes.text = "${pollOption.voteCount}"
holder.tvVotes.text = "${pollOption.voteCount}"
val votePercent = (pollOption.voteCount.div(poll.totalVotes.toDouble())) * 100
holder.tv_percent.text = String.format("%.2f%%", votePercent)
holder.seek_bar.progress = round(votePercent).toInt()
holder.seek_bar.setOnTouchListener { v, event -> true }
holder.tvPercent.text = String.format("%.2f%%", votePercent)
holder.seekBar.progress = round(votePercent).toInt()
holder.seekBar.setOnTouchListener { v, event -> true }
}
}

Expand All @@ -112,11 +112,11 @@ class PollOptionAdapter(
class PollHolder(
itemBinding: PollListItemBinding,
) : RecyclerView.ViewHolder(itemBinding.root) {
internal var tv_option: TextView = itemBinding.tvOption
internal var tv_percent: TextView = itemBinding.tvPercent
internal var seek_bar: SeekBar = itemBinding.seekBar
internal var card_view: CardView = itemBinding.cardView
internal var tv_votes: TextView = itemBinding.tvVotes
internal var tvOption: TextView = itemBinding.tvOption
internal var tvPercent: TextView = itemBinding.tvPercent
internal var seekBar: SeekBar = itemBinding.seekBar
internal var cardView: CardView = itemBinding.cardView
internal var tvVotes: TextView = itemBinding.tvVotes
}

companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class UniversityEventAdapter(

// holder.itemView.event_day.text = dayOfMonth
// holder.itemView.event_month.text = month
holder.event_month.text = event.date
holder.event_name.text = name
holder.event_name.isSelected = true
holder.eventMonth.text = event.date
holder.eventName.text = name
holder.eventName.isSelected = true
/* if (from == to) {
holder.itemView.event_day_of_week.text = start
} else {
Expand All @@ -58,7 +58,7 @@ class UniversityEventAdapter(
inner class UniversityEventViewHolder(
itemBinding: UniversityEventBinding,
) : RecyclerView.ViewHolder(itemBinding.root) {
val event_month : TextView = itemBinding.eventMonth
val event_name : TextView = itemBinding.eventNameTv
val eventMonth: TextView = itemBinding.eventMonth
val eventName: TextView = itemBinding.eventNameTv
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import com.pennapps.labs.pennmobile.components.collapsingtoolbar.ToolbarBehavior
import com.pennapps.labs.pennmobile.databinding.FragmentMoreBinding
import com.pennapps.labs.pennmobile.utils.Utils


class MoreFragment : Fragment() {
private lateinit var mActivity: MainActivity

Expand All @@ -37,9 +36,9 @@ class MoreFragment : Fragment() {
val v = binding.root
binding.dateView.text = Utils.getCurrentSystemTime()
(
binding.appbarHome.layoutParams
as CoordinatorLayout.LayoutParams
).behavior = ToolbarBehavior()
binding.appbarHome.layoutParams
as CoordinatorLayout.LayoutParams
).behavior = ToolbarBehavior()
return v
}

Expand Down

0 comments on commit 1a8b9c6

Please sign in to comment.