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
ef2ddec9
authored
Apr 21, 2019
by
Paktalin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
introduced TagFragment
parent
6dbccfca
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
35 additions
and
12 deletions
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/MainActivity.kt
app/src/main/java/com/paktalin/vocabularynotebook/ui/fragments/TagFragment.kt
app/src/main/java/com/paktalin/vocabularynotebook/utils/ActivityUtil.kt
app/src/main/res/layout/content_main.xml
app/src/main/res/layout/tag.xml → app/src/main/res/layout/fragment_tag.xml
app/src/main/java/com/paktalin/vocabularynotebook/ui/activities/MainActivity.kt
View file @
ef2ddec9
...
@@ -19,7 +19,6 @@ import com.paktalin.vocabularynotebook.vocabulary.Sort
...
@@ -19,7 +19,6 @@ import com.paktalin.vocabularynotebook.vocabulary.Sort
import
com.paktalin.vocabularynotebook.vocabulary.VocabSet
import
com.paktalin.vocabularynotebook.vocabulary.VocabSet
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.activity_main.*
import
kotlinx.android.synthetic.main.content_main.*
import
kotlinx.android.synthetic.main.content_main.*
import
kotlinx.android.synthetic.main.tag.*
class
MainActivity
:
AppCompatActivity
()
{
class
MainActivity
:
AppCompatActivity
()
{
...
@@ -129,10 +128,10 @@ class MainActivity : AppCompatActivity() {
...
@@ -129,10 +128,10 @@ class MainActivity : AppCompatActivity() {
if
(!
selection
.
isEmpty
)
{
if
(!
selection
.
isEmpty
)
{
vocabularyAdapter
.
showPopupMenu
=
false
vocabularyAdapter
.
showPopupMenu
=
false
Log
.
d
(
TAG
,
"selection ${selection.toList()}"
)
Log
.
d
(
TAG
,
"selection ${selection.toList()}"
)
visible
(
tagLayout
)
addTagFragment
(
supportFragmentManager
,
R
.
id
.
main_activity_container
)
}
else
{
}
else
{
vocabularyAdapter
.
showPopupMenu
=
true
vocabularyAdapter
.
showPopupMenu
=
true
gone
(
tagLayout
)
removeTagFragment
(
supportFragmentManager
)
}
}
}
}
...
...
app/src/main/java/com/paktalin/vocabularynotebook/ui/fragments/TagFragment.kt
0 → 100644
View file @
ef2ddec9
package
com.paktalin.vocabularynotebook.ui.fragments
import
android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.fragment.app.Fragment
import
com.paktalin.vocabularynotebook.R
class
TagFragment
:
Fragment
()
{
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
?,
savedInstanceState
:
Bundle
?):
View
?
{
return
inflater
.
inflate
(
R
.
layout
.
fragment_tag
,
container
,
false
)
}
}
\ No newline at end of file
app/src/main/java/com/paktalin/vocabularynotebook/utils/ActivityUtil.kt
View file @
ef2ddec9
...
@@ -3,15 +3,17 @@ package com.paktalin.vocabularynotebook.utils
...
@@ -3,15 +3,17 @@ package com.paktalin.vocabularynotebook.utils
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentManager
import
android.view.View
import
android.view.View
import
android.widget.Toast
import
android.widget.Toast
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.FragmentManager
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.R
import
com.paktalin.vocabularynotebook.ui.fragments.ProgressFragment
import
com.paktalin.vocabularynotebook.ui.fragments.ProgressFragment
import
com.paktalin.vocabularynotebook.ui.fragments.TagFragment
import
org.apache.commons.lang3.StringUtils
import
org.apache.commons.lang3.StringUtils
val
progressFragment
:
Fragment
=
ProgressFragment
()
val
progressFragment
=
ProgressFragment
()
val
tagFragment
=
TagFragment
()
fun
addFragment
(
fragmentManager
:
FragmentManager
,
fragment
:
Fragment
,
containerId
:
Int
,
arguments
:
Bundle
?
=
null
,
tag
:
String
?
=
null
)
{
fun
addFragment
(
fragmentManager
:
FragmentManager
,
fragment
:
Fragment
,
containerId
:
Int
,
arguments
:
Bundle
?
=
null
,
tag
:
String
?
=
null
)
{
fragment
.
arguments
=
arguments
fragment
.
arguments
=
arguments
...
@@ -26,7 +28,16 @@ fun removeFragment(fragmentManager: FragmentManager, fragment: Fragment) {
...
@@ -26,7 +28,16 @@ fun removeFragment(fragmentManager: FragmentManager, fragment: Fragment) {
}
}
fun
addProgressBar
(
fragmentManager
:
FragmentManager
,
containerId
:
Int
)
{
fun
addProgressBar
(
fragmentManager
:
FragmentManager
,
containerId
:
Int
)
{
addFragment
(
fragmentManager
,
progressFragment
,
containerId
,
null
)
addFragment
(
fragmentManager
,
progressFragment
,
containerId
)
}
fun
addTagFragment
(
fragmentManager
:
FragmentManager
,
containerId
:
Int
)
{
if
(
fragmentManager
.
findFragmentById
(
tagFragment
.
id
)
==
null
)
addFragment
(
fragmentManager
,
tagFragment
,
containerId
)
}
fun
removeTagFragment
(
fragmentManager
:
FragmentManager
)
{
removeFragment
(
fragmentManager
,
tagFragment
)
}
}
fun
removeProgressBar
(
fragmentManager
:
FragmentManager
)
{
fun
removeProgressBar
(
fragmentManager
:
FragmentManager
)
{
...
...
app/src/main/res/layout/content_main.xml
View file @
ef2ddec9
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:id=
"@+id/main_activity_container"
android:layout_height=
"match_parent"
>
android:layout_height=
"match_parent"
>
<LinearLayout
<LinearLayout
...
@@ -43,6 +44,4 @@
...
@@ -43,6 +44,4 @@
<include
layout=
"@layout/submit"
/>
<include
layout=
"@layout/submit"
/>
<include
layout=
"@layout/tag"
/>
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
app/src/main/res/layout/tag.xml
→
app/src/main/res/layout/
fragment_
tag.xml
View file @
ef2ddec9
...
@@ -7,8 +7,7 @@
...
@@ -7,8 +7,7 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentBottom=
"true"
android:layout_alignParentBottom=
"true"
android:background=
"@color/colorPrimary"
android:background=
"@color/colorPrimary"
android:orientation=
"horizontal"
android:orientation=
"horizontal"
>
android:visibility=
"gone"
>
<ImageButton
<ImageButton
android:id=
"@+id/btnCancelTag"
android:id=
"@+id/btnCancelTag"
...
...
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