Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
LifeLogger
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PLN
LifeLogger
Commits
b14ad1dc
Unverified
Commit
b14ad1dc
authored
Mar 04, 2018
by
PLN (Algolia)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(UI): HomeActivity with logs
parent
86f046b5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
58 additions
and
14 deletions
+58
-14
AndroidManifest.xml
app/src/main/AndroidManifest.xml
+1
-1
HomeActivity.kt
app/src/main/java/fr/plnech/lifelogger/ui/HomeActivity.kt
+43
-2
activity_home.xml
app/src/main/res/layout/activity_home.xml
+2
-2
content_home.xml
app/src/main/res/layout/content_home.xml
+11
-8
menu_home.xml
app/src/main/res/menu/menu_home.xml
+1
-1
No files found.
app/src/main/AndroidManifest.xml
View file @
b14ad1dc
...
...
@@ -10,7 +10,7 @@
android:supportsRtl=
"true"
android:theme=
"@style/AppTheme"
>
<activity
android:name=
".HomeActivity"
android:name=
".
ui.
HomeActivity"
android:label=
"@string/app_name"
android:theme=
"@style/AppTheme.NoActionBar"
>
<intent-filter>
...
...
app/src/main/java/fr/plnech/lifelogger/HomeActivity.kt
→
app/src/main/java/fr/plnech/lifelogger/
ui/
HomeActivity.kt
View file @
b14ad1dc
package
fr.plnech.lifelogger
package
fr.plnech.lifelogger
.ui
import
android.os.Bundle
import
android.support.design.widget.Snackbar
import
android.support.v7.app.AppCompatActivity
import
android.view.Menu
import
android.view.MenuItem
import
fr.plnech.lifelogger.R
import
fr.plnech.lifelogger.model.DataPoint
import
fr.plnech.lifelogger.model.Log
import
fr.plnech.lifelogger.model.LogAdapter
import
kotlinx.android.synthetic.main.activity_home.*
import
kotlinx.android.synthetic.main.content_home.*
class
HomeActivity
:
AppCompatActivity
()
{
private
lateinit
var
adapter
:
LogAdapter
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
setContentView
(
R
.
layout
.
activity_home
)
...
...
@@ -19,6 +26,16 @@ class HomeActivity : AppCompatActivity() {
Snackbar
.
make
(
view
,
"Replace with your own action"
,
Snackbar
.
LENGTH_LONG
)
.
setAction
(
"Action"
,
null
).
show
()
}
adapter
=
LogAdapter
(
this
,
generateDebugData
())
list
?.
adapter
=
adapter
adapter
.
notifyDataSetChanged
()
// val model = ViewModelProviders.of(this).get(LogViewModel::class.java)
// model.logs.observe(this, Observer {
//
// })
}
override
fun
onCreateOptionsMenu
(
menu
:
Menu
):
Boolean
{
...
...
@@ -36,4 +53,28 @@ class HomeActivity : AppCompatActivity() {
else
->
super
.
onOptionsItemSelected
(
item
)
}
}
private
fun
generateDebugData
():
ArrayList
<
Log
>
{
var
logs
:
ArrayList
<
Log
>
=
ArrayList
()
val
stairs
=
Log
(
"Stairway to heaven"
)
stairs
.
addPoint
(
DataPoint
(
"stairs"
,
7
))
stairs
.
addPoint
(
DataPoint
(
"lift"
))
stairs
.
addPoint
(
DataPoint
(
"stairs"
,
4
))
stairs
.
addPoint
(
DataPoint
(
"stairs"
,
4
))
stairs
.
addPoint
(
DataPoint
(
"lift"
))
val
moods
=
Log
(
"MoodBoard"
)
moods
.
addPoint
(
DataPoint
(
"happy"
))
moods
.
addPoint
(
DataPoint
(
"focused"
))
moods
.
addPoint
(
DataPoint
(
"relax"
))
val
mind
=
Log
(
"MindBoard"
)
mind
.
addPoint
(
DataPoint
(
"HeadSpace"
,
10
))
mind
.
addPoint
(
DataPoint
(
"HeadSpace"
,
5
))
logs
.
add
(
stairs
)
logs
.
add
(
moods
)
logs
.
add
(
mind
)
return
logs
}
}
app/src/main/res/layout/activity_home.xml
View file @
b14ad1dc
...
...
@@ -5,7 +5,7 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:context=
"fr.plnech.lifelogger.HomeActivity"
>
tools:context=
"fr.plnech.lifelogger.
ui.
HomeActivity"
>
<android.support.design.widget.AppBarLayout
android:layout_width=
"match_parent"
...
...
@@ -29,6 +29,6 @@
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|end"
android:layout_margin=
"@dimen/fab_margin"
app:srcCompat=
"@android:drawable/ic_dialog_
email
"
/>
app:srcCompat=
"@android:drawable/ic_dialog_
dialer
"
/>
</android.support.design.widget.CoordinatorLayout>
app/src/main/res/layout/content_home.xml
View file @
b14ad1dc
...
...
@@ -6,16 +6,19 @@
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
tools:context=
"fr.plnech.lifelogger.HomeActivity"
tools:context=
"fr.plnech.lifelogger.
ui.
HomeActivity"
tools:showIn=
"@layout/activity_home"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Hello World!"
<ListView
android:id=
"@+id/list"
android:layout_width=
"0dp"
android:layout_height=
"0dp"
android:layout_marginBottom=
"8dp"
android:layout_marginEnd=
"8dp"
android:layout_marginStart=
"8dp"
android:layout_marginTop=
"8dp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraint
Left_toLeft
Of=
"parent"
app:layout_constraint
Right_toRigh
tOf=
"parent"
app:layout_constraint
End_toEnd
Of=
"parent"
app:layout_constraint
Start_toStar
tOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</android.support.constraint.ConstraintLayout>
app/src/main/res/menu/menu_home.xml
View file @
b14ad1dc
<menu
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
tools:context=
"fr.plnech.lifelogger.HomeActivity"
>
tools:context=
"fr.plnech.lifelogger.
ui.
HomeActivity"
>
<item
android:id=
"@+id/action_settings"
android:orderInCategory=
"100"
...
...
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