Skip to content

Commit

Permalink
#1: Create register feeling screen
Browse files Browse the repository at this point in the history
  • Loading branch information
vhra committed Jul 30, 2018
1 parent 1b18c8a commit ec7fedc
Show file tree
Hide file tree
Showing 6 changed files with 152 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0-alpha3'
}
5 changes: 5 additions & 0 deletions app/src/main/java/br/com/hay/hay/feeling/Feeling.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package br.com.hay.hay.feeling

data class Feeling(
val title: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package br.com.hay.hay.feeling

class RegisterFeelingContract {

interface View {
fun setPresenter(presenter: Presenter)
fun showSubTitle(subTitle: String)
fun showFeelings(feelings: List<Feeling>)
}

interface Presenter {
fun start()
fun onClickNextButton()
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package br.com.hay.hay.feeling

import android.os.Bundle
import android.support.v4.app.Fragment
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.TextView
import br.com.hay.hay.R

class RegisterFeelingFragment : Fragment(), RegisterFeelingContract.View {

private lateinit var mPresenter : RegisterFeelingContract.Presenter
private lateinit var mNextButton : Button
private lateinit var mSubTitleTextView: TextView
private lateinit var mFeelingList : RecyclerView

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.fragment_register_feeling_layout, container, false)

mNextButton = view.findViewById(R.id.button_next)
mSubTitleTextView = view.findViewById(R.id.text_sub_title)
mFeelingList = view.findViewById(R.id.list_feelings)

mNextButton.setOnClickListener {
mPresenter.onClickNextButton()
}

return view
}

override fun onResume() {
super.onResume()
mPresenter.start()
}

override fun setPresenter(presenter: RegisterFeelingContract.Presenter) {
mPresenter = presenter
}

override fun showSubTitle(subTitle: String) {
mSubTitleTextView.text = subTitle
}

override fun showFeelings(feelings: List<Feeling>) {

}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package br.com.hay.hay.feeling

class RegisterFeelingPresenter : RegisterFeelingContract.Presenter {

fun RegisterFeelingPresenter() {

}

override fun start() {

}

override fun onClickNextButton() {

}
}

61 changes: 61 additions & 0 deletions app/src/main/res/layout/fragment_register_feeling_layout.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
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">

<TextView
android:id="@+id/text_title_screen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginTop="32dp"
android:text="COMO VAI VOCÊ?"
android:textSize="42sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/text_sub_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
tools:text="Qua Jul 25 16:03:30"
android:textSize="21sp"
android:textColor="#000"
app:layout_constraintEnd_toEndOf="@+id/text_title_screen"
app:layout_constraintStart_toStartOf="@+id/text_title_screen"
app:layout_constraintTop_toBottomOf="@+id/text_title_screen" />


<android.support.v7.widget.RecyclerView
android:id="@+id/list_feelings"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="6dp"
android:layout_marginTop="32dp"
app:layout_constraintBottom_toTopOf="@+id/button_next"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/text_sub_title" />

<Button
android:id="@+id/button_next"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:background="#0F0"
style="?android:attr/borderlessButtonStyle"
android:text="Next"
android:textColor="#fff"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />

</android.support.constraint.ConstraintLayout>

0 comments on commit ec7fedc

Please sign in to comment.