Commit 0373e9dd authored by Konstantin Tskhovrebov's avatar Konstantin Tskhovrebov 🤖

Merge branch 'develop' into feature/material_improvements

parents 26ac8b79 8a20da45
......@@ -90,7 +90,7 @@ class MergeRequestRepository @Inject constructor(
),
mr.title,
mr.createdAt,
AppTarget.ISSUE,
AppTarget.MERGE_REQUEST,
mr.id,
TargetInternal(mr.projectId, mr.iid),
badges
......
......@@ -61,7 +61,7 @@ class IssueActivity : BaseActivity() {
override fun onDestroy() {
super.onDestroy()
if (isFinishing) Toothpick.closeScope(DI.MERGE_REQUEST_SCOPE)
if (isFinishing) Toothpick.closeScope(DI.ISSUE_SCOPE)
}
private val navigator = object : FlowNavigator(this, R.id.container) {
......
......@@ -5,6 +5,10 @@ import com.arellomobile.mvp.presenter.InjectPresenter
import com.arellomobile.mvp.presenter.ProvidePresenter
import kotlinx.android.synthetic.main.fragment_issue_info.*
import ru.terrakok.gitlabclient.R
import ru.terrakok.gitlabclient.entity.issue.IssueState
import ru.terrakok.gitlabclient.extension.color
import ru.terrakok.gitlabclient.extension.humanTime
import ru.terrakok.gitlabclient.extension.loadRoundedImage
import ru.terrakok.gitlabclient.presentation.issue.IssueInfoPresenter
import ru.terrakok.gitlabclient.presentation.issue.IssueInfoView
import ru.terrakok.gitlabclient.toothpick.DI
......@@ -31,7 +35,32 @@ class IssueInfoFragment : BaseFragment(), IssueInfoView {
}
override fun showIssue(issueInfo: IssueInfoView.IssueInfo) {
toolbar.title = issueInfo.issue.id.toString()
val issue = issueInfo.issue
val project = issueInfo.project
toolbar.title = "#${issue.iid}"
toolbar.subtitle = project.name
titleTextView.text = issue.title
stateImageView.setImageResource(R.drawable.circle)
// TODO: issue info (Display action user name for the CLOSED states).
// Wait for https://gitlab.com/gitlab-org/gitlab-ce/issues/41967
when (issue.state) {
IssueState.OPENED -> {
stateImageView.setColorFilter(context!!.color(R.color.green))
subtitleTextView.text = String.format(
getString(R.string.issue_info_subtitle),
getString(R.string.target_status_opened),
issue.author.name,
issue.createdAt.humanTime(resources)
)
}
IssueState.CLOSED -> {
stateImageView.setColorFilter(context!!.color(R.color.red))
subtitleTextView.text = getString(R.string.target_status_closed)
}
}
avatarImageView.loadRoundedImage(issue.author.avatarUrl, context)
descriptionWebView.loadData(issueInfo.htmlDescription, "text/html", "UTF-8")
}
override fun showProgress(show: Boolean) {
......
......@@ -5,6 +5,10 @@ import com.arellomobile.mvp.presenter.InjectPresenter
import com.arellomobile.mvp.presenter.ProvidePresenter
import kotlinx.android.synthetic.main.fragment_mr_info.*
import ru.terrakok.gitlabclient.R
import ru.terrakok.gitlabclient.entity.mergerequest.MergeRequestState
import ru.terrakok.gitlabclient.extension.color
import ru.terrakok.gitlabclient.extension.humanTime
import ru.terrakok.gitlabclient.extension.loadRoundedImage
import ru.terrakok.gitlabclient.presentation.mergerequest.MergeRequestInfoPresenter
import ru.terrakok.gitlabclient.presentation.mergerequest.MergeRequestInfoView
import ru.terrakok.gitlabclient.toothpick.DI
......@@ -32,7 +36,36 @@ class MergeRequestInfoFragment : BaseFragment(), MergeRequestInfoView {
}
override fun showMergeRequest(mrInfo: MergeRequestInfoView.MergeRequestInfo) {
toolbar.title = mrInfo.mr.id.toString()
val mergeRequest = mrInfo.mr
val project = mrInfo.project
toolbar.title = "!${mergeRequest.iid}"
toolbar.subtitle = project.name
titleTextView.text = mergeRequest.title
stateImageView.setImageResource(R.drawable.circle)
// TODO: merge request info (Display action user name for the MERGED/CLOSED states).
// Wait for https://gitlab.com/gitlab-org/gitlab-ce/issues/41905.
when (mergeRequest.state) {
MergeRequestState.OPENED -> {
stateImageView.setColorFilter(context!!.color(R.color.green))
subtitleTextView.text = String.format(
getString(R.string.merge_request_info_subtitle),
getString(R.string.target_status_opened),
mergeRequest.author.name,
mergeRequest.createdAt.humanTime(resources)
)
}
MergeRequestState.MERGED -> {
stateImageView.setColorFilter(context!!.color(R.color.blue))
subtitleTextView.text = getString(R.string.target_status_merged)
}
MergeRequestState.CLOSED -> {
stateImageView.setColorFilter(context!!.color(R.color.red))
subtitleTextView.text = getString(R.string.target_status_closed)
}
}
avatarImageView.loadRoundedImage(mergeRequest.author.avatarUrl, context)
descriptionWebView.loadData(mrInfo.htmlDescription, "text/html", "UTF-8")
}
override fun showProgress(show: Boolean) {
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/ToolbarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
app:navigationIcon="@drawable/ic_arrow_back_24dp"
tools:title="MergeRequest"/>
tools:subtitle="GitFox"
tools:title="#56" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="16dp"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/avatarImageView"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
tools:src="@drawable/default_img" />
<TextView
android:id="@+id/titleTextView"
fontPath="@string/font_main_medium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:textColor="@color/primary_text"
android:textSize="18sp"
app:layout_constraintLeft_toRightOf="@id/avatarImageView"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/avatarImageView"
tools:text="Issue title" />
<ImageView
android:id="@+id/stateImageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginTop="6dp"
app:layout_constraintStart_toStartOf="@id/titleTextView"
app:layout_constraintTop_toBottomOf="@id/titleTextView"
tools:src="@drawable/circle" />
<TextView
android:id="@+id/subtitleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:textColor="@color/secondary_text"
android:textSize="14sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toEndOf="@id/stateImageView"
app:layout_constraintTop_toBottomOf="@id/titleTextView"
tools:text="Opened by CraggyHaggy 3d ago" />
<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="@dimen/divider_size"
android:layout_marginTop="16dp"
android:background="@color/divider"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/subtitleTextView" />
<WebView
android:id="@+id/descriptionWebView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
style="@style/ToolbarStyle"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.AppCompat.Dark"
app:navigationIcon="@drawable/ic_arrow_back_24dp"
tools:title="MergeRequest"/>
tools:subtitle="GitFox"
tools:title="!56" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="16dp"
android:fillViewport="true">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/avatarImageView"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="16dp"
app:layout_constraintLeft_toLeftOf="parent"
tools:src="@drawable/default_img" />
<TextView
android:id="@+id/titleTextView"
fontPath="@string/font_main_medium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:textColor="@color/primary_text"
android:textSize="18sp"
app:layout_constraintLeft_toRightOf="@id/avatarImageView"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="@id/avatarImageView"
tools:text="MergeRequest title" />
<ImageView
android:id="@+id/stateImageView"
android:layout_width="16dp"
android:layout_height="16dp"
android:layout_marginTop="6dp"
app:layout_constraintStart_toStartOf="@id/titleTextView"
app:layout_constraintTop_toBottomOf="@id/titleTextView"
tools:src="@drawable/circle" />
<TextView
android:id="@+id/subtitleTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp"
android:layout_marginTop="4dp"
android:textColor="@color/secondary_text"
android:textSize="14sp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toEndOf="@id/stateImageView"
app:layout_constraintTop_toBottomOf="@id/titleTextView"
tools:text="Opened by CraggyHaggy 3d ago" />
<View
android:id="@+id/divider"
android:layout_width="0dp"
android:layout_height="@dimen/divider_size"
android:layout_marginTop="16dp"
android:background="@color/divider"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/subtitleTextView" />
<WebView
android:id="@+id/descriptionWebView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider" />
</android.support.constraint.ConstraintLayout>
</ScrollView>
</LinearLayout>
\ No newline at end of file
......@@ -139,6 +139,12 @@
<string name="todo_action_approval_required">approval required</string>
<string name="todo_action_directly_addressed">directly addressed</string>
<!--Merge Request Info screen-->
<string name="merge_request_info_subtitle" formatted="false">%s by %s %s</string>
<!--Issue Info screen-->
<string name="issue_info_subtitle" formatted="false">%s by %s %s</string>
<!--Calligraphy Config-->
<string name="font_main_regular">fonts/Roboto-Regular.ttf</string>
<string name="font_main_medium">fonts/Roboto-Medium.ttf</string>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment