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
685ba537
authored
Sep 12, 2018
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hide previous views inside EditWordFragment
parent
63e5838b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
app/src/main/java/com/paktalin/vocabularynotebook/VocabularyAdapter.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/EditWordFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/VocabularyAdapter.kt
View file @
685ba537
...
@@ -12,7 +12,6 @@ import android.widget.TextView
...
@@ -12,7 +12,6 @@ import android.widget.TextView
import
com.paktalin.vocabularynotebook.ui.EditWordFragment
import
com.paktalin.vocabularynotebook.ui.EditWordFragment
import
com.paktalin.vocabularynotebook.ui.MainActivity
import
com.paktalin.vocabularynotebook.ui.MainActivity
class
VocabularyAdapter
(
private
val
wordItems
:
MutableList
<
WordItem
>,
private
val
activity
:
Activity
)
:
RecyclerView
.
Adapter
<
VocabularyAdapter
.
ViewHolder
>()
{
class
VocabularyAdapter
(
private
val
wordItems
:
MutableList
<
WordItem
>,
private
val
activity
:
Activity
)
:
RecyclerView
.
Adapter
<
VocabularyAdapter
.
ViewHolder
>()
{
private
lateinit
var
recyclerView
:
RecyclerView
private
lateinit
var
recyclerView
:
RecyclerView
...
@@ -65,10 +64,6 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va
...
@@ -65,10 +64,6 @@ class VocabularyAdapter(private val wordItems: MutableList<WordItem>, private va
@SuppressLint
(
"ResourceType"
)
@SuppressLint
(
"ResourceType"
)
private
fun
editWordItem
(
container
:
View
,
wordItem
:
WordItem
)
{
private
fun
editWordItem
(
container
:
View
,
wordItem
:
WordItem
)
{
//hide textViews
container
.
findViewById
<
TextView
>(
R
.
id
.
word
).
visibility
=
View
.
GONE
container
.
findViewById
<
TextView
>(
R
.
id
.
translation
).
visibility
=
View
.
GONE
//set container id
//set container id
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
JELLY_BEAN_MR1
)
{
container
.
id
=
View
.
generateViewId
()
container
.
id
=
View
.
generateViewId
()
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/EditWordFragment.kt
View file @
685ba537
...
@@ -9,6 +9,7 @@ import android.view.ViewGroup
...
@@ -9,6 +9,7 @@ import android.view.ViewGroup
import
android.view.WindowManager
import
android.view.WindowManager
import
android.view.inputmethod.InputMethodManager
import
android.view.inputmethod.InputMethodManager
import
android.widget.EditText
import
android.widget.EditText
import
android.widget.TextView
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.WordItem
import
com.paktalin.vocabularynotebook.WordItem
...
@@ -18,6 +19,7 @@ class EditWordFragment : Fragment() {
...
@@ -18,6 +19,7 @@ class EditWordFragment : Fragment() {
private
lateinit
var
etWord
:
EditText
private
lateinit
var
etWord
:
EditText
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
hidePreviousViews
(
container
)
wordItem
=
arguments
!!
[
"wordItem"
]
as
WordItem
wordItem
=
arguments
!!
[
"wordItem"
]
as
WordItem
return
inflater
.
inflate
(
R
.
layout
.
editable_word_item
,
container
,
false
)
return
inflater
.
inflate
(
R
.
layout
.
editable_word_item
,
container
,
false
)
}
}
...
@@ -40,4 +42,11 @@ class EditWordFragment : Fragment() {
...
@@ -40,4 +42,11 @@ class EditWordFragment : Fragment() {
val
imm
=
activity
!!
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
?
val
imm
=
activity
!!
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
)
as
InputMethodManager
?
imm
!!
.
toggleSoftInput
(
InputMethodManager
.
SHOW_FORCED
,
InputMethodManager
.
HIDE_IMPLICIT_ONLY
)
imm
!!
.
toggleSoftInput
(
InputMethodManager
.
SHOW_FORCED
,
InputMethodManager
.
HIDE_IMPLICIT_ONLY
)
}
}
}
private
fun
hidePreviousViews
(
container
:
ViewGroup
?)
{
if
(
container
!=
null
)
{
container
.
findViewById
<
TextView
>(
R
.
id
.
word
).
visibility
=
View
.
GONE
container
.
findViewById
<
TextView
>(
R
.
id
.
translation
).
visibility
=
View
.
GONE
}
}
}
\ 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