Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
likorn
/
vocabulary_notebook
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
2d0634ca
authored
Sep 07, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start addWordActivity when button is pressed
parent
1622b5ca
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
3 deletions
app/src/main/AndroidManifest.xml
app/src/main/java/com/paktalin/vocabularynotebook/activities/AddWordActivity.java
app/src/main/java/com/paktalin/vocabularynotebook/activities/VocabularyFragment.kt
app/src/main/res/layout/activity_add_word.xml
app/src/main/AndroidManifest.xml
View file @
2d0634ca
...
...
@@ -23,6 +23,7 @@
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".activities.AddWordActivity"
/>
</application>
</manifest>
\ No newline at end of file
app/src/main/java/com/paktalin/vocabularynotebook/activities/AddWordActivity.java
0 → 100644
View file @
2d0634ca
package
com
.
paktalin
.
vocabularynotebook
.
activities
;
import
android.os.Bundle
;
import
android.support.annotation.Nullable
;
import
android.support.v7.app.AppCompatActivity
;
import
com.paktalin.vocabularynotebook.R
;
public
class
AddWordActivity
extends
AppCompatActivity
{
@Override
protected
void
onCreate
(
@Nullable
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_add_word
);
}
}
app/src/main/java/com/paktalin/vocabularynotebook/activities/VocabularyFragment.kt
View file @
2d0634ca
package
com.paktalin.vocabularynotebook.activities
import
android.annotation.SuppressLint
import
android.content.Intent
import
android.os.Bundle
import
android.support.v4.app.Fragment
import
android.util.Log
...
...
@@ -25,10 +26,16 @@ class VocabularyFragment : Fragment() {
override
fun
onActivityCreated
(
savedInstanceState
:
Bundle
?)
{
super
.
onActivityCreated
(
savedInstanceState
)
fabAddWord
.
setOnClickListener
(
{
addWord
()
}
)
extractUserDocument
()
printUserData
()
}
override
fun
onDestroy
()
{
super
.
onDestroy
()
FirebaseAuth
.
getInstance
().
signOut
()
}
private
fun
extractUserDocument
()
{
val
userId
=
FirebaseAuth
.
getInstance
().
currentUser
!!
.
uid
Log
.
d
(
TAG
,
"retrieved userId: $userId"
)
...
...
@@ -56,9 +63,9 @@ class VocabularyFragment : Fragment() {
}
}
override
fun
onDestroy
()
{
super
.
onDestroy
(
)
FirebaseAuth
.
getInstance
().
signOut
(
)
private
fun
addWord
()
{
val
addWordIntent
=
Intent
(
activity
,
AddWordActivity
::
class
.
java
)
startActivity
(
addWordIntent
)
}
companion
object
{
...
...
app/src/main/res/layout/activity_add_word.xml
0 → 100644
View file @
2d0634ca
<?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"
>
<EditText
android:id=
"@+id/etWord"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:ems=
"10"
android:hint=
"Word"
app:layout_constraintBottom_toTopOf=
"@+id/etTranslation"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintVertical_chainStyle=
"packed"
/>
<EditText
android:id=
"@+id/etTranslation"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"8dp"
android:ems=
"10"
android:hint=
"Translation"
app:layout_constraintBottom_toTopOf=
"@+id/btnSubmit"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/etWord"
/>
<Button
android:id=
"@+id/btnSubmit"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"16dp"
android:text=
"Submit"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toBottomOf=
"@+id/etTranslation"
/>
</android.support.constraint.ConstraintLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment