Archived
Changed colour picker from a single palette dialog to recycler view to gain parity with iOS-version
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
package com.denizd.substitutionplan.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.denizd.substitutionplan.models.Colour
|
||||
import com.denizd.substitutionplan.R
|
||||
import com.google.android.material.card.MaterialCardView
|
||||
|
||||
/**
|
||||
* Adapter class used for displaying the colours available for tinting courses on the substitution
|
||||
* plan. Used in SettingsFragment.kt
|
||||
*
|
||||
* @param colours a list of all available colours
|
||||
* @param onClickListener a reference to an OnClickListener
|
||||
*/
|
||||
internal class ColourPickerAdapter(private var colours: List<Colour>, private val onClickListener: OnColourClickListener) : RecyclerView.Adapter<ColourPickerAdapter.ColourPickerViewHolder>() {
|
||||
|
||||
internal class ColourPickerViewHolder(view: View, private val clickListener: OnColourClickListener) : RecyclerView.ViewHolder(view), View.OnClickListener {
|
||||
val title: TextView = view.findViewById(R.id.item_text)
|
||||
var image: ImageView = view.findViewById(R.id.item_image)
|
||||
var colourNoLang = ""
|
||||
init { view.setOnClickListener(this) }
|
||||
|
||||
override fun onClick(v: View?) { clickListener.onColourClick(adapterPosition, colourNoLang) }
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ColourPickerViewHolder {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.colour_picker_item, parent, false)
|
||||
return ColourPickerViewHolder(v, onClickListener)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ColourPickerViewHolder, position: Int) {
|
||||
val currentItem = colours[position]
|
||||
|
||||
holder.title.text = currentItem.title
|
||||
holder.colourNoLang = currentItem.titleNoLang
|
||||
|
||||
val bg = ContextCompat.getDrawable(holder.image.context, R.drawable.circle)
|
||||
bg?.setTint((ContextCompat.getColor(holder.image.context, if (currentItem.colour != 0) {
|
||||
currentItem.colour
|
||||
} else {
|
||||
R.color.colorBackgroundLight
|
||||
})))
|
||||
|
||||
holder.image.background = bg
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int = colours.size
|
||||
|
||||
internal interface OnColourClickListener {
|
||||
fun onColourClick(position: Int, colourNoLang: String)
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -18,25 +18,25 @@ import com.google.android.material.card.MaterialCardView
|
||||
* @param colours a list of all courses and their associated colour
|
||||
* @param onClickListener a reference to an OnClickListener
|
||||
*/
|
||||
internal class ColourAdapter(private var colours: List<Colour>, private val onClickListener: OnColourClickListener) : RecyclerView.Adapter<ColourAdapter.ColourViewHolder>() {
|
||||
internal class CourseColourAdapter(private var colours: List<Colour>, private val onClickListener: OnCourseColourClickListener) : RecyclerView.Adapter<CourseColourAdapter.CourseColourViewHolder>() {
|
||||
|
||||
internal class ColourViewHolder(view: View, private val clickListener: OnColourClickListener) : RecyclerView.ViewHolder(view), View.OnClickListener {
|
||||
internal class CourseColourViewHolder(view: View, private val clickListener: OnCourseColourClickListener) : RecyclerView.ViewHolder(view), View.OnClickListener {
|
||||
val title: TextView = view.findViewById(R.id.item_text)
|
||||
var image: ImageView = view.findViewById(R.id.item_image)
|
||||
var titleNoLang: String = ""
|
||||
val cardView: MaterialCardView = view.findViewById(R.id.cardView)
|
||||
init { view.setOnClickListener(this) }
|
||||
|
||||
override fun onClick(v: View?) { clickListener.onColourClick(adapterPosition, title.text.toString(), titleNoLang) }
|
||||
override fun onClick(v: View?) { clickListener.onCourseClick(adapterPosition, title.text.toString(), titleNoLang) }
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ColourViewHolder {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.list_item, parent, false)
|
||||
return ColourViewHolder(v, onClickListener)
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CourseColourViewHolder {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.course_colour_picker_item, parent, false)
|
||||
return CourseColourViewHolder(v, onClickListener)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: ColourViewHolder, position: Int) {
|
||||
override fun onBindViewHolder(holder: CourseColourViewHolder, position: Int) {
|
||||
val currentItem = colours[position]
|
||||
|
||||
holder.title.text = currentItem.title
|
||||
@@ -60,7 +60,7 @@ internal class ColourAdapter(private var colours: List<Colour>, private val onCl
|
||||
|
||||
override fun getItemCount(): Int = colours.size
|
||||
|
||||
internal interface OnColourClickListener {
|
||||
fun onColourClick(position: Int, title: String, titleNoLang: String)
|
||||
internal interface OnCourseColourClickListener {
|
||||
fun onCourseClick(position: Int, title: String, titleNoLang: String)
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ internal class RingtoneAdapter(private val ringtones: List<Ringtone>, private va
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RingtoneViewHolder {
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.list_item, parent, false)
|
||||
val v = LayoutInflater.from(parent.context).inflate(R.layout.course_colour_picker_item, parent, false)
|
||||
return RingtoneViewHolder(v, onClickListener)
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ internal class SubstitutionAdapter(private var substitutions: List<Substitution>
|
||||
} else {
|
||||
""
|
||||
}
|
||||
colour = HelperFunctions.getColourForString(colourPrefsInt)
|
||||
colour = HelperFunctions.getColourForString(colourPrefsInt, holder.context)
|
||||
cardBackgroundColour = if (colour != 0) {
|
||||
colour
|
||||
} else {
|
||||
|
||||
@@ -20,6 +20,7 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.core.content.ContextCompat.checkSelfPermission
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import com.denizd.substitutionplan.R
|
||||
import com.denizd.substitutionplan.models.Colour
|
||||
import com.denizd.substitutionplan.models.Substitution
|
||||
import java.util.*
|
||||
import java.io.File
|
||||
@@ -43,8 +44,8 @@ internal object HelperFunctions {
|
||||
"Physics", "CompSci", "PhysEd", "GLL", "WAT", "Forder", "WP")
|
||||
|
||||
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")
|
||||
"brown", "grey", "salmon", "tangerine", "banana", "flora", "spindrift", "sky", "orchid",
|
||||
"lavender", "carnation", "brown2", "pureWhite", "pureBlack")
|
||||
|
||||
/**
|
||||
* A lower-cased list of all phrases used to describe that a course has been cancelled. Expand
|
||||
@@ -83,33 +84,41 @@ internal object HelperFunctions {
|
||||
|
||||
const val notificationChannelId = "general"
|
||||
|
||||
fun getColourForString(name: String): Int {
|
||||
return when (name) {
|
||||
"red" -> R.color.bgRed
|
||||
"orange" -> R.color.bgOrange
|
||||
"yellow" -> R.color.bgYellow
|
||||
"green" -> R.color.bgGreen
|
||||
"teal" -> R.color.bgTeal
|
||||
"cyan" -> R.color.bgCyan
|
||||
"blue" -> R.color.bgBlue
|
||||
"purple" -> R.color.bgPurple
|
||||
"pink" -> R.color.bgPink
|
||||
"brown" -> R.color.bgBrown
|
||||
"grey" -> R.color.bgGrey
|
||||
"pureWhite" -> R.color.bgPureWhite
|
||||
"salmon" -> R.color.bgSalmon
|
||||
"tangerine" -> R.color.bgTangerine
|
||||
"banana" -> R.color.bgBanana
|
||||
"flora" -> R.color.bgFlora
|
||||
"spindrift" -> R.color.bgSpindrift
|
||||
"sky" -> R.color.bgSky
|
||||
"orchid" -> R.color.bgOrchid
|
||||
"lavender" -> R.color.bgLavender
|
||||
"carnation" -> R.color.bgCarnation
|
||||
"brown2" -> R.color.bgBrown2
|
||||
"pureBlack" -> R.color.bgPureBlack
|
||||
else -> R.color.colorBackgroundLight
|
||||
fun getColourArray(c: Context): Array<Colour> {
|
||||
val titles = c.resources.getStringArray(R.array.colour_names)
|
||||
return arrayOf(
|
||||
Colour(titles[0], "default", 0, 0),
|
||||
Colour(titles[1], "red", 0, R.color.bgRed),
|
||||
Colour(titles[2], "orange", 0, R.color.bgOrange),
|
||||
Colour(titles[3], "yellow", 0, R.color.bgYellow),
|
||||
Colour(titles[4], "green", 0, R.color.bgGreen),
|
||||
Colour(titles[5], "teal", 0, R.color.bgTeal),
|
||||
Colour(titles[6], "cyan", 0, R.color.bgCyan),
|
||||
Colour(titles[7], "blue", 0, R.color.bgBlue),
|
||||
Colour(titles[8], "purple", 0, R.color.bgPurple),
|
||||
Colour(titles[9], "pink", 0, R.color.bgPink),
|
||||
Colour(titles[10], "brown", 0, R.color.bgBrown),
|
||||
Colour(titles[11], "grey", 0, R.color.bgGrey),
|
||||
Colour(titles[12], "salmon", 0, R.color.bgSalmon),
|
||||
Colour(titles[13], "tangerine", 0, R.color.bgTangerine),
|
||||
Colour(titles[14], "banana", 0, R.color.bgBanana),
|
||||
Colour(titles[15], "flora", 0, R.color.bgFlora),
|
||||
Colour(titles[16], "spindrift", 0, R.color.bgSpindrift),
|
||||
Colour(titles[17], "sky", 0, R.color.bgSky),
|
||||
Colour(titles[18], "orchid", 0, R.color.bgOrchid),
|
||||
Colour(titles[19], "lavender", 0, R.color.bgLavender),
|
||||
Colour(titles[20], "carnation", 0, R.color.bgCarnation),
|
||||
Colour(titles[21], "brown2", 0, R.color.bgBrown2),
|
||||
Colour(titles[22], "pureWhite", 0, R.color.bgPureWhite),
|
||||
Colour(titles[23], "pureBlack", 0, R.color.bgPureBlack)
|
||||
)
|
||||
}
|
||||
|
||||
fun getColourForString(name: String, context: Context): Int {
|
||||
for (colour in getColourArray(context)) {
|
||||
if (colour.titleNoLang == name) return colour.colour
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
fun getIconForCourse(course: String): Int {
|
||||
|
||||
@@ -27,7 +27,8 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.denizd.substitutionplan.*
|
||||
import com.denizd.substitutionplan.adapters.ColourAdapter
|
||||
import com.denizd.substitutionplan.adapters.ColourPickerAdapter
|
||||
import com.denizd.substitutionplan.adapters.CourseColourAdapter
|
||||
import com.denizd.substitutionplan.adapters.RingtoneAdapter
|
||||
import com.denizd.substitutionplan.data.DataFetcher
|
||||
import com.denizd.substitutionplan.data.HelperFunctions
|
||||
@@ -41,8 +42,8 @@ import com.google.firebase.messaging.FirebaseMessaging
|
||||
import kotlin.collections.ArrayList
|
||||
|
||||
internal class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongClickListener,
|
||||
CompoundButton.OnCheckedChangeListener, ColourAdapter.OnColourClickListener,
|
||||
RingtoneAdapter.OnRingtoneClickListener {
|
||||
CompoundButton.OnCheckedChangeListener, CourseColourAdapter.OnCourseColourClickListener,
|
||||
RingtoneAdapter.OnRingtoneClickListener, ColourPickerAdapter.OnColourClickListener {
|
||||
|
||||
private lateinit var mContext: Context
|
||||
private lateinit var prefs: SharedPreferences
|
||||
@@ -50,6 +51,7 @@ internal class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongC
|
||||
private var window: Window? = null
|
||||
private var longPressed = false
|
||||
private var versionCount = 0
|
||||
private var currentCourseSelectedInColourPicker = ""
|
||||
|
||||
private val ringtones: List<Ringtone> by lazy {
|
||||
getRingtones()
|
||||
@@ -57,6 +59,7 @@ internal class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongC
|
||||
|
||||
private lateinit var colourRecycler: RecyclerView
|
||||
private lateinit var ringtoneDialog: AlertDialog
|
||||
private lateinit var colourPickerDialog: AlertDialog
|
||||
|
||||
private lateinit var binding: ContentSettingsBinding
|
||||
private lateinit var textCustomiseColoursTitle: TextView
|
||||
@@ -311,36 +314,31 @@ internal class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongC
|
||||
}
|
||||
|
||||
// Functions for handling touch events for recycler view elements
|
||||
override fun onColourClick(position: Int, title: String, titleNoLang: String) {
|
||||
override fun onCourseClick(position: Int, title: String, titleNoLang: String) {
|
||||
currentCourseSelectedInColourPicker = titleNoLang
|
||||
|
||||
val colourPickerBuilder = AlertDialog.Builder(mContext)
|
||||
val pickerDialogView = View.inflate(mContext, R.layout.empty_dialog, null)
|
||||
val pickerTitleText = pickerDialogView.findViewById<TextView>(R.id.empty_textviewtitle)
|
||||
val pickerLayout = pickerDialogView.findViewById<LinearLayout>(R.id.empty_linearlayout)
|
||||
pickerTitleText.text = title
|
||||
|
||||
val picker = View.inflate(mContext, R.layout.bg_colour_picker, null)
|
||||
pickerLayout.addView(picker)
|
||||
colourPickerBuilder.setView(pickerDialogView)
|
||||
val colourPickerDialog: AlertDialog = colourPickerBuilder.create()
|
||||
|
||||
val buttons = intArrayOf(R.id.def, R.id.red, R.id.orange, R.id.yellow, R.id.green,
|
||||
R.id.teal, R.id.cyan, R.id.blue, R.id.purple, R.id.pink, R.id.brown, R.id.grey,
|
||||
R.id.pureWhite, R.id.salmon, R.id.tangerine, R.id.banana, R.id.flora, R.id.spindrift,
|
||||
R.id.sky, R.id.orchid, R.id.lavender, R.id.carnation, R.id.brown2, R.id.pureBlack)
|
||||
val colours = HelperFunctions.colourNames
|
||||
|
||||
for (i2 in buttons.indices) {
|
||||
picker.findViewById<MaterialButton>(buttons[i2]).setOnClickListener {
|
||||
prefs.edit().putString("card$titleNoLang", colours[i2]).apply()
|
||||
val recyclerViewState = colourRecycler.layoutManager?.onSaveInstanceState()
|
||||
colourRecycler.adapter = ColourAdapter(getColourList(), this)
|
||||
colourRecycler.layoutManager?.onRestoreInstanceState(recyclerViewState)
|
||||
colourPickerDialog.dismiss()
|
||||
}
|
||||
val dialogView = View.inflate(mContext, R.layout.recycler_dialog, null)
|
||||
val titleText = dialogView.findViewById<TextView>(R.id.empty_textviewtitle)
|
||||
titleText.text = title
|
||||
val colourRecycler = dialogView.findViewById<RecyclerView>(R.id.recyclerView)
|
||||
colourRecycler.apply {
|
||||
hasFixedSize()
|
||||
layoutManager = GridLayoutManager(mContext, 1)
|
||||
adapter = ColourPickerAdapter(HelperFunctions.getColourArray(mContext).toList(), this@SettingsFragment)
|
||||
}
|
||||
colourPickerDialog = colourPickerBuilder.setView(dialogView).create()
|
||||
colourPickerDialog.show()
|
||||
}
|
||||
|
||||
override fun onColourClick(position: Int, colourNoLang: String) {
|
||||
prefs.edit().putString("card$currentCourseSelectedInColourPicker", colourNoLang).apply()
|
||||
val recyclerViewState = colourRecycler.layoutManager?.onSaveInstanceState()
|
||||
colourRecycler.adapter = CourseColourAdapter(getColourList(), this)
|
||||
colourRecycler.layoutManager?.onRestoreInstanceState(recyclerViewState)
|
||||
colourPickerDialog.dismiss()
|
||||
}
|
||||
|
||||
override fun onRingtoneClick(position: Int, name: String, uri: String) {
|
||||
prefs.edit().apply {
|
||||
putString("ringtoneName", name)
|
||||
@@ -365,11 +363,11 @@ internal class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongC
|
||||
val dialogView = View.inflate(mContext, R.layout.recycler_dialog, null)
|
||||
val titleText = dialogView.findViewById<TextView>(R.id.empty_textviewtitle)
|
||||
titleText.text = getString(R.string.customise_colours_title)
|
||||
val colourRecycler = dialogView.findViewById<RecyclerView>(R.id.recyclerView)
|
||||
colourRecycler = dialogView.findViewById(R.id.recyclerView)
|
||||
colourRecycler.apply {
|
||||
hasFixedSize()
|
||||
layoutManager = GridLayoutManager(mContext, 1)
|
||||
adapter = ColourAdapter(getColourList(), this@SettingsFragment)
|
||||
adapter = CourseColourAdapter(getColourList(), this@SettingsFragment)
|
||||
}
|
||||
colourCustomisationDialogBuilder.setView(dialogView)
|
||||
val colourCustomisationDialog = colourCustomisationDialogBuilder.create()
|
||||
@@ -550,7 +548,7 @@ internal class SettingsFragment : Fragment(), View.OnClickListener, View.OnLongC
|
||||
courses[i],
|
||||
coursesNoLang[i],
|
||||
coursesIcons[i],
|
||||
HelperFunctions.getColourForString(prefs.getString("card${coursesNoLang[i]}", "") ?: "")
|
||||
HelperFunctions.getColourForString(prefs.getString("card${coursesNoLang[i]}", "") ?: "", mContext)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ internal data class Substitution(
|
||||
val date_priority: Int,
|
||||
val website_priority: Int
|
||||
) {
|
||||
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
var id: Int = 0
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:innerRadius="0dp"
|
||||
android:shape="oval"
|
||||
android:thicknessRatio="1.9"
|
||||
android:useLevel="false">
|
||||
|
||||
<solid/>
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:innerRadius="0dp"
|
||||
android:shape="oval"
|
||||
android:thicknessRatio="1.9"
|
||||
android:useLevel="false">
|
||||
|
||||
<stroke
|
||||
android:width="2dp"
|
||||
android:color="@color/colorHintReversed" />
|
||||
|
||||
</shape>
|
||||
@@ -1,140 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/constraintLayout"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/colorBackground"
|
||||
android:animateLayoutChanges="true">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/txtWelcome"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="56dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:text="@string/hello"
|
||||
android:textAlignment="viewStart"
|
||||
android:textColor="@color/colorAccent"
|
||||
android:fontFamily="@font/manrope_extrabold"
|
||||
android:textSize="28sp"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<TextView android:id="@+id/loginRequiredText"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/login_required"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/colorText"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="8dp"
|
||||
app:layout_constraintTop_toBottomOf="@+id/txtWelcome"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/usernameTextLayout"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:hint="@string/username"
|
||||
android:importantForAutofill="no"
|
||||
android:textColorHint="@color/colorHint"
|
||||
app:boxStrokeColor="@color/colorAccent"
|
||||
app:boxStrokeWidth="1dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/loginRequiredText">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/usernameText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:ems="10"
|
||||
android:gravity="start"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="textNoSuggestions"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/colorText"
|
||||
android:textSize="16sp" />
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<com.google.android.material.textfield.TextInputLayout
|
||||
android:id="@+id/passwordTextLayout"
|
||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
|
||||
app:boxStrokeColor="@color/colorAccent"
|
||||
app:boxStrokeWidth="1dp"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:hint="@string/password"
|
||||
android:textColorHint="@color/colorHint"
|
||||
android:importantForAutofill="no"
|
||||
app:layout_constraintTop_toBottomOf="@+id/usernameTextLayout"
|
||||
app:layout_constraintStart_toStartOf="@+id/usernameTextLayout"
|
||||
app:layout_constraintEnd_toEndOf="@+id/usernameTextLayout">
|
||||
|
||||
<com.google.android.material.textfield.TextInputEditText
|
||||
android:id="@+id/passwordText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:animateLayoutChanges="true"
|
||||
android:ems="10"
|
||||
android:gravity="start"
|
||||
android:imeOptions="flagNoExtractUi"
|
||||
android:inputType="textPassword"
|
||||
android:singleLine="true"
|
||||
android:textColor="@color/colorText"
|
||||
android:textSize="16sp"/>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/temporary"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="substitution plan"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
|
||||
android:id="@+id/loginFab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:backgroundTint="@color/colorAccent"
|
||||
android:text="@string/login"
|
||||
android:textColor="@color/colorBackground"
|
||||
app:icon="@drawable/ic_tick"
|
||||
app:iconTint="@color/colorBackground"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:translationZ="-1dp"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/snackBarLayout"/>
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/snackBarLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="top"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,241 +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"
|
||||
android:scrollbars="vertical"
|
||||
android:background="@color/colorBackgroundLight">
|
||||
|
||||
<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>
|
||||
|
||||
<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/pureWhite"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgPureWhite"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/salmon"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgSalmon"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/tangerine"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgTangerine"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/banana"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgBanana"
|
||||
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/flora"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgFlora"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/spindrift"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgSpindrift"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/sky"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgSky"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/orchid"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgOrchid"
|
||||
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/lavender"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgLavender"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/carnation"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgCarnation"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/brown2"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgBrown2"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
style="@style/Widget.MaterialComponents.Button.UnelevatedButton"
|
||||
android:id="@+id/pureBlack"
|
||||
android:layout_margin="8dp"
|
||||
android:layout_weight="1"
|
||||
android:backgroundTint="@color/bgPureBlack"
|
||||
app:cornerRadius="16dp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/cardView"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardBackgroundColor="@color/colorBackgroundLight"
|
||||
app:cardCornerRadius="8dp"
|
||||
android:clickable="true"
|
||||
android:focusable="true"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="3dp"
|
||||
android:layout_marginBottom="3dp"
|
||||
app:cardElevation="2dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/item_image"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/item_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/item_text"
|
||||
android:src="@drawable/circle_border"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:textColor="@color/colorText"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
+1
-2
@@ -26,10 +26,9 @@
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:tint="@color/colorText"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/item_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/item_text" />
|
||||
app:layout_constraintTop_toTopOf="@+id/item_text"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/item_text"
|
||||
@@ -1,38 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:orientation="vertical" android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorBackgroundLight">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/empty_textviewtitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="24dp"
|
||||
android:layout_marginEnd="24dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textSize="22sp"
|
||||
android:fontFamily="@font/manrope_semibold"
|
||||
android:layout_gravity="start"
|
||||
android:textColor="@color/colorText"
|
||||
android:textAlignment="viewStart"/>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="4dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/empty_linearlayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="0dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:paddingBottom="0dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -12,4 +12,4 @@
|
||||
android:layoutAnimation="@anim/layout_animation_fall_down"
|
||||
android:scrollbars="vertical"/>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
@@ -52,4 +52,3 @@
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
||||
@@ -163,4 +163,31 @@
|
||||
<string name="error_please_try_again">Ein Fehler ist aufgetreten, bitte versuche es erneut</string>
|
||||
<string name="thanks_for_using">Danke, dass du die App nutzt!</string>
|
||||
<string name="congratulations_for_nothing">Gratulation! Du hast nichts erreicht.</string>
|
||||
|
||||
<string-array name="colour_names">
|
||||
<item>Standard</item>
|
||||
<item>Rot</item>
|
||||
<item>Orange</item>
|
||||
<item>Gelb</item>
|
||||
<item>Grün</item>
|
||||
<item>Cyan</item>
|
||||
<item>Hellblau</item>
|
||||
<item>Blau</item>
|
||||
<item>Violett</item>
|
||||
<item>Pink</item>
|
||||
<item>Braun</item>
|
||||
<item>Grau</item>
|
||||
<item>Rot (iOS)</item>
|
||||
<item>Orange (iOS)</item>
|
||||
<item>Gelb (iOS)</item>
|
||||
<item>Grün (iOS)</item>
|
||||
<item>Cyan (iOS)</item>
|
||||
<item>Hellblau (iOS)</item>
|
||||
<item>Blau (iOS)</item>
|
||||
<item>Violett (iOS)</item>
|
||||
<item>Pink (iOS)</item>
|
||||
<item>Braun (iOS)</item>
|
||||
<item>Weiß</item>
|
||||
<item>Schwarz</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
@@ -5,6 +5,7 @@
|
||||
<color name="colorAccent">#64b5f6</color>
|
||||
<color name="colorText">#e0e0e0</color>
|
||||
<color name="colorHint">#9e9e9e</color>
|
||||
<color name="colorHintReversed">#757575</color>
|
||||
<color name="colorHintLight">#313131</color>
|
||||
|
||||
<color name="bgRed">#5B2B2A</color>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<color name="colorAccent">#448aff</color>
|
||||
<color name="colorText">#212121</color>
|
||||
<color name="colorHint">#757575</color>
|
||||
<color name="colorHintReversed">#9e9e9e</color>
|
||||
<color name="colorHintLight">#bdbdbd</color>
|
||||
|
||||
<color name="legacyBlack">#000000</color>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">AvH Plan</string>
|
||||
<string name="substitution_plan">Substitution Plan</string>
|
||||
@@ -175,4 +176,31 @@
|
||||
<string name="error_please_try_again">An error occurred, please try again</string>
|
||||
<string name="thanks_for_using">Thanks for using the app!</string>
|
||||
<string name="congratulations_for_nothing">Congratulations! You have achieved nothing.</string>
|
||||
|
||||
<string-array name="colour_names">
|
||||
<item>Default</item>
|
||||
<item>Red</item>
|
||||
<item>Orange</item>
|
||||
<item>Yellow</item>
|
||||
<item>Green</item>
|
||||
<item>Cyan</item>
|
||||
<item>Light blue</item>
|
||||
<item>Blue</item>
|
||||
<item>Purple</item>
|
||||
<item>Pink</item>
|
||||
<item>Brown</item>
|
||||
<item>Grey</item>
|
||||
<item>Red (iOS)</item>
|
||||
<item>Orange (iOS)</item>
|
||||
<item>Yellow (iOS)</item>
|
||||
<item>Green (iOS)</item>
|
||||
<item>Cyan (iOS)</item>
|
||||
<item>Light blue (iOS)</item>
|
||||
<item>Blue (iOS)</item>
|
||||
<item>Purple (iOS)</item>
|
||||
<item>Pink (iOS)</item>
|
||||
<item>Brown (iOS)</item>
|
||||
<item>White</item>
|
||||
<item>Black</item>
|
||||
</string-array>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user