Archived
Visual bugfixes: first time screen now shows status bar icons in dark mode, long names now don't cut off anymore in toolbar, status bar colour corrected on some devices. First time screen hides dark mode toggle and defaults to "conform to system setting" on Android 10 and above
This commit is contained in:
+5
-5
@@ -10,8 +10,8 @@ android {
|
||||
applicationId "com.denizd.substitutionplan"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 28
|
||||
versionCode 32
|
||||
versionName "2.2.9"
|
||||
versionCode 33
|
||||
versionName "2.2.10"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
@@ -25,11 +25,11 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0-rc1'
|
||||
implementation 'androidx.appcompat:appcompat:1.1.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta03'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha09'
|
||||
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta04'
|
||||
implementation 'com.google.android.material:material:1.1.0-alpha10'
|
||||
implementation 'com.android.support:customtabs:28.0.0'
|
||||
|
||||
implementation 'com.google.firebase:firebase-core:17.1.0'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.denizd.substitutionplan.activities
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.SharedPreferences
|
||||
@@ -35,38 +36,24 @@ internal class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val window = this.window
|
||||
|
||||
when (AppCompatDelegate.getDefaultNightMode()) {
|
||||
AppCompatDelegate.MODE_NIGHT_NO, AppCompatDelegate.MODE_NIGHT_UNSPECIFIED -> {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||
window.statusBarColor = ContextCompat.getColor(this,
|
||||
R.color.colorBackground
|
||||
)
|
||||
window.navigationBarColor = ContextCompat.getColor(this,
|
||||
R.color.colorBackground
|
||||
)
|
||||
} else {
|
||||
window.statusBarColor = ContextCompat.getColor(this,
|
||||
R.color.legacyBlack
|
||||
)
|
||||
window.navigationBarColor = ContextCompat.getColor(this,
|
||||
R.color.legacyBlack
|
||||
)
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
window.navigationBarColor = ContextCompat.getColor(this,
|
||||
R.color.colorBackground
|
||||
)
|
||||
window.statusBarColor = ContextCompat.getColor(this,
|
||||
R.color.colorBackground
|
||||
)
|
||||
// window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
context = this
|
||||
|
||||
val barColour = when {
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.M -> ContextCompat.getColor(context, R.color.legacyBlack)
|
||||
Build.VERSION.SDK_INT <= Build.VERSION_CODES.P -> ContextCompat.getColor(context, R.color.colorBackground)
|
||||
else -> 0
|
||||
}
|
||||
if (barColour != 0) {
|
||||
window.navigationBarColor = barColour
|
||||
window.statusBarColor = barColour
|
||||
}
|
||||
if (AppCompatDelegate.getDefaultNightMode() == AppCompatDelegate.MODE_NIGHT_NO) {
|
||||
if (Build.VERSION.SDK_INT in 23..28) {
|
||||
@SuppressLint("InlinedApi")
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||
}
|
||||
}
|
||||
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(context) as SharedPreferences
|
||||
val edit = prefs.edit()
|
||||
val fab = findViewById<ExtendedFloatingActionButton>(R.id.efab)
|
||||
@@ -81,6 +68,10 @@ internal class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
||||
val helpCourses = findViewById<ImageButton>(R.id.chipHelpCourses)
|
||||
val greeting = findViewById<CheckBox>(R.id.cbGreetings)
|
||||
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
|
||||
dark.visibility = View.GONE
|
||||
}
|
||||
|
||||
helpClasses.setOnClickListener {
|
||||
createDialog(getString(R.string.enterGradeHelpTitle), getString(
|
||||
R.string.enterGradeHelp
|
||||
@@ -94,23 +85,6 @@ internal class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
||||
|
||||
val inflater = this.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
|
||||
// findViewById<MaterialButton>(R.id.btnRestoreFromFile).setOnClickListener {
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// requestPermissions(arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), 42)
|
||||
// }
|
||||
// HelperFunctions.readPrefsFromXml(prefs)
|
||||
// name.setText(prefs.getString("username", ""))
|
||||
// grade.setText(prefs.getString("classes", ""))
|
||||
// courses.setText(prefs.getString("courses", ""))
|
||||
// notif.isChecked = prefs.getBoolean("notif", false)
|
||||
// dark.isChecked = when (prefs.getInt("themeInt", 0)) {
|
||||
// 0 -> true
|
||||
// else -> false
|
||||
// }
|
||||
// greeting.isChecked = prefs.getBoolean("greeting", false)
|
||||
// pers.isChecked = prefs.getBoolean("defaultPersonalised", false)
|
||||
// }
|
||||
|
||||
fab.setOnClickListener {
|
||||
fab.isClickable = false
|
||||
|
||||
@@ -118,11 +92,16 @@ internal class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
||||
.putString("username", name.text.toString())
|
||||
.putString("classes", grade.text.toString())
|
||||
.putString("courses", courses.text.toString())
|
||||
if (dark.isChecked) {
|
||||
edit.putInt("themeInt", 1)
|
||||
val themeInt = if (Build.VERSION.SDK_INT > Build.VERSION_CODES.P) {
|
||||
2
|
||||
} else {
|
||||
edit.putInt("themeInt", 0)
|
||||
if (dark.isChecked) {
|
||||
1
|
||||
} else {
|
||||
0
|
||||
}
|
||||
}
|
||||
edit.putInt("themeInt", themeInt)
|
||||
edit.putBoolean("notif", notif.isChecked)
|
||||
.putBoolean("greeting", greeting.isChecked)
|
||||
.putBoolean("defaultPersonalised", pers.isChecked)
|
||||
@@ -146,7 +125,7 @@ internal class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
|
||||
val colour = findViewById<LinearLayout>(R.id.colourLayout)
|
||||
linearInflation.visibility = View.VISIBLE
|
||||
anim.start()
|
||||
fab.hide(true)
|
||||
fab.hide()
|
||||
|
||||
handler.postDelayed({
|
||||
colour.startAnimation(animOut)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.denizd.substitutionplan.activities
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.job.JobInfo
|
||||
import android.app.job.JobScheduler
|
||||
import android.content.ComponentName
|
||||
@@ -31,7 +32,6 @@ import com.google.android.material.appbar.AppBarLayout
|
||||
import com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
import com.google.android.material.snackbar.Snackbar
|
||||
import com.google.firebase.FirebaseApp
|
||||
import com.jaredrummler.android.device.DeviceName
|
||||
import java.lang.IllegalArgumentException
|
||||
import java.util.*
|
||||
|
||||
@@ -73,21 +73,22 @@ internal class Main : AppCompatActivity(R.layout.app_bar_main) {
|
||||
|
||||
setTheme(R.style.AppTheme0)
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
||||
window.statusBarColor = ContextCompat.getColor(this,
|
||||
R.color.legacyBlack
|
||||
)
|
||||
window.navigationBarColor = ContextCompat.getColor(this,
|
||||
R.color.legacyBlack
|
||||
)
|
||||
val barColour = when {
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.M -> ContextCompat.getColor(context, R.color.legacyBlack)
|
||||
Build.VERSION.SDK_INT <= Build.VERSION_CODES.P -> ContextCompat.getColor(context, R.color.colorBackground)
|
||||
else -> 0
|
||||
}
|
||||
if (barColour != 0) {
|
||||
window.navigationBarColor = barColour
|
||||
window.statusBarColor = barColour
|
||||
}
|
||||
|
||||
when (prefs.getInt("themeInt", 0)) {
|
||||
0 -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
|
||||
if (Build.VERSION.SDK_INT in 23..28) {
|
||||
@SuppressLint("InlinedApi")
|
||||
window.decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
|
||||
window.navigationBarColor = ContextCompat.getColor(context, R.color.colorBackground)
|
||||
}
|
||||
}
|
||||
2 -> {
|
||||
@@ -95,9 +96,6 @@ internal class Main : AppCompatActivity(R.layout.app_bar_main) {
|
||||
}
|
||||
else -> {
|
||||
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES)
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.P) {
|
||||
window.navigationBarColor = ContextCompat.getColor(context, R.color.colorBackground)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,24 +105,6 @@ internal class Main : AppCompatActivity(R.layout.app_bar_main) {
|
||||
} catch (e: IllegalArgumentException) {}
|
||||
}
|
||||
|
||||
if (prefs.getBoolean("huaweiDeviceDialog", true)) {
|
||||
DeviceName.with(context).request { info, _ ->
|
||||
if (info.manufacturer.contains("Huawei") ||
|
||||
info.manufacturer.contains("Honor") ||
|
||||
info.manufacturer.contains("Xiaomi")) {
|
||||
val alertDialog = AlertDialog.Builder(context, R.style.AlertDialog)
|
||||
val dialogView = LayoutInflater.from(context).inflate(R.layout.secret_dialog, null)
|
||||
val title = dialogView.findViewById<TextView>(R.id.textviewtitle)
|
||||
title.text = getString(R.string.chineseDevicesTitle)
|
||||
val dialogText = dialogView.findViewById<TextView>(R.id.dialogtext)
|
||||
dialogText.text = getString(R.string.chineseDevicesHelp)
|
||||
alertDialog.setView(dialogView).show()
|
||||
|
||||
edit.putBoolean("huaweiDeviceDialog", false).apply()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val textViewGreeting = findViewById<TextView>(R.id.text_greeting)
|
||||
if (prefs.getBoolean("greeting", true)) {
|
||||
if ((prefs.getString("username", "") ?: "").isNotEmpty()) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.denizd.substitutionplan.adapters
|
||||
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.preference.PreferenceManager
|
||||
import android.text.SpannableString
|
||||
import android.text.style.StrikethroughSpan
|
||||
import android.view.LayoutInflater
|
||||
@@ -20,7 +20,7 @@ import com.denizd.substitutionplan.models.Subst
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
import java.util.*
|
||||
|
||||
internal class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapter<CardAdapter.CardViewHolder>() {
|
||||
internal class CardAdapter(private var mSubst: List<Subst>, private val prefs: SharedPreferences) : RecyclerView.Adapter<CardAdapter.CardViewHolder>() {
|
||||
|
||||
private var colour = 0
|
||||
private var colourString = ""
|
||||
@@ -28,25 +28,25 @@ internal class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapt
|
||||
|
||||
class CardViewHolder(view: View) : RecyclerView.ViewHolder(view), View.OnClickListener {
|
||||
|
||||
var mImageView: ImageView = view.findViewById(R.id.iconView)
|
||||
var mGroup: TextView = view.findViewById(R.id.group)
|
||||
var mDate: TextView = view.findViewById(R.id.date)
|
||||
var mTime: TextView = view.findViewById(R.id.time)
|
||||
var mCourse: TextView = view.findViewById(R.id.course)
|
||||
var mRoom: TextView = view.findViewById(R.id.room)
|
||||
var mAdditional: TextView = view.findViewById(R.id.additional)
|
||||
var spacer: TextView = view.findViewById(R.id.spacer)
|
||||
var iconView: ImageView = view.findViewById(R.id.iconView)
|
||||
var group: TextView = view.findViewById(R.id.group)
|
||||
var date: TextView = view.findViewById(R.id.date)
|
||||
var time: TextView = view.findViewById(R.id.time)
|
||||
var course: TextView = view.findViewById(R.id.course)
|
||||
var room: TextView = view.findViewById(R.id.room)
|
||||
var additional: TextView = view.findViewById(R.id.additional)
|
||||
var teacher: TextView = view.findViewById(R.id.teacher)
|
||||
var spacer: TextView = view.findViewById(R.id.spacer)
|
||||
|
||||
var mCard: MaterialCardView = view.findViewById(R.id.planCard)
|
||||
var card: MaterialCardView = view.findViewById(R.id.planCard)
|
||||
init { view.setOnClickListener(this) }
|
||||
override fun onClick(v: View?) {
|
||||
if (mDate.text.toString().length > 7 && mDate.text.toString().substring(3, 7) == "http") {
|
||||
if (date.text.toString().length > 7 && date.text.toString().substring(3, 7) == "http") {
|
||||
try {
|
||||
CustomTabsIntent.Builder().build().launchUrl(mCard.context,
|
||||
Uri.parse(mDate.text.toString().substring(3)))
|
||||
CustomTabsIntent.Builder().build().launchUrl(card.context,
|
||||
Uri.parse(date.text.toString().substring(3)))
|
||||
} catch (e: ActivityNotFoundException) {
|
||||
Toast.makeText(mCard.context, mCard.context.getString(R.string.chromeCompatibleNotFound), Toast.LENGTH_LONG).show()
|
||||
Toast.makeText(card.context, card.context.getString(R.string.chromeCompatibleNotFound), Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,70 +59,60 @@ internal class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapt
|
||||
|
||||
override fun onBindViewHolder(holder: CardViewHolder, position: Int) {
|
||||
val currentItem = mSubst[position]
|
||||
val prefs = PreferenceManager.getDefaultSharedPreferences(holder.mImageView.context)
|
||||
var psa = false
|
||||
val strings = arrayOf(SpannableString(currentItem.group), SpannableString(currentItem.time),
|
||||
SpannableString(currentItem.course), SpannableString(currentItem.room), SpannableString(currentItem.teacher))
|
||||
for (item in strings) {
|
||||
val qmark = item.indexOf("?")
|
||||
if (qmark != -1) {
|
||||
item.setSpan(StrikethroughSpan(), 0, qmark, 0)
|
||||
var cardBackgroundColour = 0
|
||||
|
||||
for (string in strings) {
|
||||
val questionMarkIndex = string.indexOf("?")
|
||||
if (questionMarkIndex != -1) {
|
||||
string.setSpan(StrikethroughSpan(), 0, questionMarkIndex, 0)
|
||||
}
|
||||
}
|
||||
with (currentItem.additional.toLowerCase(Locale.ROOT)) {
|
||||
if (contains("eigenverantwortliches arbeiten") || contains("entfall") || contains("fällt aus")) {
|
||||
strings[2].setSpan(StrikethroughSpan(), 0, strings[2].length, 0)
|
||||
strings[3].setSpan(StrikethroughSpan(), 0, strings[3].length, 0)
|
||||
strings[4].setSpan(StrikethroughSpan(), 0, strings[4].length, 0)
|
||||
for (i in 2..4) { strings[i].setSpan(StrikethroughSpan(), 0, strings[i].length, 0) }
|
||||
}
|
||||
}
|
||||
|
||||
holder.mImageView.setImageResource(HelperFunctions.getIconForCourse(currentItem.course))
|
||||
holder.mGroup.setText(strings[0], TextView.BufferType.SPANNABLE)
|
||||
holder.mTime.setText(strings[1], TextView.BufferType.SPANNABLE)
|
||||
holder.mCourse.setText(strings[2], TextView.BufferType.SPANNABLE)
|
||||
holder.mRoom.setText(strings[3], TextView.BufferType.SPANNABLE)
|
||||
var icon = HelperFunctions.getIconForCourse(currentItem.course)
|
||||
holder.group.setText(strings[0], TextView.BufferType.SPANNABLE)
|
||||
holder.time.setText(strings[1], TextView.BufferType.SPANNABLE)
|
||||
holder.course.setText(strings[2], TextView.BufferType.SPANNABLE)
|
||||
holder.room.setText(strings[3], TextView.BufferType.SPANNABLE)
|
||||
holder.teacher.setText(strings[4], TextView.BufferType.SPANNABLE)
|
||||
holder.mAdditional.text = currentItem.additional
|
||||
holder.additional.text = currentItem.additional
|
||||
|
||||
if (currentItem.date.isNotEmpty() && currentItem.date.substring(0, 3) == "psa") {
|
||||
holder.date.visibility = if (currentItem.date.isNotEmpty() && currentItem.date.substring(0, 3) == "psa") {
|
||||
psa = true
|
||||
holder.mDate.visibility = View.GONE
|
||||
holder.mDate.text = currentItem.date
|
||||
holder.mTime.text = " "
|
||||
holder.mImageView.setImageResource(R.drawable.ic_idea)
|
||||
holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mImageView.context,
|
||||
R.color.colorAccent
|
||||
))
|
||||
holder.time.text = " "
|
||||
icon = R.drawable.ic_idea
|
||||
cardBackgroundColour = R.color.colorAccent
|
||||
View.GONE
|
||||
} else {
|
||||
holder.mDate.visibility = View.VISIBLE
|
||||
holder.mDate.text = currentItem.date
|
||||
}
|
||||
|
||||
if (!psa) {
|
||||
colourString = getColourString(holder.mCourse.text.toString())
|
||||
colourString = getColourString(holder.course.text.toString())
|
||||
val colourPrefsInt = if (colourString.isNotEmpty()) {
|
||||
prefs.getString("card$colourString", "") ?: ""
|
||||
} else {
|
||||
""
|
||||
}
|
||||
colour = HelperFunctions.getColourForString(colourPrefsInt)
|
||||
if (colour != 0) {
|
||||
holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mCourse.context, colour))
|
||||
cardBackgroundColour = if (colour != 0) {
|
||||
colour
|
||||
} else {
|
||||
holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mCourse.context,
|
||||
R.color.colorBackgroundLight
|
||||
))
|
||||
}
|
||||
View.VISIBLE
|
||||
}
|
||||
|
||||
holder.date.text = currentItem.date
|
||||
holder.spacer.visibility = if (strings[2].isEmpty() || strings[4].isEmpty()) {
|
||||
View.GONE
|
||||
} else {
|
||||
View.VISIBLE
|
||||
}
|
||||
|
||||
val textColor = ContextCompat.getColor(holder.mImageView.context, if (psa) {
|
||||
val textColor = ContextCompat.getColor(holder.iconView.context, if (psa) {
|
||||
R.color.colorBackground
|
||||
} else {
|
||||
when (colour) {
|
||||
@@ -131,13 +121,15 @@ internal class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapt
|
||||
else -> R.color.colorText
|
||||
}
|
||||
})
|
||||
holder.mImageView.setColorFilter(textColor)
|
||||
holder.mGroup.setTextColor(textColor)
|
||||
holder.mDate.setTextColor(textColor)
|
||||
holder.mTime.setTextColor(textColor)
|
||||
holder.mCourse.setTextColor(textColor)
|
||||
holder.mRoom.setTextColor(textColor)
|
||||
holder.mAdditional.setTextColor(textColor)
|
||||
holder.card.setCardBackgroundColor(ContextCompat.getColor(holder.iconView.context, cardBackgroundColour))
|
||||
holder.iconView.setImageResource(icon)
|
||||
holder.iconView.setColorFilter(textColor)
|
||||
holder.group.setTextColor(textColor)
|
||||
holder.date.setTextColor(textColor)
|
||||
holder.time.setTextColor(textColor)
|
||||
holder.course.setTextColor(textColor)
|
||||
holder.room.setTextColor(textColor)
|
||||
holder.additional.setTextColor(textColor)
|
||||
holder.spacer.setTextColor(textColor)
|
||||
holder.teacher.setTextColor(textColor)
|
||||
}
|
||||
|
||||
@@ -9,9 +9,7 @@ import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Color
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.app.ActivityCompat.requestPermissions
|
||||
import androidx.core.content.ContextCompat.checkSelfPermission
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
@@ -31,7 +29,8 @@ internal object HelperFunctions {
|
||||
val colourNames = arrayOf("default", "red", "orange", "yellow", "green", "teal", "cyan", "blue", "purple", "pink",
|
||||
"brown", "grey", "pureWhite", "salmon", "tangerine", "banana", "flora", "spindrift", "sky", "orchid",
|
||||
"lavender", "carnation", "brown2", "pureBlack")
|
||||
private val colourIntegers = intArrayOf(0,
|
||||
private val colourIntegers = intArrayOf(
|
||||
0,
|
||||
R.color.bgRed,
|
||||
R.color.bgOrange,
|
||||
R.color.bgYellow,
|
||||
@@ -250,7 +249,6 @@ internal object HelperFunctions {
|
||||
for (i in localPrefTypes.indices) {
|
||||
val key = document.getElementsByTagName("key").item(i).textContent
|
||||
val value = document.getElementsByTagName("value").item(i).textContent
|
||||
Log.d("VALUES", "$key $value")
|
||||
setPrefValue(prefs, key, value, localPrefTypes[i])
|
||||
}
|
||||
Toast.makeText(context, context.getString(R.string.success), Toast.LENGTH_LONG).show()
|
||||
|
||||
@@ -19,8 +19,7 @@ internal abstract class SubstDatabase : RoomDatabase() {
|
||||
private var instance: SubstDatabase? = null
|
||||
private val addTeacherColumn = object : Migration(5, 6) {
|
||||
override fun migrate(database: SupportSQLiteDatabase) {
|
||||
database.execSQL(
|
||||
"ALTER TABLE subst_table ADD COLUMN teacher TEXT NOT NULL DEFAULT ''")
|
||||
database.execSQL("ALTER TABLE subst_table ADD COLUMN teacher TEXT NOT NULL DEFAULT ''")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ internal open class PlanFragment : Fragment(R.layout.plan) {
|
||||
layoutManager = GridLayoutManager(mContext, getGridColumnCount(resources.configuration))
|
||||
recyclerView.layoutManager = layoutManager
|
||||
|
||||
mAdapter = CardAdapter(planCardList)
|
||||
mAdapter = CardAdapter(planCardList, prefs)
|
||||
recyclerView.adapter = mAdapter
|
||||
|
||||
if (prefs.getInt("firstTimeOpening", 0) == 1) {
|
||||
|
||||
@@ -45,9 +45,6 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
|
||||
ColourAdapter.OnClickListener,
|
||||
RingtoneAdapter.OnClickListener {
|
||||
|
||||
private var name = ""
|
||||
private var model = ""
|
||||
|
||||
private lateinit var mContext: Context
|
||||
private lateinit var prefs: SharedPreferences
|
||||
private lateinit var edit: SharedPreferences.Editor
|
||||
@@ -490,11 +487,6 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
|
||||
}
|
||||
|
||||
private fun debugMenu(): Boolean {
|
||||
DeviceName.with(mContext).request { deviceInfo, _ ->
|
||||
name = deviceInfo.marketName
|
||||
model = deviceInfo.model
|
||||
}
|
||||
|
||||
val alertDialog = AlertDialog.Builder(mContext,
|
||||
R.style.AlertDialog
|
||||
)
|
||||
@@ -593,8 +585,8 @@ internal class SettingsFragment : Fragment(R.layout.content_settings), View.OnCl
|
||||
return "First Launch: ${prefs.getString("firstTimeDev", "")}" +
|
||||
"\n\nApp launched: ${prefs.getInt("launchDev", 0)}" +
|
||||
"\n\nFirebase ping service fired: ${prefs.getInt("pingFB", 0)}" +
|
||||
"\n\nDevice Name: $name" +
|
||||
"\n\nDevice Model: $model" +
|
||||
"\n\nDevice Name: ${Build.DEVICE}" +
|
||||
"\n\nDevice Model: ${Build.MODEL}" +
|
||||
"\n\nAndroid Version: ${Build.VERSION.RELEASE}" +
|
||||
"\n\nSubscribed to notification channel: ${prefs.getBoolean("notif", false)}" +
|
||||
"\n\nSubscribed to dev channel: ${prefs.getBoolean("subscribedToFBDebugChannel", false)}"
|
||||
|
||||
@@ -19,14 +19,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layoutAnimation="@anim/layout_animation_fall_down">
|
||||
|
||||
<!-- <LinearLayout-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="0dp"-->
|
||||
<!-- android:focusable="true"-->
|
||||
<!-- android:focusableInTouchMode="true"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent" />-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtWelcome"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -223,83 +215,56 @@
|
||||
app:layout_constraintStart_toStartOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtLayoutCourses" />
|
||||
|
||||
<LinearLayout android:id="@+id/checkBoxLinearLayout"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="64dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtMore"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbGreetings"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/enableGreeting"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/colorText"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintStart_toStartOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtMore" />
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbDark"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/enableDarkMode"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/colorText"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintStart_toStartOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cbGreetings" />
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbNotif"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/notificationsAndSync"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/colorText"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintEnd_toEndOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintStart_toStartOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cbDark" />
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbPersonalised"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/personalised"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/colorText"
|
||||
android:textSize="14sp"
|
||||
android:layout_marginBottom="64dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintStart_toStartOf="@+id/txtLayoutClasses"
|
||||
app:layout_constraintTop_toBottomOf="@+id/cbNotif" />
|
||||
android:textSize="14sp"/>
|
||||
|
||||
<!-- <TextView-->
|
||||
<!-- android:id="@+id/txtOr"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:text="@string/or"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/cbPersonalised"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@+id/txtLayoutClasses"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@+id/txtLayoutClasses"-->
|
||||
<!-- android:gravity="start"-->
|
||||
<!-- android:layout_marginTop="16dp"-->
|
||||
<!-- android:textColor="@color/colorText"/>-->
|
||||
|
||||
<!-- <com.google.android.material.button.MaterialButton style="@style/Widget.MaterialComponents.Button.OutlinedButton"-->
|
||||
<!-- android:id="@+id/btnRestoreFromFile"-->
|
||||
<!-- android:layout_width="0dp"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- app:strokeColor="@color/colorAccent"-->
|
||||
<!-- app:strokeWidth="2dp"-->
|
||||
<!-- android:textColor="@color/colorAccent"-->
|
||||
<!-- android:text="@string/restoreFromFile"-->
|
||||
<!-- android:layout_marginBottom="64dp"-->
|
||||
<!-- android:layout_marginTop="8dp"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintTop_toBottomOf="@+id/txtOr"-->
|
||||
<!-- app:layout_constraintEnd_toEndOf="@+id/txtLayoutClasses"-->
|
||||
<!-- app:layout_constraintStart_toStartOf="@+id/txtLayoutClasses"/>-->
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -16,15 +16,29 @@
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="84dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:titleTextColor="@color/colorAccent"
|
||||
app:contentInsetStart="0dp"
|
||||
android:elevation="0dp"
|
||||
app:layout_scrollFlags="scroll|enterAlwaysCollapsed">
|
||||
|
||||
<!-- 84dp-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_greeting"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="18sp"
|
||||
android:fontFamily="@font/manrope_semibold"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/toolbarTxt"
|
||||
@@ -38,22 +52,12 @@
|
||||
android:singleLine="true"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/text_greeting"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/text_greeting"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/toolbarTxt"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginBottom="4dp"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:textSize="18sp"
|
||||
android:fontFamily="@font/manrope_semibold"/>
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -63,8 +63,6 @@
|
||||
<string name="diagnosticsMenu">Diagnosemenü</string>
|
||||
<string name="notificationsAndSync">Kursbenachrichtigungen aktivieren</string>
|
||||
<string name="noSubstitutionsForYou">Kein Entfall für dich</string>
|
||||
<string name="chineseDevicesHelp">Einige chinesische Hersteller, wie Huawei/Honor und Xiaomi, unterdrücken Hintergrund-Services, weshalb Benachrichtungen und Hintergrund-Synchronisation nicht funktionieren.\n\nIch habe feststellen müssen, dass es keine einfache Lösung dafür gibt, die ich einbauen könnte.\n\nStattdessen kannst du jedoch versuchen, App-Optimierungen für diese App zu deaktivieren:\n\nSchließe die App und öffne \"Einstellungen\" -> \"Apps\" -> \"AvH-Plan\" -> \"Akku\" -> \"App-Start\" -> \"Automatisch verwalten\" deaktivieren, \"Im Hintergrund ausführen\" aktivieren.\n\nDies kann unter Umständen keinen Einfluss haben.</string>
|
||||
<string name="chineseDevicesTitle">Informationen bezüglich deines Gerätes</string>
|
||||
<string name="customiseColoursTitle">Benutzerdefinierte Farben</string>
|
||||
<string name="customiseColoursIndividually">Farben für jedes Fach einstellen</string>
|
||||
<string name="courseDeu">Deutsch (+ DAZ)</string>
|
||||
|
||||
@@ -73,9 +73,6 @@
|
||||
<string name="invalidCode">Invalid code</string>
|
||||
<string name="noSubstitutionsForYou">No substitutions for you</string>
|
||||
|
||||
<string name="chineseDevicesTitle">Information regarding your device</string>
|
||||
<string name="chineseDevicesHelp">Some Chinese manufacturers, such as Huawei/Honor and Xiaomi, heavily suppress background services, which results in notifications and background synchronisation not working.\n\nFrom my current research, I have determined that there\'s no easy workaround I can implement.\n\nYou can, however, try to disable power optimisation for this app in the settings:\n\nClose the app and open \"Settings\" -> \"Apps\" -> \"AvH Plan\" -> \"Battery\" -> \"Launch\" -> disable \"Manage automatically\", enable \"Run in background\"\n\nThis is not guaranteed to work.</string>
|
||||
|
||||
<string name="customiseColoursTitle">Customise colours</string>
|
||||
<string name="customiseColoursIndividually">Customise every subject individually</string>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user