Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mytfg
mytfg-vplan-app
Commits
2eefb498
Commit
2eefb498
authored
Jan 09, 2017
by
Lennart Bader
Browse files
Added PlanText and SubstText.
Made lines disappear when empty.
parent
db95499d
Changes
2
Show whitespace changes
Inline
Side-by-side
app/src/main/java/de/mytfg/apps/vplan/adapters/PlanEntryHolder.java
View file @
2eefb498
...
...
@@ -12,12 +12,16 @@ import android.widget.TextView;
import
de.mytfg.apps.vplan.R
;
import
de.mytfg.apps.vplan.objects.VplanEntry
;
import
static
android
.
view
.
View
.
GONE
;
public
class
PlanEntryHolder
extends
RecyclerView
.
ViewHolder
{
private
TextView
lesson
;
private
TextView
cls
;
private
TextView
plan
;
private
TextView
subst
;
private
TextView
substHeader
;
private
TextView
comment
;
private
TextView
commentHeader
;
private
Context
context
;
private
CardView
cardView
;
...
...
@@ -31,14 +35,30 @@ public class PlanEntryHolder extends RecyclerView.ViewHolder {
plan
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
plan
);
subst
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
subst
);
comment
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
comment
);
substHeader
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
subst_header
);
commentHeader
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
comment_header
);
}
public
void
update
(
VplanEntry
planEntry
)
{
//titleView.setText(baseObject.getName());
lesson
.
setText
(
planEntry
.
getLesson
());
plan
.
setText
(
planEntry
.
getPlan
());
if
(
planEntry
.
getSubstitution
().
isEmpty
())
{
substHeader
.
setVisibility
(
GONE
);
subst
.
setVisibility
(
GONE
);
}
else
{
subst
.
setText
(
planEntry
.
getSubstitution
());
subst
.
setVisibility
(
View
.
VISIBLE
);
substHeader
.
setVisibility
(
View
.
VISIBLE
);
}
if
(
planEntry
.
getComment
().
isEmpty
())
{
comment
.
setVisibility
(
GONE
);
commentHeader
.
setVisibility
(
GONE
);
}
else
{
comment
.
setText
(
planEntry
.
getComment
());
commentHeader
.
setVisibility
(
View
.
VISIBLE
);
comment
.
setVisibility
(
View
.
VISIBLE
);
}
cls
.
setText
(
planEntry
.
getCls
());
if
(
planEntry
.
isOwn
())
{
cardView
.
setCardBackgroundColor
(
context
.
getResources
().
getColor
(
R
.
color
.
colorPrimaryLight
));
...
...
app/src/main/java/de/mytfg/apps/vplan/objects/VplanEntry.java
View file @
2eefb498
...
...
@@ -13,10 +13,13 @@ public class VplanEntry extends MytfgObject {
private
String
lesson
;
private
String
cls
;
private
String
plan
;
private
String
plan_text
;
private
String
substitution
;
private
String
subst_text
;
private
String
comment
;
private
String
teacher
;
private
boolean
own
;
private
Vplan
day
;
...
...
@@ -51,6 +54,8 @@ public class VplanEntry extends MytfgObject {
substitution
=
data
.
getString
(
"substitution"
);
comment
=
data
.
getString
(
"comment"
);
teacher
=
data
.
getString
(
"teacher"
);
subst_text
=
data
.
getString
(
"subst_text"
);
plan_text
=
data
.
getString
(
"plan_text"
);
}
catch
(
JSONException
ex
)
{
// TODO: Remove this line:
ex
.
printStackTrace
();
...
...
@@ -83,6 +88,14 @@ public class VplanEntry extends MytfgObject {
return
teacher
;
}
public
String
getPlanText
()
{
return
plan_text
;
}
public
String
getSubstText
()
{
return
subst_text
;
}
/**
* Checks wheter this entry contains information matching the given filter.
* @param filter The filter to apply
...
...
@@ -93,6 +106,8 @@ public class VplanEntry extends MytfgObject {
||
getComment
().
toLowerCase
().
contains
(
filter
)
||
getLesson
().
toLowerCase
().
contains
(
filter
)
||
getPlan
().
toLowerCase
().
contains
(
filter
)
||
getPlanText
().
toLowerCase
().
contains
(
filter
)
||
getSubstText
().
toLowerCase
().
contains
(
filter
)
||
getSubstitution
().
toLowerCase
().
contains
(
filter
);
}
...
...
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