Skip to content

Commit

Permalink
AJ-181: setup click by company name
Browse files Browse the repository at this point in the history
  • Loading branch information
Gromov Evgeny committed Mar 2, 2020
1 parent 2d644ae commit 7ba127d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class SelectedReviewFragment : BaseSupportFragment(), SelectedReview {
if (editMode) {
ivEdit.setOnClickListener { showEditReview() }
}
tvName.setOnClickListener { presenter.onClickCompanyName() }
}

private fun setupToolbar() {
Expand Down Expand Up @@ -406,6 +407,12 @@ class SelectedReviewFragment : BaseSupportFragment(), SelectedReview {
etMessage.text = null
}

override fun showCompanyDetail(companyId: String?) {
companyId?.let {
addFragment(CompanyDetailFragment.newInstance(companyId), R.id.main_container, true)
}
}

companion object {
private const val NEW = 0
private const val UPDATE = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ interface SelectedReview: MvpView {
fun onDislikeClicked()
fun setupComments(user: FirebaseUser?)
fun clearMessage()
fun showCompanyDetail(companyId: String?)
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,8 @@ class SelectedReviewPresenter : BasePresenter<SelectedReview>(), ValueEventListe
if (user == null) viewState.showAuth(R.string.dislike_login)
else viewState.onDislikeClicked()
}

fun onClickCompanyName() {
viewState.showCompanyDetail(review?.companyId)
}
}
6 changes: 4 additions & 2 deletions app/src/main/res/layout/content_selected_review.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,20 @@

<TextView
android:id="@+id/tvName"
android:layout_width="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:background="?android:attr/selectableItemBackground"
android:textColor="@color/colorPrimaryDark"
android:textStyle="bold"
app:layout_constrainedWidth="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="druger" />
tools:text="Google" />

<TextView
android:id="@+id/tvDate"
Expand Down

0 comments on commit 7ba127d

Please sign in to comment.