-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
52 changed files
with
821 additions
and
175 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,4 +63,4 @@ | |
|
||
</application> | ||
|
||
</manifest> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
app/src/main/java/com/carbonylgroup/schoolpower/adapter/AssignmentFlagAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.carbonylgroup.schoolpower.adapter | ||
|
||
import android.content.Context | ||
import android.support.v7.widget.RecyclerView | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import android.widget.ImageView | ||
import android.widget.TextView | ||
import com.carbonylgroup.schoolpower.R | ||
import com.carbonylgroup.schoolpower.R2 | ||
import com.carbonylgroup.schoolpower.data.AssignmentItem | ||
import com.carbonylgroup.schoolpower.utils.Utils | ||
import kotterknife.bindView | ||
|
||
/** | ||
* Created by carbonyl on 21/01/2018. | ||
*/ | ||
|
||
class AssignmentFlagAdapter(private val context: Context, private val assignmentItem: AssignmentItem) : | ||
RecyclerView.Adapter<AssignmentFlagAdapter.AssignmentFlagViewHolder>() { | ||
|
||
private val inflater: LayoutInflater = LayoutInflater.from(context) | ||
private val utils: Utils = Utils(context) | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AssignmentFlagViewHolder { | ||
|
||
val view = inflater.inflate(R.layout.assignment_flag_item, parent, false) | ||
return AssignmentFlagViewHolder(view) | ||
} | ||
|
||
override fun onBindViewHolder(viewHolder: AssignmentFlagViewHolder, position: Int) { | ||
|
||
val (icon, descrip) = utils.getAssignmentFlag(assignmentItem.trueFlags[position].first) | ||
viewHolder.assignment_flag_image.setImageResource(icon) | ||
viewHolder.assignment_flag_description.text = descrip | ||
} | ||
|
||
override fun getItemCount(): Int { | ||
return assignmentItem.trueFlags.count() | ||
} | ||
|
||
class AssignmentFlagViewHolder internal constructor(view: View) : RecyclerView.ViewHolder(view) { | ||
val assignment_flag_image: ImageView by bindView(R2.id.assignment_flag_image) | ||
val assignment_flag_description: TextView by bindView(R2.id.assignment_flag_description) | ||
} | ||
} |
Oops, something went wrong.