Commit fc1ee8d4 by Paktalin

Button Cancel in AddWordActivity added

parent 4dd660d5
...@@ -4,6 +4,8 @@ import android.util.Log ...@@ -4,6 +4,8 @@ import android.util.Log
import com.google.firebase.auth.FirebaseUser import com.google.firebase.auth.FirebaseUser
import com.google.firebase.firestore.FirebaseFirestore import com.google.firebase.firestore.FirebaseFirestore
import com.paktalin.vocabularynotebook.activities.LogInActivity import com.paktalin.vocabularynotebook.activities.LogInActivity
import com.paktalin.vocabularynotebook.pojo.UserPojo
import com.paktalin.vocabularynotebook.pojo.VocabularyPojo
import java.util.* import java.util.*
class UserManager { class UserManager {
......
package com.paktalin.vocabularynotebook.activities package com.paktalin.vocabularynotebook.activities
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import android.support.v7.app.AppCompatActivity import android.support.v7.app.AppCompatActivity
import android.util.Log import android.util.Log
...@@ -8,7 +9,7 @@ import com.google.firebase.firestore.FirebaseFirestore ...@@ -8,7 +9,7 @@ import com.google.firebase.firestore.FirebaseFirestore
import com.paktalin.vocabularynotebook.R import com.paktalin.vocabularynotebook.R
import com.paktalin.vocabularynotebook.Utils import com.paktalin.vocabularynotebook.Utils
import com.paktalin.vocabularynotebook.WordPojo import com.paktalin.vocabularynotebook.pojo.WordPojo
import kotlinx.android.synthetic.main.activity_add_word.* import kotlinx.android.synthetic.main.activity_add_word.*
class AddWordActivity : AppCompatActivity() { class AddWordActivity : AppCompatActivity() {
...@@ -25,7 +26,8 @@ class AddWordActivity : AppCompatActivity() { ...@@ -25,7 +26,8 @@ class AddWordActivity : AppCompatActivity() {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(R.layout.activity_add_word) setContentView(R.layout.activity_add_word)
vocabularyId = intent.getStringExtra("vocabularyId") vocabularyId = intent.getStringExtra("vocabularyId")
btnSubmitNewWord.setOnClickListener( { addWordToDb() }) btnSubmitNewWord.setOnClickListener { addWordToDb() }
btnCancel.setOnClickListener { cancel() }
} }
private fun addWordToDb() { private fun addWordToDb() {
...@@ -44,6 +46,11 @@ class AddWordActivity : AppCompatActivity() { ...@@ -44,6 +46,11 @@ class AddWordActivity : AppCompatActivity() {
} }
} }
private fun cancel() {
val intentMainActivity = Intent(this, MainActivity::class.java)
startActivity(intentMainActivity)
}
private fun clearFields() { private fun clearFields() {
etWord.text.clear() etWord.text.clear()
etTranslation.text.clear() etTranslation.text.clear()
......
package com.paktalin.vocabularynotebook; package com.paktalin.vocabularynotebook.pojo;
import com.google.firebase.firestore.DocumentReference; import com.google.firebase.firestore.DocumentReference;
......
package com.paktalin.vocabularynotebook; package com.paktalin.vocabularynotebook.pojo;
public class VocabularyPojo { public class VocabularyPojo {
......
package com.paktalin.vocabularynotebook; package com.paktalin.vocabularynotebook.pojo;
public class WordPojo { public class WordPojo {
......
...@@ -38,4 +38,15 @@ ...@@ -38,4 +38,15 @@
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etTranslation" /> app:layout_constraintTop_toBottomOf="@+id/etTranslation" />
<Button
android:id="@+id/btnCancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginLeft="8dp"
android:layout_marginStart="8dp"
android:text="Cancel"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
\ 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