Commit 2eefb498 authored by Lennart Bader's avatar Lennart Bader
Browse files

Added PlanText and SubstText.

Made lines disappear when empty.
parent db95499d
......@@ -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());
subst.setText(planEntry.getSubstitution());
comment.setText(planEntry.getComment());
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));
......
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment