Skip to content

Commit

Permalink
Revert "Several development and improvements"
Browse files Browse the repository at this point in the history
This reverts commit ae0d179.
  • Loading branch information
koenidv committed Nov 15, 2023
1 parent f81a60c commit 0d80dfa
Show file tree
Hide file tree
Showing 38 changed files with 57 additions and 1,393 deletions.
42 changes: 6 additions & 36 deletions app/src/main/java/de/koenidv/sph/adapters/LessonsAdapter.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package de.koenidv.sph.adapters

import android.graphics.BlendMode
import android.graphics.BlendModeColorFilter
import android.graphics.PorterDuff
import android.graphics.*
import android.graphics.drawable.StateListDrawable
import android.os.Build
import android.text.Html
Expand Down Expand Up @@ -69,36 +67,11 @@ class LessonsAdapter(private var dataset: List<List<TimetableEntry>>,
}
}

// In case of exam => Set red triangle flag " \uD83D\uDEA9"
val schedules = SchedulesDb.getSchedWithStartDate(dat)//Exam tdy?
var exam = false
if (schedules.isNotEmpty()) {
for (entries1 in schedules) {
if ((entries1.hr != "") && (entries1.src == "portal")) {
val hArr = entries1.hr.split("#").toMutableList()
for (h in hArr) {
try {
if (h.toInt() == (entries[0].lesson.hour/*position + 1*/)) {
exam = true
}
} catch (nfe: NumberFormatException) {
//nfe.printStackTrace()
}
}
}
}
}

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
textView.text = Html.fromHtml(title, Html.FROM_HTML_MODE_LEGACY).toString()
textView.text = Html.fromHtml(title, Html.FROM_HTML_MODE_LEGACY)
} else {
@Suppress("DEPRECATION")
textView.text = Html.fromHtml(title).toString()
}
if (exam) {
var spprtStr = textView.text
spprtStr = "$spprtStr \uD83D\uDEA9"//red triangle flag
textView.text = spprtStr
textView.text = Html.fromHtml(title)
}

/*
Expand All @@ -108,8 +81,7 @@ class LessonsAdapter(private var dataset: List<List<TimetableEntry>>,
// Set size
// Enlarge to show rooms
// Or span multiple hours if consecutive lessons are the same
val height =
if (expanded && !multiple) 64f else if (multiple) maxConcurrent * 32f else 32f
val height = if (expanded && !multiple) 64f else if (multiple) maxConcurrent * 32f else 32f
val extrapadding = (hourcount - 1) * 4f
layout.layoutParams.height = Utility.dpToPx(hourcount * height + extrapadding).toInt()

Expand Down Expand Up @@ -186,9 +158,7 @@ class LessonsAdapter(private var dataset: List<List<TimetableEntry>>,
viewHolder.bind(dataset[position], hourcount, expanded, multiple, maxConcurrent)

} else if (!dataset.getOrNull(position).isNullOrEmpty()
&& (dataset[position][0].lesson.isDisplayed == true)
//&& ((dataset[position][0].lesson.day + 2) == c.get(Calendar.DAY_OF_WEEK) ) /* MON := 0, ... VS. SUN := 1, MON := 2, ... */
) {
&& dataset[position][0].lesson.isDisplayed == true) {
// Lesson is already displayed, hide completely
viewHolder.outerlayout.visibility = View.GONE
} else {
Expand All @@ -213,7 +183,7 @@ class LessonsAdapter(private var dataset: List<List<TimetableEntry>>,
notifyDataSetChanged()
}

fun setDataAndMultiple(nwDt: Date, newDataset: List<List<TimetableEntry>>, expanded: Boolean, multiple: Boolean, maxConcurrent: Int) {
fun setDataAndMultiple(newDataset: List<List<TimetableEntry>>, multiple: Boolean, maxConcurrent: Int) {
this.dataset = newDataset
this.multiple = multiple
this.maxConcurrent = maxConcurrent
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/de/koenidv/sph/adapters/PostsAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ class PostsAdapter(private val posts: List<Post>,
constraintSet.applyTo(layout)
} else {
// Set up file attachments recycler
attachmentsRecycler.setHasFixedSize(true) // changing the contents of the adapter does not change it's height or the width.
attachmentsRecycler.setRecycledViewPool(attachmentsViewPool)//put recycler views in the pool with same structure
attachmentsRecycler.setHasFixedSize(true)
attachmentsRecycler.setRecycledViewPool(attachmentsViewPool)
// Add a pagerSnapHelper for nice scrolling with many attachments
if (attachmentsRecycler.onFlingListener == null)
PagerSnapHelper().attachToRecyclerView(attachmentsRecycler)
Expand Down
154 changes: 0 additions & 154 deletions app/src/main/java/de/koenidv/sph/adapters/SchedulesAdapter.kt

This file was deleted.

15 changes: 1 addition & 14 deletions app/src/main/java/de/koenidv/sph/database/DatabaseHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import de.koenidv.sph.SphPlanner;

// Created by R-Theis on 8.12.2020.
// Adapted StKl
public class DatabaseHelper extends SQLiteOpenHelper {

// todo close db on exit
Expand Down Expand Up @@ -42,10 +41,6 @@ public void onCreate(SQLiteDatabase db) {
* Create tables
*/

// Create schedules table
db.execSQL("CREATE TABLE schedules(nameS TEXT UNIQUE PRIMARY KEY, startS INTEGER," +
" endeS INTEGER, hourS TEXT, durationS INTEGER, textS TEXT," +
" courseS TEXT, categoryS TEXT, sourceS TEXT, shareS INTEGER, locationS TEXT, respS TEXT)");
// Create courses table
db.execSQL("CREATE TABLE courses(course_id TEXT UNIQUE PRIMARY KEY, gmb_id TEXT," +
" sph_id TEXT UNIQUE, named_id TEXT, number_id TEXT UNIQUE, fullname TEXT," +
Expand Down Expand Up @@ -101,15 +96,7 @@ public void onUpgrade(SQLiteDatabase db, int oldversion, int newversion) {
db.execSQL("CREATE TABLE holidays(id TEXT PRIMARY KEY, start INTEGER," +
"endtime INTEGER, name TEXT, year TEXT)");
}
if (oldversion < 5) {
createMessagesTables(db);
// Create schedules table
db.execSQL("CREATE TABLE schedules(nameS TEXT UNIQUE PRIMARY KEY, startS INTEGER," +
" endeS INTEGER, hourS TEXT, durationS INTEGER, textS TEXT," +
" courseS TEXT, categoryS TEXT, sourceS TEXT, shareS INTEGER, locationS TEXT, respS TEXT)");
// Create timebar table
db.execSQL("CREATE TABLE timebar(someinfo TEXT)");
}
if (oldversion < 5) createMessagesTables(db);
}

// Create conversations and messages tables
Expand Down
Loading

0 comments on commit 0d80dfa

Please sign in to comment.