diff --git a/app/src/main/java/de/tum/in/tumcampusapp/api/app/model/ObfuscatedIdsUpload.kt b/app/src/main/java/de/tum/in/tumcampusapp/api/app/model/ObfuscatedIdsUpload.kt
index 4e0d83fd0d..7c640c6edc 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/api/app/model/ObfuscatedIdsUpload.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/api/app/model/ObfuscatedIdsUpload.kt
@@ -3,8 +3,6 @@ package de.tum.`in`.tumcampusapp.api.app.model
import com.google.gson.annotations.SerializedName
/**
- * @param fcmToken can be null/uploaded/invalid
- * @param publicKey can be null/uploaded/verified
* @param studentId true if uploaded
* @param employeeId true if uploaded
* @param externalId true if uploaded
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/api/tumonline/converters/EscapedStringConverter.kt b/app/src/main/java/de/tum/in/tumcampusapp/api/tumonline/converters/EscapedStringConverter.kt
index 0f876af3a0..a011adbc79 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/api/tumonline/converters/EscapedStringConverter.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/api/tumonline/converters/EscapedStringConverter.kt
@@ -19,6 +19,7 @@ class EscapedStringConverter : TypeConverter {
return if (Build.VERSION.SDK_INT >= 24) {
Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY).toString()
} else {
+ @Suppress("DEPRECATION") // SDK version checked
Html.fromHtml(str).toString()
}
}
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/other/generic/activity/BaseNavigationActivity.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/other/generic/activity/BaseNavigationActivity.kt
index a3d48e3da1..520048207f 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/other/generic/activity/BaseNavigationActivity.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/other/generic/activity/BaseNavigationActivity.kt
@@ -35,11 +35,11 @@ class BaseNavigationActivity :
}
private val drawerLayout: DrawerLayout by lazy {
- findViewById(R.id.drawer_layout)
+ findViewById(R.id.drawer_layout)
}
private val navigationView: NavigationView by lazy {
- findViewById(R.id.left_drawer)
+ findViewById(R.id.left_drawer)
}
private val drawerMenuHelper: DrawerMenuHelper by lazy {
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/other/generic/activity/ProgressActivity.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/other/generic/activity/ProgressActivity.kt
index 8f731f7d3d..2bcdd297fc 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/other/generic/activity/ProgressActivity.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/other/generic/activity/ProgressActivity.kt
@@ -54,35 +54,35 @@ abstract class ProgressActivity(
}
protected val swipeRefreshLayout: SwipeRefreshLayout? by lazy {
- findViewById(R.id.swipeRefreshLayout)
+ findViewById(R.id.swipeRefreshLayout)
}
private val errorLayoutsContainer: FrameLayout by lazy {
- findViewById(R.id.errors_layout)
+ findViewById(R.id.errors_layout)
}
private val errorLayout: LinearLayout by lazy {
- findViewById(R.id.layout_error)
+ findViewById(R.id.layout_error)
}
private val errorIconImageView: ImageView by lazy {
- findViewById(R.id.iconImageView)
+ findViewById(R.id.iconImageView)
}
private val errorHeaderTextView: TextView by lazy {
- errorLayout.findViewById(R.id.headerTextView)
+ errorLayout.findViewById(R.id.headerTextView)
}
private val errorMessageTextView: TextView by lazy {
- errorLayout.findViewById(R.id.messageTextView)
+ errorLayout.findViewById(R.id.messageTextView)
}
private val errorButton: MaterialButton by lazy {
- errorLayout.findViewById(R.id.button)
+ errorLayout.findViewById(R.id.button)
}
private val progressLayout: FrameLayout by lazy {
- findViewById(R.id.layout_progress)
+ findViewById(R.id.layout_progress)
}
private var registered: Boolean = false
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/CreateEventActivity.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/CreateEventActivity.kt
index 25ad6ffe4e..7c378d05cc 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/CreateEventActivity.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/CreateEventActivity.kt
@@ -1,7 +1,6 @@
package de.tum.`in`.tumcampusapp.component.tumui.calendar
import android.app.Activity
-import android.app.DatePickerDialog
import android.content.Context
import android.content.Intent
import android.content.res.ColorStateList
@@ -39,7 +38,6 @@ import retrofit2.Callback
import retrofit2.Response
import java.net.UnknownHostException
import java.util.Locale
-import kotlin.collections.ArrayList
/**
* Allows the user to create (and edit) a private event in TUMonline.
@@ -184,7 +182,7 @@ class CreateEventActivity : ActivityForAccessingTumOnline(R
binding.eventLastDateView.setOnClickListener {
hideKeyboard()
- DatePickerDialog(this, { _, year, month, dayOfMonth ->
+ ThemedDatePickerDialog(this, { _, year, month, dayOfMonth ->
repeatHelper.end = repeatHelper.end?.withDate(year, month + 1, dayOfMonth)
updateDateViews()
}, repeatHelper.end?.year!!, repeatHelper.end?.monthOfYear!! - 1, repeatHelper.end?.dayOfMonth!!).show()
@@ -224,16 +222,9 @@ class CreateEventActivity : ActivityForAccessingTumOnline(R
val eventTitle = extras?.getSerializable(Const.EVENT_TITLE) as String?
val startTime = extras?.getSerializable(Const.EVENT_START) as DateTime?
- if (eventNr == null || eventTitle == null || startTime == null) {
- return
- }
+ if (eventNr == null || eventTitle == null || startTime == null) return
- val calendarItem = CalendarItem(
- nr = eventNr,
- title = eventTitle,
- dtstart = startTime,
- url = ""
- )
+ val calendarItem = CalendarItem(nr = eventNr, title = eventTitle, dtstart = startTime, url = "")
val currentColor = eventColorController.getResourceColor(calendarItem)
val colorText = getTextColorByColor(currentColor)
@@ -241,14 +232,9 @@ class CreateEventActivity : ActivityForAccessingTumOnline(R
binding.colorChangeBtn?.buttonTintList = ColorStateList.valueOf(ContextCompat.getColor(this, currentColor))
binding.colorChangeBtn?.setOnClickListener {
- val dialog = ChangeEventColorDialog(
- context = this,
- calendarItem = calendarItem,
- onColorChanged = { data ->
- updateEventColorInput(data)
- },
- fromCreateEventActivity = true
- )
+ val dialog = ChangeEventColorDialog(context = this, calendarItem = calendarItem, onColorChanged = { data ->
+ updateEventColorInput(data)
+ }, fromCreateEventActivity = true)
dialog.show()
dialog.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
@@ -273,14 +259,9 @@ class CreateEventActivity : ActivityForAccessingTumOnline(R
private fun initEventColorOnClickListener() {
binding.colorChangeBtn?.setOnClickListener {
- val dialog = ChangeEventColorDialog(
- context = this,
- calendarItem = CalendarItem(),
- onColorChanged = { data ->
- updateEventColorInput(data)
- },
- fromCreateEventActivity = true
- )
+ val dialog = ChangeEventColorDialog(context = this, calendarItem = CalendarItem(), onColorChanged = { data ->
+ updateEventColorInput(data)
+ }, fromCreateEventActivity = true)
dialog.show()
dialog.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
@@ -320,38 +301,27 @@ class CreateEventActivity : ActivityForAccessingTumOnline(R
}
// TIME
- binding.eventStartTimeView.setOnClickListener {
+ binding.eventStartTimeView.setOnClickListener { _ ->
hideKeyboard()
- ThemedTimePickerDialog(
- this,
- { timePicker, hour, minute ->
- timePicker.layoutParams = LinearLayout.LayoutParams(
- LinearLayout.LayoutParams.WRAP_CONTENT,
- LinearLayout.LayoutParams.WRAP_CONTENT
- )
- val eventLength = end.millis - start.millis
- start = start.withHourOfDay(hour).withMinuteOfHour(minute)
- end = end.withMillis(start.millis + eventLength)
- updateTimeViews()
- },
- start.hourOfDay,
- start.minuteOfHour
- ).show()
+ ThemedTimePickerDialog(this, { _, hour, minute ->
+ val eventLength = end.millis - start.millis
+ start = start.withHourOfDay(hour).withMinuteOfHour(minute)
+ end = end.withMillis(start.millis + eventLength)
+ updateTimeViews()
+ }, start.hourOfDay, start.minuteOfHour).show()
}
- binding.eventEndTimeView.setOnClickListener {
+ binding.eventEndTimeView.setOnClickListener { _ ->
hideKeyboard()
ThemedTimePickerDialog(this, { _, hour, minute ->
- end = end.withHourOfDay(hour)
- .withMinuteOfHour(minute)
+ end = end.withHourOfDay(hour).withMinuteOfHour(minute)
updateTimeViews()
}, end.hourOfDay, end.minuteOfHour).show()
}
}
private fun updateTimeViews() {
- val format = DateTimeFormat.forPattern("HH:mm")
- .withLocale(Locale.getDefault())
+ val format = DateTimeFormat.forPattern("HH:mm").withLocale(Locale.getDefault())
with(binding) {
eventStartTimeView.text = format.print(start)
eventEndTimeView.text = format.print(end)
@@ -359,8 +329,7 @@ class CreateEventActivity : ActivityForAccessingTumOnline(R
}
private fun updateDateViews() {
- val format = DateTimeFormat.forPattern("EEE, dd.MM.yyyy")
- .withLocale(Locale.getDefault())
+ val format = DateTimeFormat.forPattern("EEE, dd.MM.yyyy").withLocale(Locale.getDefault())
with(binding) {
eventStartDateView.text = format.print(start)
eventEndDateView.text = format.print(end)
@@ -376,31 +345,23 @@ class CreateEventActivity : ActivityForAccessingTumOnline(R
// request), we use a short Toast to let the user know that something is happening.
Toast.makeText(this, R.string.updating_event, Toast.LENGTH_SHORT).show()
- apiClient
- .deleteEvent(eventId)
- .enqueue(object : Callback {
- override fun onResponse(
- call: Call,
- response: Response
- ) {
- if (response.isSuccessful) {
- Utils.log("Event successfully deleted (now creating the edited version)")
- TcaDb.getInstance(this@CreateEventActivity).calendarDao().delete(eventId)
- eventColorController.removeEventColor(eventId)
- createEvent()
- } else {
- Utils.showToast(this@CreateEventActivity, R.string.error_unknown)
- }
+ apiClient.deleteEvent(eventId).enqueue(object : Callback {
+ override fun onResponse(call: Call, response: Response) {
+ if (response.isSuccessful) {
+ Utils.log("Event successfully deleted (now creating the edited version)")
+ TcaDb.getInstance(this@CreateEventActivity).calendarDao().delete(eventId)
+ eventColorController.removeEventColor(eventId)
+ createEvent()
+ } else {
+ Utils.showToast(this@CreateEventActivity, R.string.error_unknown)
}
+ }
- override fun onFailure(
- call: Call,
- t: Throwable
- ) {
- Utils.log(t)
- displayErrorMessage(t)
- }
- })
+ override fun onFailure(call: Call, t: Throwable) {
+ Utils.log(t)
+ displayErrorMessage(t)
+ }
+ })
}
private fun displayErrorMessage(throwable: Throwable) {
@@ -541,7 +502,6 @@ class CreateEventActivity : ActivityForAccessingTumOnline(R
finish()
}
- @Deprecated("Deprecated in Java")
override fun onBackPressed() {
hideKeyboard()
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/WidgetCalendarItem.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/WidgetCalendarItem.kt
index 6e6aa95ef7..149810c9c9 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/WidgetCalendarItem.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/WidgetCalendarItem.kt
@@ -10,24 +10,16 @@ import org.joda.time.DateTime
/**
* A class to represent events for the integrated WeekView calendar
*/
-data class WidgetCalendarItem(
- val id: String,
- val title: String,
- val startTime: DateTime,
- val endTime: DateTime,
- val location: String
-) : WeekViewDisplayable {
+data class WidgetCalendarItem(val id: String, val title: String, val startTime: DateTime, val endTime: DateTime, val location: String) : WeekViewDisplayable {
var color: Int = 0
var isFirstOnDay: Boolean = false
override fun toWeekViewEvent(): WeekViewEvent {
- val style = WeekViewEvent.Style.Builder()
- .setBackgroundColor(color)
- .build()
+ val style = WeekViewEvent.Style.Builder().setBackgroundColor(color).build()
- return WeekViewEvent.Builder(this)
+ return WeekViewEvent.Builder(this)
.setId(id.toLong())
.setTitle(title)
.setStartTime(startTime.toGregorianCalendar())
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/model/CalendarItem.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/model/CalendarItem.kt
index 5cd3cd48d5..1da56ce734 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/model/CalendarItem.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/model/CalendarItem.kt
@@ -112,9 +112,7 @@ data class CalendarItem(
}
fun isSameEventButForLocation(other: CalendarItem): Boolean {
- return title == other.title &&
- dtstart == other.dtstart &&
- dtend == other.dtend
+ return title == other.title && dtstart == other.dtstart && dtend == other.dtend
}
override fun toWeekViewEvent(): WeekViewEvent {
@@ -132,7 +130,7 @@ data class CalendarItem(
.setBorderColor(color)
.build()
- return WeekViewEvent.Builder(this)
+ return WeekViewEvent.Builder(this)
.setId(nr.toLong())
.setTitle(title)
.setStartTime(eventStart.toGregorianCalendar())
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/ExamListAdapter.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/ExamListAdapter.kt
index 8db2ede775..fde45da351 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/ExamListAdapter.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/ExamListAdapter.kt
@@ -182,7 +182,7 @@ class ExamListAdapter(context: Context, results: List, gradesFragment: Gra
private fun initCheckBoxUsedInAverage(exam: Exam, holder: ViewHolder) {
holder.checkBoxUseGradeForAverage.isChecked = exam.gradeUsedInAverage
adaptUIToCheckboxStatus(holder, exam)
- holder.checkBoxUseGradeForAverage.setOnClickListener() {
+ holder.checkBoxUseGradeForAverage.setOnClickListener {
exam.gradeUsedInAverage = holder.checkBoxUseGradeForAverage.isChecked
adaptUIToCheckboxStatus(holder, exam)
localGradesFragment.storeExamListInSharedPreferences()
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/GradesFragment.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/GradesFragment.kt
index 603345d821..82d2ac5a19 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/GradesFragment.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/grades/GradesFragment.kt
@@ -381,7 +381,7 @@ class GradesFragment : FragmentForAccessingTumOnline(
val desc = Description()
desc.text = context.getString(R.string.grade_percentages)
- desc.setTextSize(11f)
+ desc.textSize = 11f
desc.setPosition(540F, 50F)
description = desc
axisRight.disableGridDashedLine()
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/cafeteria/details/CafeteriaDetailsSectionFragment.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/cafeteria/details/CafeteriaDetailsSectionFragment.kt
index 035cfec0f9..d74a81ab65 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/cafeteria/details/CafeteriaDetailsSectionFragment.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/cafeteria/details/CafeteriaDetailsSectionFragment.kt
@@ -7,13 +7,11 @@ import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import com.zhuinden.fragmentviewbindingdelegatekt.viewBinding
import de.tum.`in`.tumcampusapp.R
-import de.tum.`in`.tumcampusapp.component.ui.cafeteria.model.CafeteriaMenu
import de.tum.`in`.tumcampusapp.databinding.FragmentCafeteriadetailsSectionBinding
import de.tum.`in`.tumcampusapp.di.ViewModelFactory
import de.tum.`in`.tumcampusapp.di.injector
@@ -93,9 +91,8 @@ class CafeteriaDetailsSectionFragment : Fragment() {
menusRecyclerView.adapter = adapter
cafeteriaViewModel.cafeteriaMenus.observe(
- viewLifecycleOwner,
- Observer> { adapter.update(it) }
- )
+ viewLifecycleOwner
+ ) { adapter.update(it) }
cafeteriaViewModel.fetchCafeteriaMenus(cafeteriaId, menuDate)
}
}
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsNotificationProvider.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsNotificationProvider.kt
index 190a057d6c..8523f33550 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsNotificationProvider.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsNotificationProvider.kt
@@ -27,8 +27,7 @@ class NewsNotificationProvider(
override fun buildNotification(): AppNotification {
val summaryTitle = context.getString(R.string.news)
- val summaryText = context.getString(R.string.new_items_format_string, newsItems.size)
-
+ val summaryText = context.resources.getQuantityString(R.plurals.new_items_format_string, newsItems.size, newsItems.size)
val inboxStyle = NotificationCompat.InboxStyle()
newsItems.forEach { inboxStyle.addLine(it.title) }
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsViewHolder.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsViewHolder.kt
index 559790a632..c912f2fec7 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsViewHolder.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsViewHolder.kt
@@ -29,13 +29,13 @@ class NewsViewHolder(
private val showOptionsButton: Boolean = true
) : CardViewHolder(itemView, interactionListener) {
- private val optionsButtonGroup: Group by lazy { itemView.findViewById(R.id.cardMoreIconGroup) }
- private val imageView: ImageView? by lazy { itemView.findViewById(R.id.news_img) }
- private val titleTextView: TextView? by lazy { itemView.findViewById(R.id.news_title) }
- private val dateTextView: TextView by lazy { itemView.findViewById(R.id.news_src_date) }
- private val sourceTextView: TextView by lazy { itemView.findViewById(R.id.news_src_title) }
- private val ticketsIcon: ImageView? by lazy { itemView.findViewById(R.id.tickets_icon) }
- private val ticketsTextView: TextView? by lazy { itemView.findViewById(R.id.tickets_available) }
+ private val optionsButtonGroup: Group by lazy { itemView.findViewById(R.id.cardMoreIconGroup) }
+ private val imageView: ImageView? by lazy { itemView.findViewById(R.id.news_img) }
+ private val titleTextView: TextView? by lazy { itemView.findViewById(R.id.news_title) }
+ private val dateTextView: TextView by lazy { itemView.findViewById(R.id.news_src_date) }
+ private val sourceTextView: TextView by lazy { itemView.findViewById(R.id.news_src_title) }
+ private val ticketsIcon: ImageView? by lazy { itemView.findViewById(R.id.tickets_icon) }
+ private val ticketsTextView: TextView? by lazy { itemView.findViewById(R.id.tickets_available) }
fun bind(newsItem: News, newsSource: NewsSources, hasEvent: Boolean) = with(itemView) {
val card = if (newsItem.isFilm) FilmCard(context, newsItem) else NewsCard(context = context, news = newsItem)
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/openinghour/OpeningHoursDetailFragment.java b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/openinghour/OpeningHoursDetailFragment.java
index 6648aa4e9c..3ae51e28bf 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/openinghour/OpeningHoursDetailFragment.java
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/openinghour/OpeningHoursDetailFragment.java
@@ -10,6 +10,7 @@
import com.google.android.material.button.MaterialButton;
import java.util.List;
+import java.util.Objects;
import java.util.regex.Pattern;
import androidx.annotation.NonNull;
@@ -32,29 +33,21 @@ public class OpeningHoursDetailFragment extends Fragment {
static final String ARG_ITEM_ID = "item_id";
static final String ARG_ITEM_CONTENT = "item_content";
static final String TWO_PANE = "two_pane";
- private static final Pattern COMPILE = Pattern.compile("\\\\n");
private int mItemId;
private String mItemContent;
- /**
- * Mandatory empty constructor for the fragment manager to instantiate the
- * fragment (e.g. upon screen orientation changes).
- */
- public OpeningHoursDetailFragment() {
- // NOP
- }
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+ assert getArguments() != null;
if (getArguments().containsKey(ARG_ITEM_ID)) {
mItemId = getArguments().getInt(ARG_ITEM_ID);
mItemContent = getArguments().getString(ARG_ITEM_CONTENT);
}
if (getArguments().containsKey(TWO_PANE) && !getArguments().getBoolean(TWO_PANE)) {
- getActivity().setTitle(mItemContent);
+ requireActivity().setTitle(mItemContent);
}
}
@@ -63,8 +56,7 @@ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container,
View rootView = inflater.inflate(R.layout.fragment_item_detail, container, false);
// click on category in list
- LocationDao dao = TcaDb.Companion.getInstance(getActivity())
- .locationDao();
+ LocationDao dao = TcaDb.Companion.getInstance(requireActivity()).locationDao();
String[] categories = {"library", "info", "cafeteria_gar", "cafeteria_grh", "cafeteria", "cafeteria_pas", "cafeteria_wst"};
List locations = dao.getAllOfCategory(categories[mItemId]);
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/search/SearchViewModel.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/search/SearchViewModel.kt
index ae17e2ee1b..0f89d664d8 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/search/SearchViewModel.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/search/SearchViewModel.kt
@@ -179,7 +179,7 @@ class SearchViewModel @Inject constructor(
fun fetchRecentSearches(context: Context) {
val recentSearchesDao: RecentsDao = TcaDb.getInstance(context).recentsDao()
- val recentSearches: List = recentSearchesDao.allRecentSearches.reversed() ?: emptyList()
+ val recentSearches: List = recentSearchesDao.allRecentSearches.reversed()
state.value = state.value.copy(
recentSearches = recentSearches.filter { x -> x.type != STATIONS } // filter for undesirable stations
)
@@ -188,7 +188,7 @@ class SearchViewModel @Inject constructor(
fun removeRecentSearch(recent: Recent, context: Context) {
val recentSearchesDao: RecentsDao = TcaDb.getInstance(context).recentsDao()
recentSearchesDao.deleteByName(recent.name)
- val recentSearches: List = recentSearchesDao.allRecentSearches.reversed() ?: emptyList()
+ val recentSearches: List = recentSearchesDao.allRecentSearches.reversed()
state.value = state.value.copy(
recentSearches = recentSearches
)
@@ -205,7 +205,7 @@ class SearchViewModel @Inject constructor(
fun saveRecentSearch(recent: Recent, context: Context) {
val recentSearchesDao: RecentsDao = TcaDb.getInstance(context).recentsDao()
recentSearchesDao.insert(recent)
- val recentSearches: List = recentSearchesDao.allRecentSearches.reversed() ?: emptyList()
+ val recentSearches: List = recentSearchesDao.allRecentSearches.reversed()
state.value = state.value.copy(
recentSearches = recentSearches
)
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/BoughtTicketViewHolder.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/BoughtTicketViewHolder.kt
index ef182d6bef..4551d09c73 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/BoughtTicketViewHolder.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/BoughtTicketViewHolder.kt
@@ -9,9 +9,9 @@ import de.tum.`in`.tumcampusapp.utils.Utils
class BoughtTicketViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
- private val amountTextView: TextView by lazy { itemView.findViewById(R.id.ticket_amount) }
- private val ticketTypeNameTextView: TextView by lazy { itemView.findViewById(R.id.ticket_type_name) }
- private val ticketPriceTextView: TextView by lazy { itemView.findViewById(R.id.price_per_ticket) }
+ private val amountTextView: TextView by lazy { itemView.findViewById(R.id.ticket_amount) }
+ private val ticketTypeNameTextView: TextView by lazy { itemView.findViewById(R.id.ticket_type_name) }
+ private val ticketPriceTextView: TextView by lazy { itemView.findViewById(R.id.price_per_ticket) }
fun bind(ticketInfo: TicketInfo) {
amountTextView.text = itemView.context.getString(R.string.amount_x, ticketInfo.count)
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/TicketAmountViewHolder.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/TicketAmountViewHolder.kt
index 457d475ec5..7bf7ae9310 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/TicketAmountViewHolder.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/TicketAmountViewHolder.kt
@@ -15,11 +15,11 @@ class TicketAmountViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
fun ticketAmountUpdated(ticketTypeId: Int, amount: Int)
}
- private val minusButton: MaterialButton by lazy { itemView.findViewById(R.id.ticket_amount_minus) }
- private val plusButton: MaterialButton by lazy { itemView.findViewById(R.id.ticket_amount_plus) }
- private val currentAmount: TextView by lazy { itemView.findViewById(R.id.current_ticket_amount) }
- private val ticketTypeName: TextView by lazy { itemView.findViewById(R.id.ticket_type_name) }
- private val ticketPrice: TextView by lazy { itemView.findViewById(R.id.price_per_ticket) }
+ private val minusButton: MaterialButton by lazy { itemView.findViewById(R.id.ticket_amount_minus) }
+ private val plusButton: MaterialButton by lazy { itemView.findViewById(R.id.ticket_amount_plus) }
+ private val currentAmount: TextView by lazy { itemView.findViewById(R.id.current_ticket_amount) }
+ private val ticketTypeName: TextView by lazy { itemView.findViewById(R.id.ticket_type_name) }
+ private val ticketPrice: TextView by lazy { itemView.findViewById(R.id.price_per_ticket) }
private var ticketAmount = 1
private var ticketType = TicketType()
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/fragment/EventDetailsFragment.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/fragment/EventDetailsFragment.kt
index deea20b857..2670d15013 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/fragment/EventDetailsFragment.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/fragment/EventDetailsFragment.kt
@@ -8,7 +8,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.squareup.picasso.Picasso
@@ -69,7 +68,7 @@ class EventDetailsFragment : Fragment(), SwipeRefreshLayout.OnRefreshListener {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
showEventDetails(event)
- viewModel.aggregatedTicketStatus.observe(viewLifecycleOwner, Observer { showTicketCount(it) })
+ viewModel.aggregatedTicketStatus.observe(viewLifecycleOwner) { showTicketCount(it) }
}
override fun onRefresh() {
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/model/Ticket.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/model/Ticket.kt
index b803d6d996..01e4c52a50 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/model/Ticket.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/model/Ticket.kt
@@ -14,10 +14,10 @@ import org.joda.time.format.DateTimeFormat
* Ticket
*
* @param id ID of ticket_history in DB
- * @param event Event ID
+ * @param eventId Event ID
* @param code Ticket Code
* @param ticketTypeId ID of TicketType
- * @param redeemed
+ * @param redemption
*/
@Entity(tableName = "tickets")
@SuppressWarnings(RoomWarnings.DEFAULT_CONSTRUCTOR)
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/DepartureView.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/DepartureView.kt
index e66c9d5471..2ed0ec5d8a 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/DepartureView.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/DepartureView.kt
@@ -30,9 +30,9 @@ import java.util.*
class DepartureView
@JvmOverloads constructor(context: Context, private val useCompactView: Boolean = true) :
LinearLayout(context), LifecycleObserver, DefaultLifecycleObserver {
- private val symbolView: TextView by lazy { findViewById(R.id.line_symbol) }
- private val lineView: TextView by lazy { findViewById(R.id.nameTextView) }
- private val timeSwitcher: TextSwitcher by lazy { findViewById(R.id.line_switcher) }
+ private val symbolView: TextView by lazy { findViewById(R.id.line_symbol) }
+ private val lineView: TextView by lazy { findViewById(R.id.nameTextView) }
+ private val timeSwitcher: TextSwitcher by lazy { findViewById(R.id.line_switcher) }
private val countdownHandler: Handler
private var valueAnimator: ValueAnimator? = null
private var departureTime: DateTime? = null
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/KinoActivity.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/KinoActivity.kt
index 0c39624068..5f19e48e11 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/KinoActivity.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/KinoActivity.kt
@@ -1,7 +1,6 @@
package de.tum.`in`.tumcampusapp.component.ui.tufilm
import android.os.Bundle
-import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import androidx.viewpager.widget.ViewPager
import de.tum.`in`.tumcampusapp.R
@@ -46,8 +45,8 @@ class KinoActivity : ProgressActivity(R.layout.activity_kino) {
viewPager = findViewById(R.id.kinoViewPager)
viewPager.pageMargin = margin
- kinoViewModel.kinos.observe(this, Observer> { this.showMoviesOrPlaceholder(it) })
- kinoViewModel.error.observe(this, Observer { this.showError(it) })
+ kinoViewModel.kinos.observe(this) { this.showMoviesOrPlaceholder(it) }
+ kinoViewModel.error.observe(this) { this.showError(it) }
}
private fun showMoviesOrPlaceholder(kinos: List) {
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/KinoDetailsFragment.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/KinoDetailsFragment.kt
index ffe5f17a13..7feeadd17d 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/KinoDetailsFragment.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/KinoDetailsFragment.kt
@@ -13,7 +13,6 @@ import android.view.ViewGroup
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
-import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProvider
import com.squareup.picasso.Picasso
import com.squareup.picasso.Target
@@ -59,9 +58,9 @@ class KinoDetailsFragment : Fragment() {
val factory = ViewModelFactory(viewModelProvider)
kinoViewModel = ViewModelProvider(this, factory).get(KinoDetailsViewModel::class.java)
- kinoViewModel.kino.observe(this, Observer { showMovieDetails(it) })
- kinoViewModel.event.observe(this, Observer { showEventTicketDetails(it) })
- kinoViewModel.aggregatedTicketStatus.observe(this, Observer { showTicketCount(it) })
+ kinoViewModel.kino.observe(this) { showMovieDetails(it) }
+ kinoViewModel.event.observe(this) { showEventTicketDetails(it) }
+ kinoViewModel.aggregatedTicketStatus.observe(this) { showTicketCount(it) }
}
override fun onCreateView(
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/service/BackgroundWorker.kt b/app/src/main/java/de/tum/in/tumcampusapp/service/BackgroundWorker.kt
index 72a835e714..4e62d542ae 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/service/BackgroundWorker.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/service/BackgroundWorker.kt
@@ -3,7 +3,6 @@ package de.tum.`in`.tumcampusapp.service
import android.content.Context
import androidx.work.Constraints
import androidx.work.ExistingWorkPolicy
-import androidx.work.ListenableWorker
import androidx.work.ListenableWorker.Result.success
import androidx.work.PeriodicWorkRequest
import androidx.work.PeriodicWorkRequestBuilder
@@ -20,7 +19,7 @@ class BackgroundWorker(
workerParams: WorkerParameters
) : Worker(context, workerParams) {
- override fun doWork(): ListenableWorker.Result {
+ override fun doWork(): Result {
val downloadWorkRequest = DownloadWorker.getWorkRequest()
WorkManager.getInstance(applicationContext)
.beginUniqueWork(UNIQUE_DOWNLOAD, ExistingWorkPolicy.KEEP, downloadWorkRequest)
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/service/DownloadWorker.kt b/app/src/main/java/de/tum/in/tumcampusapp/service/DownloadWorker.kt
index 5485c78370..dd5fc93ddc 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/service/DownloadWorker.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/service/DownloadWorker.kt
@@ -26,7 +26,7 @@ class DownloadWorker(
) : Worker(context, workerParams) {
@Inject
- lateinit var downloadActions: DownloadWorker.WorkerActions
+ lateinit var downloadActions: WorkerActions
init {
Utils.log("DownloadService service has started")
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/utils/DateTimeUtils.kt b/app/src/main/java/de/tum/in/tumcampusapp/utils/DateTimeUtils.kt
index 8cda607f7a..640a964a1c 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/utils/DateTimeUtils.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/utils/DateTimeUtils.kt
@@ -42,7 +42,7 @@ object DateTimeUtils {
val now = DateTime.now().millis
// Catch future dates: current clock might be running behind
- if (timeInMillis < now || timeInMillis <= 0) return DateTimeUtils.formatTimeOrDay(time, context)
+ if (timeInMillis < now || timeInMillis <= 0) return formatTimeOrDay(time, context)
val diff = timeInMillis - now
return when {
@@ -65,8 +65,8 @@ object DateTimeUtils {
*/
@Deprecated("Use the version with a proper DateTime object, there's really no reason to pass datetimes as strings")
fun formatTimeOrDayFromISO(datetime: String, context: Context): String {
- val d = DateTimeUtils.parseIsoDate(datetime) ?: return ""
- return DateTimeUtils.formatTimeOrDay(d, context)
+ val d = parseIsoDate(datetime) ?: return ""
+ return formatTimeOrDay(d, context)
}
/**
diff --git a/app/src/main/java/de/tum/in/tumcampusapp/utils/Extensions.kt b/app/src/main/java/de/tum/in/tumcampusapp/utils/Extensions.kt
index 6c756369e2..8365ca06a2 100644
--- a/app/src/main/java/de/tum/in/tumcampusapp/utils/Extensions.kt
+++ b/app/src/main/java/de/tum/in/tumcampusapp/utils/Extensions.kt
@@ -111,13 +111,13 @@ fun DrawerLayout.closeDrawers(callback: () -> Unit) {
}
fun LiveData.observe(owner: LifecycleOwner, callback: (T?) -> Unit) {
- observe(owner, Observer { value -> callback(value) })
+ observe(owner, Observer { value -> callback(value) })
}
fun LiveData.observeNonNull(owner: LifecycleOwner, callback: (T) -> Unit) {
observe(
owner,
- Observer { value ->
+ Observer { value ->
value?.let {
callback(it)
}
diff --git a/app/src/main/res/layout/card_news_film_item.xml b/app/src/main/res/layout/card_news_film_item.xml
index 08656e3c8b..e48b8ec0a5 100644
--- a/app/src/main/res/layout/card_news_film_item.xml
+++ b/app/src/main/res/layout/card_news_film_item.xml
@@ -83,7 +83,7 @@
android:layout_marginStart="@dimen/material_default_padding"
android:layout_marginTop="@dimen/material_small_padding"
android:src="@drawable/tickets"
- android:tint="@color/color_primary"
+ app:tint="@color/color_primary"
app:layout_constraintStart_toEndOf="@id/news_img"
app:layout_constraintTop_toBottomOf="@id/news_src_date" />
diff --git a/app/src/main/res/layout/card_news_item.xml b/app/src/main/res/layout/card_news_item.xml
index e2fe53a7fb..2f61787b12 100644
--- a/app/src/main/res/layout/card_news_item.xml
+++ b/app/src/main/res/layout/card_news_item.xml
@@ -19,6 +19,7 @@
android:scaleType="centerCrop"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent"
tools:background="@android:color/darker_gray" />
@@ -36,6 +37,7 @@
diff --git a/app/src/main/res/layout/mensa_widget.xml b/app/src/main/res/layout/mensa_widget.xml
index 1eb3be60cf..e1ba2dddfe 100644
--- a/app/src/main/res/layout/mensa_widget.xml
+++ b/app/src/main/res/layout/mensa_widget.xml
@@ -2,6 +2,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:padding="@dimen/widget_margin">
@@ -44,7 +45,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_cutlery"
- android:tint="@android:color/white" />
+ app:tint="@android:color/white" />
diff --git a/app/src/main/res/layout/mvv_widget.xml b/app/src/main/res/layout/mvv_widget.xml
index 0eec09bff3..8a25cc94e1 100644
--- a/app/src/main/res/layout/mvv_widget.xml
+++ b/app/src/main/res/layout/mvv_widget.xml
@@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:padding="@dimen/widget_margin">
@@ -44,7 +45,7 @@
android:background="@android:color/transparent"
android:padding="12dp"
android:src="@drawable/ic_outline_settings_24px"
- android:tint="@android:color/white" />
+ app:tint="@android:color/white" />
diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
index b533f65f02..0a0484a5ec 100644
--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
@@ -2,5 +2,4 @@
-
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index c7cc9135d2..ee894b9aa9 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -167,6 +167,7 @@
Kein Link gefunden.
Neuigkeiten:
+ Popup-Fenster mit Optionen öffnen
IMDb-Wertung
@@ -747,7 +748,10 @@ Signatur: %5$s
Studienfinanzierung und Beiträge
Veröffentlicht
- %d neue Meldungen
+
+ - 1 neue Meldung
+ - %d neue Meldungen
+
inklusive %s
Abmelden
Bist du sicher, dass du dich abmelden willst?
@@ -759,7 +763,7 @@ Signatur: %5$s
Verlassen
Heute
Der Ticketverkauf befindet sich momentan im Testbetrieb und es können Fehler auftreten. Solltet ihr Probleme haben, könnt ihr uns unter app@tum.de erreichen. Es gibt weiterhin Karten an der Abendkasse, selbst wenn digital das Kontigent erschöpft ist.
- Zeige %d weitere …
+ Zeige %d weitere …
Verbergen
Personalmodus
Menüpunkte wie die Notenansicht oder Studienbeitrag werden in dieser Ansicht nicht angezeigt.
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ad7ed50898..196bce24af 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -216,6 +216,7 @@
No link existing.
New information:
+ Open options popup
Open
@@ -821,13 +822,16 @@ Signature: %5$s
Released
including %s
- %d new items
+
+ - 1 new item
+ - %d new items
+
Message couldn’t be sent
The message couldn’t be send. Try again?
Today
The ticket sale is still in beta and might have some side effects and errors. In case you experience any troubles, please contact us at app@tum.de. You can still buy tickets at the box office just before the event, even if there are no more tickets here in the app.
Hide
- Show %d more …
+ Show %d more …
Show in Calendar
Tickets available here!
@@ -835,7 +839,7 @@ Signature: %5$s
Version %s
Action can’t be performed
Not redeemed yet
- %1$d of %2$d redeemed (%3$s)
+ %1$d of %2$d redeemed (%3$s)
Redeemed at %s
No tickets remaining
Unfortunately there are no more online tickets available for this event.\nFor many events you can still purchase tickets on site.