Commit 1ca4ace2 by Paktalin

RecyclerView layout is now scrollable

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