Commit 8eee40c0 by Paktalin

Button addWord appears and disappears as expected

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