Browse Source

the menus text is now selectable

* fixed some formating errors at the mensa screen
pull/20/head 0.3.1
Jannik 2 years ago
parent
commit
3d7f6f961a
  1. 4
      app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt
  2. 2
      app/src/main/java/org/mosad/seil0/projectlaogai/hsoparser/MensaParser.kt
  3. 7
      app/src/main/res/layout/fragment_home.xml
  4. 3
      app/src/main/res/layout/menu_cardview.xml

4
app/src/main/java/org/mosad/seil0/projectlaogai/fragments/MensaFragment.kt

@ -84,8 +84,10 @@ class MensaFragment : Fragment() {
val menuViewMenu = MenuCardView(context!!, null)
menuViewMenu.setMenuHeading(meal.heading)
for(part in meal.parts) {
for ((i, part) in meal.parts.withIndex()) {
menuViewMenu.getTxtViewMenu().append(part)
if(i < (meal.parts.size - 2))
menuViewMenu.getTxtViewMenu().append("\n")
}
cardViewMensaDay.setDayHeading(meal.day) //TODO move this out of the first for loop, performance!!

2
app/src/main/java/org/mosad/seil0/projectlaogai/hsoparser/MensaParser.kt

@ -43,7 +43,7 @@ class MensaParser {
for (i in 0 .. (element.select("div.row h4").size - 1)) {
try {
val heading = element.select("div.row h4")[i].text()
val parts = ArrayList<String>(element.select("div.row").select("div.menu-info")[i].html().substringBefore("<span").replace("<br>", "").split("\n"))
val parts = ArrayList<String>(element.select("div.row").select("div.menu-info")[i].html().substringBefore("<span").replace("<br>", " ").split("\n"))
val additives = element.select("div.row").select("div.menu-info")[i].select("span.show-with-allergenes").text()
mealList.add(Meal(day, heading, parts, additives))

7
app/src/main/res/layout/fragment_home.xml

@ -36,13 +36,15 @@
android:textStyle="bold" android:textAlignment="center" android:textSize="16sp"
android:typeface="sans" android:fontFamily="sans-serif" android:paddingBottom="5dp"/>
<TextView
android:id="@+id/txtViewMenu1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif"
android:textAlignment="center"
android:textSize="16sp"
android:textStyle="bold"
android:typeface="sans" android:id="@+id/txtViewMenu1"/>
android:typeface="sans"
android:textIsSelectable="true"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
@ -75,7 +77,8 @@
android:textAlignment="center"
android:textSize="16sp"
android:textStyle="bold"
android:typeface="sans"/>
android:typeface="sans"
android:textIsSelectable="true"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
<ScrollView

3
app/src/main/res/layout/menu_cardview.xml

@ -35,7 +35,8 @@
android:textAlignment="center"
android:textSize="16sp"
android:textStyle="bold"
android:typeface="sans"/>
android:typeface="sans"
android:textIsSelectable="true"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
Loading…
Cancel
Save