diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/other/settings/SettingsFragment.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/other/settings/SettingsFragment.kt index 3a87df7738..e1863232e0 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/other/settings/SettingsFragment.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/other/settings/SettingsFragment.kt @@ -29,6 +29,7 @@ import de.tum.`in`.tumcampusapp.component.ui.cafeteria.repository.CafeteriaLocal import de.tum.`in`.tumcampusapp.component.ui.eduroam.SetupEduroamActivity import de.tum.`in`.tumcampusapp.component.ui.news.NewsController import de.tum.`in`.tumcampusapp.component.ui.onboarding.StartupActivity +import de.tum.`in`.tumcampusapp.component.ui.overview.CardManager import de.tum.`in`.tumcampusapp.database.TcaDb import de.tum.`in`.tumcampusapp.di.injector import de.tum.`in`.tumcampusapp.service.SilenceWorker @@ -46,7 +47,7 @@ import java.util.concurrent.ExecutionException import javax.inject.Inject class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClickListener, - SharedPreferences.OnSharedPreferenceChangeListener { + SharedPreferences.OnSharedPreferenceChangeListener { private val compositeDisposable = CompositeDisposable() @@ -91,6 +92,7 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic setSummary("silent_mode_set_to") setSummary("background_mode_set_to") } + "card_cafeteria" -> { setSummary("card_cafeteria_default_G") setSummary("card_cafeteria_default_K") @@ -98,11 +100,13 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic setSummary("card_role") initCafeteriaCardSelections() } + "card_mvv" -> { setSummary("card_stations_default_G") setSummary("card_stations_default_C") setSummary("card_stations_default_K") } + "card_eduroam" -> { findPreference(SETUP_EDUROAM).onPreferenceClickListener = this } @@ -139,11 +143,11 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic url: String ) { compositeDisposable += Single - .fromCallable { Picasso.get().load(url).get() } - .subscribeOn(Schedulers.io()) - .map { BitmapDrawable(resources, it) } - .observeOn(AndroidSchedulers.mainThread()) - .subscribe(preference::setIcon, Utils::log) + .fromCallable { Picasso.get().load(url).get() } + .subscribeOn(Schedulers.io()) + .map { BitmapDrawable(resources, it) } + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(preference::setIcon, Utils::log) } /** @@ -219,13 +223,19 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic if (key == "language_preference" && activity != null) { (activity as SettingsActivity).restartApp() } + // restart app after visibility of card changed + val cardTypesPrefNames = CardManager.CardTypes.values().map { context?.getString(it.showCardPreferenceStringRes) } + // restart when visibility changed + if (key in cardTypesPrefNames) { + (activity as SettingsActivity).restartApp() + } } private fun initCafeteriaCardSelections() { val cafeterias = cafeteriaLocalRepository - .getAllCafeterias() - .blockingFirst() - .sortedBy { it.name } + .getAllCafeterias() + .blockingFirst() + .sortedBy { it.name } val cafeteriaByLocationName = getString(R.string.settings_cafeteria_depending_on_location) val cafeteriaNames = listOf(cafeteriaByLocationName) + cafeterias.map { it.name } @@ -260,11 +270,11 @@ class SettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceClic preference.setSummary(R.string.settings_no_location_selected) } else { preference.summary = values - .map { preference.findIndexOfValue(it) } - .map { preference.entries[it] } - .map { it.toString() } - .sorted() - .joinToString(", ") + .map { preference.findIndexOfValue(it) } + .map { preference.entries[it] } + .map { it.toString() } + .sorted() + .joinToString(", ") } } diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/NextLectureCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/NextLectureCard.kt index dd4278e6b3..124022451d 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/NextLectureCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/calendar/NextLectureCard.kt @@ -14,7 +14,7 @@ import de.tum.`in`.tumcampusapp.component.ui.overview.card.CardViewHolder import org.joda.time.DateTime import java.util.* -class NextLectureCard(context: Context) : Card(CardManager.CARD_NEXT_LECTURE, context, "card_next_lecture") { +class NextLectureCard(context: Context) : Card(CardManager.CardTypes.NEXT_LECTURE, context) { private val calendarController: CalendarController = CalendarController(context) diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/tutionfees/TuitionFeesCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/tutionfees/TuitionFeesCard.kt index 36e9b6d765..37f265846c 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/tutionfees/TuitionFeesCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/tumui/tutionfees/TuitionFeesCard.kt @@ -24,7 +24,7 @@ import org.joda.time.format.DateTimeFormat class TuitionFeesCard( context: Context, private val tuition: Tuition -) : Card(CardManager.CARD_TUITION_FEE, context, "card_tuition_fee") { +) : Card(CardManager.CardTypes.TUITION_FEE, context) { override val optionsMenuResId: Int get() = R.menu.card_popup_menu diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/cafeteria/CafeteriaMenuCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/cafeteria/CafeteriaMenuCard.kt index 4575948940..877585df98 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/cafeteria/CafeteriaMenuCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/cafeteria/CafeteriaMenuCard.kt @@ -22,7 +22,8 @@ import java.util.* /** * Card that shows the cafeteria menu */ -class CafeteriaMenuCard(context: Context, private val cafeteria: CafeteriaWithMenus) : Card(CardManager.CARD_CAFETERIA, context, "card_cafeteria") { +class CafeteriaMenuCard(context: Context, private val cafeteria: CafeteriaWithMenus) : + Card(CardManager.CardTypes.CAFETERIA, context) { override val optionsMenuResId: Int get() = R.menu.card_popup_menu diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/eduroam/EduroamCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/eduroam/EduroamCard.kt index 323eeea2a5..75ed6fbcc3 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/eduroam/EduroamCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/eduroam/EduroamCard.kt @@ -7,7 +7,6 @@ import android.content.Intent import android.content.SharedPreferences import android.content.pm.PackageManager.PERMISSION_GRANTED import android.net.wifi.WifiManager -import android.preference.PreferenceManager import android.view.LayoutInflater import android.view.ViewGroup import androidx.core.content.ContextCompat.checkSelfPermission @@ -24,7 +23,7 @@ import org.jetbrains.anko.wifiManager /** * Card that can start [SetupEduroamActivity] */ -class EduroamCard(context: Context) : Card(CardManager.CARD_EDUROAM, context, "card_eduroam") { +class EduroamCard(context: Context) : Card(CardManager.CardTypes.EDUROAM, context) { override val optionsMenuResId: Int get() = R.menu.card_popup_menu @@ -39,7 +38,10 @@ class EduroamCard(context: Context) : Card(CardManager.CARD_EDUROAM, context, "c override fun shouldShow(prefs: SharedPreferences): Boolean { // Check if WiFi is turned on at all, as we cannot say if it was configured if it is off val wifiManager = context.wifiManager - return (wifiManager.isWifiEnabled && EduroamController.getEduroamConfig(context) == null && eduroamAvailable(wifiManager)) + return (wifiManager.isWifiEnabled && + EduroamController.getEduroamConfig(context) == null && + eduroamAvailable(wifiManager) && + prefs.getBoolean("card_eduroam_start", true)) } private fun eduroamAvailable(wifi: WifiManager): Boolean { @@ -54,9 +56,7 @@ class EduroamCard(context: Context) : Card(CardManager.CARD_EDUROAM, context, "c } override fun discard(editor: SharedPreferences.Editor) { - val prefs = PreferenceManager.getDefaultSharedPreferences(context) - prefs.edit().putBoolean("card_eduroam_start", false) - .apply() + editor.putBoolean("card_eduroam_start", false) } override fun getId(): Int { diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/eduroam/EduroamFixCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/eduroam/EduroamFixCard.kt index fda4e65343..eb65f4b50d 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/eduroam/EduroamFixCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/eduroam/EduroamFixCard.kt @@ -19,14 +19,13 @@ import de.tum.`in`.tumcampusapp.component.ui.overview.card.Card import de.tum.`in`.tumcampusapp.component.ui.overview.card.CardViewHolder import de.tum.`in`.tumcampusapp.utils.Const import de.tum.`in`.tumcampusapp.utils.Utils -import org.jetbrains.anko.defaultSharedPreferences import org.jetbrains.anko.wifiManager import java.util.* import java.util.regex.Pattern class EduroamFixCard( context: Context -) : Card(CardManager.CARD_EDUROAM_FIX, context, "card_eduroam_fix_start") { +) : Card(CardManager.CardTypes.EDUROAM_FIX, context) { private val errors: MutableList = ArrayList() private lateinit var eduroam: WifiConfiguration @@ -72,11 +71,11 @@ class EduroamFixCard( // Check if wifi is turned on at all, as we cannot say if it was configured if its off return if (!context.wifiManager.isWifiEnabled) { false - } else !isConfigValid() + } else !isConfigValid() && prefs.getBoolean("card_eduroam_fix_start", true) } override fun discard(editor: SharedPreferences.Editor) { - context.defaultSharedPreferences.edit().putBoolean("card_eduroam_fix_start", false).apply() + editor.putBoolean("card_eduroam_fix_start", false) } override fun getId(): Int { diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsCard.kt index 971010ec2a..08418cc0b6 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/NewsCard.kt @@ -20,8 +20,8 @@ import org.joda.time.DateTime open class NewsCard @JvmOverloads constructor( context: Context, val news: News, - type: Int = CardManager.CARD_NEWS -) : Card(type, context, "card_news") { + type: CardManager.CardTypes = CardManager.CardTypes.NEWS +) : Card(type, context) { override val optionsMenuResId: Int get() = R.menu.card_popup_menu 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 7219384597..9c878230ad 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 @@ -93,6 +93,7 @@ class NewsViewHolder( private fun bindNews(newsItem: News) { val imageUrl = newsItem.image if (imageUrl.isNotEmpty()) { + imageView?.visibility = VISIBLE loadNewsImage(imageUrl) } else { imageView?.visibility = GONE diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/TopNewsCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/TopNewsCard.kt index 3a578688ff..f362671924 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/TopNewsCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/TopNewsCard.kt @@ -24,7 +24,7 @@ import org.jetbrains.anko.defaultSharedPreferences /** * Shows important news */ -class TopNewsCard(context: Context) : Card(CardManager.CARD_TOP_NEWS, context, "top_news") { +class TopNewsCard(context: Context) : Card(CardManager.CardTypes.TOP_NEWS, context) { private lateinit var imageView: ImageView private lateinit var progress: ProgressBar private val topNewsStore: TopNewsStore diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/TopNewsStore.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/TopNewsStore.kt index 54cc9fd27f..393e090c9c 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/TopNewsStore.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/news/TopNewsStore.kt @@ -62,6 +62,9 @@ class RealTopNewsStore @Inject constructor( } val displayUntil = sharedPrefs.getString(Const.NEWS_ALERT_SHOW_UNTIL, "")!! + if (displayUntil.isEmpty()) { + return null + } val until: DateTime? = DateTimeUtils.parseIsoDateWithMillis(displayUntil) if (until == null || until.isBeforeNow) { return null diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/LoginPromptCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/LoginPromptCard.kt index 166ccd1c6f..821b26f312 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/LoginPromptCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/onboarding/LoginPromptCard.kt @@ -17,15 +17,17 @@ import de.tum.`in`.tumcampusapp.utils.Utils * Card that prompts the user to login to TUMonline since we don't show the wizard after the first launch anymore. * It will be shown until it is swiped away for the first time. */ -class LoginPromptCard(context: Context) : Card(CardManager.CARD_LOGIN, context, "card_login") { +class LoginPromptCard(context: Context) : Card(CardManager.CardTypes.LOGIN, context) { + + private val showLogin = "show_login" public override fun discard(editor: SharedPreferences.Editor) { - Utils.setSetting(context, CardManager.SHOW_LOGIN, false) + editor.putBoolean(showLogin, false) } override fun shouldShow(prefs: SharedPreferences): Boolean { // show on top as long as user hasn't swiped it away and isn't connected to TUMonline - return Utils.getSettingBool(context, CardManager.SHOW_LOGIN, true) && + return prefs.getBoolean(showLogin, true) && Utils.getSetting(context, Const.LRZ_ID, "").isEmpty() } diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardAdapter.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardAdapter.kt index 1925b9ef94..bd464da562 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardAdapter.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardAdapter.kt @@ -27,20 +27,20 @@ class CardAdapter(private val interactionListener: CardInteractionListener) : Re override fun onCreateViewHolder(viewGroup: ViewGroup, viewType: Int): CardViewHolder { when (viewType) { - CardManager.CARD_CAFETERIA -> return CafeteriaMenuCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_TUITION_FEE -> return TuitionFeesCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_NEXT_LECTURE -> return NextLectureCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_RESTORE -> return RestoreCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_NO_INTERNET -> return NoInternetCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_MVV -> return MVVCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_NEWS, CardManager.CARD_NEWS_FILM -> return NewsCard.inflateViewHolder(viewGroup, viewType, interactionListener) - CardManager.CARD_EDUROAM -> return EduroamCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_EDUROAM_FIX -> return EduroamFixCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_SUPPORT -> return SupportCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_LOGIN -> return LoginPromptCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_TOP_NEWS -> return TopNewsCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_EVENT -> return EventCard.inflateViewHolder(viewGroup, interactionListener) - CardManager.CARD_UPDATE_NOTE -> return UpdateNoteCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.CAFETERIA.id -> return CafeteriaMenuCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.TUITION_FEE.id -> return TuitionFeesCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.NEXT_LECTURE.id -> return NextLectureCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.RESTORE.id -> return RestoreCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.NO_INTERNET.id -> return NoInternetCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.MVV.id -> return MVVCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.NEWS.id, CardManager.CardTypes.NEWS_FILM.id -> return NewsCard.inflateViewHolder(viewGroup, viewType, interactionListener) + CardManager.CardTypes.EDUROAM.id -> return EduroamCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.EDUROAM_FIX.id -> return EduroamFixCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.SUPPORT.id -> return SupportCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.LOGIN.id -> return LoginPromptCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.TOP_NEWS.id -> return TopNewsCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.EVENT.id -> return EventCard.inflateViewHolder(viewGroup, interactionListener) + CardManager.CardTypes.UPDATE_NOTE.id -> return UpdateNoteCard.inflateViewHolder(viewGroup, interactionListener) else -> throw UnsupportedOperationException() } } @@ -51,11 +51,11 @@ class CardAdapter(private val interactionListener: CardInteractionListener) : Re card.updateViewHolder(viewHolder) } - override fun getItemViewType(position: Int) = mItems[position].cardType + override fun getItemViewType(position: Int) = mItems[position].cardType.id override fun getItemId(position: Int): Long { val card = mItems[position] - return (card.cardType + (card.getId() shl 4)).toLong() + return (card.cardType.id + (card.getId() shl 4)).toLong() } override fun getItemCount() = mItems.size diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardManager.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardManager.kt index ec8f401567..ed6e6e7b05 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardManager.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardManager.kt @@ -1,61 +1,62 @@ package de.tum.`in`.tumcampusapp.component.ui.overview import android.content.Context -import android.preference.PreferenceManager import de.tum.`in`.tumcampusapp.R import de.tum.`in`.tumcampusapp.database.TcaDb import de.tum.`in`.tumcampusapp.utils.Const.CARD_POSITION_PREFERENCE_SUFFIX -import de.tum.`in`.tumcampusapp.utils.Const.DISCARD_SETTINGS_START import de.tum.`in`.tumcampusapp.utils.Utils +import org.jetbrains.anko.defaultSharedPreferences /** * Card manager, manages inserting, dismissing, updating and displaying of cards */ object CardManager { - const val SHOW_SUPPORT = "show_support" - const val SHOW_LOGIN = "show_login" const val SHOW_TOP_NEWS = "show_top_news" /** * Card typ constants */ - const val CARD_CAFETERIA = R.layout.card_cafeteria_menu - const val CARD_TUITION_FEE = R.layout.card_tuition_fees - const val CARD_NEXT_LECTURE = R.layout.card_next_lecture_item - const val CARD_RESTORE = R.layout.card_restore - const val CARD_NO_INTERNET = R.layout.card_no_internet - const val CARD_MVV = R.layout.card_mvv - const val CARD_NEWS = R.layout.card_news_item - const val CARD_NEWS_FILM = R.layout.card_news_film_item - const val CARD_EDUROAM = R.layout.card_eduroam - const val CARD_CHAT = R.layout.card_chat_messages - const val CARD_SUPPORT = R.layout.card_support - const val CARD_LOGIN = R.layout.card_login_prompt - const val CARD_EDUROAM_FIX = R.layout.card_eduroam_fix - const val CARD_TOP_NEWS = R.layout.card_top_news - const val CARD_EVENT = R.layout.card_events_item - const val CARD_UPDATE_NOTE = R.layout.card_update_note + enum class CardTypes(val id: Int, val showCardPreferenceStringRes: Int) { + CAFETERIA(R.layout.card_cafeteria_menu, R.string.cafeteria_default_sharedpref_shown), + TUITION_FEE(R.layout.card_tuition_fees, R.string.tuition_fee_default_sharedpref_shown), + NEXT_LECTURE(R.layout.card_next_lecture_item, R.string.next_lecture_default_sharedpref_shown), + RESTORE(R.layout.card_restore, R.string.restore_default_sharedpref_shown), + NO_INTERNET(R.layout.card_no_internet, R.string.no_internet_default_sharedpref_shown), + MVV(R.layout.card_mvv, R.string.mvv_default_sharedpref_shown), + NEWS(R.layout.card_news_item, R.string.news_default_sharedpref_shown), + NEWS_FILM(R.layout.card_news_film_item, R.string.news_film_default_sharedpref_shown), + EDUROAM(R.layout.card_eduroam, R.string.eduroam_default_sharedpref_shown), + CHAT(R.layout.card_chat_messages, R.string.chat_default_sharedpref_shown), + SUPPORT(R.layout.card_support, R.string.support_default_sharedpref_shown), + LOGIN(R.layout.card_login_prompt, R.string.login_default_sharedpref_shown), + EDUROAM_FIX(R.layout.card_eduroam_fix, R.string.eduroam_fix_default_sharedpref_shown), + TOP_NEWS(R.layout.card_top_news, R.string.top_news_default_sharedpref_shown), + EVENT(R.layout.card_events_item, R.string.event_default_sharedpref_shown), + UPDATE_NOTE(R.layout.card_update_note, R.string.update_note_default_sharedpref_shown) + } /** * Resets dismiss settings for all cards */ fun restoreCards(context: Context) { - context.getSharedPreferences(DISCARD_SETTINGS_START, 0) + CardTypes.values().forEach { + context.getSharedPreferences("CardPref$it", Context.MODE_PRIVATE) .edit() .clear() .apply() + } TcaDb.getInstance(context) - .newsDao() - .restoreAllNews() + .newsDao() + .restoreAllNews() Utils.setSetting(context, SHOW_TOP_NEWS, true) restoreCardPositions(context) } private fun restoreCardPositions(context: Context) { - val preferences = PreferenceManager.getDefaultSharedPreferences(context) + val preferences = context.defaultSharedPreferences val editor = preferences.edit() for (s in preferences.all.keys) { diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardsRepository.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardsRepository.kt index fe72505677..ed1e32c157 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardsRepository.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/CardsRepository.kt @@ -20,7 +20,9 @@ import de.tum.`in`.tumcampusapp.component.ui.ticket.EventCardsProvider import de.tum.`in`.tumcampusapp.component.ui.transportation.TransportController import de.tum.`in`.tumcampusapp.component.ui.updatenote.UpdateNoteCard import de.tum.`in`.tumcampusapp.utils.Utils -import org.jetbrains.anko.doAsync +import kotlinx.coroutines.CoroutineDispatcher +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.withContext import javax.inject.Inject class CardsRepository @Inject constructor( @@ -30,6 +32,8 @@ class CardsRepository @Inject constructor( private var cards = MutableLiveData>() + private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO + /** * Starts refresh of [Card]s and returns the corresponding [LiveData] * through which the result can be received. @@ -37,15 +41,14 @@ class CardsRepository @Inject constructor( * @return The [LiveData] of [Card]s */ fun getCards(): LiveData> { - refreshCards(CacheControl.USE_CACHE) return cards } /** * Refreshes the [LiveData] of [Card]s and updates its value. */ - fun refreshCards(cacheControl: CacheControl) { - doAsync { + suspend fun refreshCards(cacheControl: CacheControl) { + withContext(ioDispatcher) { val results = getCardsNow(cacheControl) cards.postValue(results) } diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/MainActivityViewModel.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/MainActivityViewModel.kt index 380f4adfbb..9c44df4d97 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/MainActivityViewModel.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/MainActivityViewModel.kt @@ -2,8 +2,10 @@ package de.tum.`in`.tumcampusapp.component.ui.overview import androidx.lifecycle.LiveData import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope import de.tum.`in`.tumcampusapp.api.tumonline.CacheControl import de.tum.`in`.tumcampusapp.component.ui.overview.card.Card +import kotlinx.coroutines.launch import javax.inject.Inject class MainActivityViewModel @Inject constructor( @@ -11,9 +13,16 @@ class MainActivityViewModel @Inject constructor( ) : ViewModel() { val cards: LiveData> - get() = cardsRepo.getCards() + get() { + viewModelScope.launch { + cardsRepo.refreshCards(CacheControl.USE_CACHE) + } + return cardsRepo.getCards() + } fun refreshCards() { - cardsRepo.refreshCards(CacheControl.BYPASS_CACHE) + viewModelScope.launch { + cardsRepo.refreshCards(CacheControl.BYPASS_CACHE) + } } } \ No newline at end of file diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/MainFragment.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/MainFragment.kt index d6f3d3f63e..e997940d17 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/MainFragment.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/MainFragment.kt @@ -66,6 +66,8 @@ class MainFragment : BaseFragment( ViewModelProviders.of(this, factory).get(MainActivityViewModel::class.java) } + var snackBar: Snackbar? = null + override fun onAttach(context: Context) { super.onAttach(context) injector.inject(this) @@ -146,7 +148,17 @@ class MainFragment : BaseFragment( } override fun onRefresh() { - viewModel.refreshCards() + // check if SnackBar is shown + // if shown that means a card is in the process of being discarded + // to guarantee that the card is really discarded we will trigger the dismiss of the SnackBar manually + // if shown also refreshCards is called inside the dismiss-callback of the SnackBar + // this guarantees that it is always called after the dismissal is completed + // which because of the callback would not be the case otherwise + if (snackBar != null && snackBar!!.isShown) { + snackBar!!.dismiss() + } else { + viewModel.refreshCards() + } } override fun onAlwaysHideCard(position: Int) { @@ -225,7 +237,7 @@ class MainFragment : BaseFragment( cardsAdapter.remove(lastPos) with(binding) { - Snackbar.make(cardsRecyclerView, R.string.card_dismissed, Snackbar.LENGTH_LONG) + snackBar = Snackbar.make(cardsRecyclerView, R.string.card_dismissed, Snackbar.LENGTH_LONG) .setAction(R.string.undo) { card?.let { cardsAdapter.insert(lastPos, it) @@ -243,9 +255,13 @@ class MainFragment : BaseFragment( // and therefore, we didn't really dismiss the card card?.discard() } + if (event == DISMISS_EVENT_MANUAL) { + // manual dismissal means we need to call refresh here + viewModel.refreshCards() + } } }) - .show() + snackBar!!.show() } } } diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/NoInternetCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/NoInternetCard.kt index 8d5e8bba98..4297b5561f 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/NoInternetCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/NoInternetCard.kt @@ -17,7 +17,7 @@ import org.joda.time.DateTime /** * Card that informs that no internet connection is available */ -class NoInternetCard(context: Context) : StickyCard(CardManager.CARD_NO_INTERNET, context) { +class NoInternetCard(context: Context) : StickyCard(CardManager.CardTypes.NO_INTERNET, context) { override fun updateViewHolder(viewHolder: RecyclerView.ViewHolder) { super.updateViewHolder(viewHolder) diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/RestoreCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/RestoreCard.kt index 27f35ac011..fe4bad34fb 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/RestoreCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/RestoreCard.kt @@ -12,7 +12,7 @@ import de.tum.`in`.tumcampusapp.component.ui.overview.card.StickyCard /** * Card that allows the user to reset the dismiss state of all cards */ -class RestoreCard(context: Context) : StickyCard(CardManager.CARD_RESTORE, context) { +class RestoreCard(context: Context) : StickyCard(CardManager.CardTypes.RESTORE, context) { /** * Override getPositionByDate, we want the RestoreCard to be the last card. diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/SupportCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/SupportCard.kt index ed6dab8eba..09d819d12a 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/SupportCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/SupportCard.kt @@ -12,19 +12,21 @@ import android.view.ViewGroup import de.tum.`in`.tumcampusapp.R import de.tum.`in`.tumcampusapp.component.ui.overview.card.Card import de.tum.`in`.tumcampusapp.component.ui.overview.card.CardViewHolder -import de.tum.`in`.tumcampusapp.utils.Utils /** * Card that describes how to dismiss a card */ -class SupportCard(context: Context) : Card(CardManager.CARD_SUPPORT, context, "") { +class SupportCard(context: Context) : Card(CardManager.CardTypes.SUPPORT, context) { + + private val showSupport = "show_support" public override fun discard(editor: Editor) { - Utils.setSetting(context, CardManager.SHOW_SUPPORT, false) + editor.putBoolean(showSupport, false) } - override fun shouldShow(prefs: SharedPreferences) = - Utils.getSettingBool(context, CardManager.SHOW_SUPPORT, true) + override fun shouldShow(prefs: SharedPreferences): Boolean { + return prefs.getBoolean(showSupport, true) + } override fun getId() = 0 @@ -34,14 +36,18 @@ class SupportCard(context: Context) : Card(CardManager.CARD_SUPPORT, context, "" val view = LayoutInflater.from(parent.context).inflate(R.layout.card_support, parent, false) view.findViewById(R.id.facebook_button).setOnClickListener { v -> val browserIntent = Intent(Intent.ACTION_VIEW) - browserIntent.data = Uri.parse(view.context - .getString(R.string.facebook_link)) + browserIntent.data = Uri.parse( + view.context + .getString(R.string.facebook_link) + ) v.context.startActivity(browserIntent) } view.findViewById(R.id.github_button).setOnClickListener { v -> val browserIntent = Intent(Intent.ACTION_VIEW) - browserIntent.data = Uri.parse(view.context - .getString(R.string.github_link)) + browserIntent.data = Uri.parse( + view.context + .getString(R.string.github_link) + ) v.context.startActivity(browserIntent) } view.findViewById(R.id.email_button).setOnClickListener { v -> diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/Card.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/Card.kt index 18dfdc1bd8..3de56f7efd 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/Card.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/Card.kt @@ -3,28 +3,26 @@ package de.tum.`in`.tumcampusapp.component.ui.overview.card import android.content.Context import android.content.SharedPreferences import android.content.SharedPreferences.Editor -import android.preference.PreferenceManager import androidx.recyclerview.widget.DiffUtil import de.tum.`in`.tumcampusapp.R import de.tum.`in`.tumcampusapp.component.other.navigation.NavDestination +import de.tum.`in`.tumcampusapp.component.ui.overview.CardManager import de.tum.`in`.tumcampusapp.utils.Const.CARD_POSITION_PREFERENCE_SUFFIX -import de.tum.`in`.tumcampusapp.utils.Const.DISCARD_SETTINGS_START import de.tum.`in`.tumcampusapp.utils.Utils +import org.jetbrains.anko.defaultSharedPreferences /** * Base class for all cards * @param cardType Individual integer for each card type * @param context Android Context - * @param settingsPrefix Preference key prefix used for all preferences belonging to that card */ abstract class Card( - val cardType: Int, - protected var context: Context, - val settingsPrefix: String = "" + val cardType: CardManager.CardTypes, + protected var context: Context ) : Comparable { - // Settings for showing this card on start page or as notification - private var showStart = Utils.getSettingBool(context, settingsPrefix + "_start", true) + // stores information for dismiss + private val dismissCardSharedPreferences: SharedPreferences = context.getSharedPreferences("CardPref$cardType", Context.MODE_PRIVATE) open fun getId(): Int { return 0 @@ -70,8 +68,7 @@ abstract class Card( * Should be called after the user has dismissed the card */ fun discard() { - val prefs = context.getSharedPreferences(DISCARD_SETTINGS_START, 0) - val editor = prefs.edit() + val editor = dismissCardSharedPreferences.edit() discard(editor) editor.apply() } @@ -82,9 +79,8 @@ abstract class Card( * @return The Card to be displayed or null */ open fun getIfShowOnStart(): Card? { - if (showStart) { - val prefs = context.getSharedPreferences(DISCARD_SETTINGS_START, 0) - if (shouldShow(prefs)) { + if (context.defaultSharedPreferences.getBoolean(context.getString(cardType.showCardPreferenceStringRes), true)) { + if (shouldShow(dismissCardSharedPreferences)) { return this } } @@ -92,7 +88,7 @@ abstract class Card( } /** - * Determines if the card should be shown. Decision is based on the given SharedPreferences. + * Determines if the card should be shown at the card level. Decision is based on the given SharedPreferences. * This method should be overridden in most cases. * * @return returns true if the card should be shown @@ -106,12 +102,11 @@ abstract class Card( * reactivated manually by the user */ open fun hideAlways() { - val prefs = PreferenceManager.getDefaultSharedPreferences(context) - val e = prefs.edit() - e.putBoolean(settingsPrefix + "_start", false) - e.putBoolean(settingsPrefix + "_phone", false) - e.apply() - Utils.log("Hiding card: $settingsPrefix") + context.defaultSharedPreferences + .edit() + .putBoolean(context.getString(cardType.showCardPreferenceStringRes), false) + .apply() + Utils.log("Hiding card: $cardType") } override fun compareTo(other: Card): Int { @@ -119,7 +114,8 @@ abstract class Card( } /** - * Save information about the dismissed card/notification to decide later if the cardView should be shown again + * Save information about the dismissed card/notification to decide later if the cardView should be shown again. + * It is exclusively called from [discard] where the changes made to the SharedPreferences are applied. * * @param editor Editor to be used for saving values */ @@ -135,9 +131,9 @@ abstract class Card( override fun getNewListSize() = newList.size override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int) = - oldList[oldItemPosition].cardType == newList[newItemPosition].cardType + oldList[oldItemPosition].cardType == newList[newItemPosition].cardType override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int) = - oldList[oldItemPosition] == newList[newItemPosition] + oldList[oldItemPosition] == newList[newItemPosition] } } diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/CardViewHolder.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/CardViewHolder.kt index 7492d6de53..e5a58a890d 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/CardViewHolder.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/CardViewHolder.kt @@ -54,7 +54,8 @@ open class CardViewHolder @JvmOverloads constructor( } private fun openCardSettings() { - val key = currentCard?.settingsPrefix ?: return + val resId = currentCard?.cardType?.showCardPreferenceStringRes ?: return + val key = context.getString(resId) val intent = SettingsActivity.newIntent(context, key) context.startActivity(intent) } diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/StickyCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/StickyCard.kt index 1e810a10ba..30f4103a78 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/StickyCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/overview/card/StickyCard.kt @@ -2,8 +2,9 @@ package de.tum.`in`.tumcampusapp.component.ui.overview.card import android.content.Context import android.content.SharedPreferences +import de.tum.`in`.tumcampusapp.component.ui.overview.CardManager -abstract class StickyCard(cardType: Int, context: Context) : Card(cardType, context) { +abstract class StickyCard(cardType: CardManager.CardTypes, context: Context) : Card(cardType, context) { override val isDismissible: Boolean get() = false diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/EventCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/EventCard.kt index b6af0bdb61..fbbf06dd32 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/EventCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/ticket/EventCard.kt @@ -21,7 +21,7 @@ import de.tum.`in`.tumcampusapp.component.ui.tufilm.KinoActivity import de.tum.`in`.tumcampusapp.database.TcaDb import de.tum.`in`.tumcampusapp.utils.Const -class EventCard(context: Context) : Card(CardManager.CARD_EVENT, context, "card_event") { +class EventCard(context: Context) : Card(CardManager.CardTypes.EVENT, context) { var event: Event? = null diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/MVVCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/MVVCard.kt index bb5d975eaa..bbc40fd344 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/MVVCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/transportation/MVVCard.kt @@ -10,7 +10,7 @@ import androidx.recyclerview.widget.RecyclerView import de.tum.`in`.tumcampusapp.R import de.tum.`in`.tumcampusapp.component.other.navigation.NavDestination import de.tum.`in`.tumcampusapp.component.ui.overview.CardInteractionListener -import de.tum.`in`.tumcampusapp.component.ui.overview.CardManager.CARD_MVV +import de.tum.`in`.tumcampusapp.component.ui.overview.CardManager import de.tum.`in`.tumcampusapp.component.ui.overview.card.Card import de.tum.`in`.tumcampusapp.component.ui.overview.card.CardViewHolder import de.tum.`in`.tumcampusapp.component.ui.transportation.model.efa.Departure @@ -19,7 +19,7 @@ import de.tum.`in`.tumcampusapp.component.ui.transportation.model.efa.StationRes /** * Card that shows MVV departure times */ -class MVVCard(context: Context, val station: StationResult, val departures: List) : Card(CARD_MVV, context, "card_mvv") { +class MVVCard(context: Context, val station: StationResult, val departures: List) : Card(CardManager.CardTypes.MVV, context) { override val optionsMenuResId: Int get() = R.menu.card_popup_menu diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/FilmCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/FilmCard.kt index 85fdc219f3..4e287fb57f 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/FilmCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/tufilm/FilmCard.kt @@ -13,7 +13,7 @@ import de.tum.`in`.tumcampusapp.utils.DateTimeUtils class FilmCard( context: Context, news: News -) : NewsCard(context, news, CardManager.CARD_NEWS_FILM) { +) : NewsCard(context, news, CardManager.CardTypes.NEWS_FILM) { override fun getNavigationDestination(): NavDestination { val args = Bundle() args.putString(Const.KINO_DATE, DateTimeUtils.getDateTimeString(date)) diff --git a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/updatenote/UpdateNoteCard.kt b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/updatenote/UpdateNoteCard.kt index e3dcbd41ef..1755b56719 100644 --- a/app/src/main/java/de/tum/in/tumcampusapp/component/ui/updatenote/UpdateNoteCard.kt +++ b/app/src/main/java/de/tum/in/tumcampusapp/component/ui/updatenote/UpdateNoteCard.kt @@ -16,7 +16,7 @@ import de.tum.`in`.tumcampusapp.component.ui.overview.card.CardViewHolder import de.tum.`in`.tumcampusapp.utils.Const import de.tum.`in`.tumcampusapp.utils.Utils -class UpdateNoteCard(context: Context) : Card(CardManager.CARD_UPDATE_NOTE, context, "update_note") { +class UpdateNoteCard(context: Context) : Card(CardManager.CardTypes.UPDATE_NOTE, context) { override fun updateViewHolder(viewHolder: RecyclerView.ViewHolder) { super.updateViewHolder(viewHolder) @@ -26,12 +26,12 @@ class UpdateNoteCard(context: Context) : Card(CardManager.CARD_UPDATE_NOTE, cont } override fun shouldShow(prefs: SharedPreferences): Boolean { - return Utils.getSettingBool(context, Const.SHOW_UPDATE_NOTE, false) && + return prefs.getBoolean(Const.SHOW_UPDATE_NOTE, false) && Utils.getSetting(context, Const.UPDATE_MESSAGE, "").isNotEmpty() } override fun discard(editor: SharedPreferences.Editor) { - Utils.setSetting(context, Const.SHOW_UPDATE_NOTE, false) + editor.putBoolean(Const.SHOW_UPDATE_NOTE, false) } companion object { diff --git a/app/src/main/res/drawable/ic_celebration.xml b/app/src/main/res/drawable/ic_celebration.xml new file mode 100644 index 0000000000..10ceb08299 --- /dev/null +++ b/app/src/main/res/drawable/ic_celebration.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/app/src/main/res/drawable/ic_download.xml b/app/src/main/res/drawable/ic_download.xml new file mode 100644 index 0000000000..c7a77ca853 --- /dev/null +++ b/app/src/main/res/drawable/ic_download.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_live_help.xml b/app/src/main/res/drawable/ic_live_help.xml new file mode 100644 index 0000000000..ac8620024a --- /dev/null +++ b/app/src/main/res/drawable/ic_live_help.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_person_24.xml b/app/src/main/res/drawable/ic_person_24.xml new file mode 100644 index 0000000000..68ec21feb7 --- /dev/null +++ b/app/src/main/res/drawable/ic_person_24.xml @@ -0,0 +1,9 @@ + + + diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 741091953d..9f49168e26 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -339,13 +339,23 @@ Zeigt die Abfahrtszeiten der öffentlich Verkehrmittel an Zeigt Informationen zur nächsten Vorlesung an Erinnert dich, wenn du die Studiengebühren zahlen musst + Unterstütze uns durch Feedback oder teilen der App + Zeigt an wenn keine Internetverbindung vorhanden ist + Erlaubt dir dich mit TUMOnline zu verbinden Schlägt ausgewählte News vor Benachrichtigt dich über neue Nachrichten + Zeigt anstehenden Events an + Gibt eine Übersicht über neue Features Karte anpassen Karte immer ausblenden Um Benachrichtigungen auf dem Telefon zu erhalten muss Wearable aktiviert sein Anzeige + + Startseite News + Startseite Top-News + Startseite Film-News + Öffnet Schließt Geschlossen diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 4d4f81e842..59e294e49b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -333,6 +333,24 @@ You have to reregister until %s! Undo + + CafeteriaCardShown + TuitionFeeCardShown + NextLectureCardShown + RestoreCardShown + NoInternetCardShown + MVVCardShown + NewsCardShown + NewsFilmCardShown + EduroamCardShown + ChatCardShown + SupportCardShown + LoginCardShown + EduroamFixCardShown + TopNewsCardShown + EventCardShown + UpdateNoteCardShown + Swipe left or right to hide a card. If you want to hide a card permanently or you want to be notified if a new card is available open card-settings by long pressing on a card @@ -390,14 +408,24 @@ Shows you the departure times of public transport Shows information about your next lecture Reminds you when you have to pay your fees + Support us by giving feedback or sharing the app + Shows when there is no internet connection + Allows you to connect to TUMOnline Advertises selected news Notifies you about new messages + Shows upcoming events + Provides an overview about new features Chat Open card settings Always hide card To receive notifications on your phone you have to enable Wearable Display + + Startpage news + Startpage top-news + Startpage film-news + Opens Closes Closed diff --git a/app/src/main/res/xml/settings.xml b/app/src/main/res/xml/settings.xml index f13bee9e31..905ba50332 100644 --- a/app/src/main/res/xml/settings.xml +++ b/app/src/main/res/xml/settings.xml @@ -39,7 +39,7 @@ @@ -47,7 +47,7 @@ @@ -153,7 +153,7 @@ @@ -188,7 +188,7 @@ @@ -196,7 +196,7 @@ @@ -219,7 +219,7 @@ + + + + + + + + + + + @@ -242,8 +260,18 @@ + android:key="@string/news_default_sharedpref_shown" + android:title="@string/startpage_news" /> + + + + + @@ -312,7 +342,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +