Commit 1ca4ace2 by Paktalin

RecyclerView layout is now scrollable

parent cf0341cf
...@@ -30,7 +30,6 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va ...@@ -30,7 +30,6 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va
holder.tvWord.text = wordItem.pojo!!.word holder.tvWord.text = wordItem.pojo!!.word
holder.tvTranslation.text = wordItem.pojo!!.translation holder.tvTranslation.text = wordItem.pojo!!.translation
holder.itemView.setOnClickListener { openWordItemInfo(wordItem) } holder.itemView.setOnClickListener { openWordItemInfo(wordItem) }
holder.btnPopupMenu.setOnClickListener { showPopupMenu(holder.btnPopupMenu, position) }
//todo set click listener to menu //todo set click listener to menu
} }
...@@ -71,7 +70,6 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va ...@@ -71,7 +70,6 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va
inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) { inner class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val tvWord: TextView = itemView.findViewById(R.id.etWord) val tvWord: TextView = itemView.findViewById(R.id.etWord)
val tvTranslation: TextView = itemView.findViewById(R.id.etTranslation) val tvTranslation: TextView = itemView.findViewById(R.id.etTranslation)
val btnPopupMenu: ImageButton = itemView.findViewById(R.id.btnClear)
val layout: LinearLayout = itemView.findViewById(R.id.tableLayout) val layout: LinearLayout = itemView.findViewById(R.id.tableLayout)
} }
......
...@@ -5,6 +5,7 @@ import android.content.Intent ...@@ -5,6 +5,7 @@ import android.content.Intent
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.os.Bundle import android.os.Bundle
import android.util.Log import android.util.Log
import android.view.View
import android.widget.Toast import android.widget.Toast
import com.google.firebase.auth.FirebaseAuth import com.google.firebase.auth.FirebaseAuth
...@@ -36,17 +37,17 @@ class LogInActivity : AppCompatActivity() { ...@@ -36,17 +37,17 @@ class LogInActivity : AppCompatActivity() {
val password = etPassword!!.text.toString() val password = etPassword!!.text.toString()
if (Utils.fieldsNotEmpty(email, password, "Please, enter email and password", this)) { if (Utils.fieldsNotEmpty(email, password, "Please, enter email and password", this)) {
progress.visibility = View.VISIBLE
mAuth!!.signInWithEmailAndPassword(email, password) mAuth!!.signInWithEmailAndPassword(email, password)
.addOnCompleteListener { task -> .addOnCompleteListener { progress.visibility = View.GONE }
if (task.isSuccessful) { .addOnSuccessListener {
Log.d(TAG, "Successfully signed in") Log.d(TAG, "Successfully signed in")
startUserActivity() startUserActivity()
} }
else { .addOnFailureListener {
Log.w(TAG, "signInWithEmail:failure", task.exception) Log.w(TAG, "signInWithEmail:failure", it)
Toast.makeText(this@LogInActivity, "Authentication failed.", Toast.makeText(this@LogInActivity, "Authentication failed.",
Toast.LENGTH_SHORT).show() Toast.LENGTH_SHORT).show()
}
} }
} }
} }
...@@ -83,7 +84,5 @@ class LogInActivity : AppCompatActivity() { ...@@ -83,7 +84,5 @@ class LogInActivity : AppCompatActivity() {
signUp() signUp()
} }
companion object { companion object { private val TAG = "VN/" + LogInActivity::class.simpleName }
private val TAG = "VN/" + LogInActivity::class.simpleName
}
} }
\ No newline at end of file
...@@ -48,8 +48,10 @@ class MainActivity : AppCompatActivity() { ...@@ -48,8 +48,10 @@ class MainActivity : AppCompatActivity() {
val db = ConfiguredFirestore.instance val db = ConfiguredFirestore.instance
val userDocument = db.collection("users").document(userId) val userDocument = db.collection("users").document(userId)
progress.visibility = View.VISIBLE
userDocument.get().addOnSuccessListener { task -> userDocument.get()
.addOnSuccessListener { task ->
progress.visibility = View.GONE
val vocabularies: List<DocumentReference> = task.get("vocabularies") as List<DocumentReference> val vocabularies: List<DocumentReference> = task.get("vocabularies") as List<DocumentReference>
//todo represent specific vocabulary instead of the first one //todo represent specific vocabulary instead of the first one
val vocabulary = db.collection("vocabularies").document(vocabularies[0].id) val vocabulary = db.collection("vocabularies").document(vocabularies[0].id)
......
...@@ -68,7 +68,7 @@ class NewWordFragment : Fragment() { ...@@ -68,7 +68,7 @@ class NewWordFragment : Fragment() {
private fun hideAddWordButton() { private fun hideAddWordButton() {
activity!!.findViewById<FrameLayout>(R.id.btnAddWordLayout).visibility = View.GONE } activity!!.findViewById<FrameLayout>(R.id.btnAddWordLayout).visibility = View.GONE }
private fun hideClearButton() { btnClear.visibility = View.GONE } private fun hideClearButton() { btnClear.visibility = View.INVISIBLE }
private fun showClearButton() { btnClear.visibility = View.VISIBLE } private fun showClearButton() { btnClear.visibility = View.VISIBLE }
......
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.LogInActivity"> tools:context=".ui.LogInActivity">
<include
android:id="@+id/progress"
layout="@layout/progress"
android:visibility="gone"/>
<EditText <EditText
android:id="@+id/etEmail" android:id="@+id/etEmail"
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -7,10 +7,13 @@ ...@@ -7,10 +7,13 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:openDrawer="start"> tools:openDrawer="start">
<include layout="@layout/img_background" />
<include layout="@layout/notebook_sheet" /> <include layout="@layout/notebook_sheet" />
<include
android:id="@+id/progress"
layout="@layout/progress"
android:visibility="gone" />
<android.support.design.widget.NavigationView <android.support.design.widget.NavigationView
android:id="@+id/navigationView" android:id="@+id/navigationView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -3,11 +3,7 @@ ...@@ -3,11 +3,7 @@
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:paddingLeft="4dp"
android:paddingRight="4dp">
<ImageView <ImageView
android:layout_width="match_parent" android:layout_width="match_parent"
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
xmlns:app="http://schemas.android.com/apk/res-auto">
<include layout="@layout/img_background" /> <ScrollView
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginBottom="24dp" android:scrollbars="vertical">
android:layout_marginEnd="32dp"
android:layout_marginLeft="56dp"
android:layout_marginRight="32dp"
android:layout_marginStart="56dp"
android:layout_marginTop="24dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<fragment
android:id="@+id/fragment_new_word"
android:name="com.paktalin.vocabularynotebook.ui.NewWordFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<fragment <LinearLayout
android:id="@+id/fragment_vocabulary"
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:orientation="vertical">
<fragment
android:id="@+id/fragment_new_word"
android:name="com.paktalin.vocabularynotebook.ui.NewWordFragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout> <fragment
android:id="@+id/fragment_vocabulary"
android:name="com.paktalin.vocabularynotebook.ui.VocabularyFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</ScrollView>
<FrameLayout <FrameLayout
android:id="@+id/btnAddWordLayout" android:id="@+id/btnAddWordLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@color/colorPrimary" android:background="@color/colorPrimary"
android:visibility="invisible"> android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent">
<ImageButton <ImageButton
android:id="@+id/btnAddWord" android:id="@+id/btnAddWord"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginBottom="8dp" android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp" android:layout_marginEnd="8dp"
android:layout_marginRight="8dp" android:layout_marginRight="8dp"
android:background="@android:color/transparent" android:background="@android:color/transparent"
android:layout_gravity="end"
app:srcCompat="@drawable/ic_done_icon" /> app:srcCompat="@drawable/ic_done_icon" />
</FrameLayout> </FrameLayout>
......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</FrameLayout>
\ No newline at end of file
...@@ -7,13 +7,18 @@ ...@@ -7,13 +7,18 @@
android:id="@+id/tableLayout" android:id="@+id/tableLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="horizontal"
android:background="@drawable/one_item2"
android:paddingRight="32dp"
android:paddingLeft="56dp"
android:paddingEnd="32dp"
android:paddingStart="56dp">
<TextView <TextView
android:id="@+id/etWord" android:id="@+id/etWord"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="8" android:layout_weight="1"
android:textSize="22sp" android:textSize="22sp"
app:fontFamily="@font/fonts" app:fontFamily="@font/fonts"
tools:ignore="LabelFor" /> tools:ignore="LabelFor" />
...@@ -22,18 +27,9 @@ ...@@ -22,18 +27,9 @@
android:id="@+id/etTranslation" android:id="@+id/etTranslation"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="8" android:layout_weight="1"
android:textSize="22sp" android:textSize="22sp"
app:fontFamily="@font/fonts" app:fontFamily="@font/fonts"
tools:ignore="LabelFor" /> tools:ignore="LabelFor" />
<ImageButton
android:id="@+id/btnClear"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@android:color/transparent"
app:srcCompat="@drawable/ic_delete_icon"
tools:ignore="ContentDescription" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
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