Skip to content

Commit

Permalink
remove from adapters, api
Browse files Browse the repository at this point in the history
  • Loading branch information
rchhaya committed Oct 8, 2023
1 parent b2c8954 commit 795ef8f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ class AboutAdapter(private var members: ArrayList<String>)
"Aaron Mei" -> R.drawable.aaron
else -> null
}
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M){
if (imageId != null) holder.view.person_iv?.setImageResource(imageId)
}
if (imageId != null) holder.view.person_iv?.setImageResource(imageId)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class DiningInsightsCardAdapter(private var cells: ArrayList<DiningInsightCell>)
}
}

@RequiresApi(Build.VERSION_CODES.O)
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val cell = cells[position]
when (cell.type) {
Expand Down Expand Up @@ -109,23 +108,20 @@ class DiningInsightsCardAdapter(private var cells: ArrayList<DiningInsightCell>)
// Populate dining dollars spent card

}
@RequiresApi(Build.VERSION_CODES.O)
private fun bindDiningDollarsPredictions(holder: ViewHolder, cell: DiningInsightCell) {
val v = holder.view
val tvPredictionsTitle = (v.findViewById<View>(R.id.predictions_title) as TextView)
tvPredictionsTitle.text = mContext.getString(R.string.dining_dollars_predictions)
bindPredictions(holder, cell, DINING_DOLLARS_PREDICTIONS)
}

@RequiresApi(Build.VERSION_CODES.O)
private fun bindDiningSwipesPredictions(holder: ViewHolder, cell: DiningInsightCell) {
val v = holder.view
val tvPredictionsTitle = (v.findViewById<View>(R.id.predictions_title) as TextView)
tvPredictionsTitle.text = mContext.getString(R.string.dining_swipes_predictions)
bindPredictions(holder, cell, DINING_SWIPES_PREDICTIONS)
}

@RequiresApi(Build.VERSION_CODES.O)
private fun bindPredictions(holder: ViewHolder, cell: DiningInsightCell, typeId: Int) {
// Populate dining dollars predictions card
if (cell.diningBalancesList == null) {
Expand Down Expand Up @@ -205,7 +201,6 @@ class DiningInsightsCardAdapter(private var cells: ArrayList<DiningInsightCell>)
}
}

@RequiresApi(Build.VERSION_CODES.M)
private fun setData(amounts: List<Float>, diningDollarsGraph: LineChart, holder: ViewHolder, typeId: Int) {
val values: ArrayList<Entry> = ArrayList()
amounts.forEachIndexed { index, amount ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import com.pennapps.labs.pennmobile.DiningInsightsFragment

class DiningPagerAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle?) : FragmentStateAdapter(fragmentManager, lifecycle!!) {
override fun createFragment(position: Int): Fragment {
if (position == 0) {
return DiningFragment()
return if (position == 0) {
DiningFragment()
} else {
return DiningInsightsFragment()
DiningInsightsFragment()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,6 @@ class GsrRoomAdapter(internal var timeRanges: ArrayList<String>, internal var id
if (duration > 0) {
val startTime = starts[position]
val endTime = ends[position]
/*if (gsrLocationCode == "JMHH") {
val huntsmanGSRLogin = HuntsmanGSRLogin.newInstance(localGSRID, gsrLocationCode, startTime, endTime,
gid, roomName)
val fragmentManager = (context as MainActivity).supportFragmentManager
fragmentManager.beginTransaction()
.replace(R.id.content_frame, huntsmanGSRLogin)
.addToBackStack("GSR Fragment")
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.commit()
} else {
val bookGsrFragment = BookGsrFragment.newInstance(localGSRID, gsrLocationCode, startTime, endTime,
gid, localGSRID.toInt(), roomName)
val fragmentManager = (context as MainActivity).supportFragmentManager
fragmentManager.beginTransaction()
.replace(R.id.content_frame, bookGsrFragment)
.addToBackStack("GSR Fragment")
.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
.commit()
}*/
val bookGsrFragment = BookGsrFragment.newInstance(localGSRID, gsrLocationCode, startTime, endTime,
gid, localGSRID.toInt(), roomName)
val fragmentManager = (context as MainActivity).supportFragmentManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,16 +265,11 @@ class HomeAdapter(private var cells: ArrayList<HomeCell>) :
}

/** Sets up blur view on news card */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
holder.itemView.blurView.setupWith(holder.itemView.news_card_container)
.setFrameClearDrawable(ColorDrawable(getColor(mContext, R.color.white)))
.setBlurAlgorithm(RenderScriptBlur(mContext))
.setBlurRadius(25f)
.setHasFixedTransformationMatrix(true)
} else {
holder.itemView.blurView.setBackgroundColor(ColorUtils
.setAlphaComponent(getColor(mContext, R.color.black), 225))
}
holder.itemView.blurView.setupWith(holder.itemView.news_card_container)
.setFrameClearDrawable(ColorDrawable(getColor(mContext, R.color.white)))
.setBlurAlgorithm(RenderScriptBlur(mContext))
.setBlurRadius(25f)
.setHasFixedTransformationMatrix(true)

holder.itemView.button.setOnClickListener {

Expand Down Expand Up @@ -344,9 +339,7 @@ class HomeAdapter(private var cells: ArrayList<HomeCell>) :
val params : ConstraintLayout.LayoutParams =
holder.itemView.home_card_rv.layoutParams as ConstraintLayout.LayoutParams
params.setMargins(0, 0, 0, 0)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
params.marginStart = 0
}
params.marginStart = 0

holder.itemView.home_card_rv.layoutParams = params

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ public void onBindViewHolder(LaundryRoomAdapter.CustomViewHolder holder, int pos
holder.layout.setBackgroundResource(0);
LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) holder.layout.getLayoutParams();
layoutParams.setMargins(0, 0, 0, 0);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
layoutParams.setMarginStart(0);
}
layoutParams.setMarginStart(0);
holder.layout.setLayoutParams(layoutParams);
CardView container = (CardView) holder.dryerRecyclerView.getParent();
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) container.getLayoutParams();
Expand Down

0 comments on commit 795ef8f

Please sign in to comment.