123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- /*
- * DSBDirect
- * Copyright (C) 2019 Fynn Godau
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <https://www.gnu.org/licenses/>.
- *
- * This software is not affiliated with heinekingmedia GmbH, the
- * developer of the DSB platform.
- */
- package godau.fynn.dsbdirect.table;
- import android.support.annotation.Nullable;
- import godau.fynn.dsbdirect.Utility;
- import java.util.Date;
- public class Entry {
- private String mAffectedClass;
- private String mLesson;
- private String mReplacementTeacher;
- private String mInfo;
- private Date mDate;
- public Entry(@Nullable String affectedClass, @Nullable String lesson, @Nullable String replacementTeacher,
- @Nullable String info, @Nullable Date date) {
- mAffectedClass = affectedClass;
- mLesson = lesson;
- mReplacementTeacher = replacementTeacher;
- mInfo = info;
- mDate = date;
- if (mAffectedClass == null) {
- mAffectedClass = "";
- }
- if (mLesson == null) {
- mLesson = "";
- } else {
- mLesson = mLesson.replaceAll(" ", "");
- }
- if (mReplacementTeacher == null) {
- mReplacementTeacher = "";
- }
- if (mInfo == null) {
- mInfo = "";
- }
- }
- public String getAffectedClass() {
- return mAffectedClass;
- }
- public void setAffectedClass(String affectedClass) {
- mAffectedClass = affectedClass;
- }
- public String getLesson() {
- return mLesson;
- }
- public void setLesson(String lesson) {
- mLesson = lesson;
- }
- public String getReplacementTeacher() {
- return mReplacementTeacher;
- }
- public void setReplacementTeacher(String replacementTeacher) {
- mReplacementTeacher = replacementTeacher;
- }
- public String getInfo() {
- return mInfo;
- }
- public void setInfo(String info) {
- mInfo = info;
- }
- public Date getDate() {
- return mDate;
- }
- public void setDate(Date date) {
- mDate = date;
- }
- public String getShareText(Utility u) {
- String text = Utility.smartConcatenate(new String[]{
- u.formatDate(mDate),
- mAffectedClass,
- mLesson,
- mReplacementTeacher,
- mInfo
- }, " · ");
- // There might be some html in there that needs to go away
- text = text.replaceAll("<br>", "\n");
- text = text.replaceAll("</*strike>", "~");
- return text;
- }
- }
|