Version 2.0.2 - card background now customisable, tablet layout changed

This commit is contained in:
Deniz Düzgören
2019-06-02 17:57:57 +02:00
parent abc3309acd
commit d4cef4f25d
23 changed files with 379 additions and 450 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ android {
applicationId "com.denizd.substitutionplan" applicationId "com.denizd.substitutionplan"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 28 targetSdkVersion 28
versionCode 12 versionCode 14
versionName "2.0.0" versionName "2.0.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
} }
buildTypes { buildTypes {
@@ -8,11 +8,12 @@ import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.card.MaterialCardView
class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapter<CardAdapter.CardViewHolder>() { class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapter<CardAdapter.CardViewHolder>() {
var colour = 0 private var colour = 0
var colorCheck = "" private var colorCheck = ""
class CardViewHolder (view: View) : RecyclerView.ViewHolder(view) { class CardViewHolder (view: View) : RecyclerView.ViewHolder(view) {
var mImageView: ImageView = itemView.findViewById(R.id.iconView) var mImageView: ImageView = itemView.findViewById(R.id.iconView)
@@ -22,10 +23,7 @@ class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapter<CardAd
var mCourse: TextView = itemView.findViewById(R.id.course) var mCourse: TextView = itemView.findViewById(R.id.course)
var mRoom: TextView = itemView.findViewById(R.id.room) var mRoom: TextView = itemView.findViewById(R.id.room)
var mAdditional: TextView = itemView.findViewById(R.id.additional) var mAdditional: TextView = itemView.findViewById(R.id.additional)
} var mCard = itemView.findViewById<MaterialCardView>(R.id.planCard)
fun CardAdapter(subst: ArrayList<Subst>) {
mSubst = subst
} }
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CardViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CardViewHolder {
@@ -35,7 +33,7 @@ class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapter<CardAd
fun getSubstAt(i: Int): Subst { fun getSubstAt(i: Int): Subst {
return mSubst[i] return mSubst[i]
} } // do I need this in Kotlin?
override fun onBindViewHolder(holder: CardViewHolder, position: Int) { override fun onBindViewHolder(holder: CardViewHolder, position: Int) {
val currentItem = mSubst[position] val currentItem = mSubst[position]
@@ -52,52 +50,51 @@ class CardAdapter(private var mSubst: List<Subst>) : RecyclerView.Adapter<CardAd
try { try {
colorCheck = holder.mCourse.text.toString().toLowerCase().substring(0, 3) colorCheck = holder.mCourse.text.toString().toLowerCase().substring(0, 3)
colour = when (colorCheck) { colour = when (colorCheck) {
"deu", "dep", "daz", "fda" -> prefs.getInt("colGerman", 0) "deu", "dep", "daz", "fda" -> prefs.getInt("bgGerman", 0)
"mat", "map" -> prefs.getInt("colMaths", 0) "mat", "map" -> prefs.getInt("bgMaths", 0)
"eng", "enp", "ena" -> prefs.getInt("colEnglish", 0) "eng", "enp", "ena" -> prefs.getInt("bgEnglish", 0)
"spo", "spp", "spth" -> prefs.getInt("colPhysEd", 0) "spo", "spp", "spth" -> prefs.getInt("bgPhysEd", 0)
"pol", "pop" -> prefs.getInt("colPolitics", 0) "pol", "pop" -> prefs.getInt("bgPolitics", 0)
"dar", "dap" -> prefs.getInt("colTheatre", 0) "dar", "dap" -> prefs.getInt("bgTheatre", 0)
"phy", "php" -> prefs.getInt("colPhysics", 0) "phy", "php" -> prefs.getInt("bgPhysics", 0)
"bio", "bip" -> prefs.getInt("colBiology", 0) "bio", "bip", "nw1", "nw2", "nw3", "nw4" -> prefs.getInt("bgBiology", 0)
"che", "chp" -> prefs.getInt("colChemistry", 0) "che", "chp" -> prefs.getInt("bgChemistry", 0)
"phi", "psp" -> prefs.getInt("colPhilosophy", 0) "phi", "psp" -> prefs.getInt("bgPhilosophy", 0)
"laa", "laf", "lat" -> prefs.getInt("colLatin", 0) "laa", "laf", "lat" -> prefs.getInt("bgLatin", 0)
"spa", "spf" -> prefs.getInt("colSpanish", 0) "spa", "spf" -> prefs.getInt("bgSpanish", 0)
"fra", "frf", "frz" -> prefs.getInt("colFrench", 0) "fra", "frf", "frz" -> prefs.getInt("bgFrench", 0)
"inf" -> prefs.getInt("colCompsci", 0) "inf" -> prefs.getInt("bgCompsci", 0)
"ges" -> prefs.getInt("colHistory", 0) "ges" -> prefs.getInt("bgHistory", 0)
"rel" -> prefs.getInt("colReligion", 0) "rel" -> prefs.getInt("bgReligion", 0)
"geg" -> prefs.getInt("colGeography", 0) "geg" -> prefs.getInt("bgGeography", 0)
"kun" -> prefs.getInt("colArts", 0) "kun" -> prefs.getInt("bgArts", 0)
"mus" -> prefs.getInt("colMusic", 0) "mus" -> prefs.getInt("bgMusic", 0)
"tue" -> prefs.getInt("colTurkish", 0) "tue" -> prefs.getInt("bgTurkish", 0)
"chi" -> prefs.getInt("colChinese", 0) "chi" -> prefs.getInt("bgChinese", 0)
"gll" -> prefs.getInt("colGLL", 0) "gll" -> prefs.getInt("bgGLL", 0)
"wat" -> prefs.getInt("colWAT", 0) "wat" -> prefs.getInt("bgWAT", 0)
"för" -> prefs.getInt("colForder", 0) "för" -> prefs.getInt("bgForder", 0)
"met" -> prefs.getInt("colWP", 0) "met", "wpb" -> prefs.getInt("bgWP", 0)
else -> 0 else -> 0
} }
} catch (e: StringIndexOutOfBoundsException) { } catch (e: StringIndexOutOfBoundsException) {
try { try {
colorCheck = holder.mCourse.text.toString().toLowerCase().substring(0, 2) colorCheck = holder.mCourse.text.toString().toLowerCase().substring(0, 2)
colour = when (colorCheck) { colour = when (colorCheck) {
"nw" -> prefs.getInt("colBiology", 0) "nw" -> prefs.getInt("bgBiology", 0)
"wp" -> prefs.getInt("colWP", 0) "wp" -> prefs.getInt("bgWP", 0)
else -> 0 else -> 0
} }
} catch (e2: StringIndexOutOfBoundsException) { } catch (e2: StringIndexOutOfBoundsException) {
colour = 0 colour = 0
} }
} finally {
if (colour == 0) {
colour = R.color.textcolor
}
} }
holder.mImageView.drawable.setTint(ContextCompat.getColor(holder.mImageView.context, colour)) if (colour != 0) {
holder.mCourse.setTextColor(ContextCompat.getColor(holder.mCourse.context, colour)) holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mCourse.context, colour))
} else {
holder.mCard.setCardBackgroundColor(ContextCompat.getColor(holder.mCourse.context, R.color.lightbackground))
}
} }
override fun getItemCount(): Int = mSubst.size override fun getItemCount(): Int = mSubst.size
@@ -38,9 +38,9 @@ class DataFetcher(isplan: Boolean, ismenu: Boolean, isjobservice: Boolean, conte
private var menu = ismenu private var menu = ismenu
/* booleans to improve performance when fetching data /* booleans to improve performance when fetching data
"plan" is required to fetch the substitution data "plan" = true is required to fetch the substitution data
"menu" is required to fetch the food menu "menu" = true is required to fetch the food menu
"jobservice" is required to send a notification "jobservice" = true is required to send a notification
"jobservice" = true has no effect unless "plan" is also true "jobservice" = true has no effect unless "plan" is also true
*/ */
@@ -77,7 +77,6 @@ class DataFetcher(isplan: Boolean, ismenu: Boolean, isjobservice: Boolean, conte
private val handler = Handler(Looper.getMainLooper()) private val handler = Handler(Looper.getMainLooper())
override fun doInBackground(vararg params: Void?): Void? { override fun doInBackground(vararg params: Void?): Void? {
try { try {
mView?.let { v: View -> mView?.let { v: View ->
pullToRefresh = v.findViewById(R.id.pullToRefresh) pullToRefresh = v.findViewById(R.id.pullToRefresh)
@@ -209,7 +208,7 @@ class DataFetcher(isplan: Boolean, ismenu: Boolean, isjobservice: Boolean, conte
val subst = Subst(drawable, groupS[i].toString(), dateS[i].toString(), timeS[i].toString(), courseS[i].toString(), val subst = Subst(drawable, groupS[i].toString(), dateS[i].toString(), timeS[i].toString(), courseS[i].toString(),
roomS[i].toString(), additionalS[i].toString(), priority) roomS[i].toString(), additionalS[i].toString(), priority)
priority-- priority--
substViewModel.insert(subst) substViewModel.insertSubst(subst)
if (jobservice) { if (jobservice) {
if (prefs.getString("courses", "").isEmpty() && prefs.getString("classes", "").isNotEmpty()) { if (prefs.getString("courses", "").isEmpty() && prefs.getString("classes", "").isNotEmpty()) {
@@ -296,9 +295,11 @@ class DataFetcher(isplan: Boolean, ismenu: Boolean, isjobservice: Boolean, conte
} }
} catch (e: NullPointerException) { } catch (e: Exception) {
mView?.let { v: View -> mView?.let { v: View ->
try {
pullToRefresh.isRefreshing = false pullToRefresh.isRefreshing = false
} catch (ignored: Exception) {}
val snackbarview = v.findViewById<View>(R.id.coordination) val snackbarview = v.findViewById<View>(R.id.coordination)
Snackbar.make(snackbarview, mContext.getText(R.string.nointernet), Snackbar.LENGTH_LONG) Snackbar.make(snackbarview, mContext.getText(R.string.nointernet), Snackbar.LENGTH_LONG)
.setAction("Action", null).show() .setAction("Action", null).show()
@@ -129,11 +129,7 @@ class FirstTime : AppCompatActivity(R.layout.activity_first_time) {
} }
private fun createDialog(title: String, text: String) { private fun createDialog(title: String, text: String) {
val alertDialog = if (prefs.getInt("themeInt", 0) == 1) { val alertDialog = AlertDialog.Builder(context, R.style.AlertDialog)
AlertDialog.Builder(context, R.style.AlertDialogCustomDark)
} else {
AlertDialog.Builder(context, R.style.AlertDialogCustomLight)
}
val dialogView = LayoutInflater.from(context).inflate(R.layout.simple_dialog, null) val dialogView = LayoutInflater.from(context).inflate(R.layout.simple_dialog, null)
val dialogTitle = dialogView.findViewById<TextView>(R.id.textviewtitle) val dialogTitle = dialogView.findViewById<TextView>(R.id.textviewtitle)
val dialogText = dialogView.findViewById<TextView>(R.id.dialogtext) val dialogText = dialogView.findViewById<TextView>(R.id.dialogtext)
@@ -15,6 +15,7 @@ import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.google.android.material.snackbar.Snackbar
import com.madapps.prefrences.EasyPrefrences import com.madapps.prefrences.EasyPrefrences
import org.jsoup.Jsoup import org.jsoup.Jsoup
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
@@ -79,6 +80,7 @@ class FoodFragment : Fragment(R.layout.food_layout) {
adapter: FoodAdapter, foodArrayList: ArrayList<Food>, adapter: FoodAdapter, foodArrayList: ArrayList<Food>,
swipeRefreshLayout: SwipeRefreshLayout, rootView: View) : AsyncTask<Void, Void, Void>() { swipeRefreshLayout: SwipeRefreshLayout, rootView: View) : AsyncTask<Void, Void, Void>() {
private val mContext = context
private val mRecyclerView = recyclerView private val mRecyclerView = recyclerView
private val mEasyPrefs = easyPrefs private val mEasyPrefs = easyPrefs
private val mAdapter = adapter private val mAdapter = adapter
@@ -91,8 +93,10 @@ class FoodFragment : Fragment(R.layout.food_layout) {
val mRootView = rootView val mRootView = rootView
private val fadeOut = AnimationUtils.loadAnimation(context, R.anim.fade_out) private val fadeOut = AnimationUtils.loadAnimation(context, R.anim.fade_out)
private val handler = Handler(Looper.getMainLooper()) private val handler = Handler(Looper.getMainLooper())
private var exceptionOccured = false
override fun doInBackground(vararg params: Void?): Void? { override fun doInBackground(vararg params: Void?): Void? {
try {
docFood = Jsoup.connect("https://djd4rkn355.github.io/food.html").get() docFood = Jsoup.connect("https://djd4rkn355.github.io/food.html").get()
foodElements = docFood.select("th") foodElements = docFood.select("th")
@@ -152,12 +156,14 @@ class FoodFragment : Fragment(R.layout.food_layout) {
progressBar.progress = 100 progressBar.progress = 100
mEasyPrefs.putListString("foodListPrefs", foodList) mEasyPrefs.putListString("foodListPrefs", foodList)
} catch (e: Exception) { exceptionOccured = true }
return null return null
} }
override fun onPostExecute(result: Void?) { override fun onPostExecute(result: Void?) {
super.onPostExecute(result) super.onPostExecute(result)
if (!exceptionOccured) {
try { try {
mRecyclerView.removeAllViews() mRecyclerView.removeAllViews()
mFoodArrayList.removeAll(mFoodArrayList) mFoodArrayList.removeAll(mFoodArrayList)
@@ -181,6 +187,13 @@ class FoodFragment : Fragment(R.layout.food_layout) {
progressBar.progress = 0 progressBar.progress = 0
} }
}) })
} else {
pullToRefresh.isRefreshing = false
val snackbarview = mRootView.findViewById<View>(R.id.coordination)
Snackbar.make(snackbarview, mContext.getText(R.string.nointernet), Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
} }
} }
@@ -42,8 +42,8 @@ import java.util.*
class Main : AppCompatActivity(R.layout.activity_main) { class Main : AppCompatActivity(R.layout.activity_main) {
var bottomSheetExpanded = false private var bottomSheetExpanded = false
lateinit var bottomSheetBehaviour: BottomSheetBehavior<*> private lateinit var bottomSheetBehaviour: BottomSheetBehavior<*>
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
@@ -144,10 +144,7 @@ class Main : AppCompatActivity(R.layout.activity_main) {
if (info.manufacturer.contains("Huawei") || if (info.manufacturer.contains("Huawei") ||
info.manufacturer.contains("Honor") || info.manufacturer.contains("Honor") ||
info.manufacturer.contains("Xiaomi")) { info.manufacturer.contains("Xiaomi")) {
val alertDialog = when (prefs.getInt("themeInt", 0)) { val alertDialog = AlertDialog.Builder(context, R.style.AlertDialog)
1 -> AlertDialog.Builder(context, R.style.AlertDialogCustomDark)
else -> AlertDialog.Builder(context, R.style.AlertDialogCustomLight)
}
val dialogView = LayoutInflater.from(context).inflate(R.layout.secret_dialog, null) val dialogView = LayoutInflater.from(context).inflate(R.layout.secret_dialog, null)
val title = dialogView.findViewById<TextView>(R.id.textviewtitle) val title = dialogView.findViewById<TextView>(R.id.textviewtitle)
title.text = getString(R.string.chinaTitle) title.text = getString(R.string.chinaTitle)
@@ -160,13 +157,6 @@ class Main : AppCompatActivity(R.layout.activity_main) {
} }
} }
val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val statusMobile = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).state
val statusWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).state
if (statusMobile != NetworkInfo.State.CONNECTED && statusWifi != NetworkInfo.State.CONNECTED) {
Snackbar.make(contextView, getText(R.string.nointernet), Snackbar.LENGTH_LONG).show()
}
if (prefs.getBoolean("greeting", false)) { if (prefs.getBoolean("greeting", false)) {
if (prefs.getString("username", "").isNotEmpty()) { if (prefs.getString("username", "").isNotEmpty()) {
val animationIn = AnimationUtils.loadAnimation(context, R.anim.chip_slide_in) val animationIn = AnimationUtils.loadAnimation(context, R.anim.chip_slide_in)
@@ -192,7 +182,7 @@ class Main : AppCompatActivity(R.layout.activity_main) {
else -> greetings[1] + prefs.getString("username", "") + "." else -> greetings[1] + prefs.getString("username", "") + "."
} }
} }
else -> getString(R.string.error) else -> ";)" // getString(R.string.error)
} }
handler.postDelayed({ handler.postDelayed({
@@ -293,26 +283,32 @@ class Main : AppCompatActivity(R.layout.activity_main) {
bottomNav.setOnNavigationItemReselectedListener { item: MenuItem -> bottomNav.setOnNavigationItemReselectedListener { item: MenuItem ->
when (item.itemId) { when (item.itemId) {
R.id.plan, R.id.personal-> { R.id.plan, R.id.personal -> {
try {
val recyclerView = findViewById<RecyclerView>(R.id.linearRecycler) val recyclerView = findViewById<RecyclerView>(R.id.linearRecycler)
recyclerView.post { recyclerView.post {
recyclerView.smoothScrollToPosition(0) recyclerView.smoothScrollToPosition(0)
bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED
} }
} catch (e: NullPointerException) {}
} }
R.id.menu -> { R.id.menu -> {
try {
val recyclerView = findViewById<RecyclerView>(R.id.linear_food) val recyclerView = findViewById<RecyclerView>(R.id.linear_food)
recyclerView.post { recyclerView.post {
recyclerView.smoothScrollToPosition(0) recyclerView.smoothScrollToPosition(0)
bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED
} }
} catch (e: NullPointerException) {}
} }
R.id.settings -> { R.id.settings -> {
try {
val nsv = findViewById<NestedScrollView>(R.id.nsvsettings) val nsv = findViewById<NestedScrollView>(R.id.nsvsettings)
nsv.post { nsv.post {
nsv.smoothScrollTo(0, 0) nsv.smoothScrollTo(0, 0)
bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED bottomSheetBehaviour.state = BottomSheetBehavior.STATE_COLLAPSED
} }
} catch (e: NullPointerException) {}
} }
} }
appbarlayout.setExpanded(true) appbarlayout.setExpanded(true)
@@ -2,7 +2,11 @@ package com.denizd.substitutionplan
import android.app.job.JobParameters import android.app.job.JobParameters
import android.app.job.JobService import android.app.job.JobService
import android.content.Context
import android.net.ConnectivityManager
import android.net.NetworkInfo
import android.preference.PreferenceManager import android.preference.PreferenceManager
import com.google.android.material.snackbar.Snackbar
import java.io.IOException import java.io.IOException
import java.lang.NullPointerException import java.lang.NullPointerException
import java.net.MalformedURLException import java.net.MalformedURLException
@@ -26,10 +30,15 @@ class NotificationService : JobService() {
private fun doBackgroundWork(params: JobParameters) { private fun doBackgroundWork(params: JobParameters) {
val prefs = PreferenceManager.getDefaultSharedPreferences(context) val prefs = PreferenceManager.getDefaultSharedPreferences(context)
val edit = prefs.edit() val edit = prefs.edit()
val connectivityManager = getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val statusMobile = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE).state
val statusWifi = connectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI).state
Thread(Runnable { Thread(Runnable {
if (jobCancelled) { if (jobCancelled) {
return@Runnable return@Runnable
} else if (statusMobile != NetworkInfo.State.CONNECTED && statusWifi != NetworkInfo.State.CONNECTED) {
return@Runnable
} }
if (prefs.getBoolean("notif", false)) { if (prefs.getBoolean("notif", false)) {
edit.putInt("notificationTestNumberDev", prefs.getInt("notificationTestNumberDev", 0) + 1).apply() edit.putInt("notificationTestNumberDev", prefs.getInt("notificationTestNumberDev", 0) + 1).apply()
@@ -40,9 +49,7 @@ class NotificationService : JobService() {
DataFetcher(true, true, true, context, application, null).execute() DataFetcher(true, true, true, context, application, null).execute()
edit.putString("time", connection.getHeaderField("Last-Modified")).apply() edit.putString("time", connection.getHeaderField("Last-Modified")).apply()
} }
} catch (ignored: NullPointerException) {} } catch (ignored: Exception) {}
catch (ignored: IOException) {}
catch (ignored: MalformedURLException) {}
} }
jobFinished(params, false) jobFinished(params, false)
}).start() }).start()
@@ -1,4 +0,0 @@
package com.denizd.substitutionplan
class PersonalFragment {
}
@@ -18,7 +18,9 @@ import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import java.util.* import java.util.*
import kotlin.collections.ArrayList import kotlin.collections.ArrayList
class PlanFragment() : Fragment(R.layout.plan) { // isPersonal: Boolean
class PlanFragment : Fragment(R.layout.plan) {
private lateinit var recyclerView: RecyclerView private lateinit var recyclerView: RecyclerView
private lateinit var mAdapter: CardAdapter private lateinit var mAdapter: CardAdapter
private lateinit var layoutManager: GridLayoutManager private lateinit var layoutManager: GridLayoutManager
@@ -45,10 +47,19 @@ class PlanFragment() : Fragment(R.layout.plan) { // isPersonal: Boolean
override fun onConfigurationChanged(newConfig: Configuration) { override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig) super.onConfigurationChanged(newConfig)
val grid = when (newConfig.orientation) { val tabletSize = resources.getBoolean(R.bool.isTablet)
val grid = if (tabletSize) {
when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 2
else -> 3
}
} else {
when (newConfig.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1 Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2 else -> 2
} }
}
layoutManager = GridLayoutManager(mContext, grid) layoutManager = GridLayoutManager(mContext, grid)
recyclerView.layoutManager = layoutManager recyclerView.layoutManager = layoutManager
} }
@@ -68,10 +79,19 @@ class PlanFragment() : Fragment(R.layout.plan) { // isPersonal: Boolean
recyclerView = view.findViewById(R.id.linearRecycler) recyclerView = view.findViewById(R.id.linearRecycler)
recyclerView.hasFixedSize() recyclerView.hasFixedSize()
val grid = when (resources.configuration.orientation) { val tabletSize = resources.getBoolean(R.bool.isTablet)
val grid = if (tabletSize) {
when (resources.configuration.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 2
else -> 3
}
} else {
when (resources.configuration.orientation) {
Configuration.ORIENTATION_PORTRAIT -> 1 Configuration.ORIENTATION_PORTRAIT -> 1
else -> 2 else -> 2
} }
}
layoutManager = GridLayoutManager(mContext, grid) layoutManager = GridLayoutManager(mContext, grid)
recyclerView.layoutManager = layoutManager recyclerView.layoutManager = layoutManager
@@ -260,11 +260,7 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
} }
private fun createDialog(title: String, text: String) { private fun createDialog(title: String, text: String) {
val alertDialog = if (prefs.getInt("themeInt", 0) == 1) { val alertDialog = AlertDialog.Builder(mContext, R.style.AlertDialog)
AlertDialog.Builder(mContext, R.style.AlertDialogCustomDark)
} else {
AlertDialog.Builder(mContext, R.style.AlertDialogCustomLight)
}
val dialogView = LayoutInflater.from(mContext).inflate(R.layout.simple_dialog, null) val dialogView = LayoutInflater.from(mContext).inflate(R.layout.simple_dialog, null)
val dialogTitle = dialogView.findViewById<TextView>(R.id.textviewtitle) val dialogTitle = dialogView.findViewById<TextView>(R.id.textviewtitle)
val dialogText = dialogView.findViewById<TextView>(R.id.dialogtext) val dialogText = dialogView.findViewById<TextView>(R.id.dialogtext)
@@ -279,10 +275,7 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
val courses = arrayOf(getString(R.string.courseDeu), getString(R.string.courseEng), getString(R.string.courseFra), getString(R.string.courseSpa), getString(R.string.courseLat), getString(R.string.courseTue), getString(R.string.courseChi), getString(R.string.courseKun), getString(R.string.courseMus), getString(R.string.courseDar), getString(R.string.courseGeg), getString(R.string.courseGes), getString(R.string.coursePol), getString(R.string.coursePhi), getString(R.string.courseRel), getString(R.string.courseMat), getString(R.string.courseBio), getString(R.string.courseChe), getString(R.string.coursePhy), getString(R.string.courseInf), getString(R.string.courseSpo), getString(R.string.courseGll), getString(R.string.courseWat), getString(R.string.courseFor), getString(R.string.courseWp)) val courses = arrayOf(getString(R.string.courseDeu), getString(R.string.courseEng), getString(R.string.courseFra), getString(R.string.courseSpa), getString(R.string.courseLat), getString(R.string.courseTue), getString(R.string.courseChi), getString(R.string.courseKun), getString(R.string.courseMus), getString(R.string.courseDar), getString(R.string.courseGeg), getString(R.string.courseGes), getString(R.string.coursePol), getString(R.string.coursePhi), getString(R.string.courseRel), getString(R.string.courseMat), getString(R.string.courseBio), getString(R.string.courseChe), getString(R.string.coursePhy), getString(R.string.courseInf), getString(R.string.courseSpo), getString(R.string.courseGll), getString(R.string.courseWat), getString(R.string.courseFor), getString(R.string.courseWp))
val coursesIcons = intArrayOf(R.drawable.ic_german, R.drawable.ic_english, R.drawable.ic_french, R.drawable.ic_spanish, R.drawable.ic_latin, R.drawable.ic_turkish, R.drawable.ic_chinese, R.drawable.ic_arts, R.drawable.ic_music, R.drawable.ic_drama, R.drawable.ic_geography, R.drawable.ic_history, R.drawable.ic_politics, R.drawable.ic_philosophy, R.drawable.ic_religion, R.drawable.ic_maths, R.drawable.ic_biology, R.drawable.ic_chemistry, R.drawable.ic_physics, R.drawable.ic_compsci, R.drawable.ic_pe, R.drawable.ic_gll, R.drawable.ic_wat, R.drawable.ic_help, R.drawable.ic_pencil) val coursesIcons = intArrayOf(R.drawable.ic_german, R.drawable.ic_english, R.drawable.ic_french, R.drawable.ic_spanish, R.drawable.ic_latin, R.drawable.ic_turkish, R.drawable.ic_chinese, R.drawable.ic_arts, R.drawable.ic_music, R.drawable.ic_drama, R.drawable.ic_geography, R.drawable.ic_history, R.drawable.ic_politics, R.drawable.ic_philosophy, R.drawable.ic_religion, R.drawable.ic_maths, R.drawable.ic_biology, R.drawable.ic_chemistry, R.drawable.ic_physics, R.drawable.ic_compsci, R.drawable.ic_pe, R.drawable.ic_gll, R.drawable.ic_wat, R.drawable.ic_help, R.drawable.ic_pencil)
val colourCustomiserBuilder = when (prefs.getInt("themeInt", 0)) { val colourCustomiserBuilder = AlertDialog.Builder(mContext, R.style.AlertDialog)
1 -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomDark)
else -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomLight)
}
val dialogView = LayoutInflater.from(mContext).inflate(R.layout.empty_dialog, null) val dialogView = LayoutInflater.from(mContext).inflate(R.layout.empty_dialog, null)
val titleText = dialogView.findViewById<TextView>(R.id.empty_textviewtitle) val titleText = dialogView.findViewById<TextView>(R.id.empty_textviewtitle)
@@ -301,32 +294,29 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
val courseNoLangTxt = coursesNoLang[i] val courseNoLangTxt = coursesNoLang[i]
val courseTxt = courses[i] val courseTxt = courses[i]
if (prefs.getInt("col" + coursesNoLang[i], 0) != 0) { if (prefs.getInt("bg" + coursesNoLang[i], 0) != 0) {
itemText.setTextColor(ContextCompat.getColor(mContext, prefs.getInt("col$courseNoLangTxt", 0))) // itemText.setTextColor(ContextCompat.getColor(mContext, prefs.getInt("col$courseNoLangTxt", 0)))
itemImage.drawable.setTint(ContextCompat.getColor(mContext, prefs.getInt("col$courseNoLangTxt", 0))) itemImage.drawable.setTint(ContextCompat.getColor(mContext, prefs.getInt("bg$courseNoLangTxt", 0)))
} }
layout.setOnClickListener { layout.setOnClickListener {
val colourPickerBuilder = when (prefs.getInt("themeInt", 0)) { val colourPickerBuilder = AlertDialog.Builder(mContext, R.style.AlertDialog)
1 -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomDark)
else -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomLight)
}
val pickerDialogView = LayoutInflater.from(mContext).inflate(R.layout.empty_dialog, null) val pickerDialogView = LayoutInflater.from(mContext).inflate(R.layout.empty_dialog, null)
val pickerTitleText = pickerDialogView.findViewById<TextView>(R.id.empty_textviewtitle) val pickerTitleText = pickerDialogView.findViewById<TextView>(R.id.empty_textviewtitle)
val pickerLayout = pickerDialogView.findViewById<LinearLayout>(R.id.empty_linearlayout) val pickerLayout = pickerDialogView.findViewById<LinearLayout>(R.id.empty_linearlayout)
pickerTitleText.text = courseTxt pickerTitleText.text = courseTxt
val picker = LayoutInflater.from(mContext).inflate(R.layout.colour_picker, null) val picker = LayoutInflater.from(mContext).inflate(R.layout.bg_colour_picker, null)
pickerLayout.addView(picker) pickerLayout.addView(picker)
colourPickerBuilder.setView(pickerDialogView) colourPickerBuilder.setView(pickerDialogView)
val colourPickerDialog: AlertDialog = colourPickerBuilder.create() val colourPickerDialog: AlertDialog = colourPickerBuilder.create()
val buttons = arrayOf<MaterialButton>(picker.findViewById(R.id.colourRed), picker.findViewById(R.id.colourPink), picker.findViewById(R.id.colourPurple), picker.findViewById(R.id.colourDeepPurple), picker.findViewById(R.id.colourLavender), picker.findViewById(R.id.colourIndigo), picker.findViewById(R.id.colourBlue), picker.findViewById(R.id.colourLightBlue), picker.findViewById(R.id.colourTeal), picker.findViewById(R.id.colourGreen), picker.findViewById(R.id.colourYellow), picker.findViewById(R.id.colourOrange), picker.findViewById(R.id.colourNeonRed), picker.findViewById(R.id.colourNeonPink), picker.findViewById(R.id.colourNeonPurple), picker.findViewById(R.id.colourNeonDeepPurple), picker.findViewById(R.id.colourNeonBlue), picker.findViewById(R.id.colourNeonGreen), picker.findViewById(R.id.colourNeonYellow), picker.findViewById(R.id.colourNeonOrange), picker.findViewById(R.id.colourNone)) val buttons = arrayOf<MaterialButton>(picker.findViewById(R.id.def), picker.findViewById(R.id.red), picker.findViewById(R.id.orange), picker.findViewById(R.id.yellow), picker.findViewById(R.id.green), picker.findViewById(R.id.teal), picker.findViewById(R.id.cyan), picker.findViewById(R.id.blue), picker.findViewById(R.id.purple), picker.findViewById(R.id.pink), picker.findViewById(R.id.brown), picker.findViewById(R.id.grey))
val colours = intArrayOf(R.color.red, R.color.pink, R.color.purple, R.color.deeppurple, R.color.lavender, R.color.indigo, R.color.blue, R.color.lightblue, R.color.teal, R.color.green, R.color.yellow, R.color.orange, R.color.neonred, R.color.neonpink, R.color.neonpurple, R.color.neondeeppurple, R.color.neonblue, R.color.neongreen, R.color.neonyellow, R.color.neonorange, 0) val colours = intArrayOf(0, R.color.bgred, R.color.bgorange, R.color.bgyellow, R.color.bggreen, R.color.bgteal, R.color.bgcyan, R.color.bgblue, R.color.bgpurple, R.color.bgpink, R.color.bgbrown, R.color.bggrey)
for (i2 in 0 until buttons.size) { for (i2 in 0 until buttons.size) {
buttons[i2].setOnClickListener { buttons[i2].setOnClickListener {
edit.putInt("col$courseNoLangTxt", colours[i2]).apply() edit.putInt("bg$courseNoLangTxt", colours[i2]).apply()
colourPickerDialog.dismiss() colourPickerDialog.dismiss()
} }
} }
@@ -344,7 +334,7 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
buttonClearAll.setOnClickListener { buttonClearAll.setOnClickListener {
for (course in coursesNoLang) { for (course in coursesNoLang) {
edit.putInt("col$course", 0) edit.putInt("bg$course", 0)
} }
edit.apply() edit.apply()
Toast.makeText(mContext, getString(R.string.allcolourscleared), Toast.makeText(mContext, getString(R.string.allcolourscleared),
@@ -363,10 +353,7 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
model = deviceInfo.model model = deviceInfo.model
} }
val alertDialog = when (prefs.getInt("themeInt", 0)) { val alertDialog = AlertDialog.Builder(mContext, R.style.AlertDialog)
1 -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomDark)
else -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomLight)
}
val dialogView = LayoutInflater.from(mContext).inflate(R.layout.edittext_dialog, null) val dialogView = LayoutInflater.from(mContext).inflate(R.layout.edittext_dialog, null)
val dialogEditText = dialogView.findViewById<EditText>(R.id.dialog_edittext) val dialogEditText = dialogView.findViewById<EditText>(R.id.dialog_edittext)
val dialogButton = dialogView.findViewById<Button>(R.id.dialog_button) val dialogButton = dialogView.findViewById<Button>(R.id.dialog_button)
@@ -376,10 +363,7 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
dialogButton.setOnClickListener { dialogButton.setOnClickListener {
when (dialogEditText.text.toString()) { when (dialogEditText.text.toString()) {
"@DIAGNOSTICS" -> { "@DIAGNOSTICS" -> {
val alertDialogDev = when (prefs.getInt("themeInt", 0)) { val alertDialogDev = AlertDialog.Builder(mContext, R.style.AlertDialog)
1 -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomDark)
else -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomLight)
}
val devDialogView = LayoutInflater.from(mContext).inflate(R.layout.diagnostics_dialog, null) val devDialogView = LayoutInflater.from(mContext).inflate(R.layout.diagnostics_dialog, null)
val devDialogText = devDialogView.findViewById<TextView>(R.id.dialogtext) val devDialogText = devDialogView.findViewById<TextView>(R.id.dialogtext)
val resetLaunchBtn = devDialogView.findViewById<Button>(R.id.btnResetLaunch) val resetLaunchBtn = devDialogView.findViewById<Button>(R.id.btnResetLaunch)
@@ -412,10 +396,7 @@ class SettingsFragment : Fragment(R.layout.content_settings), View.OnClickListen
} }
"Q1 Matchmaker" -> { "Q1 Matchmaker" -> {
val gen = Random() val gen = Random()
val alertDialogDate = when (prefs.getInt("themeInt", 0)) { val alertDialogDate = AlertDialog.Builder(mContext, R.style.AlertDialog)
1 -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomDark)
else -> AlertDialog.Builder(mContext, R.style.AlertDialogCustomLight)
}
val dateDialogView = LayoutInflater.from(mContext).inflate(R.layout.dating_dialog, null) val dateDialogView = LayoutInflater.from(mContext).inflate(R.layout.dating_dialog, null)
val datingBtn = dateDialogView.findViewById<Button>(R.id.dating_btn) val datingBtn = dateDialogView.findViewById<Button>(R.id.dating_btn)
val boyTxt = dateDialogView.findViewById<TextInputEditText>(R.id.dating_txt1) val boyTxt = dateDialogView.findViewById<TextInputEditText>(R.id.dating_txt1)
@@ -10,13 +10,13 @@ public interface SubstDao {
val allSubst: LiveData<List<Subst>> val allSubst: LiveData<List<Subst>>
@Insert @Insert
fun insert(subst: Subst) fun insertSubst(subst: Subst)
@Update @Update
fun update(subst: Subst) fun updateSubst(subst: Subst)
@Delete @Delete
fun delete(subst: Subst) fun deleteSubst(subst: Subst)
@Query("DELETE FROM subst_table") @Query("DELETE FROM subst_table")
fun deleteAllSubst() fun deleteAllSubst()
@@ -35,7 +35,7 @@ public class SubstRepository(application: Application) {
class InsertSubstAsync(substDao: SubstDao?) : AsyncTask<Subst, Void, Void>() { class InsertSubstAsync(substDao: SubstDao?) : AsyncTask<Subst, Void, Void>() {
val mSubstDao = substDao val mSubstDao = substDao
override fun doInBackground(vararg substs: Subst): Void? { override fun doInBackground(vararg substs: Subst): Void? {
mSubstDao?.insert(substs[0]) mSubstDao?.insertSubst(substs[0])
return null return null
} }
} }
@@ -43,7 +43,7 @@ public class SubstRepository(application: Application) {
class UpdateSubstAsync(substDao: SubstDao?) : AsyncTask<Subst, Void, Void>() { class UpdateSubstAsync(substDao: SubstDao?) : AsyncTask<Subst, Void, Void>() {
private val mSubstDao = substDao private val mSubstDao = substDao
override fun doInBackground(vararg substs: Subst): Void? { override fun doInBackground(vararg substs: Subst): Void? {
mSubstDao?.update(substs[0]) mSubstDao?.updateSubst(substs[0])
return null return null
} }
} }
@@ -51,7 +51,7 @@ public class SubstRepository(application: Application) {
class DeleteSubstAsync(substDao: SubstDao?) : AsyncTask<Subst, Void, Void>() { class DeleteSubstAsync(substDao: SubstDao?) : AsyncTask<Subst, Void, Void>() {
private val mSubstDao = substDao private val mSubstDao = substDao
override fun doInBackground(vararg substs: Subst): Void? { override fun doInBackground(vararg substs: Subst): Void? {
mSubstDao?.delete(substs[0]) mSubstDao?.deleteSubst(substs[0])
return null return null
} }
} }
@@ -14,15 +14,15 @@ public class SubstViewModel(application: Application) : AndroidViewModel(applica
allSubst = repository.allSubst allSubst = repository.allSubst
} }
fun insert(subst: Subst) { fun insertSubst(subst: Subst) {
repository.insert(subst) repository.insert(subst)
} }
fun update(subst: Subst) { fun updateSubst(subst: Subst) {
repository.update(subst) repository.update(subst)
} }
fun delete(subst: Subst) { fun deleteSubst(subst: Subst) {
repository.delete(subst) repository.delete(subst)
} }
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:id="@+id/def"
android:layout_margin="8dp"
android:layout_weight="1"
app:strokeColor="@color/bggrey"
app:strokeWidth="2dp"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/red"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgred"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/orange"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgorange"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/yellow"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgyellow"
app:cornerRadius="16dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/green"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bggreen"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/teal"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgteal"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/cyan"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgcyan"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/blue"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgblue"
app:cornerRadius="16dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/purple"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgpurple"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/pink"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgpink"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/brown"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bgbrown"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
android:id="@+id/grey"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/bggrey"
app:cornerRadius="16dp"/>
</TableRow>
</TableLayout>
-196
View File
@@ -1,196 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:paddingStart="16dp"
android:paddingEnd="16dp"
android:paddingBottom="8dp">
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/colourRed"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/red"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourPink"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/pink"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourPurple"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/purple"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourDeepPurple"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/deeppurple"
app:cornerRadius="16dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/colourLavender"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/lavender"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourIndigo"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/indigo"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourBlue"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/blue"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourLightBlue"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/lightblue"
app:cornerRadius="16dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/colourTeal"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/teal"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourGreen"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/green"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourYellow"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/yellow"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourOrange"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/orange"
app:cornerRadius="16dp"/>
</TableRow>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/neoncolours"
android:textColor="@color/textcolor"
android:layout_marginStart="8dp"/>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNeonRed"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/neonred"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNeonPink"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/neonpink"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNeonPurple"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/neonpurple"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNeonDeepPurple"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/neondeeppurple"
app:cornerRadius="16dp"/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNeonBlue"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/neonblue"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNeonGreen"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/neongreen"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNeonYellow"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/neonyellow"
app:cornerRadius="16dp"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNeonOrange"
android:layout_margin="8dp"
android:layout_weight="1"
android:backgroundTint="@color/neonorange"
app:cornerRadius="16dp"/>
</TableRow>
<com.google.android.material.button.MaterialButton
android:id="@+id/colourNone"
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
android:layout_margin="8dp"
android:text="@string/clearcolour"
android:textColor="@color/textcolor"
app:strokeColor="@color/textcolor"
app:strokeWidth="2dp"/>
</TableLayout>
+1 -1
View File
@@ -655,9 +655,9 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginBottom="16dp" android:layout_marginBottom="16dp"
android:text=""
android:textColor="@color/hintcolor" android:textColor="@color/hintcolor"
android:textSize="12sp" android:textSize="12sp"
android:fontFeatureSettings="tnum"
app:layout_constraintStart_toStartOf="@+id/txtVersion" app:layout_constraintStart_toStartOf="@+id/txtVersion"
app:layout_constraintTop_toBottomOf="@+id/txtVersion" app:layout_constraintTop_toBottomOf="@+id/txtVersion"
app:layout_constraintBottom_toBottomOf="parent"/> app:layout_constraintBottom_toBottomOf="parent"/>
+6 -3
View File
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView <com.google.android.material.card.MaterialCardView
android:id="@+id/planCard"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:backgroundTint="@color/lightbackground" app:cardBackgroundColor="@color/lightbackground"
app:cardCornerRadius="8dp" app:cardCornerRadius="8dp"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
@@ -69,11 +70,13 @@
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:layout_marginBottom="16dp"
android:textAlignment="textEnd" android:textAlignment="textEnd"
android:textColor="@color/textcolor"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/time" app:layout_constraintEnd_toEndOf="@+id/time"
app:layout_constraintStart_toStartOf="@+id/time" app:layout_constraintStart_toStartOf="@+id/time"
app:layout_constraintTop_toBottomOf="@+id/time" app:layout_constraintTop_toBottomOf="@+id/time" />
android:textColor="@color/textcolor" />
<TextView <TextView
android:id="@+id/additional" android:id="@+id/additional"
+12 -1
View File
@@ -1,10 +1,21 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<color name="background">#121212</color> <color name="background">#121212</color>
<!-- <color name="lightbackground">#1E1E1E</color>-->
<color name="lightbackground">#222222</color> <color name="lightbackground">#222222</color>
<color name="accent">#64b5f6</color> <color name="accent">#64b5f6</color>
<color name="textcolor">#e0e0e0</color> <color name="textcolor">#e0e0e0</color>
<color name="hintcolor">#9e9e9e</color> <color name="hintcolor">#9e9e9e</color>
<color name="lighthintcolor">#313131</color> <color name="lighthintcolor">#313131</color>
<color name="bgred">#5B2B2A</color>
<color name="bgorange">#604A1D</color>
<color name="bgyellow">#635C1F</color>
<color name="bggreen">#355823</color>
<color name="bgteal">#19504B</color>
<color name="bgcyan">#2F555D</color>
<color name="bgblue">#1F3B5E</color>
<color name="bgpurple">#42295D</color>
<color name="bgpink">#5A2345</color>
<color name="bgbrown">#442F1B</color>
<color name="bggrey">#3C3F43</color>
</resources> </resources>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isTablet">true</bool>
</resources>
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="isTablet">false</bool>
</resources>
-18
View File
@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="ds">
<attr name="colorPrimary" format="color"/>
<attr name="colorPrimaryDark" format="color"/>
<attr name="colorAccent" format="color"/>
<attr name="colorBackground" format="color"/>
<attr name="colorBackgroundCard" format="color"/>
<attr name="colorText" format="color"/>
<attr name="colorHint" format="color"/>
<attr name="colorHintDark" format="color"/>
<attr name="colorHintLight" format="color"/>
<attr name="referenceTextColor" format="reference"/>
<attr name="colorChip" format="color"/>
</declare-styleable>
</resources>
+11 -22
View File
@@ -10,29 +10,18 @@
<color name="datingPink">#d81b60</color> <color name="datingPink">#d81b60</color>
<color name="red">#e53935</color> <color name="bgred">#F28B82</color>
<color name="pink">#E91E63</color> <color name="bgorange">#FBBC04</color>
<color name="purple">#9C27B0</color> <color name="bgyellow">#FFF475</color>
<color name="deeppurple">#673AB7</color> <color name="bggreen">#CCFF90</color>
<color name="lavender">#AB47BC</color> <color name="bgteal">#A7FFEB</color>
<color name="indigo">#3F51B5</color> <color name="bgcyan">#CBF0F8</color>
<color name="blue">#1976D2</color> <color name="bgblue">#AECBFA</color>
<color name="lightblue">#2196F3</color> <color name="bgpurple">#D7AEFB</color>
<color name="teal">#009688</color> <color name="bgpink">#FDCFE8</color>
<color name="green">#43A047</color> <color name="bgbrown">#E6C9A8</color>
<color name="yellow">#FDD835</color> <color name="bggrey">#BDBDBD</color>
<color name="orange">#F4511E</color>
<color name="neonred">#ff1744</color>
<color name="neonpink">#F50057</color>
<color name="neonpurple">#D500F9</color>
<color name="neondeeppurple">#651FFF</color>
<color name="neonblue">#2979FF</color>
<color name="neongreen">#00E676</color>
<color name="neonyellow">#FFEA00</color>
<color name="neonorange">#FF3D00</color>
<color name="mtrl_textinput_default_box_stroke_color" tools:override="true">#757575</color> <color name="mtrl_textinput_default_box_stroke_color" tools:override="true">#757575</color>
</resources> </resources>
+4 -4
View File
@@ -25,14 +25,14 @@
<item name="android:colorEdgeEffect">@color/accent</item> <item name="android:colorEdgeEffect">@color/accent</item>
</style> </style>
<style name="AlertDialogCustomLight" parent="Theme.AppCompat.Light.Dialog.Alert"> <style name="AlertDialogCustomLight" parent="Theme.MaterialComponents.Light.Dialog.Alert">
<item name="android:background">#eeeeee</item> <item name="android:background">#eeeeee</item>
<item name="android:textColorPrimary">#212121</item> <item name="android:textColorPrimary">#212121</item>
</style> </style>
<style name="AlertDialogCustomDark" parent="Theme.AppCompat.Light.Dialog.Alert"> <style name="AlertDialog" parent="Theme.MaterialComponents.Light.Dialog.Alert">
<item name="android:background">#121212</item> <item name="android:background">@color/lightbackground</item>
<item name="android:textColorPrimary">#e0e0e0</item> <item name="android:textColorPrimary">@color/textcolor</item>
</style> </style>
<style name="AppThemeLight.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar"> <style name="AppThemeLight.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar">