Commit 8eee40c0 by Paktalin

Button addWord appears and disappears as expected

parent 56cd1959
......@@ -15,7 +15,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".ui.MainActivity" />
<activity
android:name=".ui.MainActivity"
android:windowSoftInputMode="adjustResize"/>
<activity android:name=".ui.LogInActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......
......@@ -8,6 +8,7 @@ import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageButton
import com.paktalin.vocabularynotebook.R
import kotlinx.android.synthetic.main.fragment_new_word.*
......@@ -35,6 +36,7 @@ class NewWordFragment : Fragment() {
etWord.text.clear()
etTranslation.text.clear()
}
activity!!.findViewById<ImageButton>(R.id.btnAddWord).setOnClickListener { addWord() }
}
private fun textWatcher(setEmpty: () -> Unit): TextWatcher {
......@@ -58,11 +60,12 @@ class NewWordFragment : Fragment() {
private fun showAddWordButton() {
Log.d(TAG, "showAddWordButton")
//todo show add word button
activity!!.findViewById<ImageButton>(R.id.btnAddWord).visibility = View.VISIBLE
}
private fun hideAddWordButton() {
Log.d(TAG, "hideAddWordButton")
activity!!.findViewById<ImageButton>(R.id.btnAddWord).visibility = View.GONE
}
private fun hideClearButton() {
......@@ -73,7 +76,10 @@ class NewWordFragment : Fragment() {
private fun showClearButton() {
Log.d(TAG, "showClearButton")
btnClear.visibility = View.VISIBLE
//todo add button click listener
}
private fun addWord() {
//todo get word data from edit texts and save it
}
companion object { private val TAG = "VN/" + NewWordFragment::class.java.simpleName }
......
......@@ -9,10 +9,9 @@
<include layout="@layout/img_background" />
<LinearLayout
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<fragment
android:id="@+id/fragment_new_word"
......@@ -32,9 +31,30 @@
android:id="@+id/fragment_vocabulary"
android:name="com.paktalin.vocabularynotebook.ui.VocabularyFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/fragment_new_word" />
<ImageButton
android:id="@+id/btnAddWord"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:background="@android:color/transparent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:visibility="invisible"
app:srcCompat="@drawable/ic_done_icon" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
<android.support.design.widget.NavigationView
android:id="@+id/navigationView"
......
......@@ -10,7 +10,6 @@
<android.support.v7.widget.RecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp" />
android:layout_height="wrap_content"/>
</FrameLayout>
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 sign in to comment