Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

Commit

Permalink
removed unused imports to fix the build (#1484)
Browse files Browse the repository at this point in the history
added base structure and first spinner version

added rating structure

added rating list items

extended new rating layout

added recycler views for tag ratings

improved spacing and orientation of elements

started add ing view fragment

showing single ratings in listview

colorful list rating items

improved color scheme

removed unnecessary ui elements

added prove of concept camera

ui simplification create rating

prepared listitem in cafeteria overview

moved cafeteria in shared fragment
  • Loading branch information
CommanderStorm authored and tobiasjungmann committed Feb 2, 2023
1 parent 9efff8d commit 4064abf
Show file tree
Hide file tree
Showing 32 changed files with 1,504 additions and 262 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,4 @@ protobuf {
}

apply plugin: 'com.google.gms.google-services'

351 changes: 172 additions & 179 deletions app/src/main/AndroidManifest.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ class FeedbackPresenter @Inject constructor(
return true
}


override fun onImageOptionSelected(option: Int) {
if (option == 0) {
if (SDK_INT < M || checkPermission(CAMERA)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class CafeteriaMenuCard(context: Context, private val cafeteria: CafeteriaWithMe
@JvmStatic
fun inflateViewHolder(parent: ViewGroup, interactionListener: CardInteractionListener): CardViewHolder {
val view = LayoutInflater.from(parent.context).inflate(R.layout.card_cafeteria_menu, parent, false)
return CafeteriaMenuViewHolder(view, interactionListener)
return CafeteriaMenuViewHolder(view, interactionListener)//,requireA)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ package de.tum.`in`.tumcampusapp.component.ui.cafeteria

import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.DefaultItemAnimator
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import de.tum.`in`.tumcampusapp.R
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.details.CafeteriaMenusAdapter
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.details.OpenHoursHelper
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.model.CafeteriaWithMenus
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.rating.CreateCafeteriaRatingFragment
import de.tum.`in`.tumcampusapp.component.ui.overview.CardInteractionListener
import de.tum.`in`.tumcampusapp.component.ui.overview.card.CardViewHolder
import org.joda.time.format.DateTimeFormat
Expand Down Expand Up @@ -49,7 +52,20 @@ class CafeteriaMenuViewHolder(
menusRecyclerView.layoutManager = LinearLayoutManager(context)
menusRecyclerView.itemAnimator = DefaultItemAnimator()

adapter = CafeteriaMenusAdapter(context, false) { performClick() }
val lambda= { /*performClick()*/
// val intent = Intent(requireContext, CreateCafeteriaRatingActivity::class.java)
// context.startActivity(intent)
val nextFrag = CreateCafeteriaRatingFragment()
val help= itemView.context

(context as Fragment).requireActivity().supportFragmentManager.beginTransaction()
.replace(R.id.contentFrame, nextFrag, "cafeteriaRating")
.addToBackStack(null)
.commit()
}

adapter = CafeteriaMenusAdapter(context, false)//,lambda)

menusRecyclerView.adapter = adapter
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ 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.component.ui.cafeteria.rating.CreateCafeteriaRatingFragment
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.rating.ShowCafeteriaRatingsFragment
import de.tum.`in`.tumcampusapp.databinding.FragmentCafeteriadetailsSectionBinding
import de.tum.`in`.tumcampusapp.di.ViewModelFactory
import de.tum.`in`.tumcampusapp.di.injector
Expand Down Expand Up @@ -85,7 +87,15 @@ class CafeteriaDetailsSectionFragment : Fragment() {
menusRecyclerView.layoutManager = LinearLayoutManager(requireContext())
menusRecyclerView.itemAnimator = DefaultItemAnimator()

val adapter = CafeteriaMenusAdapter(requireContext(), true, null)
val adapter = CafeteriaMenusAdapter(requireContext(), true
) {
val nextFrag = ShowCafeteriaRatingsFragment()

requireActivity().supportFragmentManager.beginTransaction()
.replace(R.id.contentFrame, nextFrag, "cafeteriaRating")
.addToBackStack(null)
.commit()
}
menusRecyclerView.adapter = adapter

cafeteriaViewModel.cafeteriaMenus.observe(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package de.tum.`in`.tumcampusapp.component.ui.cafeteria.details
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import androidx.fragment.app.Fragment
import de.tum.`in`.tumcampusapp.R
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.CafeteriaMenuFormatter
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.FavoriteDishDao
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.model.CafeteriaMenu
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.model.FavoriteDish
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.rating.CreateCafeteriaRatingFragment
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat

Expand All @@ -32,7 +34,16 @@ sealed class CafeteriaMenuAdapterItem {
val headerTextView = findViewById<TextView>(R.id.headerTextView)

headerTextView.text = menu.typeLong.replace("[0-9]", "").trim()
setOnClickListener { listener?.invoke() }
setOnClickListener {
listener?.invoke()
/* val nextFrag = CreateCafeteriaRatingFragment()
val help= it.context
(context as Fragment).requireActivity().supportFragmentManager.beginTransaction()
.replace(R.id.contentFrame, nextFrag, "cafeteriaRating")
.addToBackStack(null)
.commit()*/
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package de.tum.`in`.tumcampusapp.component.ui.cafeteria.details

import android.content.Context
import android.content.Intent
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import de.tum.`in`.tumcampusapp.R
Expand Down Expand Up @@ -48,10 +51,10 @@ class CafeteriaMenusAdapter(

fun update(menus: List<CafeteriaMenu>) {
val newItems = menus
.filter(this::shouldShowMenu)
.splitOnChanged { it.typeLong }
.map(this::createAdapterItemsForSection)
.flatten()
.filter(this::shouldShowMenu)
.splitOnChanged { it.typeLong }
.map(this::createAdapterItemsForSection)
.flatten()

val diffResult = DiffUtil.calculateDiff(DiffUtilCallback(adapterItems, newItems))

Expand All @@ -63,9 +66,9 @@ class CafeteriaMenusAdapter(

private fun shouldShowMenu(menu: CafeteriaMenu): Boolean {
val shouldShowMenuType = Utils.getSettingBool(
context,
"card_cafeteria_${menu.typeShort}",
"tg" == menu.typeShort || "ae" == menu.typeShort
context,
"card_cafeteria_${menu.typeShort}",
"tg" == menu.typeShort || "ae" == menu.typeShort
)
return shouldShowMenuType || isBigLayout
}
Expand All @@ -90,7 +93,15 @@ class CafeteriaMenusAdapter(
}
}

class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView)
class ViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
init {
itemView.setBackgroundColor(0x80808)
itemView.setOnClickListener({
// itemView.findViewById<TextView>(R.id.nameTextView).text = "clicked"
Log.d("help", "test: ")
})
}
}

private class DiffUtilCallback(
private val oldItems: List<CafeteriaMenuAdapterItem>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ import de.tum.`in`.tumcampusapp.component.ui.cafeteria.controller.CafeteriaManag
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.details.CafeteriaDetailsSectionsPagerAdapter
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.details.CafeteriaViewModel
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.model.Cafeteria
import de.tum.`in`.tumcampusapp.component.ui.cafeteria.rating.CreateCafeteriaRatingFragment
import de.tum.`in`.tumcampusapp.databinding.FragmentCafeteriaBinding
import de.tum.`in`.tumcampusapp.di.ViewModelFactory
import de.tum.`in`.tumcampusapp.di.injector
import de.tum.`in`.tumcampusapp.service.DownloadWorker
import de.tum.`in`.tumcampusapp.utils.Const
import de.tum.`in`.tumcampusapp.utils.Utils
import de.tum.`in`.tumcampusapp.utils.observeNonNull
import org.jetbrains.anko.sdk27.coroutines.onClick
import org.joda.time.DateTime
import javax.inject.Inject
import javax.inject.Provider
Expand Down Expand Up @@ -84,6 +86,14 @@ class CafeteriaFragment : FragmentForDownloadingExternal(
binding.spinnerToolbar.adapter = adapter
binding.spinnerToolbar.onItemSelectedListener = this

binding.floatingActionButton.onClick {
val nextFrag = CreateCafeteriaRatingFragment()
requireActivity().supportFragmentManager.beginTransaction()
.replace(R.id.contentFrame, nextFrag, "cafeteriaRating")
.addToBackStack(null)
.commit()
}

cafeteriaViewModel.cafeterias.observeNonNull(this) { updateCafeterias(it) }
cafeteriaViewModel.selectedCafeteria.observeNonNull(this) { onNewCafeteriaSelected(it) }
cafeteriaViewModel.menuDates.observeNonNull(this) { updateSectionsPagerAdapter(it) }
Expand Down
Loading

0 comments on commit 4064abf

Please sign in to comment.