Archived
shrinkResources now enabled; debugSymbolLevel set to SYMBOL_TABLE; StwParser.kt now fetches news from the top of the website, if any are available; fixed a bug that would cut off shadows from the largest FAB in CanteenFragment.kt
This commit is contained in:
+4
-3
@@ -12,8 +12,8 @@ android {
|
||||
applicationId "com.denizk0461.weserplaner"
|
||||
minSdk 24
|
||||
targetSdk 33
|
||||
versionCode 3
|
||||
versionName "1.0.0"
|
||||
versionCode 4
|
||||
versionName "1.0.1"
|
||||
|
||||
resourceConfigurations += ["en", "de"]
|
||||
|
||||
@@ -25,11 +25,12 @@ android {
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled true
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
signingConfig signingConfigs.debug
|
||||
|
||||
ndk {
|
||||
debugSymbolLevel 'FULL'
|
||||
debugSymbolLevel 'SYMBOL_TABLE'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import kotlinx.coroutines.withContext
|
||||
import org.jsoup.Jsoup
|
||||
import org.jsoup.nodes.Element
|
||||
import org.jsoup.select.Elements
|
||||
import java.io.IOException
|
||||
import kotlin.jvm.Throws
|
||||
|
||||
/**
|
||||
@@ -156,12 +157,22 @@ class StwParser(application: Application) {
|
||||
// Trim off excess line breaks
|
||||
openingHours = openingHours.trim()
|
||||
|
||||
// Fetch news displayed at the top of the page, if any are available
|
||||
val news = try {
|
||||
doc.getElementsByClass("field__items")[0]
|
||||
.getElementsByTag("p")[0]
|
||||
.text()
|
||||
} catch (e: IOException) {
|
||||
""
|
||||
}
|
||||
|
||||
// Save the canteen to its list
|
||||
canteens.add(
|
||||
OfferCanteen(
|
||||
canteenId,
|
||||
doc.getElementsByClass("pane-title")[1].text(),
|
||||
openingHours,
|
||||
news,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import android.content.Context
|
||||
import androidx.room.Database
|
||||
import androidx.room.Room
|
||||
import androidx.room.RoomDatabase
|
||||
import androidx.room.migration.Migration
|
||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||
import com.denizk0461.weserplaner.model.*
|
||||
|
||||
/**
|
||||
@@ -17,7 +19,7 @@ import com.denizk0461.weserplaner.model.*
|
||||
OfferCategory::class,
|
||||
OfferItem::class,
|
||||
],
|
||||
version = 19,
|
||||
version = 20,
|
||||
)
|
||||
abstract class AppDatabase : RoomDatabase() {
|
||||
|
||||
@@ -43,15 +45,29 @@ abstract class AppDatabase : RoomDatabase() {
|
||||
*/
|
||||
if (instance == null) {
|
||||
synchronized(AppDatabase::class) {
|
||||
instance = Room.databaseBuilder(
|
||||
context.applicationContext,
|
||||
AppDatabase::class.java,
|
||||
"event_db"
|
||||
).fallbackToDestructiveMigration().build()
|
||||
instance = Room
|
||||
.databaseBuilder(
|
||||
context.applicationContext,
|
||||
AppDatabase::class.java,
|
||||
"event_db",
|
||||
).addMigrations(migrationAddNewsToOfferCanteen_19_20)
|
||||
.fallbackToDestructiveMigration()
|
||||
.build()
|
||||
}
|
||||
}
|
||||
// Instance can never be null at this point
|
||||
return instance!!
|
||||
}
|
||||
|
||||
// - migrations - //
|
||||
|
||||
/**
|
||||
* Adds the column 'news' to the data object [OfferCanteen].
|
||||
*/
|
||||
private val migrationAddNewsToOfferCanteen_19_20 = object : Migration(19, 20) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL("ALTER TABLE offer_canteen ADD COLUMN news TEXT NOT NULL DEFAULT ''")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import androidx.room.PrimaryKey
|
||||
* @param id primary key that uniquely identifies the item
|
||||
* @param canteen name of the canteen
|
||||
* @param openingHours opening hours of the canteen
|
||||
* @param news news about the canteen
|
||||
*/
|
||||
@Entity(
|
||||
tableName = "offer_canteen",
|
||||
@@ -17,4 +18,5 @@ data class OfferCanteen(
|
||||
@PrimaryKey val id: Int,
|
||||
val canteen: String,
|
||||
val openingHours: String,
|
||||
val news: String,
|
||||
)
|
||||
@@ -212,8 +212,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_marginEnd="@dimen/fab_margin"
|
||||
android:layout_marginBottom="@dimen/fab_margin"
|
||||
app:layout_behavior="com.google.android.material.behavior.HideBottomViewOnScrollBehavior">
|
||||
|
||||
<com.google.android.material.floatingactionbutton.FloatingActionButton
|
||||
@@ -246,6 +244,8 @@
|
||||
app:srcCompat="@drawable/refresh"
|
||||
android:contentDescription="@string/canteen_fab_refresh_content_desc"
|
||||
android:tooltipText="@string/canteen_fab_refresh_content_desc"
|
||||
android:layout_marginHorizontal="@dimen/fab_margin"
|
||||
android:layout_marginBottom="@dimen/fab_margin"
|
||||
tools:ignore="UnusedAttribute"/>
|
||||
|
||||
</androidx.appcompat.widget.LinearLayoutCompat>
|
||||
|
||||
Reference in New Issue
Block a user