Commit fc1ee8d4 by Paktalin

Button Cancel in AddWordActivity added

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